static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data) { struct input_device *idev = data; char address[18]; if (cond & G_IO_IN) { if (hidp_recv_intr_data(chan, idev) && (cond == G_IO_IN)) return TRUE; } ba2str(&idev->dst, address); DBG("Device %s disconnected", address); /* Checking for ctrl_watch avoids a double g_io_channel_shutdown since * it's likely that ctrl_watch_cb has been queued for dispatching in * this mainloop iteration */ if ((cond & (G_IO_HUP | G_IO_ERR)) && idev->ctrl_watch) g_io_channel_shutdown(chan, TRUE, NULL); idev->intr_watch = 0; if (idev->intr_io) { g_io_channel_unref(idev->intr_io); idev->intr_io = NULL; } /* Close control channel */ if (idev->ctrl_io && !(cond & G_IO_NVAL)) g_io_channel_shutdown(idev->ctrl_io, TRUE, NULL); btd_service_disconnecting_complete(idev->service, 0); /* Enter the auto-reconnect mode if needed */ input_device_enter_reconnect_mode(idev); return FALSE; }
static int deviceinfo_disconnect(struct btd_service *service) { btd_service_disconnecting_complete(service, 0); return 0; }