summaryrefslogtreecommitdiffstats
path: root/input/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'input/server.c')
-rw-r--r--input/server.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/input/server.c b/input/server.c
index 6d08804b..041f302c 100644
--- a/input/server.c
+++ b/input/server.c
@@ -89,7 +89,6 @@ static int authorize_device(const bdaddr_t *src, const bdaddr_t *dst)
static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
{
- int sk;
uint16_t psm;
bdaddr_t src, dst;
GError *gerr = NULL;
@@ -113,13 +112,11 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
debug("Incoming connection on PSM %d", psm);
- sk = g_io_channel_unix_get_fd(chan);
-
- if (input_device_set_channel(&src, &dst, psm, sk) < 0) {
+ if (input_device_set_channel(&src, &dst, psm, chan) < 0) {
/* Send unplug virtual cable to unknown devices */
if (psm == L2CAP_PSM_HIDP_CTRL) {
unsigned char unplug[] = { 0x15 };
- int err;
+ int err, sk = g_io_channel_unix_get_fd(chan);
err = write(sk, unplug, sizeof(unplug));
}
g_io_channel_shutdown(chan, TRUE, NULL);