From bd393dbd33aeae0bb239f3c69938d37cc55193ca Mon Sep 17 00:00:00 2001 From: Stefan Achatz Date: Thu, 29 Dec 2011 17:20:14 +0100 Subject: [PATCH 1/9] HID: roccat: Only one Kconfig entry for all roccat drivers To cleanup Kconfig space and ease selection for users there is now a single entry that selects all roccat related drivers at once. Signed-off-by: Stefan Achatz Signed-off-by: Jiri Kosina --- drivers/hid/Kconfig | 55 ++++---------------------------------------- drivers/hid/Makefile | 11 +++------ 2 files changed, 7 insertions(+), 59 deletions(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index a421abdd1ab7..5a763d5a7bf8 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -476,59 +476,12 @@ config HID_PRIMAX HID standard. config HID_ROCCAT - tristate "Roccat special event support" + tristate "Roccat device support" depends on USB_HID - select HID_ROCCAT_COMMON ---help--- - Support for Roccat special events. - Say Y here if you have a Roccat mouse or keyboard and want OSD or - macro execution support. - -config HID_ROCCAT_COMMON - tristate - depends on HID_ROCCAT - -config HID_ROCCAT_ARVO - tristate "Roccat Arvo keyboard support" - depends on USB_HID - depends on HID_ROCCAT - ---help--- - Support for Roccat Arvo keyboard. - -config HID_ROCCAT_ISKU - tristate "Roccat Isku keyboard support" - depends on USB_HID - depends on HID_ROCCAT - ---help--- - Support for Roccat Isku keyboard. - -config HID_ROCCAT_KONE - tristate "Roccat Kone Mouse support" - depends on USB_HID - depends on HID_ROCCAT - ---help--- - Support for Roccat Kone mouse. - -config HID_ROCCAT_KONEPLUS - tristate "Roccat Kone[+] mouse support" - depends on USB_HID - depends on HID_ROCCAT - ---help--- - Support for Roccat Kone[+] mouse. - -config HID_ROCCAT_KOVAPLUS - tristate "Roccat Kova[+] mouse support" - depends on USB_HID - depends on HID_ROCCAT - ---help--- - Support for Roccat Kova[+] mouse. - -config HID_ROCCAT_PYRA - tristate "Roccat Pyra mouse support" - depends on USB_HID - depends on HID_ROCCAT - ---help--- - Support for Roccat Pyra mouse. + Support for Roccat devices. + Say Y here if you have a Roccat mouse or keyboard and want + support for its special functionalities. config HID_SAMSUNG tristate "Samsung InfraRed remote control or keyboards" diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 8aefdc963cce..7d926719e21b 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -64,14 +64,9 @@ obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o obj-$(CONFIG_HID_PRIMAX) += hid-primax.o -obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o -obj-$(CONFIG_HID_ROCCAT_COMMON) += hid-roccat-common.o -obj-$(CONFIG_HID_ROCCAT_ARVO) += hid-roccat-arvo.o -obj-$(CONFIG_HID_ROCCAT_ISKU) += hid-roccat-isku.o -obj-$(CONFIG_HID_ROCCAT_KONE) += hid-roccat-kone.o -obj-$(CONFIG_HID_ROCCAT_KONEPLUS) += hid-roccat-koneplus.o -obj-$(CONFIG_HID_ROCCAT_KOVAPLUS) += hid-roccat-kovaplus.o -obj-$(CONFIG_HID_ROCCAT_PYRA) += hid-roccat-pyra.o +obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ + hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \ + hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-pyra.o obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o obj-$(CONFIG_HID_SONY) += hid-sony.o From 32db737fb2bfe9013362c9dc2c7af998edc758be Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Sun, 19 Feb 2012 20:20:29 +0000 Subject: [PATCH 2/9] HID: wacom: fix proximity tool release Don't zero the current tool before reporting its release to the input subsystem. Signed-off-by: Aristeu Rozanski Tested-by: Przemo Firszt Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index acab74cde727..8b4922924142 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -322,10 +322,10 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, switch (data[1]) { case 0x80: /* Out of proximity report */ - wdata->tool = 0; input_report_key(input, BTN_TOUCH, 0); input_report_abs(input, ABS_PRESSURE, 0); input_report_key(input, wdata->tool, 0); + wdata->tool = 0; input_sync(input); break; case 0xC2: /* Tool report */ From 2c653e6bac85918ae76ed0199f25fb6a2206b92d Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Fri, 24 Feb 2012 13:47:48 +0000 Subject: [PATCH 3/9] HID: wacom: set ABS_MISC bit for Intuos4 WL ABS_MISC has to be set for Intuos4 WL otherwise xorg driver won't use proper protocol and the information about tool id and serial is lost. Signed-off-by: Przemo Firszt Reviewed-by: Chris Bagwell Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 8b4922924142..c4a193b6c44e 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -471,6 +471,7 @@ static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0); break; case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: + __set_bit(ABS_MISC, input->absbit); input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); From 2470900b68ccfde046d5a20c47ae9abb4e406084 Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Fri, 24 Feb 2012 13:52:32 +0000 Subject: [PATCH 4/9] HID: wacom: Add serial and id reporting for Wacom Intuos4 WL This patch implements reporting id and serial number of used tool. Reported values are the same as for USB on of the driver for wacom Intuos4 WL Signed-off-by: Przemo Firszt Reviewed-by: Chris Bagwell Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index c4a193b6c44e..a3476f9a5103 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -35,6 +35,8 @@ struct wacom_data { __u16 tool; unsigned char butstate; __u8 features; + __u32 id; + __u32 serial; unsigned char high_speed; #ifdef CONFIG_HID_WACOM_POWER_SUPPLY int battery_capacity; @@ -318,26 +320,30 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, struct input_dev *input, unsigned char *data) { __u16 x, y, pressure; - __u32 id; switch (data[1]) { case 0x80: /* Out of proximity report */ input_report_key(input, BTN_TOUCH, 0); input_report_abs(input, ABS_PRESSURE, 0); input_report_key(input, wdata->tool, 0); + input_report_abs(input, ABS_MISC, 0); + input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); wdata->tool = 0; input_sync(input); break; case 0xC2: /* Tool report */ - id = ((data[2] << 4) | (data[3] >> 4) | + wdata->id = ((data[2] << 4) | (data[3] >> 4) | ((data[7] & 0x0f) << 20) | - ((data[8] & 0xf0) << 12)) & 0xfffff; + ((data[8] & 0xf0) << 12)); + wdata->serial = ((data[3] & 0x0f) << 28) + + (data[4] << 20) + (data[5] << 12) + + (data[6] << 4) + (data[7] >> 4); - switch (id) { - case 0x802: + switch (wdata->id) { + case 0x100802: wdata->tool = BTN_TOOL_PEN; break; - case 0x80A: + case 0x10080A: wdata->tool = BTN_TOOL_RUBBER; break; } @@ -356,6 +362,9 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); input_report_abs(input, ABS_PRESSURE, pressure); + input_report_abs(input, ABS_MISC, wdata->id); + input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); + input_report_key(input, wdata->tool, 1); input_sync(input); break; } From e0829e9c1e6981450f11204a4104646ed0f6907a Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Tue, 28 Feb 2012 17:19:04 +0000 Subject: [PATCH 5/9] HID: wacom: report distance for Intuos4 WL This patch adds reporting of distance of tool to the tablet surface. Maximum reported value is 63 (0x3F). Signed-off-by: Przemo Firszt Acked-by: Peter Hutterer Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index a3476f9a5103..5a58db2440fa 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -320,6 +320,7 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, struct input_dev *input, unsigned char *data) { __u16 x, y, pressure; + __u8 distance; switch (data[1]) { case 0x80: /* Out of proximity report */ @@ -353,6 +354,7 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, y = data[4] << 9 | data[5] << 1 | (data[9] & 0x01); pressure = (data[6] << 3) | ((data[7] & 0xC0) >> 5) | (data[1] & 0x01); + distance = (data[9] >> 2) & 0x3f; input_report_key(input, BTN_TOUCH, pressure > 1); @@ -362,6 +364,7 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); input_report_abs(input, ABS_PRESSURE, pressure); + input_report_abs(input, ABS_DISTANCE, distance); input_report_abs(input, ABS_MISC, wdata->id); input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); input_report_key(input, wdata->tool, 1); @@ -484,6 +487,7 @@ static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); + input_set_abs_params(input, ABS_DISTANCE, 0, 63, 0, 0); break; } From 6245bde29dd049300d663516398335be8d451b78 Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Tue, 28 Feb 2012 17:19:05 +0000 Subject: [PATCH 6/9] HID: wacom: Add pad buttons reporting on Intuos4 WL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds reporting of 1 wheel button and 8 strip buttons for Intuos4 WL. The buttons are reported as BTN_0 to BTN_9. The change of type butstate variable is required as the old type 'char' couldn't store state of 9 buttons. The change is not affecting Graphire tablet as it only uses first 2 bits of 'butstate'. Signed-off-by: Przemo Firszt Acked-by:Ping Cheng Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 5a58db2440fa..58aedbc80f02 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -31,9 +31,11 @@ #include "hid-ids.h" +#define PAD_DEVICE_ID 0x0F + struct wacom_data { __u16 tool; - unsigned char butstate; + __u16 butstate; __u8 features; __u32 id; __u32 serial; @@ -316,6 +318,30 @@ static int wacom_gr_parse_report(struct hid_device *hdev, return 1; } +static void wacom_i4_parse_button_report(struct wacom_data *wdata, + struct input_dev *input, unsigned char *data) +{ + __u16 new_butstate; + + new_butstate = (data[3] << 1) | (data[2] & 0x01); + if (new_butstate != wdata->butstate) { + wdata->butstate = new_butstate; + input_report_key(input, BTN_0, new_butstate & 0x001); + input_report_key(input, BTN_1, new_butstate & 0x002); + input_report_key(input, BTN_2, new_butstate & 0x004); + input_report_key(input, BTN_3, new_butstate & 0x008); + input_report_key(input, BTN_4, new_butstate & 0x010); + input_report_key(input, BTN_5, new_butstate & 0x020); + input_report_key(input, BTN_6, new_butstate & 0x040); + input_report_key(input, BTN_7, new_butstate & 0x080); + input_report_key(input, BTN_8, new_butstate & 0x100); + input_report_key(input, BTN_TOOL_FINGER, 1); + input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); + input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); + input_sync(input); + } +} + static void wacom_i4_parse_pen_report(struct wacom_data *wdata, struct input_dev *input, unsigned char *data) { @@ -389,6 +415,7 @@ static void wacom_i4_parse_report(struct hid_device *hdev, wdata->features = data[2]; break; case 0x0C: /* Button report */ + wacom_i4_parse_button_report(wdata, input, data); break; default: hid_err(hdev, "Unknown report: %d,%d\n", data[0], data[1]); @@ -484,6 +511,13 @@ static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, break; case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: __set_bit(ABS_MISC, input->absbit); + __set_bit(BTN_2, input->keybit); + __set_bit(BTN_3, input->keybit); + __set_bit(BTN_4, input->keybit); + __set_bit(BTN_5, input->keybit); + __set_bit(BTN_6, input->keybit); + __set_bit(BTN_7, input->keybit); + __set_bit(BTN_8, input->keybit); input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); From 693f45bb2d6ff5bf8fb3b69ff904b44ef8cffd8d Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Fri, 9 Mar 2012 13:20:51 +0000 Subject: [PATCH 7/9] HID: wacom: Reset stylus buttons - Intuos4 WL Stylus buttons have to be resetted when going out-of-prox. Signed-off-by: Przemo Firszt Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 58aedbc80f02..f9af474275db 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -352,6 +352,8 @@ static void wacom_i4_parse_pen_report(struct wacom_data *wdata, case 0x80: /* Out of proximity report */ input_report_key(input, BTN_TOUCH, 0); input_report_abs(input, ABS_PRESSURE, 0); + input_report_key(input, BTN_STYLUS, 0); + input_report_key(input, BTN_STYLUS2, 0); input_report_key(input, wdata->tool, 0); input_report_abs(input, ABS_MISC, 0); input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); From 9a911da8d792a2d8f9a1e07eb1c41e0d7f4ec307 Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Wed, 14 Mar 2012 19:55:03 +0000 Subject: [PATCH 8/9] HID: wacom: Replace __set_bit with input_set_capability It's a trivial patch. It's doesn't change the functionality as the helper input_set_capability does the same thing. Signed-off-by: Przemo Firszt Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index f9af474275db..3fc93869024e 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -492,9 +492,7 @@ static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, __set_bit(BTN_MIDDLE, input->keybit); /* Pad */ - input->evbit[0] |= BIT(EV_MSC); - - __set_bit(MSC_SERIAL, input->mscbit); + input_set_capability(input, EV_MSC, MSC_SERIAL); __set_bit(BTN_0, input->keybit); __set_bit(BTN_1, input->keybit); From 7e503a37deee55cc30d2c8643e704a98556dd367 Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Wed, 14 Mar 2012 19:55:04 +0000 Subject: [PATCH 9/9] HID: wacom: Add reporting of wheel for Intuos4 WL This patch adds reporting of ABS_WHEEL event. Raported walues are 0..71 and are related to absolute location of the finger on the wheel. Signed-off-by: Przemo Firszt Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina --- drivers/hid/hid-wacom.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 3fc93869024e..694545d5bfea 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -36,6 +36,7 @@ struct wacom_data { __u16 tool; __u16 butstate; + __u8 whlstate; __u8 features; __u32 id; __u32 serial; @@ -322,6 +323,23 @@ static void wacom_i4_parse_button_report(struct wacom_data *wdata, struct input_dev *input, unsigned char *data) { __u16 new_butstate; + __u8 new_whlstate; + __u8 sync = 0; + + new_whlstate = data[1]; + if (new_whlstate != wdata->whlstate) { + wdata->whlstate = new_whlstate; + if (new_whlstate & 0x80) { + input_report_key(input, BTN_TOUCH, 1); + input_report_abs(input, ABS_WHEEL, (new_whlstate & 0x7f)); + input_report_key(input, BTN_TOOL_FINGER, 1); + } else { + input_report_key(input, BTN_TOUCH, 0); + input_report_abs(input, ABS_WHEEL, 0); + input_report_key(input, BTN_TOOL_FINGER, 0); + } + sync = 1; + } new_butstate = (data[3] << 1) | (data[2] & 0x01); if (new_butstate != wdata->butstate) { @@ -336,6 +354,10 @@ static void wacom_i4_parse_button_report(struct wacom_data *wdata, input_report_key(input, BTN_7, new_butstate & 0x080); input_report_key(input, BTN_8, new_butstate & 0x100); input_report_key(input, BTN_TOOL_FINGER, 1); + sync = 1; + } + + if (sync) { input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); input_sync(input); @@ -510,6 +532,7 @@ static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0); break; case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: + __set_bit(ABS_WHEEL, input->absbit); __set_bit(ABS_MISC, input->absbit); __set_bit(BTN_2, input->keybit); __set_bit(BTN_3, input->keybit); @@ -518,6 +541,7 @@ static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, __set_bit(BTN_6, input->keybit); __set_bit(BTN_7, input->keybit); __set_bit(BTN_8, input->keybit); + input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0); input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0);