RFC: to include hidapitester as it is a very useful tool for debugging #285

Closed
opened 2021-06-15 09:12:12 -05:00 by mcuee · 29 comments
mcuee commented 2021-06-15 09:12:12 -05:00 (Migrated from github.com)

hidtest is using a test device based on modified Microchip Simple HID demo. It can be kept as an example but not that useful as a test tool for the project.

hidapitester is an excellent tool for testing of HID devices and HIDAPI. It will be good to include it in HIDAPI.
https://github.com/todbot/hidapitester

hidtest is using a test device based on modified Microchip Simple HID demo. It can be kept as an example but not that useful as a test tool for the project. hidapitester is an excellent tool for testing of HID devices and HIDAPI. It will be good to include it in HIDAPI. https://github.com/todbot/hidapitester
mcuee commented 2021-06-15 09:13:59 -05:00 (Migrated from github.com)

Only issue to include hidapitester is probably the GPL 3 license, which may or may not be a problem. I do not see it as a problem. But if some people see it as a problem, we can ask @todbot to see if he is willing to change the license.

Only issue to include hidapitester is probably the GPL 3 license, which may or may not be a problem. I do not see it as a problem. But if some people see it as a problem, we can ask @todbot to see if he is willing to change the license.
mcuee commented 2021-06-15 20:54:30 -05:00 (Migrated from github.com)

@todbot How do you like the idea of including hidapitester in HIDAPI project?

@todbot How do you like the idea of including hidapitester in HIDAPI project?
todbot commented 2021-06-15 23:28:15 -05:00 (Migrated from github.com)

Sounds great to me

Sounds great to me
todbot commented 2021-06-15 23:28:37 -05:00 (Migrated from github.com)

I can change the license to whatever is most useful

I can change the license to whatever is most useful
mcuee commented 2021-06-15 23:58:31 -05:00 (Migrated from github.com)

HIDAPI license:
https://github.com/libusb/hidapi/blob/master/LICENSE.txt

hidapitester is already licensed under GPL3, just need to add the other two licenses.

HIDAPI license: https://github.com/libusb/hidapi/blob/master/LICENSE.txt hidapitester is already licensed under GPL3, just need to add the other two licenses.
mcuee commented 2021-06-17 02:19:35 -05:00 (Migrated from github.com)

Just FYI on the original hidtest, it is based on Microchip Demo FW (part of Microchip USB Stack) but I do not know if Alan Ott published the modified FW or not.

With the original FW (04d8:003f), here is the output.

Device Found
  type: 04d8 003f
  path: \\?\hid#vid_04d8&pid_003f#e&24ba9f4d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    -1
  Usage (page): 0x1 (0xff00)

Manufacturer String: Microchip Technology Inc.
Product String: Simple HID Device Demo
Unable to read serial number string
Serial Number String: (0)
Indexed String 1: Microchip Technology Inc.
Unable to send a feature report.
Unable to get a feature report.
Incorrect function.waiting...
Data read:
   81 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Press any key to continue . . .
Just FYI on the original hidtest, it is based on Microchip Demo FW (part of Microchip USB Stack) but I do not know if Alan Ott published the modified FW or not. With the original FW (04d8:003f), here is the output. ``` Device Found type: 04d8 003f path: \\?\hid#vid_04d8&pid_003f#e&24ba9f4d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: -1 Usage (page): 0x1 (0xff00) Manufacturer String: Microchip Technology Inc. Product String: Simple HID Device Demo Unable to read serial number string Serial Number String: (0) Indexed String 1: Microchip Technology Inc. Unable to send a feature report. Unable to get a feature report. Incorrect function.waiting... Data read: 81 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Press any key to continue . . . ```
mcuee commented 2021-07-23 20:33:21 -05:00 (Migrated from github.com)

With the enhancement for hidtest, it is of course worth to keep it now. But still I think hidapitester is a worthy add-on for the hidapi project as it is useful for different type of HID devices.

With the enhancement for hidtest, it is of course worth to keep it now. But still I think hidapitester is a worthy add-on for the hidapi project as it is useful for different type of HID devices.
mcuee commented 2021-08-27 01:27:27 -05:00 (Migrated from github.com)

Example run log of hidapitester with a modified Lakeview Research Generic HID example.
FW: https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod

Device: input report ID 1, output report ID 2, feature in report id 3 and feature output report id 4.

From the run log, it seems that my FW sent an extra byte for the Feature IN report. But I need to check again under different OS.

$ ./hidapitester --vidpid 0925 --list-detail
0925/7001: Lakeview Research - Generic HID
  vendorId:      0x0925
  productId:     0x7001
  usagePage:     0xFF00
  usage:         0x0001
  serial_number: (null)
  interface:     -1
  path: \\?\hid#vid_0925&pid_7001#6&461d29f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

$ ./hidapitester --vidpid 0925:7001  -l 3 --open --send-output 2,2,3 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 02 03
Reading 3-byte input report 0, 250 msec timeout...read 3 bytes:
 01 02 03
Closing device

$ ./hidapitester --vidpid 0925:7001  -l 4 --open --send-output 2,2,3,4 --read-input 1
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 4-bytes...wrote 3 bytes:
 02 02 03 04
Reading 4-byte input report 0, 250 msec timeout...read 3 bytes:
 01 02 03 00
Closing device

$ ./hidapitester --vidpid 0925:7001  -l 3 --open --send-feature 3,4,5 --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 3-byte feature report...wrote 3 bytes:
 03 04 05
Reading 3-byte feature report, report_id 4...read 4 bytes:
 04 04 05
Closing device

$ ./hidapitester --vidpid 0925:7001  -l 4 --open --send-feature 3,4,5,6 --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 4-byte feature report...wrote 4 bytes:
 03 04 05 06
Reading 4-byte feature report, report_id 4...read 4 bytes:
 04 04 05 00
Closing device

With the libusb test code, here is the output. Take note I purposefully send one more byte.

$ ./libusb1_lvrhid8.exe
Successfully find the LVR Generic HID device
Successfully set usb configuration 1
Successfully claimed MYINTERFACE
Testing control transfer using loop back test of feature report
03, 04; 21, 21; 22, 22; 23, 00;
Testing control transfer using loop back test of input/output report
02, 01; 31, 31; 32, 32; 33, 00;
Testing interrupt transfer using loop back test of input/output report
02, 01; 41, 41; 42, 42; 43, 00;
Example run log of hidapitester with a modified Lakeview Research Generic HID example. FW: https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod Device: input report ID 1, output report ID 2, feature in report id 3 and feature output report id 4. From the run log, it seems that my FW sent an extra byte for the Feature IN report. But I need to check again under different OS. ``` $ ./hidapitester --vidpid 0925 --list-detail 0925/7001: Lakeview Research - Generic HID vendorId: 0x0925 productId: 0x7001 usagePage: 0xFF00 usage: 0x0001 serial_number: (null) interface: -1 path: \\?\hid#vid_0925&pid_7001#6&461d29f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} $ ./hidapitester --vidpid 0925:7001 -l 3 --open --send-output 2,2,3 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 02 02 03 Reading 3-byte input report 0, 250 msec timeout...read 3 bytes: 01 02 03 Closing device $ ./hidapitester --vidpid 0925:7001 -l 4 --open --send-output 2,2,3,4 --read-input 1 Opening device, vid/pid: 0x0925/0x7001 Writing output report of 4-bytes...wrote 3 bytes: 02 02 03 04 Reading 4-byte input report 0, 250 msec timeout...read 3 bytes: 01 02 03 00 Closing device $ ./hidapitester --vidpid 0925:7001 -l 3 --open --send-feature 3,4,5 --read-feature 4 Opening device, vid/pid: 0x0925/0x7001 Writing 3-byte feature report...wrote 3 bytes: 03 04 05 Reading 3-byte feature report, report_id 4...read 4 bytes: 04 04 05 Closing device $ ./hidapitester --vidpid 0925:7001 -l 4 --open --send-feature 3,4,5,6 --read-feature 4 Opening device, vid/pid: 0x0925/0x7001 Writing 4-byte feature report...wrote 4 bytes: 03 04 05 06 Reading 4-byte feature report, report_id 4...read 4 bytes: 04 04 05 00 Closing device ``` With the libusb test code, here is the output. Take note I purposefully send one more byte. ``` $ ./libusb1_lvrhid8.exe Successfully find the LVR Generic HID device Successfully set usb configuration 1 Successfully claimed MYINTERFACE Testing control transfer using loop back test of feature report 03, 04; 21, 21; 22, 22; 23, 00; Testing control transfer using loop back test of input/output report 02, 01; 31, 31; 32, 32; 33, 00; Testing interrupt transfer using loop back test of input/output report 02, 01; 41, 41; 42, 42; 43, 00; ```
mcuee commented 2021-08-27 02:37:51 -05:00 (Migrated from github.com)

HIDAPI Test GUI seems to say the FW is correct.
hidapi_testgui

HIDAPI Test GUI seems to say the FW is correct. ![hidapi_testgui](https://user-images.githubusercontent.com/1294740/131090842-f43746be-6a5a-411d-90e7-756194a93f87.png)
mcuee commented 2021-08-27 06:38:21 -05:00 (Migrated from github.com)

Test under Linux (Raspberry Pi 400), hidapitester performs fine (tested with the hidraw backend).

hidapitester on  master ❯ make
gcc -I ../hidapi/hidapi -c ../hidapi/linux/hid.c -o ../hidapi/linux/hid.o
gcc -I ../hidapi/hidapi -c hidapitester.c -o hidapitester.o
gcc -I ../hidapi/hidapi ../hidapi/linux/hid.o hidapitester.o -o hidapitester `pkg-config libudev --libs`
hidapitester on  master ❯  ./hidapitester --vidpid 0925 --list-detail 
0925/7001: Lakeview Research - Generic HID
  vendorId:      0x0925
  productId:     0x7001
  usagePage:     0xFF00
  usage:         0x0001
  serial_number:  
  interface:     0 
  path: /dev/hidraw6

hidapitester on  master ❯ sudo ./hidapitester --vidpid 0925:7001  -l 3 --open --send-output 2,2,3 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 02 03
Reading 3-byte input report 0, 250 msec timeout...read 3 bytes:
 01 02 03
Closing device

hidapitester on  master ❯ sudo ./hidapitester --vidpid 0925:7001  -l 3 --open --send-feature 3,4,5 --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 3-byte feature report...wrote 3 bytes:
 03 04 05
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 04 05
Closing device
Test under Linux (Raspberry Pi 400), hidapitester performs fine (tested with the hidraw backend). ``` hidapitester on  master ❯ make gcc -I ../hidapi/hidapi -c ../hidapi/linux/hid.c -o ../hidapi/linux/hid.o gcc -I ../hidapi/hidapi -c hidapitester.c -o hidapitester.o gcc -I ../hidapi/hidapi ../hidapi/linux/hid.o hidapitester.o -o hidapitester `pkg-config libudev --libs` hidapitester on  master ❯ ./hidapitester --vidpid 0925 --list-detail 0925/7001: Lakeview Research - Generic HID vendorId: 0x0925 productId: 0x7001 usagePage: 0xFF00 usage: 0x0001 serial_number: interface: 0 path: /dev/hidraw6 hidapitester on  master ❯ sudo ./hidapitester --vidpid 0925:7001 -l 3 --open --send-output 2,2,3 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 02 02 03 Reading 3-byte input report 0, 250 msec timeout...read 3 bytes: 01 02 03 Closing device hidapitester on  master ❯ sudo ./hidapitester --vidpid 0925:7001 -l 3 --open --send-feature 3,4,5 --read-feature 4 Opening device, vid/pid: 0x0925/0x7001 Writing 3-byte feature report...wrote 3 bytes: 03 04 05 Reading 3-byte feature report, report_id 4...read 3 bytes: 04 04 05 Closing device ```
mcuee commented 2021-08-27 06:40:17 -05:00 (Migrated from github.com)

@todbot It seems to me that hidapitester report reading of one more bytes for the Feature report under Windows. Not so sure if this is a problem with hidapitester or hidapi under Windows. If it is related to hidapi under Windows, the test gui seems to be correct. That is strange.

@todbot It seems to me that hidapitester report reading of one more bytes for the Feature report under Windows. Not so sure if this is a problem with hidapitester or hidapi under Windows. If it is related to hidapi under Windows, the test gui seems to be correct. That is strange.
todbot commented 2021-08-27 16:40:33 -05:00 (Migrated from github.com)

hidapitester is using hidapi directly, and not doing anything platform-specific. If there's a byte miscount, I think it's either in the testgui or the build of hidapitester you're using uses a hidapi with off-by-one errors (this used to exist in hidapi for certain situations, I forget the details at the moment)

hidapitester is using hidapi directly, and not doing anything platform-specific. If there's a byte miscount, I think it's either in the testgui or the build of hidapitester you're using uses a hidapi with off-by-one errors (this used to exist in hidapi for certain situations, I forget the details at the moment)
mcuee commented 2021-08-27 20:03:31 -05:00 (Migrated from github.com)

The thing is that I am using the same version of hidapi here, the latest git. Test GUI is also from the latest git.

Supposedly the off-by-one has been fixed.
https://github.com/libusb/hidapi/pull/232 : for input report
github.com/libusb/hidapi@6fcb0bb228 : for feature report

The thing is that I am using the same version of hidapi here, the latest git. Test GUI is also from the latest git. Supposedly the off-by-one has been fixed. https://github.com/libusb/hidapi/pull/232 : for input report https://github.com/libusb/hidapi/commit/6fcb0bb2282dbb505561a53689eba0c0536570d9 : for feature report
mcuee commented 2021-08-27 20:44:59 -05:00 (Migrated from github.com)

It could be an hidapi issue under Windows in the end. Here is the test result from the original generic HID example here:
http://janaxelson.com/hidpage.htm

The C# based GUI application works fine. And the libusb1 hid backend works fine with the off-by-one fix https://github.com/libusb/libusb/pull/986

Host libusb1 codes:
https://github.com/mcuee/picusb/blob/master/lvr_genhid/libusb1_lvrhid4.c

C:\work\picusb\picusb\lvr_genhid [master ≡ +17 ~2 -0 !]> .\libusb_lvrhid4.exe
Successfully find the LVR Generic HID device
Successfully set usb configuration 1
Successfully claimed interface
Testing control transfer using loop back test of feature report
20, 20; 21, 21;
Testing interrupt transfer using loop back test of input/output report
40, 40; 41, 41;
It could be an hidapi issue under Windows in the end. Here is the test result from the original generic HID example here: http://janaxelson.com/hidpage.htm The C# based GUI application works fine. And the libusb1 hid backend works fine with the off-by-one fix https://github.com/libusb/libusb/pull/986 Host libusb1 codes: https://github.com/mcuee/picusb/blob/master/lvr_genhid/libusb1_lvrhid4.c ``` C:\work\picusb\picusb\lvr_genhid [master ≡ +17 ~2 -0 !]> .\libusb_lvrhid4.exe Successfully find the LVR Generic HID device Successfully set usb configuration 1 Successfully claimed interface Testing control transfer using loop back test of feature report 20, 20; 21, 21; Testing interrupt transfer using loop back test of input/output report 40, 40; 41, 41; ```
mcuee commented 2021-08-27 20:48:52 -05:00 (Migrated from github.com)

C# GUI is working fine.
csharp_gui

C# GUI is working fine. ![csharp_gui](https://user-images.githubusercontent.com/1294740/131202485-4ad725e3-6b8f-4409-aeea-9c5a2b2a6457.png)
mcuee commented 2021-08-27 20:57:32 -05:00 (Migrated from github.com)

hidapitester output: total number of read bytes seems to be correct (2 bytes). But the data read seems to be not consistent between input report and feature report. I think we probably need to report reading 3 bytes for the Feature In report, including the report id 0. Let me try other os as well.

C:\work\hid\hidapitester2 [master ≡]> .\hidapitester.exe --vidpid 0925:7001 --open --send-feature 0,0x08,0x88 --read-feature 0
Opening device, vid/pid: 0x0925/0x7001
Writing 64-byte feature report...wrote 64 bytes:
 00 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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
C:\work\hid\hidapitester2 [master ≡]> .\hidapitester.exe --vidpid 0925:7001 --open --send-output 0,0x08,0x88 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 64-bytes...wrote 3 bytes:
 00 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 2 bytes:
 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 output: total number of read bytes seems to be correct (2 bytes). But the data read seems to be not consistent between input report and feature report. I think we probably need to report reading 3 bytes for the Feature In report, including the report id 0. Let me try other os as well. ``` C:\work\hid\hidapitester2 [master ≡]> .\hidapitester.exe --vidpid 0925:7001 --open --send-feature 0,0x08,0x88 --read-feature 0 Opening device, vid/pid: 0x0925/0x7001 Writing 64-byte feature report...wrote 64 bytes: 00 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 C:\work\hid\hidapitester2 [master ≡]> .\hidapitester.exe --vidpid 0925:7001 --open --send-output 0,0x08,0x88 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 64-bytes...wrote 3 bytes: 00 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 2 bytes: 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 ```
mcuee commented 2021-08-27 21:04:51 -05:00 (Migrated from github.com)

The Test GUI indeed has an issue to cut the feature in report by one byte. But the question is that should we report reading 3 bytes or 2 bytes? I think we probably need to report reading 3 bytes, including the report id 0. In that case the GUI will work fine for the reading of feature report.

hidapi_testgui_noreportid_wrong

The Test GUI indeed has an issue to cut the feature in report by one byte. But the question is that should we report reading 3 bytes or 2 bytes? I think we probably need to report reading 3 bytes, including the report id 0. In that case the GUI will work fine for the reading of feature report. ![hidapi_testgui_noreportid_wrong](https://user-images.githubusercontent.com/1294740/131202845-d21d4b87-58f0-400e-9d3d-7939c243075e.png)
mcuee commented 2021-08-27 21:06:47 -05:00 (Migrated from github.com)

@todbot In the end I think hidapitester is good.
The issue is probably for feature report under Windows. Shall we report one more byte so that data will not be truncated? Or shall we discard the first byte (report id 0) to be consistent with the input report under Windows and other OS (edit: this may not be correct, please refer to the comments below)?

@todbot In the end I think hidapitester is good. The issue is probably for feature report under Windows. Shall we report one more byte so that data will not be truncated? Or shall we discard the first byte (report id 0) to be consistent with the input report under Windows and other OS (edit: this may not be correct, please refer to the comments below)?
mcuee commented 2021-08-27 21:12:00 -05:00 (Migrated from github.com)

Now I start to question the following commit which I proposed in #232 with regard to feature report. It may be correct when the report id is not zero but may not be correct when the report id is zero. It seems to me for Windows, we may need to read one more byte when the report id is zero.
github.com/libusb/hidapi@6fcb0bb228

Now I start to question the following commit which I proposed in #232 with regard to feature report. It may be correct when the report id is not zero but may not be correct when the report id is zero. It seems to me for Windows, we may need to read one more byte when the report id is zero. https://github.com/libusb/hidapi/commit/6fcb0bb2282dbb505561a53689eba0c0536570d9
mcuee commented 2021-08-27 21:16:35 -05:00 (Migrated from github.com)

@Youw : please take a look as well for the feature report. Thanks.

Ref:
https://github.com/libusb/hidapi/issues/229#issuecomment-810780640

That is at least a reasonable interpretation of the documentation for hid_get_input_report. However, the same text appears in hid_get_feature_report which, in turn, seems to have conflicting implementations:

https://github.com/liquidctl/liquidctl/issues/312

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.

@Youw : please take a look as well for the feature report. Thanks. Ref: https://github.com/libusb/hidapi/issues/229#issuecomment-810780640 > That is at least a reasonable interpretation of the documentation for hid_get_input_report. However, the same text appears in hid_get_feature_report which, in turn, seems to have conflicting implementations: https://github.com/liquidctl/liquidctl/issues/312 > 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.
mcuee commented 2021-08-27 21:50:37 -05:00 (Migrated from github.com)

My recommendation is to discard the report id 0 for feature report under Windows, to be consistent with input report handing under Windows, and also other OS.

Edit: this may not be correct. From the Linux hidapitester output, indeed there is a difference in dealing with input report the feature report. Not so sure if this is because of API difference or real different on the wire.

My recommendation is to discard the report id 0 for feature report under Windows, to be consistent with input report handing under Windows, and also other OS. Edit: this may not be correct. From the Linux hidapitester output, indeed there is a difference in dealing with input report the feature report. Not so sure if this is because of API difference or real different on the wire.
mcuee commented 2021-08-27 22:08:24 -05:00 (Migrated from github.com)

Output under Linux:

hidapitester on  master [?] ❯ sudo ./hidapitester_hidraw --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 on  master [?] ❯ sudo ./hidapitester_hidraw --vidpid=0925:7001 --open --send-output 0,0x80,0x81 --read-input    
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 64-bytes...wrote 64 bytes:
 00 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 2 bytes:
 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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

Output under macOS (Mac Mini M1, macOS Big Sur ARM64), same as Linux.

mcuee@mcuees-Mac-mini hidapitester % ./hidapitester --vidpid=0925:7001 --open --send-output 0,0x40,0x41 --read-input   
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 64-bytes...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 input report 0, 250 msec timeout...read 2 bytes:
 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 00
Closing device
mcuee@mcuees-Mac-mini hidapitester % sudo ./hidapitester --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
Output under Linux: ``` hidapitester on  master [?] ❯ sudo ./hidapitester_hidraw --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 on  master [?] ❯ sudo ./hidapitester_hidraw --vidpid=0925:7001 --open --send-output 0,0x80,0x81 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 64-bytes...wrote 64 bytes: 00 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 2 bytes: 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 ``` Output under macOS (Mac Mini M1, macOS Big Sur ARM64), same as Linux. ``` mcuee@mcuees-Mac-mini hidapitester % ./hidapitester --vidpid=0925:7001 --open --send-output 0,0x40,0x41 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 64-bytes...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 input report 0, 250 msec timeout...read 2 bytes: 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 00 Closing device mcuee@mcuees-Mac-mini hidapitester % sudo ./hidapitester --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 ```
mcuee commented 2021-08-27 22:20:57 -05:00 (Migrated from github.com)

Linux test gui is consistent with hidapitester
linux_test_gui

Linux test gui is consistent with hidapitester ![linux_test_gui](https://user-images.githubusercontent.com/1294740/131204684-b1e8313a-8156-4e90-ab36-d57c9cbcb911.png)
mcuee commented 2021-08-27 23:41:28 -05:00 (Migrated from github.com)

Hopefully other Windows users can chime in and test latest git of hidapi to see if there is a real issue for the feature report or not.

Hopefully other Windows users can chime in and test latest git of hidapi to see if there is a real issue for the feature report or not.
mcuee commented 2021-08-27 23:55:33 -05:00 (Migrated from github.com)

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 github.com/libusb/hidapi@6fcb0bb228 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
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 https://github.com/libusb/hidapi/commit/6fcb0bb2282dbb505561a53689eba0c0536570d9 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 ```
mcuee commented 2021-08-28 00:59:15 -05:00 (Migrated from github.com)

For those with report id, commit github.com/libusb/hidapi@6fcb0bb228 seems to be correct.

C:\work\hid\hidapitester [master ≡ +1 ~1 -0 !]> .\hidapitester_release0101.exe --vidpid 0925:7001 --open --send-feature 3,0x08,0x88 --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 64-byte feature report...wrote 64 bytes:
 03 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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
C:\work\hid\hidapitester [master ≡ +1 ~1 -0 !]> .\hidapitester_git4d63a50.exe --vidpid 0925:7001 --open --send-feature 3,0x08,0x88 --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 64-byte feature report...wrote 64 bytes:
 03 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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
For those with report id, commit https://github.com/libusb/hidapi/commit/6fcb0bb2282dbb505561a53689eba0c0536570d9 seems to be correct. ``` C:\work\hid\hidapitester [master ≡ +1 ~1 -0 !]> .\hidapitester_release0101.exe --vidpid 0925:7001 --open --send-feature 3,0x08,0x88 --read-feature 4 Opening device, vid/pid: 0x0925/0x7001 Writing 64-byte feature report...wrote 64 bytes: 03 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 C:\work\hid\hidapitester [master ≡ +1 ~1 -0 !]> .\hidapitester_git4d63a50.exe --vidpid 0925:7001 --open --send-feature 3,0x08,0x88 --read-feature 4 Opening device, vid/pid: 0x0925/0x7001 Writing 64-byte feature report...wrote 64 bytes: 03 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 08 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 ```
mcuee commented 2021-08-30 09:38:01 -05:00 (Migrated from github.com)

Here is a quick hack of hidapitester with libusb backend (https://github.com/todbot/hidapitester/issues/8)

With patched libusb-1.0.dll (https://github.com/libusb/libusb/pull/986), it works fine.

C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.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
C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.exe --vidpid=0925:7001 --open --send-output 0,0x80,0x81 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 64-bytes...wrote 4 bytes:
 00 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 3 bytes:
 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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_mingw64_libusb.zip

It also works fine with devices with report ids (my mod FW of the above generic hid example from Jan Axelson).

C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.exe --vidpid=0925:7001 --open --send-output 2,0x80,0x81 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 64-bytes...wrote 3 bytes:
 02 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 3 bytes:
 01 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 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
C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.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
Here is a quick hack of hidapitester with libusb backend (https://github.com/todbot/hidapitester/issues/8) With patched libusb-1.0.dll (https://github.com/libusb/libusb/pull/986), it works fine. ``` C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.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 C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.exe --vidpid=0925:7001 --open --send-output 0,0x80,0x81 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 64-bytes...wrote 4 bytes: 00 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 3 bytes: 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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_mingw64_libusb.zip](https://github.com/libusb/hidapi/files/7077458/hidapitester_mingw64_libusb.zip) It also works fine with devices with report ids (my mod FW of the above generic hid example from Jan Axelson). ``` C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.exe --vidpid=0925:7001 --open --send-output 2,0x80,0x81 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 64-bytes...wrote 3 bytes: 02 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 input report 0, 250 msec timeout...read 3 bytes: 01 80 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 C:\work\hid\hidapitester [master ≡ +3 ~0 -0 !]> .\hidapitester_libusb.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 ```
mcuee commented 2021-08-30 09:48:55 -05:00 (Migrated from github.com)

All in all, hidapitester is okay. But we may need to fix hidapi under Windows, for reading of feature report. Therefore I have created an issue #328.

All in all, hidapitester is okay. But we may need to fix hidapi under Windows, for reading of feature report. Therefore I have created an issue #328.
mcuee commented 2022-04-25 00:12:30 -05:00 (Migrated from github.com)

I will close this as hidapitester is already mentioned in hidapi README.md.
https://github.com/libusb/hidapi/blob/master/README.md

I will close this as hidapitester is already mentioned in hidapi README.md. https://github.com/libusb/hidapi/blob/master/README.md
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi#285
No description provided.