Re: [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 29, 2012 at 1:04 AM, Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> 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@xxxxxxxxxxxxxx>
>> Reviewed-by: Chris Bagwell <chris@xxxxxxxxxxxxxx>
>> Signed-off-by: Ping Cheng <pingc@xxxxxxxxx>
>> ---
>>
>> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux