Skip to content

Possibly incorrect expectations on hid_get_feature_report #312

Open

Description

@jonasmalacofilho

When looking into libusb/hidapi#229, I noticed that the behavior of hid_get_feature_report when report IDs are not used is not as clear as I thought, and perhaps not even well defined.

This doesn't currently affect any of our drivers, but it's different than the expectations that are documented in HidapiDevice.get_feature_report (and asserted in test_gets_feature_report).

For now, let's just follow how this is resolved in hidapi, and proceed from there.

Additional information about the system:

  • Affected device: none at the moment
  • Operating system: undetermined
  • Liquidctl version: HEAD

Related: libusb/hidapi#229
Related: libusb/hidapi#232

Activity

  1. added
    bug
    low priority
    on Mar 31, 2021
  2. changed the title [-]Incorrect expecations on hid_get_feature_report[/-] [+]Incorrect expectations on hid_get_feature_report[/+] on Apr 6, 2021
  3. jonasmalacofilho commented on Jan 15, 2022

    @jonasmalacofilho
    MemberAuthor

    Actually, the bug appears to be in hidraw's documentation:

    • HIDIOCGFEATURE simply calls hidraw_get_report() 1
    • ... which calls hid_hw_raw_request() 2
    • ... which calls the low level driver's raw_request() 3
    • ... which, in the case of USB HIDs, calls usbhid_get_raw_report() 4
    • ... which ensures that byte 0 will be the report number (or zero) 5

    It is possible that other types of HIDs behave differently, but that would still mean a bug in the kernel (in that case, in the actual code, not just in the documentation).

    Leaving this open until I report (or maybe fix) it upstream.

    Footnotes

    1. https://github.com/torvalds/linux/blob/a33f5c380c4bd3fa5278d690421b72052456d9fe/drivers/hid/hidraw.c#L425-L429 ↩

    2. https://github.com/torvalds/linux/blob/a33f5c380c4bd3fa5278d690421b72052456d9fe/drivers/hid/hidraw.c#L228-L229 ↩

    3. https://github.com/torvalds/linux/blob/4aa1b8257fba5931511a7e152bcbbb3dd673c6c1/drivers/hid/hid-core.c#L2160-L2170 ↩

    4. https://github.com/torvalds/linux/blob/4aa1b8257fba5931511a7e152bcbbb3dd673c6c1/drivers/hid/usbhid/hid-core.c#L1286-L1298 ↩

    5. https://github.com/torvalds/linux/blob/4aa1b8257fba5931511a7e152bcbbb3dd673c6c1/drivers/hid/usbhid/hid-core.c#L869-L901 ↩

  4. removed
    bug
    low priority
    on Jan 15, 2022
  5. changed the title [-]Incorrect expectations on hid_get_feature_report[/-] [+]Possibly incorrect expectations on hid_get_feature_report[/+] on Jan 15, 2022
  6. added
    external
    linux
    on Feb 3, 2022
  7. removed their assignment
    on Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    externallinux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions