Skip to content

Missing one byte feature report read under Windows for devices without report id #328

Closed

Description

@mcuee

Reference here:
#285

Now I start to question the commit 6fcb0bb which I proposed in #232 with regard to feature report. It seems to be correct when the report id is not zero. However, it seems to report one less byte when there is no report id. It seems to me for Windows, we may need to report one more byte for reading of feature report when the report id is zero.

Activity

  1. added
    Windows
    on Aug 30, 2021
  2. mcuee commented on Aug 30, 2021

    @mcuee
    MemberAuthor

    #285 (comment)

    Just tried hidapitester with hidapi-0.10.1 release and hidapi git head, with regard to input report, the result is the same since it is using hid_read_timeout(). So #232 does not matter in that case.
    https://github.com/todbot/hidapitester/blob/master/hidapitester.c#L379

    With regard to feature report, then the result will be different as it uses hid_get_feature_report(). So commit 6fcb0bb does matter for getting the feature report. In this particular case without report id (report id zero), it seems to me the commit is not correct.
    https://github.com/todbot/hidapitester/blob/master/hidapitester.c#L403

    $ ./hidapitester_release0101.exe --vidpid=0925:7001 --open --send-feature 0,0x40,0x41 --read-feature 0
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 0...read 3 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
    $ ./hidapitester_git4d63a50.exe --vidpid=0925:7001 --open --send-feature 0,0x40,0x41 --read-feature 0
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 0...read 2 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
  3. Youw commented on Sep 4, 2021

    @Youw
    Member

    Do you think we need to do the same as we do for macOS?

  4. mcuee commented on Sep 5, 2021

    @mcuee
    MemberAuthor

    Do you think we need to do the same as we do for macOS?

    Yes I think that will fix this issue.

  5. added
    bug
    on Sep 13, 2021
  6. Youw commented on Sep 22, 2021

    @Youw
    Member

    I think this one is worth fixing before releasing v0.11.0

  7. Youw commented on Sep 22, 2021

    @Youw
    Member

    After reading the documentation for IOCTL_HID_GET_INPUT_REPORT and IOCTL_HID_GET_FEATURE one more time, combined with your test results, I believe input_report is as broken as feature_report

  8. added 2 commits that reference this issue on Sep 22, 2021
    19e809e
    ad36065
  9. mcuee commented on Sep 23, 2021

    @mcuee
    MemberAuthor

    After reading the documentation for IOCTL_HID_GET_INPUT_REPORT and IOCTL_HID_GET_FEATURE one more time, combined with your test results, I believe input_report is as broken as feature_report

    Let me test out #334 over the weekend.

  10. mcuee commented on Sep 27, 2021

    @mcuee
    MemberAuthor

    Firstly for feature report for device without report ID.

    I think #334 is correct since it reports reading 3 bytes. Release 0.10.1 is actually correct but then 6fcb0bb introduced the regression. #334 fixes the issue in the current master.

    $ ./hidapitester_release0101.exe --vidpid=0925:7001 --open --send-feature 0,0x40,0x41 --read-feature 0
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 0...read 3 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
    $ ./hidapitester_hidapi_master.exe --vidpid=0925:7001 --open --send-feature 0,0x40,0x41 --read-feature 0
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 0...read 2 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
    $ ./hidapitester_hidapi_fix_feature.exe --vidpid=0925:7001 --open --send-feature 0,0x40,0x41 --read-feature 0
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 0...read 3 bytes:
     00 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
    
  11. mcuee commented on Sep 27, 2021

    @mcuee
    MemberAuthor

    Secondly for devices with report ID. No regression from the current master. Release 0.10.1 is not correct and it was fixed by 6fcb0bb .

    $ ./hidapitester_release0101.exe --vidpid=0925:7001 --open --send-feature 3,0x40,0x41 --read-feature 4
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     03 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 4...read 4 bytes:
     04 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
    $ ./hidapitester_hidapi_master.exe --vidpid=0925:7001 --open --send-feature 3,0x40,0x41 --read-feature 4
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     03 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 4...read 3 bytes:
     04 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
    $ ./hidapitester_hidapi_fix_feature.exe --vidpid=0925:7001 --open --send-feature 3,0x40,0x41 --read-feature 4
    Opening device, vid/pid: 0x0925/0x7001
    Writing 64-byte feature report...wrote 64 bytes:
     03 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Reading 64-byte feature report, report_id 4...read 3 bytes:
     04 40 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Closing device
    
    
  12. mcuee commented on Sep 27, 2021

    @mcuee
    MemberAuthor

    hdiapitester can not be used to test #334 though as it uses hid_read_timeout().
    #285 (comment)

  13. mcuee commented on Sep 27, 2021

    @mcuee
    MemberAuthor

    After reading the documentation for IOCTL_HID_GET_INPUT_REPORT and IOCTL_HID_GET_FEATURE one more time, combined with your test results, I believe input_report is as broken as feature_report

    Even though I can not use hidapitester to test the input report, but I agree with you after reading the documentation one more time.

    https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/hidclass/ni-hidclass-ioctl_hid_get_feature
    https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/hidclass/ni-hidclass-ioctl_hid_get_input_report

  14. added a commit that references this issue on Sep 27, 2021
    b923aed
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

    Windowsbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions