input: Add support for Hanwang tablet
Subsystems (2)
PATCH v3 1/1 input: Add support for Hanwang tablet
From: Xing Wei <[email protected]>
Add support for Art Master III tablet of BeiJing HanwangTechnology Co, Ltd.
---
Thanks for dmitry's comment & advice.
And I removed the part -- "Make sure to say Y to 'Mouse support(CONFIG_INPUT_MOUSEDEV)' and/or 'Event interface support' (CONFIG_INPUT_EVDEV) as well" in the Kconfig.
linux-2.6.35.3/drivers/hid/hid-core.c renamed from drivers/hid/hid-core.c +5 -0
@@ -1759,6 +1759,11 @@ static bool hid_ignore(struct hid_device hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST)return true;break ; +case USB_VENDOR_ID_HANWANG : +if (hdev->product >=USB_DEVICE_ID_HANWANG_TABLET_FIRST && + hdev->product <=USB_DEVICE_ID_HANWANG_TABLET_LAST ) +return true; +break ; } if (hdev->type == HID_TYPE_USBMOUSE &&
linux-2.6.35.3/drivers/hid/hid-ids.h renamed from drivers/hid/hid-ids.h +3 -0
@@ -526,5 +526,8 @@#define USB_DEVICE_ID_KYE_ERGO_525V 0x0087#define USB_DEVICE_ID_KYE_GPEN_560 0x5003 +#define USB_VENDOR_ID_HANWANG 0x0b57 +#define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000 +#define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff#endif
linux-2.6.35.3/drivers/input/tablet/hanwang.c renamed from drivers/input/tablet/hanwang.c +359 -0
359 lines not on this page · raw message
linux-2.6.35.3/drivers/input/tablet/Kconfig renamed from drivers/input/tablet/Kconfig +11 -0
@@ -49,6 +49,17 @@ config TABLET_USB_GTCO To compile this driver as a module, choose M here: the module will be called gtco. +config TABLET_USB_HANWANG + tristate "Hanwang Art Master III tablet support (USB)" + depends on USB_ARCH_HAS_HCD + select USB + help + Say Y here if you want to use the USB version of the Hanwang Art + Master III tablet. + + To compile this driver as a module, choose M here: the + module will be called hanwang. + config TABLET_USB_KBTAB tristate "KB Gear JamStudio tablet support (USB)" depends on USB_ARCH_HAS_HCD
linux-2.6.35.3/drivers/input/tablet/Makefile renamed from drivers/input/tablet/Makefile +1 -0
@@ -8,5 +8,6 @@ wacom-objs := wacom_wac.o wacom_sys.o obj-$(CONFIG_TABLET_USB_ACECAD) += acecad.o obj-$(CONFIG_TABLET_USB_AIPTEK) += aiptek.o obj-$(CONFIG_TABLET_USB_GTCO) += gtco.o +obj-$(CONFIG_TABLET_USB_HANWANG) += hanwang.o obj-$(CONFIG_TABLET_USB_KBTAB) += kbtab.o obj-$(CONFIG_TABLET_USB_WACOM) += wacom.o
Dmitry Torokhov
maintainerReview
Quoted 4 lines · Xing Wei
(quoted diff) +4
-0+ +struct hanwang_state { + unsigned int tool_style; + unsigned int tool_state;
tool_state is not used anywhere.
Review
Quoted 3 lines
(quoted diff) +3
-0+ } else if (data[0] == 0x0c) { /* roll wheel */ + if (data[1]) + input_report_abs(input_dev, ABS_WHEEL, data[1]);
Unlike REL_* events you need to send 0 ABS events since in absence of ABS_* event in a packet it is assumed to have the same value as last time. Thus once you move wheel it will never go back to 0.
Review
Quoted 8 lines
(quoted diff) +8
-0+ input_report_key(input_dev, BTN_0, data[2]); + input_report_key(input_dev, BTN_1, data[3] & 0x01); + input_report_key(input_dev, BTN_2, data[3] & 0x02); + input_report_key(input_dev, BTN_3, data[3] & 0x04); + input_report_key(input_dev, BTN_4, data[3] & 0x08); + input_report_key(input_dev, BTN_5, data[3] & 0x10); + input_report_key(input_dev, BTN_6, data[3] & 0x20); + input_report_key(input_dev, BTN_7, data[3] & 0x30);
0x30 is suspicious. Can't it be
for (i = 0; i < 8; i++) input_report_key(input_dev, BTN_1 + i, data[3] & (1 << i));
I adjusted the patch a bit, could you please tell me if it still works for you and I will apply it.
Thanks!
Hmm, one more thing - the device clams to have ABS_DISTANCE but I do not see where it sends such events...
Signature · 20 lines
Dmitry Input: Add support for Hanwang tablet From: Xing Wei <[email protected]> Add support for Art Master III tablet of BeiJing HanwangTechnology Co, Ltd. Signed-off-by: Xing Wei <[email protected]> Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/hid/hid-core.c | 5 + drivers/hid/hid-ids.h | 4 drivers/input/tablet/Kconfig | 11 + drivers/input/tablet/Makefile | 1 drivers/input/tablet/hanwang.c | 370 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 391 insertions(+), 0 deletions(-) create mode 100644 drivers/input/tablet/hanwang.c
drivers/hid/hid-core.c +5 -0
@@ -1770,6 +1770,11 @@ static bool hid_ignore(struct hid_device *hdev) hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST)return true;break ; +case USB_VENDOR_ID_HANWANG : +if (hdev->product >=USB_DEVICE_ID_HANWANG_TABLET_FIRST && + hdev->product <=USB_DEVICE_ID_HANWANG_TABLET_LAST ) +return true; +break ; } if (hdev->type == HID_TYPE_USBMOUSE &&
drivers/hid/hid-ids.h +4 -0
@@ -293,6 +293,10 @@#define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003#define USB_DEVICE_ID_GYRATION_REMOTE_3 0x0008 +#define USB_VENDOR_ID_HANWANG 0x0b57 +#define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000 +#define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff +#define USB_VENDOR_ID_HAPP 0x078b#define USB_DEVICE_ID_UGCI_DRIVING 0x0010#define USB_DEVICE_ID_UGCI_FLYING 0x0020
drivers/input/tablet/Kconfig +11 -0
@@ -49,6 +49,17 @@ config TABLET_USB_GTCO To compile this driver as a module, choose M here: the module will be called gtco. +config TABLET_USB_HANWANG + tristate "Hanwang Art Master III tablet support (USB)" + depends on USB_ARCH_HAS_HCD + select USB + help + Say Y here if you want to use the USB version of the Hanwang Art + Master III tablet. + + To compile this driver as a module, choose M here: the + module will be called hanwang. + config TABLET_USB_KBTAB tristate "KB Gear JamStudio tablet support (USB)" depends on USB_ARCH_HAS_HCD
drivers/input/tablet/Makefile +1 -0
@@ -8,5 +8,6 @@ wacom-objs := wacom_wac.o wacom_sys.o obj-$(CONFIG_TABLET_USB_ACECAD) += acecad.o obj-$(CONFIG_TABLET_USB_AIPTEK) += aiptek.o obj-$(CONFIG_TABLET_USB_GTCO) += gtco.o +obj-$(CONFIG_TABLET_USB_HANWANG) += hanwang.o obj-$(CONFIG_TABLET_USB_KBTAB) += kbtab.o obj-$(CONFIG_TABLET_USB_WACOM) += wacom.o
drivers/input/tablet/hanwang.c new file +370 -0
370 lines not on this page · raw message