* [PATCH v2 1/4] input: wacom - Request tablet data for Bamboo Pens
2010-09-11 18:30 [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support chris
@ 2010-09-11 18:30 ` chris
2010-09-11 18:30 ` [PATCH v2 2/4] input: wacom - move Bamboo Touch irq to own function chris
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: chris @ 2010-09-11 18:30 UTC (permalink / raw)
To: linux-input, dmitry.torokhov, pingc; +Cc: Chris Bagwell
From: Chris Bagwell <chris@cnpbagwell.com>
Bamboo P&T need to use second form of usb_set_report() to
ask to report tablet data.
With previous addition of Bamboo Touch, BTN_TOOL_TRIPLETAP is now used
for both TABLETPC2FG and BAMBOO_PT types. So reduced check to
match type=TABLETPC2FG.
This change shows redundant check for !TABLETPC2FG in else statement.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
---
drivers/input/tablet/wacom_sys.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index fc6fd53..1e3af29 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -319,8 +319,9 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
if (!rep_data)
return error;
- /* ask to report tablet data if it is 2FGT or not a Tablet PC */
- if (features->device_type == BTN_TOOL_TRIPLETAP) {
+ /* ask to report tablet data if it is 2FGT Tablet PC or
+ * not a Tablet PC */
+ if (features->type == TABLETPC2FG) {
do {
rep_data[0] = 3;
rep_data[1] = 4;
@@ -332,7 +333,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
WAC_HID_FEATURE_REPORT, report_id,
rep_data, 3);
} while ((error < 0 || rep_data[1] != 4) && limit++ < 5);
- } else if (features->type != TABLETPC && features->type != TABLETPC2FG) {
+ } else if (features->type != TABLETPC) {
do {
rep_data[0] = 2;
rep_data[1] = 2;
@@ -364,7 +365,7 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
features->pressure_fuzz = 0;
features->distance_fuzz = 0;
- /* only Tablet PCs need to retrieve the info */
+ /* only Tablet PCs and Bamboo P&T need to retrieve the info */
if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
(features->type != BAMBOO_PT))
goto out;
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] input: wacom - move Bamboo Touch irq to own function
2010-09-11 18:30 [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support chris
2010-09-11 18:30 ` [PATCH v2 1/4] input: wacom - Request tablet data for Bamboo Pens chris
@ 2010-09-11 18:30 ` chris
2010-09-11 18:30 ` [PATCH v2 3/4] input: wacom - Add support for Bamboo Pen chris
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: chris @ 2010-09-11 18:30 UTC (permalink / raw)
To: linux-input, dmitry.torokhov, pingc; +Cc: Chris Bagwell
From: Chris Bagwell <chris@cnpbagwell.com>
This is in preparation of pen support in same irq handler.
Chris
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
---
drivers/input/tablet/wacom_wac.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 2f4411a..2f7ed9a 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -855,7 +855,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
return retval;
}
-static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
+static int wacom_bpt_touch(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input;
@@ -863,9 +863,6 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
int sp = 0, sx = 0, sy = 0, count = 0;
int i;
- if (len != WACOM_PKGLEN_BBTOUCH)
- return 0;
-
for (i = 0; i < 2; i++) {
int p = data[9 * i + 2];
input_mt_slot(input, i);
@@ -907,6 +904,14 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
return 0;
}
+static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
+{
+ if (len == WACOM_PKGLEN_BBTOUCH)
+ return wacom_bpt_touch(wacom);
+
+ return 0;
+}
+
void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
{
bool sync;
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] input: wacom - Add support for Bamboo Pen
2010-09-11 18:30 [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support chris
2010-09-11 18:30 ` [PATCH v2 1/4] input: wacom - Request tablet data for Bamboo Pens chris
2010-09-11 18:30 ` [PATCH v2 2/4] input: wacom - move Bamboo Touch irq to own function chris
@ 2010-09-11 18:30 ` chris
2010-09-11 18:30 ` [PATCH v2 4/4] input: wacom - disable Bamboo touchpad when pen is being used chris
2010-09-12 2:13 ` [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support Ping Cheng
4 siblings, 0 replies; 7+ messages in thread
From: chris @ 2010-09-11 18:30 UTC (permalink / raw)
To: linux-input, dmitry.torokhov, pingc; +Cc: Chris Bagwell
From: Chris Bagwell <chris@cnpbagwell.com>
This adds support for Pen on Bamboo Pen and Bamboo Pen&Touch
devices. Touchpad is handled by previous Bamboo Touch
logic.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
---
drivers/input/tablet/wacom_wac.c | 77 ++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 2f7ed9a..3943ddf 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -904,10 +904,73 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
return 0;
}
+static int wacom_bpt_pen(struct wacom_wac *wacom)
+{
+ struct input_dev *input = wacom->input;
+ unsigned char *data = wacom->data;
+ int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
+
+ /* Similar to Graphire protocol, data[1] & 0x20 is proximity and
+ * data[1] & 0x18 is tool ID. 0x30 is safety check to ignore
+ * 2 unused tool ID's.
+ */
+ prox = (data[1] & 0x30) == 0x30;
+
+ /* All reports shared between PEN and RUBBER tool must be
+ * forced to a known starting value (zero) when transitioning to
+ * out-of-prox.
+ *
+ * If not reset then, to userspace, it will look like lost events
+ * if new tool comes in-prox with same values as previous tool sent.
+ *
+ * Hardware does report zero in most out-of-prox cases but not all.
+ */
+ if (prox) {
+ if (!wacom->shared->stylus_in_proximity) {
+ if (data[1] & 0x08) {
+ wacom->tool[0] = BTN_TOOL_RUBBER;
+ wacom->id[0] = ERASER_DEVICE_ID;
+ } else {
+ wacom->tool[0] = BTN_TOOL_PEN;
+ wacom->id[0] = STYLUS_DEVICE_ID;
+ }
+ wacom->shared->stylus_in_proximity = true;
+ }
+ x = le16_to_cpup((__le16 *)&data[2]);
+ y = le16_to_cpup((__le16 *)&data[4]);
+ p = le16_to_cpup((__le16 *)&data[6]);
+ d = data[8];
+ pen = data[1] & 0x01;
+ btn1 = data[1] & 0x02;
+ btn2 = data[1] & 0x04;
+ }
+
+ input_report_key(input, BTN_TOUCH, pen);
+ input_report_key(input, BTN_STYLUS, btn1);
+ input_report_key(input, BTN_STYLUS2, btn2);
+
+ input_report_abs(input, ABS_X, x);
+ input_report_abs(input, ABS_Y, y);
+ input_report_abs(input, ABS_PRESSURE, p);
+ input_report_abs(input, ABS_DISTANCE, d);
+
+ if (!prox) {
+ wacom->id[0] = 0;
+ wacom->shared->stylus_in_proximity = false;
+ }
+
+ input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */
+ input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */
+
+ return 1;
+}
+
static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
{
if (len == WACOM_PKGLEN_BBTOUCH)
return wacom_bpt_touch(wacom);
+ else if (len == WACOM_PKGLEN_BBFUN)
+ return wacom_bpt_pen(wacom);
return 0;
}
@@ -1193,6 +1256,11 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
features->pressure_fuzz, 0);
input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0,
MAX_TRACKING_ID, 0, 0);
+ } else if (features->device_type == BTN_TOOL_PEN) {
+ __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
+ __set_bit(BTN_TOOL_PEN, input_dev->keybit);
+ __set_bit(BTN_STYLUS, input_dev->keybit);
+ __set_bit(BTN_STYLUS2, input_dev->keybit);
}
break;
}
@@ -1334,6 +1402,12 @@ static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
static struct wacom_features wacom_features_0xD0 =
{ "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
+static struct wacom_features wacom_features_0xD1 =
+ { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
+static struct wacom_features wacom_features_0xD2 =
+ { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
+static struct wacom_features wacom_features_0xD3 =
+ { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
#define USB_DEVICE_WACOM(prod) \
USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1399,6 +1473,9 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0xC7) },
{ USB_DEVICE_WACOM(0xCE) },
{ USB_DEVICE_WACOM(0xD0) },
+ { USB_DEVICE_WACOM(0xD1) },
+ { USB_DEVICE_WACOM(0xD2) },
+ { USB_DEVICE_WACOM(0xD3) },
{ USB_DEVICE_WACOM(0xF0) },
{ USB_DEVICE_WACOM(0xCC) },
{ USB_DEVICE_WACOM(0x90) },
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread