* [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support
@ 2010-09-11 18:30 chris
2010-09-11 18:30 ` [PATCH v2 1/4] input: wacom - Request tablet data for Bamboo Pens chris
` (4 more replies)
0 siblings, 5 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>
Addes Bamboo Pen and Pen&Touch support. Builds on previous
commited support for Bamboo Touch.
Only difference in this patch set is patch #3. It makes suggested
change to logic for checking pen in-proximity and adds comment
to clarify why 2-bits are checked.
Chris Bagwell (4):
input: wacom - Request tablet data for Bamboo Pens
input: wacom - move Bamboo Touch irq to own function
input: wacom - Add support for Bamboo Pen
input: wacom - disable Bamboo touchpad when pen is being used.
drivers/input/tablet/wacom_sys.c | 9 ++--
drivers/input/tablet/wacom_wac.c | 97 ++++++++++++++++++++++++++++++++++++--
2 files changed, 97 insertions(+), 9 deletions(-)
--
1.7.2.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [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
* [PATCH v2 4/4] input: wacom - disable Bamboo touchpad when pen is being used.
2010-09-11 18:30 [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support chris
` (2 preceding siblings ...)
2010-09-11 18:30 ` [PATCH v2 3/4] input: wacom - Add support for Bamboo Pen chris
@ 2010-09-11 18:30 ` 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>
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
---
drivers/input/tablet/wacom_wac.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 3943ddf..3f89e1e 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -866,7 +866,12 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
for (i = 0; i < 2; i++) {
int p = data[9 * i + 2];
input_mt_slot(input, i);
- if (p) {
+ /* Touch events need to be disabled while stylus is
+ * in proximity because user's hand is resting on touchpad
+ * and sending unwanted events. User expects tablet buttons
+ * to continue working though.
+ */
+ if (p && !wacom->shared->stylus_in_proximity) {
int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
--
1.7.2.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support
2010-09-11 18:30 [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support chris
` (3 preceding siblings ...)
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 ` Ping Cheng
2010-09-12 7:14 ` Dmitry Torokhov
4 siblings, 1 reply; 7+ messages in thread
From: Ping Cheng @ 2010-09-12 2:13 UTC (permalink / raw)
To: chris; +Cc: linux-input, dmitry.torokhov, pingc
On Saturday, September 11, 2010, <chris@cnpbagwell.com> wrote:
> From: Chris Bagwell <chris@cnpbagwell.com>
>
> Addes Bamboo Pen and Pen&Touch support. Builds on previous
> commited support for Bamboo Touch.
>
> Only difference in this patch set is patch #3. It makes suggested
> change to logic for checking pen in-proximity and adds comment
> to clarify why 2-bits are checked.
>
> Chris Bagwell (4):
> input: wacom - Request tablet data for Bamboo Pens
> input: wacom - move Bamboo Touch irq to own function
> input: wacom - Add support for Bamboo Pen
> input: wacom - disable Bamboo touchpad when pen is being used.
Acked-by: Ping Cheng <pingc@wacom.com> for the whole series.
Ping
> drivers/input/tablet/wacom_sys.c | 9 ++--
> drivers/input/tablet/wacom_wac.c | 97 ++++++++++++++++++++++++++++++++++++--
> 2 files changed, 97 insertions(+), 9 deletions(-)
>
> --
> 1.7.2.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support
2010-09-12 2:13 ` [PATCH v2 0/4] input: wacom - Add Bamboo Pen Support Ping Cheng
@ 2010-09-12 7:14 ` Dmitry Torokhov
0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2010-09-12 7:14 UTC (permalink / raw)
To: Ping Cheng; +Cc: chris, linux-input, pingc
On Sun, Sep 12, 2010 at 04:13:27AM +0200, Ping Cheng wrote:
> On Saturday, September 11, 2010, <chris@cnpbagwell.com> wrote:
> > From: Chris Bagwell <chris@cnpbagwell.com>
> >
> > Addes Bamboo Pen and Pen&Touch support. Builds on previous
> > commited support for Bamboo Touch.
> >
> > Only difference in this patch set is patch #3. It makes suggested
> > change to logic for checking pen in-proximity and adds comment
> > to clarify why 2-bits are checked.
> >
> > Chris Bagwell (4):
> > input: wacom - Request tablet data for Bamboo Pens
> > input: wacom - move Bamboo Touch irq to own function
> > input: wacom - Add support for Bamboo Pen
> > input: wacom - disable Bamboo touchpad when pen is being used.
>
> Acked-by: Ping Cheng <pingc@wacom.com> for the whole series.
>
Applied all 4 to 'next', thanks Chris.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-12 7:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 3/4] input: wacom - Add support for Bamboo Pen 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
2010-09-12 7:14 ` Dmitry Torokhov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.