Thread (46 messages) 46 messages, 3 authors, 2012-11-06

Re: [PATCH v2 03/11] HID: hid-input: add usage_index argument in input_mapping and event.

From: Benjamin Tissoires <hidden>
Date: 2012-10-30 10:09:49
Also in: lkml

On Mon, Oct 29, 2012 at 8:25 PM, Henrik Rydberg [off-list ref] wrote:
Hi Benjamin,
quoted
Currently, there is no way to know the index of the current field
in the .input_mapping and .event callbacks  when this field is inside
an array of HID fields.
This patch forwards this index to the input_mapping and event
callbacks.
I agree with the idea, but the function argument list is becoming
ridiculously long... Could we remove the usage pointer argument, at
least?
yeah, totally agree. Let me just check whether it will not introduce
more problems than it solves for my driver.
        int (*event)(struct hid_device *hdev, struct hid_field *field,
                        unsigned int usage_index, __s32 value);

quoted
@@ -1071,19 +1072,24 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field,
      for (n = 0; n < count; n++) {

              if (HID_MAIN_ITEM_VARIABLE & field->flags) {
-                     hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
+                     hid_process_event(hid, field, &field->usage[n], n,
+                             value[n], interrupt);
                      continue;
              }

              if (field->value[n] >= min && field->value[n] <= max
                      && field->usage[field->value[n] - min].hid
                      && search(value, field->value[n], count))
-                             hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
+                             hid_process_event(hid, field,
+                                     &field->usage[field->value[n] - min], n,
+                                     0, interrupt);
Wrong index?
oops, I'll have to check that.

Thanks,
Benjamin
quoted
              if (value[n] >= min && value[n] <= max
                      && field->usage[value[n] - min].hid
                      && search(field->value, value[n], count))
-                             hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
+                             hid_process_event(hid, field,
+                                     &field->usage[value[n] - min], n,
+                                     1, interrupt);
Wrong index?
quoted
      }

      memcpy(field->value, value, count * sizeof(__s32));
Thanks,
Henrik
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help