linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@enac.fr>
To: Henrik Rydberg <rydberg@euromail.se>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>, Stephane Chatty <chatty@enac.fr>,
	Mohamed Ikbel Boulabiar <boulabiar@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] HID: multitouch: add control of the feature "Maximum Contact Number"
Date: Tue, 24 Jan 2012 15:39:09 +0100	[thread overview]
Message-ID: <CAN+gG=ERwqDgydj-LLnv2GPLSiW8cC4QZS2f7shxxnNLzJY+xg@mail.gmail.com> (raw)
In-Reply-To: <20120120161956.GB18530@polaris.bitmath.org>

Hi Henrik,

On Fri, Jan 20, 2012 at 17:19, Henrik Rydberg <rydberg@euromail.se> wrote:
> Hi Benjamin,
>
>> If the programmer fills the field maxcontacts in the mt_class,
>> then the driver will set the feature to this value. It is safe
>> for current drivers as the feature is read/right in the HID norm
>
> read/write, I presume.

you're right... ;-)

>
>> @@ -609,6 +612,36 @@ static void mt_set_input_mode(struct hid_device *hdev)
>>       }
>>  }
>>
>> +static void mt_set_maxcontacts(struct hid_device *hdev)
>> +{
>> +     struct mt_device *td = hid_get_drvdata(hdev);
>> +     struct hid_report *r;
>> +     struct hid_report_enum *re;
>> +     int fieldmax, max;
>> +
>> +     if (td->maxcontact_report_id < 0)
>> +             return;
>> +
>> +     if (!td->mtclass.maxcontacts)
>> +             return;
>> +
>> +     re = &(hdev->report_enum[HID_FEATURE_REPORT]);
>
> Why parenthesis here?

ok

>
>> +     r = re->report_id_hash[td->maxcontact_report_id];
>> +     if (r) {
>> +             max = td->mtclass.maxcontacts;
>> +             fieldmax = r->field[0]->logical_maximum;
>> +             hid_info(hdev, "%s: value = %d / %d / %d\n", __func__,
>> +                     r->field[0]->value[0],
>> +                     td->mtclass.maxcontacts,
>> +                     fieldmax);
>
> Looks like debug information, please downplay or remove.

I can remove them if you need.

>
>> +             max = fieldmax < max ? fieldmax : max;
>
> There are kernel variants of min/max functions to consider here.

I'll look for them.

>
>> +             if (r->field[0]->value[0] != max) {
>> +                     r->field[0]->value[0] = max;
>> +                     usbhid_submit_report(hdev, r, USB_DIR_OUT);
>> +             }
>
> So the report is in fact only set when different... Do we know for
> which current devices this is true?

Currently, I've got only the Perixx touchpad that needs this feature
to be set. The initial value is 0 whereas it should be 2.

Maybe some drivers that used the DUAL_MT_CLS_* can handle more, but I
have no idea has I don't have many of them.

Cheers,
Benjamin

>
> Thanks,
> Henrik

  reply	other threads:[~2012-01-24 14:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 11:51 [PATCH v2 0/3] Support of Perixx Peripad 701 for hid-multitouch Benjamin Tissoires
2012-01-18 11:51 ` [PATCH v2 1/3] hid-multitouch: add support for trackpads Benjamin Tissoires
2012-01-20 16:09   ` Henrik Rydberg
2012-01-20 16:48     ` Dmitry Torokhov
2012-01-24 14:34       ` Benjamin Tissoires
2012-02-02  8:36         ` Jiri Kosina
2012-02-03 10:07           ` Benjamin Tissoires
2012-01-18 11:51 ` [PATCH v2 2/3] HID: multitouch: add control of the feature "Maximum Contact Number" Benjamin Tissoires
2012-01-20 16:19   ` Henrik Rydberg
2012-01-24 14:39     ` Benjamin Tissoires [this message]
2012-01-18 11:51 ` [PATCH v2 3/3] HID: multitouch: support Perixx PERIPAD 701 Benjamin Tissoires

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN+gG=ERwqDgydj-LLnv2GPLSiW8cC4QZS2f7shxxnNLzJY+xg@mail.gmail.com' \
    --to=benjamin.tissoires@enac.fr \
    --cc=boulabiar@gmail.com \
    --cc=chatty@enac.fr \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rydberg@euromail.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).