summaryrefslogtreecommitdiffstats
path: root/src/dbus-common.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-01-12 15:25:30 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2009-01-12 15:25:30 +0200
commitf8f494cb4880fa6a3f8b641bf6676acfce659753 (patch)
tree6134df981cf7cb9c145059cb235aea605d8f8c91 /src/dbus-common.c
parentdd10ec5d830d2e2187f93bd2d7e60be947335f0b (diff)
Move l2raw_connect over to device.c (since it's not needed anywhere else)
Diffstat (limited to 'src/dbus-common.c')
-rw-r--r--src/dbus-common.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/dbus-common.c b/src/dbus-common.c
index 7c26a8f7..b5969096 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -32,7 +32,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <fcntl.h>
#include <sys/ioctl.h>
#include <bluetooth/bluetooth.h>
@@ -54,61 +53,6 @@
#define RECONNECT_RETRY_TIMEOUT 5000
-int l2raw_connect(const bdaddr_t *src, const bdaddr_t *dst,
- struct bt_security *sec)
-{
- struct sockaddr_l2 addr;
- long arg;
- int sk;
-
- sk = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP);
- if (sk < 0) {
- error("Can't create socket: %s (%d)", strerror(errno), errno);
- return sk;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.l2_family = AF_BLUETOOTH;
- bacpy(&addr.l2_bdaddr, src);
-
- if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- error("Can't bind socket: %s (%d)", strerror(errno), errno);
- goto failed;
- }
-
- if (sec)
- setsockopt(sk, SOL_BLUETOOTH, BT_SECURITY, sec, sizeof(*sec));
-
- arg = fcntl(sk, F_GETFL);
- if (arg < 0) {
- error("Can't get file flags: %s (%d)", strerror(errno), errno);
- goto failed;
- }
-
- arg |= O_NONBLOCK;
- if (fcntl(sk, F_SETFL, arg) < 0) {
- error("Can't set file flags: %s (%d)", strerror(errno), errno);
- goto failed;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.l2_family = AF_BLUETOOTH;
- bacpy(&addr.l2_bdaddr, dst);
-
- if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- if (errno == EAGAIN || errno == EINPROGRESS)
- return sk;
- error("Can't connect socket: %s (%d)", strerror(errno), errno);
- goto failed;
- }
-
- return sk;
-
-failed:
- close(sk);
- return -1;
-}
-
static gboolean system_bus_reconnect(void *data)
{
DBusConnection *conn = get_dbus_connection();