Re: [RFC v2 01/10] hid: add feature_mapping callback

Benjamin Tissoires
2011-01-07T11:12:23Z

On Fri, Jan 7, 2011 at 11:18 AM, Henrik Rydberg <rydberg@euromail.se> wrote:
>> >>       struct input_dev *input_dev;
>> >>       int i, j, k;
>> >> -     int max_report_type = HID_OUTPUT_REPORT;
>> >> +     int max_report_type = HID_FEATURE_REPORT;
>> >
>> > Doing it this way conflicts with the HID_QUIRK_SKIP_OUTPUT_REPORTS quirk.
>>
>>
>> Do you agree on this way? (will send the patch in the next version)
>>
>> @@ -834,11 +842,10 @@ int hidinput_connect(struct hid_device *hid,
>> unsigned int force)
>>  {
>>       struct hid_report *report;
>>       struct hid_input *hidinput = NULL;
>>       struct input_dev *input_dev;
>>       int i, j, k;
>> -     int max_report_type = HID_OUTPUT_REPORT;
>>
>>       INIT_LIST_HEAD(&hid->inputs);
>>
>>       if (!force) {
>>               for (i = 0; i < hid->maxcollection; i++) {
>> @@ -851,14 +858,14 @@ int hidinput_connect(struct hid_device *hid,
>> unsigned int force)
>>
>>               if (i == hid->maxcollection)
>>                       return -1;
>>       }
>>
>> -     if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)
>> -             max_report_type = HID_INPUT_REPORT;
>> +     for (k = HID_INPUT_REPORT; k <= HID_FEATURE_REPORT; k++)
>> +             if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)
>> +                     continue;
>>
>> -     for (k = HID_INPUT_REPORT; k <= max_report_type; k++)
>>               list_for_each_entry(report, &hid->report_enum[k].report_list, list) {
>>
>>                       if (!report->maxfield)
>>                               continue;
>
> Perfect.

Well, in fact, I made 2 big mistakes (forgot the brackets after
for(;;), and test if k==HID_OUTPUT_REPORT...), but the idea is still
the same.

Sorry,
Benjamin