lkml.org 
[lkml]   [2013]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 1/9] HID: core: add "report" hook, called once the report has been parsed
From
On Mon, Feb 4, 2013 at 10:34 AM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Sun, 3 Feb 2013, Henrik Rydberg wrote:
>
>> > This callback is called when the parsing of the report has been done
>> > by hid-core (so after the calls to .event). The hid drivers can now
>> > have access to the whole report by relying on the values stored in
>> > the different fields.
>> >
>> > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
>> > ---
>> > drivers/hid/hid-core.c | 4 ++++
>> > include/linux/hid.h | 2 ++
>> > 2 files changed, 6 insertions(+)
>> >
>> > diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
>> > index 5ae2cb1..b671e4e 100644
>> > --- a/drivers/hid/hid-core.c
>> > +++ b/drivers/hid/hid-core.c
>> > @@ -1195,6 +1195,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
>> > {
>> > struct hid_report_enum *report_enum = hid->report_enum + type;
>> > struct hid_report *report;
>> > + struct hid_driver *hdrv;
>> > unsigned int a;
>> > int rsize, csize = size;
>> > u8 *cdata = data;
>> > @@ -1231,6 +1232,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
>> > if (hid->claimed != HID_CLAIMED_HIDRAW) {
>> > for (a = 0; a < report->maxfield; a++)
>> > hid_input_field(hid, report->field[a], cdata, interrupt);
>> > + hdrv = hid->driver;
>> > + if (hdrv && hdrv->report)
>> > + hdrv->report(hid, report);
>>
>> I think this is more useful if called before the individual fields. In
>> fact, it seems raw_event() is already doing exactly that. No need for
>> a new callback, in other words.
>
> raw_event() doesn't provide equivalent functionality though; namely, the
> report is not parsed.
>
> Or have I missed your point?

No, you perfectly understood the purpose of the patch. raw_event() and
report() are not the same kind of callbacks at all.

>
> Thanks for the extensive review, Henrik, it's really helpful.

Yep, thanks Henrik, and thanks Jiri for having a look at it.

Cheers,
Benjamin


\
 
 \ /
  Last update: 2013-02-04 11:22    [W:0.078 / U:2.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site