[Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial

2012-02-01 Thread Aristeu Rozanski
This patch adds support for the pad buttons and dial in the bluetooth version
of Intuos4.

Signed-off-by: Aristeu Rozanski a...@redhat.com

---
 drivers/hid/hid-wacom.c |   38 ++
 1 file changed, 38 insertions(+)

--- linus-2.6.orig/drivers/hid/hid-wacom.c  2012-02-01 11:54:09.0 
-0500
+++ linus-2.6/drivers/hid/hid-wacom.c   2012-02-01 12:17:46.166583951 -0500
@@ -363,6 +363,35 @@input_report_key(input, BTN_STYLUS2, d
return;
 }
 
+static void wacom_i4_parse_pad_report(struct wacom_data *wdata,
+   struct input_dev *input, unsigned char *data)
+{
+   input_report_key(input, BTN_0, (data[2]  0x01));
+   input_report_key(input, BTN_1, (data[3]  0x01));
+   input_report_key(input, BTN_2, (data[3]  0x02));
+   input_report_key(input, BTN_3, (data[3]  0x04));
+   input_report_key(input, BTN_4, (data[3]  0x08));
+   input_report_key(input, BTN_5, (data[3]  0x10));
+   input_report_key(input, BTN_6, (data[3]  0x20));
+   input_report_key(input, BTN_7, (data[3]  0x40));
+   input_report_key(input, BTN_8, (data[3]  0x80));
+
+   if (data[1]  0x80)
+   input_report_abs(input, ABS_WHEEL, (data[1]  0x7f));
+   else
+   /* Out of proximity, clear wheel value. */
+   input_report_abs(input, ABS_WHEEL, 0);
+
+   if (data[1] | (data[2]  0x01) | data[3]) {
+   input_report_key(input, wdata-tool, 1);
+   input_report_key(input, BTN_TOOL_FINGER, 1);
+   } else {
+   input_report_key(input, wdata-tool, 0);
+   input_report_abs(input, BTN_TOOL_FINGER, 0);
+   }
+   input_sync(input);
+}
+
 static void wacom_i4_parse_report(struct hid_device *hdev,
struct wacom_data *wdata,
struct input_dev *input, unsigned char *data)
@@ -377,6 +406,7 @@ case 0x03: /* Features Report */
wdata-features = data[2];
break;
case 0x0C: /* Button report */
+   wacom_i4_parse_pad_report(wdata, input, data);
break;
default:
hid_err(hdev, Unknown report: %d,%d\n, data[0], data[1]);
@@ -474,6 +504,14 @@input_set_abs_params(input, ABS_DISTAN
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_WHEEL, 0, 71, 0, 0);
+   __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);
break;
}
 

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] hid-wacom: fix proximity tool release

2012-02-01 Thread Aristeu Rozanski
Don't zero the current tool before reporting its release to the input
subsystem.

Signed-off-by: Aristeu Rozanski a...@redhat.com

--- linus-2.6.orig/drivers/hid/hid-wacom.c  2012-02-01 12:04:39.660958537 
-0500
+++ linus-2.6/drivers/hid/hid-wacom.c   2012-02-01 12:05:12.205959440 -0500
@@ -322,10 +322,10 @@ static void wacom_i4_parse_pen_report(st
 
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 */

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel