linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points
@ 2012-01-04 22:43 Ping Cheng
  2012-01-28  2:51 ` Chris Bagwell
  2012-01-29  7:04 ` Dmitry Torokhov
  0 siblings, 2 replies; 5+ messages in thread
From: Ping Cheng @ 2012-01-04 22:43 UTC (permalink / raw)
  To: linux-input; +Cc: Ping Cheng, Ping Cheng

>From the HID usage table when it is supported.

Tested-by: Chris Bagwell <chris@cnpbagwell.com>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
---

v2: updated with Chris' comments.

 drivers/input/tablet/wacom_sys.c |   31 ++++++++++++++++++++++++++++++-
 drivers/input/tablet/wacom_wac.c |   10 ++++------
 drivers/input/tablet/wacom_wac.h |    1 +
 3 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index c9588ee..f7fe091 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -28,6 +28,7 @@
 #define HID_USAGE_Y_TILT		0x3e
 #define HID_USAGE_FINGER		0x22
 #define HID_USAGE_STYLUS		0x20
+#define HID_USAGE_CONTACTMAX		0x55
 #define HID_COLLECTION			0xa1
 #define HID_COLLECTION_LOGICAL		0x02
 #define HID_COLLECTION_END		0xc0
@@ -191,11 +192,30 @@ static int wacom_parse_logical_collection(unsigned char *report,
 		features->x_max = features->y_max =
 			get_unaligned_le16(&report[10]);
 
+		features->touch_max = 16;
 		length = 11;
 	}
 	return length;
 }
 
+static void wacom_retrieve_report_data(struct usb_interface *intf,
+				       struct wacom_features *features)
+{
+	int result = 0;
+	unsigned char *rep_data;
+
+	rep_data = kmalloc(2, GFP_KERNEL);
+	if (!rep_data)
+		return;
+
+	rep_data[0] = 12;
+	result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
+		 rep_data[0], rep_data, 2, WAC_MSG_RETRIES);
+
+	if ((result >= 0) && (rep_data[1] > 2))
+		features->touch_max = rep_data[1];
+}
+
 /*
  * Interface Descriptor of wacom devices can be incomplete and
  * inconsistent so wacom_features table is used to store stylus
@@ -286,16 +306,19 @@ static int wacom_parse_hid(struct usb_interface *intf,
 						if (features->type == TABLETPC2FG) {
 							/* need to reset back */
 							features->pktlen = WACOM_PKGLEN_TPC2FG;
+							features->touch_max = 2;
 						}
 						if (features->type == BAMBOO_PT) {
 							/* need to reset back */
 							features->pktlen = WACOM_PKGLEN_BBTOUCH;
+							features->touch_max = 2;
 							features->x_phy =
 								get_unaligned_le16(&report[i + 5]);
 							features->x_max =
 								get_unaligned_le16(&report[i + 8]);
 							i += 15;
 						} else {
+							features->touch_max = 1;
 							features->x_max =
 								get_unaligned_le16(&report[i + 3]);
 							features->x_phy =
@@ -369,6 +392,11 @@ static int wacom_parse_hid(struct usb_interface *intf,
 				pen = 1;
 				i++;
 				break;
+
+			case HID_USAGE_CONTACTMAX:
+				wacom_retrieve_report_data(intf, features);
+				i++;
+				break;
 			}
 			break;
 
@@ -873,7 +901,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 
 	endpoint = &intf->cur_altsetting->endpoint[0].desc;
 
-	/* Retrieve the physical and logical size for OEM devices */
+	/* Retrieve the physical and logical size for touch devices */
+	features->touch_max = 0;
 	error = wacom_retrieve_hid_descriptor(intf, features);
 	if (error)
 		goto fail3;
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index e18f362..33a4359 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -830,7 +830,8 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
 {
 	char *data = wacom->data;
 
-	dbg("wacom_tpc_irq: received report #%d", data[0]);
+	dbg("wacom_tpc_irq: received report #%d with %d contacts",
+	     data[0], wacom->features.touch_max);
 
 	if (len == WACOM_PKGLEN_TPC1FG || data[0] == WACOM_REPORT_TPC1FG)
 		return wacom_tpc_single_touch(wacom, len);
@@ -1319,7 +1320,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
 	case TABLETPC2FG:
 		if (features->device_type == BTN_TOOL_FINGER) {
 
-			input_mt_init_slots(input_dev, 2);
+			input_mt_init_slots(input_dev, features->touch_max);
 			input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
 					0, MT_TOOL_MAX, 0, 0);
 			input_set_abs_params(input_dev, ABS_MT_POSITION_X,
@@ -1374,6 +1375,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
 
 			__set_bit(BTN_TOOL_FINGER, input_dev->keybit);
 			__set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
+			input_mt_init_slots(input_dev, features->touch_max);
 
 			if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
 				__set_bit(BTN_TOOL_TRIPLETAP,
@@ -1381,13 +1383,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
 				__set_bit(BTN_TOOL_QUADTAP,
 					  input_dev->keybit);
 
-				input_mt_init_slots(input_dev, 16);
-
 				input_set_abs_params(input_dev,
 						     ABS_MT_TOUCH_MAJOR,
 						     0, 255, 0, 0);
-			} else {
-				input_mt_init_slots(input_dev, 2);
 			}
 
 			input_set_abs_params(input_dev, ABS_MT_POSITION_X,
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 050acae..6ddd2e4 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -89,6 +89,7 @@ struct wacom_features {
 	int pressure_fuzz;
 	int distance_fuzz;
 	unsigned quirks;
+	unsigned touch_max;
 };
 
 struct wacom_shared {
-- 
1.7.6.4


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

* Re: [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points
  2012-01-04 22:43 [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points Ping Cheng
@ 2012-01-28  2:51 ` Chris Bagwell
  2012-01-29  7:04 ` Dmitry Torokhov
  1 sibling, 0 replies; 5+ messages in thread
From: Chris Bagwell @ 2012-01-28  2:51 UTC (permalink / raw)
  To: Ping Cheng, Dmitry Torokhov; +Cc: linux-input, Ping Cheng

On Wed, Jan 4, 2012 at 4:43 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> From the HID usage table when it is supported.
>
> Tested-by: Chris Bagwell <chris@cnpbagwell.com>
> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>

Hi Dmitry,

Any ack/naks on this patch series from Ping?  I'm asking because of
patch 1/4 (I must have deleted that email so I'm reply to 2/4) because
it makes a change that all new Wacom touch drivers need to align with.

I have a patch for Wireless Bamboo support to submit and my patch
looks slightly different depending on if it comes before or after that
patch.

Thanks,
Chris

> ---
>
> v2: updated with Chris' comments.
>
>  drivers/input/tablet/wacom_sys.c |   31 ++++++++++++++++++++++++++++++-
>  drivers/input/tablet/wacom_wac.c |   10 ++++------
>  drivers/input/tablet/wacom_wac.h |    1 +
>  3 files changed, 35 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index c9588ee..f7fe091 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -28,6 +28,7 @@
>  #define HID_USAGE_Y_TILT               0x3e
>  #define HID_USAGE_FINGER               0x22
>  #define HID_USAGE_STYLUS               0x20
> +#define HID_USAGE_CONTACTMAX           0x55
>  #define HID_COLLECTION                 0xa1
>  #define HID_COLLECTION_LOGICAL         0x02
>  #define HID_COLLECTION_END             0xc0
> @@ -191,11 +192,30 @@ static int wacom_parse_logical_collection(unsigned char *report,
>                features->x_max = features->y_max =
>                        get_unaligned_le16(&report[10]);
>
> +               features->touch_max = 16;
>                length = 11;
>        }
>        return length;
>  }
>
> +static void wacom_retrieve_report_data(struct usb_interface *intf,
> +                                      struct wacom_features *features)
> +{
> +       int result = 0;
> +       unsigned char *rep_data;
> +
> +       rep_data = kmalloc(2, GFP_KERNEL);
> +       if (!rep_data)
> +               return;
> +
> +       rep_data[0] = 12;
> +       result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
> +                rep_data[0], rep_data, 2, WAC_MSG_RETRIES);
> +
> +       if ((result >= 0) && (rep_data[1] > 2))
> +               features->touch_max = rep_data[1];
> +}
> +
>  /*
>  * Interface Descriptor of wacom devices can be incomplete and
>  * inconsistent so wacom_features table is used to store stylus
> @@ -286,16 +306,19 @@ static int wacom_parse_hid(struct usb_interface *intf,
>                                                if (features->type == TABLETPC2FG) {
>                                                        /* need to reset back */
>                                                        features->pktlen = WACOM_PKGLEN_TPC2FG;
> +                                                       features->touch_max = 2;
>                                                }
>                                                if (features->type == BAMBOO_PT) {
>                                                        /* need to reset back */
>                                                        features->pktlen = WACOM_PKGLEN_BBTOUCH;
> +                                                       features->touch_max = 2;
>                                                        features->x_phy =
>                                                                get_unaligned_le16(&report[i + 5]);
>                                                        features->x_max =
>                                                                get_unaligned_le16(&report[i + 8]);
>                                                        i += 15;
>                                                } else {
> +                                                       features->touch_max = 1;
>                                                        features->x_max =
>                                                                get_unaligned_le16(&report[i + 3]);
>                                                        features->x_phy =
> @@ -369,6 +392,11 @@ static int wacom_parse_hid(struct usb_interface *intf,
>                                pen = 1;
>                                i++;
>                                break;
> +
> +                       case HID_USAGE_CONTACTMAX:
> +                               wacom_retrieve_report_data(intf, features);
> +                               i++;
> +                               break;
>                        }
>                        break;
>
> @@ -873,7 +901,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>
>        endpoint = &intf->cur_altsetting->endpoint[0].desc;
>
> -       /* Retrieve the physical and logical size for OEM devices */
> +       /* Retrieve the physical and logical size for touch devices */
> +       features->touch_max = 0;
>        error = wacom_retrieve_hid_descriptor(intf, features);
>        if (error)
>                goto fail3;
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index e18f362..33a4359 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -830,7 +830,8 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
>  {
>        char *data = wacom->data;
>
> -       dbg("wacom_tpc_irq: received report #%d", data[0]);
> +       dbg("wacom_tpc_irq: received report #%d with %d contacts",
> +            data[0], wacom->features.touch_max);
>
>        if (len == WACOM_PKGLEN_TPC1FG || data[0] == WACOM_REPORT_TPC1FG)
>                return wacom_tpc_single_touch(wacom, len);
> @@ -1319,7 +1320,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
>        case TABLETPC2FG:
>                if (features->device_type == BTN_TOOL_FINGER) {
>
> -                       input_mt_init_slots(input_dev, 2);
> +                       input_mt_init_slots(input_dev, features->touch_max);
>                        input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
>                                        0, MT_TOOL_MAX, 0, 0);
>                        input_set_abs_params(input_dev, ABS_MT_POSITION_X,
> @@ -1374,6 +1375,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
>
>                        __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
>                        __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
> +                       input_mt_init_slots(input_dev, features->touch_max);
>
>                        if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
>                                __set_bit(BTN_TOOL_TRIPLETAP,
> @@ -1381,13 +1383,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
>                                __set_bit(BTN_TOOL_QUADTAP,
>                                          input_dev->keybit);
>
> -                               input_mt_init_slots(input_dev, 16);
> -
>                                input_set_abs_params(input_dev,
>                                                     ABS_MT_TOUCH_MAJOR,
>                                                     0, 255, 0, 0);
> -                       } else {
> -                               input_mt_init_slots(input_dev, 2);
>                        }
>
>                        input_set_abs_params(input_dev, ABS_MT_POSITION_X,
> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
> index 050acae..6ddd2e4 100644
> --- a/drivers/input/tablet/wacom_wac.h
> +++ b/drivers/input/tablet/wacom_wac.h
> @@ -89,6 +89,7 @@ struct wacom_features {
>        int pressure_fuzz;
>        int distance_fuzz;
>        unsigned quirks;
> +       unsigned touch_max;
>  };
>
>  struct wacom_shared {
> --
> 1.7.6.4
>
> --
> 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] 5+ messages in thread

* Re: [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points
  2012-01-04 22:43 [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points Ping Cheng
  2012-01-28  2:51 ` Chris Bagwell
@ 2012-01-29  7:04 ` Dmitry Torokhov
  2012-01-31  2:08   ` Chris Bagwell
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2012-01-29  7:04 UTC (permalink / raw)
  To: Ping Cheng; +Cc: linux-input, Ping Cheng

On Wed, Jan 04, 2012 at 02:43:52PM -0800, Ping Cheng wrote:
> From the HID usage table when it is supported.
> 
> Tested-by: Chris Bagwell <chris@cnpbagwell.com>
> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
> 
> v2: updated with Chris' comments.
> 
>  drivers/input/tablet/wacom_sys.c |   31 ++++++++++++++++++++++++++++++-
>  drivers/input/tablet/wacom_wac.c |   10 ++++------
>  drivers/input/tablet/wacom_wac.h |    1 +
>  3 files changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index c9588ee..f7fe091 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -28,6 +28,7 @@
>  #define HID_USAGE_Y_TILT		0x3e
>  #define HID_USAGE_FINGER		0x22
>  #define HID_USAGE_STYLUS		0x20
> +#define HID_USAGE_CONTACTMAX		0x55
>  #define HID_COLLECTION			0xa1
>  #define HID_COLLECTION_LOGICAL		0x02
>  #define HID_COLLECTION_END		0xc0
> @@ -191,11 +192,30 @@ static int wacom_parse_logical_collection(unsigned char *report,
>  		features->x_max = features->y_max =
>  			get_unaligned_le16(&report[10]);
>  
> +		features->touch_max = 16;
>  		length = 11;
>  	}
>  	return length;
>  }
>  
> +static void wacom_retrieve_report_data(struct usb_interface *intf,
> +				       struct wacom_features *features)
> +{
> +	int result = 0;
> +	unsigned char *rep_data;
> +
> +	rep_data = kmalloc(2, GFP_KERNEL);
> +	if (!rep_data)
> +		return;
> +
> +	rep_data[0] = 12;
> +	result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
> +		 rep_data[0], rep_data, 2, WAC_MSG_RETRIES);
> +
> +	if ((result >= 0) && (rep_data[1] > 2))
> +		features->touch_max = rep_data[1];
> +}
> +
>  /*
>   * Interface Descriptor of wacom devices can be incomplete and
>   * inconsistent so wacom_features table is used to store stylus
> @@ -286,16 +306,19 @@ static int wacom_parse_hid(struct usb_interface *intf,
>  						if (features->type == TABLETPC2FG) {
>  							/* need to reset back */
>  							features->pktlen = WACOM_PKGLEN_TPC2FG;
> +							features->touch_max = 2;

Why do we set it dynamically for devices where number of contacts is
constant? Or, even if it is not constant, we could seed it in the
features that we set in driver_info and only adjust when we encounter
HID_USAGE_CONTACTMAX?

Thanks.

-- 
Dmitry

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

* Re: [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points
  2012-01-29  7:04 ` Dmitry Torokhov
@ 2012-01-31  2:08   ` Chris Bagwell
  2012-01-31  8:23     ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Bagwell @ 2012-01-31  2:08 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Ping Cheng, linux-input, Ping Cheng

On Sun, Jan 29, 2012 at 1:04 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Jan 04, 2012 at 02:43:52PM -0800, Ping Cheng wrote:
>> From the HID usage table when it is supported.
>>
>> Tested-by: Chris Bagwell <chris@cnpbagwell.com>
>> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
>> Signed-off-by: Ping Cheng <pingc@wacom.com>
>> ---
>>
>> v2: updated with Chris' comments.
>>
>>  drivers/input/tablet/wacom_sys.c |   31 ++++++++++++++++++++++++++++++-
>>  drivers/input/tablet/wacom_wac.c |   10 ++++------
>>  drivers/input/tablet/wacom_wac.h |    1 +
>>  3 files changed, 35 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
>> index c9588ee..f7fe091 100644
>> --- a/drivers/input/tablet/wacom_sys.c
>> +++ b/drivers/input/tablet/wacom_sys.c
>> @@ -28,6 +28,7 @@
>>  #define HID_USAGE_Y_TILT             0x3e
>>  #define HID_USAGE_FINGER             0x22
>>  #define HID_USAGE_STYLUS             0x20
>> +#define HID_USAGE_CONTACTMAX         0x55
>>  #define HID_COLLECTION                       0xa1
>>  #define HID_COLLECTION_LOGICAL               0x02
>>  #define HID_COLLECTION_END           0xc0
>> @@ -191,11 +192,30 @@ static int wacom_parse_logical_collection(unsigned char *report,
>>               features->x_max = features->y_max =
>>                       get_unaligned_le16(&report[10]);
>>
>> +             features->touch_max = 16;
>>               length = 11;
>>       }
>>       return length;
>>  }
>>
>> +static void wacom_retrieve_report_data(struct usb_interface *intf,
>> +                                    struct wacom_features *features)
>> +{
>> +     int result = 0;
>> +     unsigned char *rep_data;
>> +
>> +     rep_data = kmalloc(2, GFP_KERNEL);
>> +     if (!rep_data)
>> +             return;
>> +
>> +     rep_data[0] = 12;
>> +     result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
>> +              rep_data[0], rep_data, 2, WAC_MSG_RETRIES);
>> +
>> +     if ((result >= 0) && (rep_data[1] > 2))
>> +             features->touch_max = rep_data[1];
>> +}
>> +
>>  /*
>>   * Interface Descriptor of wacom devices can be incomplete and
>>   * inconsistent so wacom_features table is used to store stylus
>> @@ -286,16 +306,19 @@ static int wacom_parse_hid(struct usb_interface *intf,
>>                                               if (features->type == TABLETPC2FG) {
>>                                                       /* need to reset back */
>>                                                       features->pktlen = WACOM_PKGLEN_TPC2FG;
>> +                                                     features->touch_max = 2;
>
> Why do we set it dynamically for devices where number of contacts is
> constant? Or, even if it is not constant, we could seed it in the
> features that we set in driver_info and only adjust when we encounter
> HID_USAGE_CONTACTMAX?
>
> Thanks.
>

Since Ping will not be able to respond to this for a while, I will see
if I can address your comments.

It is true for other devices its fixed to 1, 2, or 16 touches and we
can seed that with features I believe (just need to make sure the seed
is ignored for stylus interface).  I'll flush that out and resend
updated patch.

Do you still have a copy of PATCH 1/4 and have any comments?  I can
take up any comments on it at same time.  I somehow deleted it but
here is googled version:
http://comments.gmane.org/gmane.linux.kernel.input/23163

I could probably address minor comments on 3 and 4 if needed as well.

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

* Re: [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points
  2012-01-31  2:08   ` Chris Bagwell
@ 2012-01-31  8:23     ` Dmitry Torokhov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2012-01-31  8:23 UTC (permalink / raw)
  To: Chris Bagwell; +Cc: Ping Cheng, linux-input, Ping Cheng

On Mon, Jan 30, 2012 at 08:08:28PM -0600, Chris Bagwell wrote:
> On Sun, Jan 29, 2012 at 1:04 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Wed, Jan 04, 2012 at 02:43:52PM -0800, Ping Cheng wrote:
> >> From the HID usage table when it is supported.
> >>
> >> Tested-by: Chris Bagwell <chris@cnpbagwell.com>
> >> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
> >> Signed-off-by: Ping Cheng <pingc@wacom.com>
> >> ---
> >>
> >> v2: updated with Chris' comments.
> >>
> >>  drivers/input/tablet/wacom_sys.c |   31 ++++++++++++++++++++++++++++++-
> >>  drivers/input/tablet/wacom_wac.c |   10 ++++------
> >>  drivers/input/tablet/wacom_wac.h |    1 +
> >>  3 files changed, 35 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> >> index c9588ee..f7fe091 100644
> >> --- a/drivers/input/tablet/wacom_sys.c
> >> +++ b/drivers/input/tablet/wacom_sys.c
> >> @@ -28,6 +28,7 @@
> >>  #define HID_USAGE_Y_TILT             0x3e
> >>  #define HID_USAGE_FINGER             0x22
> >>  #define HID_USAGE_STYLUS             0x20
> >> +#define HID_USAGE_CONTACTMAX         0x55
> >>  #define HID_COLLECTION                       0xa1
> >>  #define HID_COLLECTION_LOGICAL               0x02
> >>  #define HID_COLLECTION_END           0xc0
> >> @@ -191,11 +192,30 @@ static int wacom_parse_logical_collection(unsigned char *report,
> >>               features->x_max = features->y_max =
> >>                       get_unaligned_le16(&report[10]);
> >>
> >> +             features->touch_max = 16;
> >>               length = 11;
> >>       }
> >>       return length;
> >>  }
> >>
> >> +static void wacom_retrieve_report_data(struct usb_interface *intf,
> >> +                                    struct wacom_features *features)
> >> +{
> >> +     int result = 0;
> >> +     unsigned char *rep_data;
> >> +
> >> +     rep_data = kmalloc(2, GFP_KERNEL);
> >> +     if (!rep_data)
> >> +             return;
> >> +
> >> +     rep_data[0] = 12;
> >> +     result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
> >> +              rep_data[0], rep_data, 2, WAC_MSG_RETRIES);
> >> +
> >> +     if ((result >= 0) && (rep_data[1] > 2))
> >> +             features->touch_max = rep_data[1];
> >> +}
> >> +
> >>  /*
> >>   * Interface Descriptor of wacom devices can be incomplete and
> >>   * inconsistent so wacom_features table is used to store stylus
> >> @@ -286,16 +306,19 @@ static int wacom_parse_hid(struct usb_interface *intf,
> >>                                               if (features->type == TABLETPC2FG) {
> >>                                                       /* need to reset back */
> >>                                                       features->pktlen = WACOM_PKGLEN_TPC2FG;
> >> +                                                     features->touch_max = 2;
> >
> > Why do we set it dynamically for devices where number of contacts is
> > constant? Or, even if it is not constant, we could seed it in the
> > features that we set in driver_info and only adjust when we encounter
> > HID_USAGE_CONTACTMAX?
> >
> > Thanks.
> >
> 
> Since Ping will not be able to respond to this for a while, I will see
> if I can address your comments.
> 
> It is true for other devices its fixed to 1, 2, or 16 touches and we
> can seed that with features I believe (just need to make sure the seed
> is ignored for stylus interface).  I'll flush that out and resend
> updated patch.
> 
> Do you still have a copy of PATCH 1/4 and have any comments?  I can
> take up any comments on it at same time.  I somehow deleted it but
> here is googled version:
> http://comments.gmane.org/gmane.linux.kernel.input/23163
> 
> I could probably address minor comments on 3 and 4 if needed as well.
> 

Chris,

I have applied patches 1 and 3; 4 had some dependencies on 2 so I am
holding off for now.

Thanks.

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

end of thread, other threads:[~2012-01-31  8:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04 22:43 [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points Ping Cheng
2012-01-28  2:51 ` Chris Bagwell
2012-01-29  7:04 ` Dmitry Torokhov
2012-01-31  2:08   ` Chris Bagwell
2012-01-31  8:23     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).