All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] input: wacom - And Bamboo Pen Support
@ 2010-09-09  4:02 chris
  2010-09-09  4:02 ` [PATCH 1/4] input: wacom - Request tablet data for Bamboo Pens chris
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: chris @ 2010-09-09  4:02 UTC (permalink / raw)
  To: linux-input, dmitry.torokhov, pingc; +Cc: Chris Bagwell

From: Chris Bagwell <chris@cnpbagwell.com>

These patches build upon previous Bamboo Touch patches from Henrik and
add support for others in family that support Pen&Touch or Pen-only

These patch set is based on support in linuxwacom Bamboo driver.

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 |   95 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 95 insertions(+), 9 deletions(-)

-- 
1.7.2.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] input: wacom - Request tablet data for Bamboo Pens
  2010-09-09  4:02 [PATCH 0/4] input: wacom - And Bamboo Pen Support chris
@ 2010-09-09  4:02 ` chris
  2010-09-09  4:02 ` [PATCH 2/4] input: wacom - move Bamboo Touch irq to own function chris
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: chris @ 2010-09-09  4:02 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] 10+ messages in thread

* [PATCH 2/4] input: wacom - move Bamboo Touch irq to own function
  2010-09-09  4:02 [PATCH 0/4] input: wacom - And Bamboo Pen Support chris
  2010-09-09  4:02 ` [PATCH 1/4] input: wacom - Request tablet data for Bamboo Pens chris
@ 2010-09-09  4:02 ` chris
  2010-09-09  4:02 ` [PATCH 3/4] input: wacom - Add support for Bamboo Pen chris
  2010-09-09  4:02 ` [PATCH 4/4] input: wacom - disable Bamboo touchpad when pen is being used chris
  3 siblings, 0 replies; 10+ messages in thread
From: chris @ 2010-09-09  4:02 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] 10+ messages in thread

* [PATCH 3/4] input: wacom - Add support for Bamboo Pen
  2010-09-09  4:02 [PATCH 0/4] input: wacom - And Bamboo Pen Support chris
  2010-09-09  4:02 ` [PATCH 1/4] input: wacom - Request tablet data for Bamboo Pens chris
  2010-09-09  4:02 ` [PATCH 2/4] input: wacom - move Bamboo Touch irq to own function chris
@ 2010-09-09  4:02 ` chris
  2010-09-09  4:14   ` Dmitry Torokhov
  2010-09-09  4:02 ` [PATCH 4/4] input: wacom - disable Bamboo touchpad when pen is being used chris
  3 siblings, 1 reply; 10+ messages in thread
From: chris @ 2010-09-09  4:02 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 |   75 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 2f7ed9a..9cc0cf0 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -904,10 +904,71 @@ 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;
+
+	prox = (data[1] & 0x10) && (data[1] & 0x20);
+
+	/* 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 done then to user it will look like a loss
+	 * of an event if new tool comes in-prox with same
+	 * value as previous tool that went out-of-prox.
+	 *
+	 * Hardware generally forces to zero on its own but
+	 * account for that here to be extra paranoid.
+	 */
+	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 +1254,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 +1400,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 +1471,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] 10+ messages in thread

* [PATCH 4/4] input: wacom - disable Bamboo touchpad when pen is being used.
  2010-09-09  4:02 [PATCH 0/4] input: wacom - And Bamboo Pen Support chris
                   ` (2 preceding siblings ...)
  2010-09-09  4:02 ` [PATCH 3/4] input: wacom - Add support for Bamboo Pen chris
@ 2010-09-09  4:02 ` chris
  3 siblings, 0 replies; 10+ messages in thread
From: chris @ 2010-09-09  4:02 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 9cc0cf0..bae67e8 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] 10+ messages in thread

* Re: [PATCH 3/4] input: wacom - Add support for Bamboo Pen
  2010-09-09  4:02 ` [PATCH 3/4] input: wacom - Add support for Bamboo Pen chris
@ 2010-09-09  4:14   ` Dmitry Torokhov
  2010-09-09 21:34     ` Chris Bagwell
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2010-09-09  4:14 UTC (permalink / raw)
  To: chris; +Cc: linux-input, pingc

