diff options
author | Chris Bagwell <chris@cnpbagwell.com> | 2012-03-26 10:26:20 +0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-03-26 10:32:59 +0400 |
commit | 16bf288c4be67b68c3fcb6561ff145702cb7bd22 (patch) | |
tree | 9ae5f770afa5812ebdb2f2b381cb1477a59f4f85 /drivers/input/tablet/wacom_wac.c | |
parent | d3825d51c3eddb8a3c7d1281f27181aff6db19b8 (diff) | |
download | linux-16bf288c4be67b68c3fcb6561ff145702cb7bd22.tar.xz |
Input: wacom - create inputs when wireless connect
When a tablet connect or disconnect is detected, schedule
work queue to register or unregister related input devices.
When a wireless tablet connects, it reports same USB PID
used if tablet is connected with USB cable. Use this to
update features values, set input capabilities, and then
register device. From there, the Pen and Touch interfaces
will reuse the existing tablet's IRQ routines.
Its possible that 1 receiver is shared with 2 tablets with
different PID (small and medium Bamboo for example) so the
input is unregister at disconnect to better support this case.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 6264e6a8d513..fce7a09fb5db 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -1046,9 +1046,27 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) { - if (len != WACOM_PKGLEN_WIRELESS) + unsigned char *data = wacom->data; + int connected; + + if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80) return 0; + connected = data[1] & 0x01; + if (connected) { + int pid; + + pid = get_unaligned_be16(&data[6]); + if (wacom->pid != pid) { + wacom->pid = pid; + wacom_schedule_work(wacom); + } + } else if (wacom->pid != 0) { + /* disconnected while previously connected */ + wacom->pid = 0; + wacom_schedule_work(wacom); + } + return 0; } |