Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH 2/5] HID: hid-multitouch: get maxcontacts also from logical_max value

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


benjamin.tissoires at gmail

May 4, 2012, 5:53 AM

Post #1 of 6 (327 views)
Permalink
[PATCH 2/5] HID: hid-multitouch: get maxcontacts also from logical_max value

From: Benjamin Tissoires <benjamin.tissoires [at] enac>

Win8 devices are required to present the feature "Maximum Contact Number".
If the current value is 0, then, the driver can get the actual supported
contact count by seeing the logical_max.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires [at] enac>
---
drivers/hid/hid-multitouch.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index c6ffb05..e205d1e 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -265,6 +265,8 @@ static void mt_feature_mapping(struct hid_device *hdev,
case HID_DG_CONTACTMAX:
td->maxcontact_report_id = field->report->id;
td->maxcontacts = field->value[0];
+ if (!td->maxcontacts)
+ td->maxcontacts = field->logical_maximum;
if (td->mtclass.maxcontacts)
/* check if the maxcontacts is given by the class */
td->maxcontacts = td->mtclass.maxcontacts;
--
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


rydberg at euromail

May 6, 2012, 12:03 PM

Post #2 of 6 (314 views)
Permalink
Re: [PATCH 2/5] HID: hid-multitouch: get maxcontacts also from logical_max value [In reply to]

Hi,

> Win8 devices are required to present the feature "Maximum Contact Number".
> If the current value is 0, then, the driver can get the actual supported
> contact count by seeing the logical_max.

And for win7, it is zero?

>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires [at] enac>
> ---
> drivers/hid/hid-multitouch.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index c6ffb05..e205d1e 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -265,6 +265,8 @@ static void mt_feature_mapping(struct hid_device *hdev,
> case HID_DG_CONTACTMAX:
> td->maxcontact_report_id = field->report->id;
> td->maxcontacts = field->value[0];
> + if (!td->maxcontacts)
> + td->maxcontacts = field->logical_maximum;
> if (td->mtclass.maxcontacts)
> /* check if the maxcontacts is given by the class */
> td->maxcontacts = td->mtclass.maxcontacts;
> --
> 1.7.7.6
>

Thanks,
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


benjamin.tissoires at gmail

May 9, 2012, 12:13 PM

Post #3 of 6 (310 views)
Permalink
Re: [PATCH 2/5] HID: hid-multitouch: get maxcontacts also from logical_max value [In reply to]

On Sun, May 6, 2012 at 9:03 PM, Henrik Rydberg <rydberg [at] euromail> wrote:
> Hi,
>
>> Win8 devices are required to present the feature "Maximum Contact Number".
>> If the current value is 0, then, the driver can get the actual supported
>> contact count by seeing the logical_max.
>
> And for win7, it is zero?

Well, the truth is that the Win8 specification formally describes the
values here. And to get the certification, hardware makers have to put
the right value in logical_max.
TBH, I don't care that much now with win7 devices. Most of them are a
piece of crap (not true dual fingers, problems in hid reports
descriptors, etc...), but they just work (we made the necessary
things). With the introduction of Win8, hardware makers will have to
*certify* their devices, and thus, the Win8 driver is much less
tolerant. I really think that we are going to see more and more win8
devices, whereas win7 devices will fade out.

I had to add this patch because I have a win8 device that has the
value associated to this field at 0, and it's the first I saw with
this behavior.

Cheers,
Benjamin

>
>>
>> Signed-off-by: Benjamin Tissoires <benjamin.tissoires [at] enac>
>> ---
>>  drivers/hid/hid-multitouch.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
>> index c6ffb05..e205d1e 100644
>> --- a/drivers/hid/hid-multitouch.c
>> +++ b/drivers/hid/hid-multitouch.c
>> @@ -265,6 +265,8 @@ static void mt_feature_mapping(struct hid_device *hdev,
>>       case HID_DG_CONTACTMAX:
>>               td->maxcontact_report_id = field->report->id;
>>               td->maxcontacts = field->value[0];
>> +             if (!td->maxcontacts)
>> +                     td->maxcontacts = field->logical_maximum;
>>               if (td->mtclass.maxcontacts)
>>                       /* check if the maxcontacts is given by the class */
>>                       td->maxcontacts = td->mtclass.maxcontacts;
>> --
>> 1.7.7.6
>>
>
> Thanks,
> Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


rydberg at euromail

May 9, 2012, 12:46 PM

Post #4 of 6 (310 views)
Permalink
Re: [PATCH 2/5] HID: hid-multitouch: get maxcontacts also from logical_max value [In reply to]

Hi Benjamin,

> >> Win8 devices are required to present the feature "Maximum Contact Number".
> >> If the current value is 0, then, the driver can get the actual supported
> >> contact count by seeing the logical_max.
> >
> > And for win7, it is zero?
>
> Well, the truth is that the Win8 specification formally describes the
> values here. And to get the certification, hardware makers have to put
> the right value in logical_max.
> TBH, I don't care that much now with win7 devices. Most of them are a
> piece of crap (not true dual fingers, problems in hid reports
> descriptors, etc...), but they just work (we made the necessary
> things). With the introduction of Win8, hardware makers will have to
> *certify* their devices, and thus, the Win8 driver is much less
> tolerant. I really think that we are going to see more and more win8
> devices, whereas win7 devices will fade out.
>
> I had to add this patch because I have a win8 device that has the
> value associated to this field at 0, and it's the first I saw with
> this behavior.

As long as all existing devices are unaffected, it's fine, hence the question.

Thanks,
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


benjamin.tissoires at gmail

May 10, 2012, 5:15 AM

Post #5 of 6 (311 views)
Permalink
Re: [PATCH 2/5] HID: hid-multitouch: get maxcontacts also from logical_max value [In reply to]

On Wed, May 9, 2012 at 9:46 PM, Henrik Rydberg <rydberg [at] euromail> wrote:
> Hi Benjamin,
>
>> >> Win8 devices are required to present the feature "Maximum Contact Number".
>> >> If the current value is 0, then, the driver can get the actual supported
>> >> contact count by seeing the logical_max.
>> >
>> > And for win7, it is zero?
>>
>> Well, the truth is that the Win8 specification formally describes the
>> values here. And to get the certification, hardware makers have to put
>> the right value in logical_max.
>> TBH, I don't care that much now with win7 devices. Most of them are a
>> piece of crap (not true dual fingers, problems in hid reports
>> descriptors, etc...), but they just work (we made the necessary
>> things). With the introduction of Win8, hardware makers will have to
>> *certify* their devices, and thus, the Win8 driver is much less
>> tolerant. I really think that we are going to see more and more win8
>> devices, whereas win7 devices will fade out.
>>
>> I had to add this patch because I have a win8 device that has the
>> value associated to this field at 0, and it's the first I saw with
>> this behavior.
>
> As long as all existing devices are unaffected, it's fine, hence the question.

I checked all the reports descriptors that I have.
2 devices (one Stantum and one Irtouch) present an unrealistic
logical_max value (255). The thing is that if this logical_max is
false, and if the value is not provided, then I don't know how could I
retrieve the right value beside introducing a MT_CLS...

Henrik, do you think that 255 is two much for the slots?

Thanks,
Benjamin

>
> Thanks,
> Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


rydberg at euromail

May 10, 2012, 5:46 AM

Post #6 of 6 (308 views)
Permalink
Re: [PATCH 2/5] HID: hid-multitouch: get maxcontacts also from logical_max value [In reply to]

> > As long as all existing devices are unaffected, it's fine, hence the question.
>
> I checked all the reports descriptors that I have.
> 2 devices (one Stantum and one Irtouch) present an unrealistic
> logical_max value (255). The thing is that if this logical_max is
> false, and if the value is not provided, then I don't know how could I
> retrieve the right value beside introducing a MT_CLS...
>
> Henrik, do you think that 255 is two much for the slots?

It is large enough for us to start worrying about how we manage
memory, not to mention throughput. Since we do not really have devices
of that type yet, how about adding a MT_MAX_MAXCONTACT next to
MT_DEFAULT_MAXCONTACT, and use it as a sanity check, like so:

if (!td->maxcontacts && field->logical_maximum <= MT_MAX_MAXCONTACT)
td->maxcontacts = field->logical_maximum;

Then the default (10) would be picked for the suspect devices, just as
it is today.

Thanks,
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.