diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-02-27 12:20:59 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-02-27 12:20:59 +0000 |
commit | af47f85ea4422e8ec35564c1e26f84469c94c1e4 (patch) | |
tree | 306300627dc4c9592a9656464f34827905f4f3d4 /input/device.c | |
parent | 76c9ccdc6aa16e923108e221e150c0c7fc43079f (diff) |
Fake input: Changed disconnect function to support fake devices
Diffstat (limited to 'input/device.c')
-rw-r--r-- | input/device.c | 21 |
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"); |