summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
Diffstat (limited to 'input')
-rw-r--r--input/device.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/input/device.c b/input/device.c
index b28ae45b..bf20257e 100644
--- a/input/device.c
+++ b/input/device.c
@@ -915,12 +915,31 @@ failed:
return FALSE;
}
-static int disconnect(struct input_device *idev, uint32_t flags)
+static int disconnect(struct input_device *idev, uint32_t flags)
{
+ struct fake_input *fake = idev->fake;
struct hidp_conndel_req req;
struct hidp_conninfo ci;
int ctl, err;
+ /* Fake input disconnect */
+ if (fake) {
+ if (fake->io) {
+ g_io_channel_shutdown(fake->io, FALSE, NULL);
+ g_io_channel_unref(fake->io);
+ fake->io = NULL;
+ }
+ if (fake->uinput >= 0) {
+ ioctl(fake->uinput, UI_DEV_DESTROY);
+ close(fake->uinput);
+ fake->uinput = -1;
+ }
+
+ return 0;
+ }
+
+ /* Standard HID disconnect */
+
ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HIDP);
if (ctl < 0) {
error("Can't open HIDP control socket");