On Wed, Sep 08, 2010 at 11:02:31PM -0500, chris@cnpbagwell.com wrote:
> 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 |   75 ++++++++++++++++++++++++++++++++++++++
>  1 files changed, 75 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index 2f7ed9a..9cc0cf0 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -904,10 +904,71 @@ 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;
> +
> +	prox = (data[1] & 0x10) && (data[1] & 0x20);

	prox = (data[1] & 0x30) == 0x30;

?

-- 
Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] input: wacom - Add support for Bamboo Pen
  2010-09-09  4:14   ` Dmitry Torokhov
@ 2010-09-09 21:34     ` Chris Bagwell
  2010-09-09 21:46       ` Dmitry Torokhov
  0 siblings, 1 reply; 10+ messages in thread
From: Chris Bagwell @ 2010-09-09 21:34 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, pingc

On Wed, Sep 8, 2010 at 11:14 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Sep 08, 2010 at 11:02:31PM -0500, chris@cnpbagwell.com wrote:
>> 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 |   75 ++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 75 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
>> index 2f7ed9a..9cc0cf0 100644
>> --- a/drivers/input/tablet/wacom_wac.c
>> +++ b/drivers/input/tablet/wacom_wac.c
>> @@ -904,10 +904,71 @@ 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;
>> +
>> +     prox = (data[1] & 0x10) && (data[1] & 0x20);
>
>        prox = (data[1] & 0x30) == 0x30;
>
> ?
>
> --
> Dmitry
>


Agree thats faster to understand.  I'll update patch and resend soon.

Chris
--
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] 10+ messages in thread

* Re: [PATCH 3/4] input: wacom - Add support for Bamboo Pen
  2010-09-09 21:34     ` Chris Bagwell
@ 2010-09-09 21:46       ` Dmitry Torokhov
  2010-09-10  3:02         ` Chris Bagwell
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2010-09-09 21:46 UTC (permalink / raw)
  To: Chris Bagwell; +Cc: linux-input, pingc

On Thu, Sep 09, 2010 at 04:34:35PM -0500, Chris Bagwell wrote:
> On Wed, Sep 8, 2010 at 11:14 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Wed, Sep 08, 2010 at 11:02:31PM -0500, chris@cnpbagwell.com wrote:
> >> 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 |   75 ++++++++++++++++++++++++++++++++++++++
> >>  1 files changed, 75 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> >> index 2f7ed9a..9cc0cf0 100644
> >> --- a/drivers/input/tablet/wacom_wac.c
> >> +++ b/drivers/input/tablet/wacom_wac.c
> >> @@ -904,10 +904,71 @@ 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;
> >> +
> >> +     prox = (data[1] & 0x10) && (data[1] & 0x20);
> >
> >        prox = (data[1] & 0x30) == 0x30;
> >
> > ?
> >
> > --
> > Dmitry
> >
> 
> 
> Agree thats faster to understand.  I'll update patch and resend soon.
> 

I am just curious - why is it that _both_ bits should be set for the tools
to be considered "in proximity"?..

-- 
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] 10+ messages in thread

