The documentation for the .raw_event() callback says that if the driver return 1, there will be no further processing of the event, but this is not true, the actual code in hid-core.c looks like this: if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { ret = hdrv->raw_event(hid, report, data, size); if (ret < 0) goto unlock; } ret = hid_report_raw_event(hid, type, data, size, interrupt); The only return value that has any effect on the processing is a negative error. Correct this as it seems to confuse people: I found bogus code in the Razer out-of-tree driver attempting to return 1 here.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -722,8 +722,8 @@ struct hid_usage_id { · 721 unmodified lines | |||
| 722 | * input will not be passed to raw_event unless hid_device_io_start is | 722 | * input will not be passed to raw_event unless hid_device_io_start is |
| 723 | * called. | 723 | * called. |
| 724 | * | 724 | * |
| 725 | * raw_event and event should return 0 on no action performed, 1 when no | 725 | * raw_event and event should return negative on error, any other value will |
| 726 | * further processing should be done and negative on error | 726 | * pass the event on to .event() typically return 0 for success. |
| 727 | * | 727 | * |
| 728 | * input_mapping shall return a negative value to completely ignore this usage | 728 | * input_mapping shall return a negative value to completely ignore this usage |
| 729 | * (e.g. doubled or invalid usage), zero to continue with parsing of this | 729 | * (e.g. doubled or invalid usage), zero to continue with parsing of this |