diff --git a/profiles/input/device.c b/profiles/input/device.c
index fa1f5f2..785b1e9 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
guint intr_watch;
guint sec_watch;
struct hidp_connadd_req *req;
- guint dc_id;
bool disable_sdp;
enum reconnect_mode_t reconnect_mode;
guint reconnect_timer;
static void input_device_free(struct input_device *idev)
{
- if (idev->dc_id)
- device_remove_disconnect_watch(idev->device, idev->dc_id);
-
if (idev->uhid) {
if (idev->uhid_created) {
int err;
if ((cond & (G_IO_HUP | G_IO_ERR)) && idev->ctrl_watch)
g_io_channel_shutdown(chan, TRUE, NULL);
- device_remove_disconnect_watch(idev->device, idev->dc_id);
- idev->dc_id = 0;
-
idev->intr_watch = 0;
if (idev->intr_io) {
return ioctl_disconnect(idev, flags);
}
-static void disconnect_cb(struct btd_device *device, gboolean removal,
- void *user_data)
-{
- struct input_device *idev = user_data;
- int flags;
-
- info("Input: disconnect %s", idev->path);
-
- flags = removal ? (1 << HIDP_VIRTUAL_CABLE_UNPLUG) : 0;
-
- connection_disconnect(idev, flags);
-}
-
static int input_device_connected(struct input_device *idev)
{
int err;
if (err < 0)
return err;
- idev->dc_id = device_add_disconnect_watch(idev->device, disconnect_cb,
- idev, NULL);
-
btd_service_connecting_complete(idev->service, 0);
return 0;
int input_device_disconnect(struct btd_service *service)
{
struct input_device *idev;
- int err;
+ int err, flags;
DBG("");
idev = btd_service_get_user_data(service);
- err = connection_disconnect(idev, 0);
+ flags = device_is_temporary(idev->device) ?
+ (1 << HIDP_VIRTUAL_CABLE_UNPLUG) : 0;
+
+ err = connection_disconnect(idev, flags);
if (err < 0)
return err;