* Re: [PATCH 3/4] input: wacom - Add support for Bamboo Pen
  2010-09-09 21:46       ` Dmitry Torokhov
@ 2010-09-10  3:02         ` Chris Bagwell
  2010-09-10  8:28           ` Ping Cheng
  0 siblings, 1 reply; 10+ messages in thread
From: Chris Bagwell @ 2010-09-10  3:02 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, pingc

Ping would you be able to comment on question at end?

On Thu, Sep 9, 2010 at 4:46 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Thu, Sep 09, 2010 at 04:34:35PM -0500, Chris Bagwell wrote:
>> On Wed, Sep 8, 2010 at 11:14 PM, Dmitry Torokhov
>> <dmitry.torokhov@gmail.com> wrote:
>> > On Wed, Sep 08, 2010 at 11:02:31PM -0500, chris@cnpbagwell.com wrote:
>> >> 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 |   75 ++++++++++++++++++++++++++++++++++++++
>> >>  1 files changed, 75 insertions(+), 0 deletions(-)
>> >>
>> >> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
>> >> index 2f7ed9a..9cc0cf0 100644
>> >> --- a/drivers/input/tablet/wacom_wac.c
>> >> +++ b/drivers/input/tablet/wacom_wac.c
>> >> @@ -904,10 +904,71 @@ 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;
>> >> +
>> >> +     prox = (data[1] & 0x10) && (data[1] & 0x20);
>> >
>> >        prox = (data[1] & 0x30) == 0x30;
>> >
>> > ?
>> >
>> > --
>> > Dmitry
>> >
>>
>>
>> Agree thats faster to understand.  I'll update patch and resend soon.
>>
>
> I am just curious - why is it that _both_ bits should be set for the tools
> to be considered "in proximity"?..
>

Below is my guess and these values ultimately came from Ping's driver.

The Bamboo Pen protocol seems to be derived from Graphire protocol.
Based on that, they also use 3 bits from data[1] in this area.  1 bit
for in-proximity and 2 bits for a tool ID of what's being reported
(pen vs. eraser vs mouse).

Although these 3 bits order are slightly different between two
protocols, it looks roughly the same to me.  0x20 for in proximity and
0x10 for pen ID and 0x11 for eraser ID.

The 0x30 check would boil down to simplest safety check for unknown ID's.

Ping, if you could confirm this I would be happy to document bit
meaning in patch update.

Chris
--
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] 10+ messages in thread

* Re: [PATCH 3/4] input: wacom - Add support for Bamboo Pen
  2010-09-10  3:02         ` Chris Bagwell
@ 2010-09-10  8:28           ` Ping Cheng
  0 siblings, 0 replies; 10+ messages in thread
From: Ping Cheng @ 2010-09-10  8:28 UTC (permalink / raw)
  To: Chris Bagwell; +Cc: Dmitry Torokhov, linux-input, pingc

On Friday, September 10, 2010, Chris Bagwell <chris@cnpbagwell.com> wrote:
> Ping would you be able to comment on question at end?
>
> On Thu, Sep 9, 2010 at 4:46 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> On Thu, Sep 09, 2010 at 04:34:35PM -0500, Chris Bagwell wrote:
>>> On Wed, Sep 8, 2010 at 11:14 PM, Dmitry Torokhov
>>> <dmitry.torokhov@gmail.com> wrote:
>>> > On Wed, Sep 08, 2010 at 11:02:31PM -0500, chris@cnpbagwell.com wrote:
>>> >> 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 |   75 ++++++++++++++++++++++++++++++++++++++
>>> >>  1 files changed, 75 insertions(+), 0 deletions(-)
>>> >>
>>> >> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
>>> >> index 2f7ed9a..9cc0cf0 100644
>>> >> --- a/drivers/input/tablet/wacom_wac.c
>>> >> +++ b/drivers/input/tablet/wacom_wac.c
>>> >> @@ -904,10 +904,71 @@ 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;
>>> >> +
>>> >> +     prox = (data[1] & 0x10) && (data[1] & 0x20);
>>> >
>>> >        prox = (data[1] & 0x30) == 0x30;
>>> >
>
> The 0x30 check would boil down to simplest safety check for unknown ID's.
>
> Ping, if you could confirm this I would be happy to document bit
> meaning in patch update.

I do not remember the detail of this protocol off the top of my head.
And I can not access it in the next 2 weeks. I feel Chris is right.
However, if reverse engineering does confirm your comments, you'll
have to wait.

Ping
--
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] 10+ messages in thread

end of thread, other threads:[~2010-09-10  8:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09  4:02 [PATCH 0/4] input: wacom - And Bamboo Pen Support chris
2010-09-09  4:02 ` [PATCH 1/4] input: wacom - Request tablet data for Bamboo Pens chris
2010-09-09  4:02 ` [PATCH 2/4] input: wacom - move Bamboo Touch irq to own function chris
2010-09-09  4:02 ` [PATCH 3/4] input: wacom - Add support for Bamboo Pen chris
2010-09-09  4:14   ` Dmitry Torokhov
2010-09-09 21:34     ` Chris Bagwell
2010-09-09 21:46       ` Dmitry Torokhov
2010-09-10  3:02         ` Chris Bagwell
2010-09-10  8:28           ` Ping Cheng
2010-09-09  4:02 ` [PATCH 4/4] input: wacom - disable Bamboo touchpad when pen is being used chris

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.