Add hidraw backend for FreeBSD #730

Open
aokblast wants to merge 8 commits from aokblast/use_hid_raw into master
aokblast commented 2025-03-27 04:16:51 -05:00 (Migrated from github.com)

FreeBSD support hidraw in Kernel from 13.0.
By using libusb only, we can only see the HID device from usb. To address this, we implement hidraw backend for FreeBSD.

Just like Linux use libudev to handle usb specified HID stuff (like Manufacture), we use libusb to handle it.

Sponsored-by: FreeBSD Foundation

Related to #274
Fixes #543

Assisted-by: codex:gpt-5

FreeBSD support hidraw in Kernel from 13.0. By using libusb only, we can only see the HID device from usb. To address this, we implement hidraw backend for FreeBSD. Just like Linux use libudev to handle usb specified HID stuff (like Manufacture), we use libusb to handle it. Sponsored-by: FreeBSD Foundation Related to #274 Fixes #543 Assisted-by: codex:gpt-5
Youw (Migrated from github.com) reviewed 2025-03-27 04:16:51 -05:00
aokblast commented 2025-03-27 04:19:11 -05:00 (Migrated from github.com)

Currently, some stuff like the Report Descriptor parser and error registry routine are copied from Linux and I think they are platform independent. Can we create a common directory or hidraw directory in code then put them inside?

Have tested by the hidtest program.

Currently, some stuff like the Report Descriptor parser and error registry routine are copied from Linux and I think they are platform independent. Can we create a common directory or hidraw directory in code then put them inside? Have tested by the hidtest program.
Youw (Migrated from github.com) reviewed 2025-03-27 05:36:31 -05:00
Youw (Migrated from github.com) reviewed 2025-03-27 05:39:35 -05:00
Youw (Migrated from github.com) reviewed 2025-03-27 05:40:12 -05:00
Youw (Migrated from github.com) commented 2025-03-27 05:40:11 -05:00

typo?

typo?
Youw (Migrated from github.com) reviewed 2025-03-27 05:44:19 -05:00
@ -0,0 +1,46 @@
cmake_minimum_required(VERSION 3.6.3...3.25 FATAL_ERROR)
Youw (Migrated from github.com) commented 2025-03-27 05:44:19 -05:00

just to double-check - is there a minimum version of libusb that is required (at least to compile/API-wise)

just to double-check - is there a minimum version of libusb that is required (at least to compile/API-wise)
Youw (Migrated from github.com) reviewed 2025-03-27 05:48:29 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-03-27 05:48:29 -05:00

what if there are muktiple devices with the same VID/PID? is there a better way to match the device?

what if there are muktiple devices with the same VID/PID? is there a better way to match the device?
Youw (Migrated from github.com) reviewed 2025-03-27 05:50:38 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-03-27 05:50:38 -05:00

since there are no other return statements I'd call it end, not failed

since there are no other return statements I'd call it `end`, not `failed`
Youw (Migrated from github.com) reviewed 2025-03-27 05:54:28 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-03-27 05:54:28 -05:00

I'm no expert of FreeBSD, but isn't there a better way to enumerate all devices of a specific class? (like we do it for hidraw on Linux?)
If this is the "FreeBSD-way" - just confirm it

I'm no expert of FreeBSD, but isn't there a better way to enumerate all devices of a specific class? (like we do it for hidraw on Linux?) If this is the "FreeBSD-way" - just confirm it
Youw (Migrated from github.com) reviewed 2025-03-27 05:57:00 -05:00
Youw (Migrated from github.com) left a comment

No more comments

No more comments
aokblast (Migrated from github.com) reviewed 2025-03-27 08:29:05 -05:00
aokblast (Migrated from github.com) reviewed 2025-03-27 08:46:13 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
aokblast (Migrated from github.com) commented 2025-03-27 08:46:13 -05:00

I am not working on USB stuff quiet often. Is there any possibility to have same vendor id and same product id but different manufacturer string?
We cannot use serial number to distinguish them because a half of devices on my environment don't have serial number.
I can use bus and port number to distinguished between them on local machine. But that will needs a for loop each time to enumerate a usb device. I think libudev do the same thing.

I am not working on USB stuff quiet often. Is there any possibility to have same vendor id and same product id but different manufacturer string? We cannot use serial number to distinguish them because a half of devices on my environment don't have serial number. I can use bus and port number to distinguished between them on local machine. But that will needs a for loop each time to enumerate a usb device. I think libudev do the same thing.
Youw (Migrated from github.com) reviewed 2025-03-27 09:01:48 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-03-27 09:01:47 -05:00

But that will needs a for loop each time to enumerate a usb device

libusb_open_device_with_vid_pid does that under the hood anyway.

same vendor id and same product id but different manufacturer string?

Practically unlikely, but very possible - I had identical devices with different FW targeted for different countries, and one of the manufactures was written in CN.
Also, when you have multiple devices, one of the might be already exclusively open by some other application, and libusb_open might simply fail.

> But that will needs a for loop each time to enumerate a usb device `libusb_open_device_with_vid_pid` does that under the hood anyway. > same vendor id and same product id but different manufacturer string? Practically unlikely, but very possible - I had identical devices with different FW targeted for different countries, and one of the manufactures was written in CN. Also, when you have multiple devices, one of the might be already exclusively open by some other application, and libusb_open might simply fail.
aokblast (Migrated from github.com) reviewed 2025-03-27 09:06:01 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
aokblast (Migrated from github.com) commented 2025-03-27 09:06:01 -05:00

Oh, that is a good point! Thanks for your explanation! And fix it.

Oh, that is a good point! Thanks for your explanation! And fix it.
aokblast (Migrated from github.com) reviewed 2025-03-27 09:14:38 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
aokblast (Migrated from github.com) commented 2025-03-27 09:14:38 -05:00

That is also the thing I would like to confirm. Each of the usb device have the specified usbhid deivce file. But in other type of the hid device (e.g. iic), it maybe not the case. Do you think fstat to check if file "/dev/hidraw%d" exist a good idea?
Also, I can ask the author of FreeBSD hidraw driver to confirm this.

That is also the thing I would like to confirm. Each of the usb device have the specified usbhid deivce file. But in other type of the hid device (e.g. iic), it maybe not the case. Do you think fstat to check if file "/dev/hidraw%d" exist a good idea? Also, I can ask the author of FreeBSD hidraw driver to confirm this.
aokblast commented 2025-03-27 09:17:41 -05:00 (Migrated from github.com)

Thanks for @Youw your review:).

Then, What is your opinion about this?

Currently, some stuff like the Report Descriptor parser and error registry routine are copied from Linux and I think they are platform independent. Can we create a common directory or hidraw directory in code then put them inside?

Have tested by the hidtest program.

Thanks for @Youw your review:). Then, What is your opinion about this? > Currently, some stuff like the Report Descriptor parser and error registry routine are copied from Linux and I think they are platform independent. Can we create a common directory or hidraw directory in code then put them inside? > > Have tested by the hidtest program.
Youw (Migrated from github.com) reviewed 2025-03-27 09:30:44 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-03-27 09:30:44 -05:00

BTW: when I mentioned linux/hidraw backed - it actually uses libudev for enumeration, and that's not exactly what I meant.
On Linux there is /sys/class/hidraw directory, which contains only hidraw devices, and it is enough to enumerate all /sys/class/hidraw/hidraw* files to get list of all devices.

Otherwise, when devices are getting connected and disconnected, it is possible that /dev/hidraw2 exists, but /dev/hidraw1 - does not, due to being disconnected at some point.

BTW: when I mentioned linux/hidraw backed - it actually uses libudev for enumeration, and that's not exactly what I meant. On Linux there is `/sys/class/hidraw` directory, which contains only hidraw devices, and it is enough to enumerate all `/sys/class/hidraw/hidraw*` files to get list of all devices. Otherwise, when devices are getting connected and disconnected, it is possible that `/dev/hidraw2` exists, but `/dev/hidraw1` - does not, due to being disconnected at some point.
Youw commented 2025-03-27 09:33:01 -05:00 (Migrated from github.com)

Thanks for @Youw your review:).

Then, What is your opinion about this?

Currently, some stuff like the Report Descriptor parser and error registry routine are copied from Linux and I think they are platform independent. Can we create a common directory or hidraw directory in code then put them inside?
Have tested by the hidtest program.

I thinjk that is a good idea, but I don't think it really is nesessary to do so in scope of this PR.
There are really lots of stuff which I'd like to share among beckends, and I think it is going to be some refactoring after all.

> Thanks for @Youw your review:). > > Then, What is your opinion about this? > > > Currently, some stuff like the Report Descriptor parser and error registry routine are copied from Linux and I think they are platform independent. Can we create a common directory or hidraw directory in code then put them inside? > > Have tested by the hidtest program. I thinjk that is a good idea, but I don't think it really is nesessary to do so in scope of this PR. There are really lots of stuff which I'd like to share among beckends, and I think it is going to be some refactoring after all.
aokblast (Migrated from github.com) reviewed 2025-03-27 12:46:40 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
aokblast (Migrated from github.com) commented 2025-03-27 12:46:40 -05:00

I iterate all sysctl "dev.hidraw" subnode like the following code:
https://gist.github.com/aokblast/1aaf06e429899021320d045ff5387db9
The result is as the comment shows.
Then I match all dev.hidraw.%d by sscanf.

I iterate all sysctl "dev.hidraw" subnode like the following code: https://gist.github.com/aokblast/1aaf06e429899021320d045ff5387db9 The result is as the comment shows. Then I match all dev.hidraw.%d by sscanf.
mcuee commented 2025-03-27 20:50:28 -05:00 (Migrated from github.com)

Nice. This will address the following issue.

Nice. This will address the following issue. * https://github.com/libusb/hidapi/issues/543
aokblast commented 2025-03-27 21:10:47 -05:00 (Migrated from github.com)

Oops. I forget we have udev-devd stuff. Maybe we should use udev also?

Oops. I forget we have udev-devd stuff. Maybe we should use udev also?
Youw commented 2025-03-28 05:27:32 -05:00 (Migrated from github.com)

Oops. I forget we have udev-devd stuff. Maybe we should use udev also?

I lost context here. What for? Seem like you have all the functionality implemented already. Aren't you?

> Oops. I forget we have udev-devd stuff. Maybe we should use udev also? I lost context here. What for? Seem like you have all the functionality implemented already. Aren't you?
aokblast commented 2025-03-29 02:55:43 -05:00 (Migrated from github.com)

Oops. I forget we have udev-devd stuff. Maybe we should use udev also?

I lost context here. What for? Seem like you have all the functionality implemented already. Aren't you?

Yes, all functionality is fully implemented. I am just thinking if we should use libudev make hidapi more portable.

> > Oops. I forget we have udev-devd stuff. Maybe we should use udev also? > > I lost context here. What for? Seem like you have all the functionality implemented already. Aren't you? Yes, all functionality is fully implemented. I am just thinking if we should use libudev make hidapi more portable.
mcuee commented 2025-03-29 21:00:25 -05:00 (Migrated from github.com)

First test under FreeBSD 14.1 Release, under a physical machine (Chuwi mini PC, Intel J4125 CPU, 8GB RAM, 256GB SSD)

There are a few compiler warnings.

mcuee@freebsd14:~/build/hidapi_pr730 $ uname -a
FreeBSD freebsd14 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64

mcuee@freebsd14:~/build/hidapi_pr730 $ cc -v
FreeBSD clang version 18.1.5 (https://github.com/llvm/llvm-project.git llvmorg-18.1.5-0-g617a15a9eac9)
Target: x86_64-unknown-freebsd14.1
Thread model: posix
InstalledDir: /usr/bin

mcuee@freebsd14:~/build/hidapi_pr730 $ make
make  all-recursive
Making all in freebsd
  CC       hid.lo
hid.c:396:24: warning: passing 'uint8_t[255]' (aka 'unsigned char[255]') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
  396 |                 mbstowcs(namebuffer, buffer, sizeof(namebuffer));
      |                                      ^~~~~~
/usr/include/stdlib.h:107:64: note: passing argument to parameter here
  107 | size_t   mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
      |                                                                 ^
hid.c:603:1: warning: non-void function does not return a value [-Wreturn-type]
  603 | }
      | ^
hid.c:937:7: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  937 |         free(dev->device_path);
      |              ^~~~~~~~~~~~~~~~
/usr/include/stdlib.h:101:18: note: passing argument to parameter here
  101 | void     free(void *);
      |                     ^
3 warnings generated.
  CCLD     libhidapi-hidraw.la
Making all in libusb
  CC       hid.lo
  CCLD     libhidapi-libusb.la
Making all in hidtest
  CC       test.o
  CCLD     hidtest-libusb
  CCLD     hidtest-hidraw
First test under FreeBSD 14.1 Release, under a physical machine (Chuwi mini PC, Intel J4125 CPU, 8GB RAM, 256GB SSD) There are a few compiler warnings. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ uname -a FreeBSD freebsd14 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 mcuee@freebsd14:~/build/hidapi_pr730 $ cc -v FreeBSD clang version 18.1.5 (https://github.com/llvm/llvm-project.git llvmorg-18.1.5-0-g617a15a9eac9) Target: x86_64-unknown-freebsd14.1 Thread model: posix InstalledDir: /usr/bin mcuee@freebsd14:~/build/hidapi_pr730 $ make make all-recursive Making all in freebsd CC hid.lo hid.c:396:24: warning: passing 'uint8_t[255]' (aka 'unsigned char[255]') to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign] 396 | mbstowcs(namebuffer, buffer, sizeof(namebuffer)); | ^~~~~~ /usr/include/stdlib.h:107:64: note: passing argument to parameter here 107 | size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); | ^ hid.c:603:1: warning: non-void function does not return a value [-Wreturn-type] 603 | } | ^ hid.c:937:7: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 937 | free(dev->device_path); | ^~~~~~~~~~~~~~~~ /usr/include/stdlib.h:101:18: note: passing argument to parameter here 101 | void free(void *); | ^ 3 warnings generated. CCLD libhidapi-hidraw.la Making all in libusb CC hid.lo CCLD libhidapi-libusb.la Making all in hidtest CC test.o CCLD hidtest-libusb CCLD hidtest-hidraw ```
aokblast commented 2025-03-29 21:06:02 -05:00 (Migrated from github.com)

Fix it:). Forget to fix the warning.

Fix it:). Forget to fix the warning.
mcuee commented 2025-03-29 21:06:06 -05:00 (Migrated from github.com)

Somehow hidtest-hidraw will seg fault with the Microchip Simple HID example.

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Segmentation fault
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 04f2 0760
  path: 0-3:1.0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (65 bytes)
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 
0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 
0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 
0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 
0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 
0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 
0xff, 0x00, 0x81, 0x00, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-3:1.1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 1ea7 0064
  path: 0-4:1.0
  serial_number: (null)
  Manufacturer: (null)
  Product:      2.4G Mouse
  Release:      200
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (105 bytes)
0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 
0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 
0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 
0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 
0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 
0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 
0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 
0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 
0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 
0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 
0x01, 0x81, 0x06, 0xc0, 0xc0, 
Device Found
  type: 04d8 003f
  path: 0-2:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Manufacturer String: Microchip Technology Inc.
Product String: Simple HID Device Demo
Unable to read serial number string
Serial Number String: (0) 
  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04d8 003f
  path: 0-2:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Indexed String 1: Microchip Technology Inc.
Unable to send a feature report: hid_error is not implemented yet
Unable to get a feature report: hid_error is not implemented yet
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
read() timeout
Somehow hidtest-hidraw will seg fault with the Microchip Simple HID example. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Segmentation fault mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 04f2 0760 path: 0-3:1.0 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (65 bytes) 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0, Device Found type: 04f2 0760 path: 0-3:1.1 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 1 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 1ea7 0064 path: 0-4:1.0 serial_number: (null) Manufacturer: (null) Product: 2.4G Mouse Release: 200 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (105 bytes) 0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xc0, 0xc0, Device Found type: 04d8 003f path: 0-2:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Manufacturer String: Microchip Technology Inc. Product String: Simple HID Device Demo Unable to read serial number string Serial Number String: (0) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04d8 003f path: 0-2:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Indexed String 1: Microchip Technology Inc. Unable to send a feature report: hid_error is not implemented yet Unable to get a feature report: hid_error is not implemented yet waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... read() timeout ```
mcuee commented 2025-03-29 21:10:28 -05:00 (Migrated from github.com)

Fix it:). Forget to fix the warning.

Thanks. The compiler warnings are gone.

The Segfault issue is still there though.

> Fix it:). Forget to fix the warning. Thanks. The compiler warnings are gone. The Segfault issue is still there though.
aokblast commented 2025-03-29 21:10:38 -05:00 (Migrated from github.com)

Can you show me where it cause segment fault?
You can use something like lldb with (sudo lldb <binary_location>). Then use r to run.

Can you show me where it cause segment fault? You can use something like lldb with (sudo lldb <binary_location>). Then use r to run.
mcuee commented 2025-03-29 21:23:16 -05:00 (Migrated from github.com)

This is with Cmake build. Somehow it only build one version of hidtest.

mcuee@freebsd14:~/build/hidapi_pr730 $ cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DHIDAPI_BUILD_HIDTEST=ON .
-- The C compiler identification is Clang 18.1.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- hidapi: v0.15.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.2.0")
-- Checking for module 'libusb-1.0>=1.0.9'
--   Found libusb-1.0, version 1.0.13
-- Checking for module 'libusb-1.0>=1.0.9'
--   Found libusb-1.0, version 1.0.13
-- Check for Iconv
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Success
-- Found Iconv: built in to C library
-- Performing Test HIDAPI_ICONV_CONST
-- Performing Test HIDAPI_ICONV_CONST - Failed
-- Building hidtest
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/hidapi_pr730/build

mcuee@freebsd14:~/build/hidapi_pr730 $ cmake --build build
[ 16%] Building C object src/freebsd/CMakeFiles/hidapi_hidraw.dir/hid.c.o
[ 33%] Linking C shared library libhidapi-hidraw.so
[ 33%] Built target hidapi_hidraw
[ 50%] Building C object src/libusb/CMakeFiles/hidapi_libusb.dir/hid.c.o
[ 66%] Linking C shared library libhidapi-libusb.so
[ 66%] Built target hidapi_libusb
[ 83%] Building C object hidtest/CMakeFiles/hidtest.dir/test.c.o
[100%] Linking C executable hidtest
[100%] Built target hidtest

mcuee@freebsd14:~/build/hidapi_pr730/build $ ./hidtest/hidtest 
cmake_install.cmake  CMakeFiles/          hidtest/             src/                
CMakeCache.txt       export_generated/    Makefile            
mcuee@freebsd14:~/build/hidapi_pr730/build $ ./hidtest/hidtest 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

=================================================================
==17517==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x7fffffffde30,0x802000c87e50) and [0x7fffffffe010, 0x802000c88030) overlap
    #0 0x2c64b5 in __asan_memcpy /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:63:3
    #1 0x80034827d in hid_get_next_from_oid /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2
    #2 0x80034827d in hid_get_next_from_sysctl_iter /home/mcuee/build/hidapi_pr730/freebsd/hid.c:567:14
    #3 0x80034827d in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:621:8
    #4 0x2fbeb3 in main /home/mcuee/build/hidapi_pr730/hidtest/test.c:181:9
    #5 0x800474a69 in __libc_start1 (/lib/libc.so.7+0x85a69)
    #6 0x24e36f in _start /usr/src/lib/csu/amd64/crt1_s.S:83

Address 0x7fffffffde30 is located in stack of thread T0 at offset 656 in frame
    #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607

  This frame has 9 object(s):
    [32, 128) 'q_name_oid.i.i' (line 510)
    [160, 416) 'name_buffer.i.i' (line 511)
    [480, 488) 'buffer_size.i.i' (line 512)
    [512, 516) 'result.i.i' (line 513)
    [528, 624) 'q_next_oid.i.i' (line 529)
    [656, 752) 'recv_oid.i.i' (line 529) <== Memory access at offset 656 partially overflows this variable
    [784, 792) 'recv_items.i.i' (line 531) <== Memory access at offset 656 partially underflows this variable
    [816, 1071) 'buf' (line 611) <== Memory access at offset 656 partially underflows this variable
    [1136, 1256) 'iter' (line 614) <== Memory access at offset 656 partially underflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
Address 0x7fffffffe010 is located in stack of thread T0 at offset 1136 in frame
    #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607

  This frame has 9 object(s):
    [32, 128) 'q_name_oid.i.i' (line 510)
    [160, 416) 'name_buffer.i.i' (line 511)
    [480, 488) 'buffer_size.i.i' (line 512)
    [512, 516) 'result.i.i' (line 513)
    [528, 624) 'q_next_oid.i.i' (line 529)
    [656, 752) 'recv_oid.i.i' (line 529)
    [784, 792) 'recv_items.i.i' (line 531)
    [816, 1071) 'buf' (line 611)
    [1136, 1256) 'iter' (line 614) <== Memory access at offset 1136 partially overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: memcpy-param-overlap /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2 in hid_get_next_from_oid
==17517==ABORTING
This is with Cmake build. Somehow it only build one version of hidtest. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DHIDAPI_BUILD_HIDTEST=ON . -- The C compiler identification is Clang 18.1.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- hidapi: v0.15.0 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.2.0") -- Checking for module 'libusb-1.0>=1.0.9' -- Found libusb-1.0, version 1.0.13 -- Checking for module 'libusb-1.0>=1.0.9' -- Found libusb-1.0, version 1.0.13 -- Check for Iconv -- Performing Test Iconv_IS_BUILT_IN -- Performing Test Iconv_IS_BUILT_IN - Success -- Found Iconv: built in to C library -- Performing Test HIDAPI_ICONV_CONST -- Performing Test HIDAPI_ICONV_CONST - Failed -- Building hidtest -- Configuring done (0.9s) -- Generating done (0.0s) -- Build files have been written to: /home/mcuee/build/hidapi_pr730/build mcuee@freebsd14:~/build/hidapi_pr730 $ cmake --build build [ 16%] Building C object src/freebsd/CMakeFiles/hidapi_hidraw.dir/hid.c.o [ 33%] Linking C shared library libhidapi-hidraw.so [ 33%] Built target hidapi_hidraw [ 50%] Building C object src/libusb/CMakeFiles/hidapi_libusb.dir/hid.c.o [ 66%] Linking C shared library libhidapi-libusb.so [ 66%] Built target hidapi_libusb [ 83%] Building C object hidtest/CMakeFiles/hidtest.dir/test.c.o [100%] Linking C executable hidtest [100%] Built target hidtest mcuee@freebsd14:~/build/hidapi_pr730/build $ ./hidtest/hidtest cmake_install.cmake CMakeFiles/ hidtest/ src/ CMakeCache.txt export_generated/ Makefile mcuee@freebsd14:~/build/hidapi_pr730/build $ ./hidtest/hidtest hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. ================================================================= ==17517==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x7fffffffde30,0x802000c87e50) and [0x7fffffffe010, 0x802000c88030) overlap #0 0x2c64b5 in __asan_memcpy /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:63:3 #1 0x80034827d in hid_get_next_from_oid /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2 #2 0x80034827d in hid_get_next_from_sysctl_iter /home/mcuee/build/hidapi_pr730/freebsd/hid.c:567:14 #3 0x80034827d in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:621:8 #4 0x2fbeb3 in main /home/mcuee/build/hidapi_pr730/hidtest/test.c:181:9 #5 0x800474a69 in __libc_start1 (/lib/libc.so.7+0x85a69) #6 0x24e36f in _start /usr/src/lib/csu/amd64/crt1_s.S:83 Address 0x7fffffffde30 is located in stack of thread T0 at offset 656 in frame #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607 This frame has 9 object(s): [32, 128) 'q_name_oid.i.i' (line 510) [160, 416) 'name_buffer.i.i' (line 511) [480, 488) 'buffer_size.i.i' (line 512) [512, 516) 'result.i.i' (line 513) [528, 624) 'q_next_oid.i.i' (line 529) [656, 752) 'recv_oid.i.i' (line 529) <== Memory access at offset 656 partially overflows this variable [784, 792) 'recv_items.i.i' (line 531) <== Memory access at offset 656 partially underflows this variable [816, 1071) 'buf' (line 611) <== Memory access at offset 656 partially underflows this variable [1136, 1256) 'iter' (line 614) <== Memory access at offset 656 partially underflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) Address 0x7fffffffe010 is located in stack of thread T0 at offset 1136 in frame #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607 This frame has 9 object(s): [32, 128) 'q_name_oid.i.i' (line 510) [160, 416) 'name_buffer.i.i' (line 511) [480, 488) 'buffer_size.i.i' (line 512) [512, 516) 'result.i.i' (line 513) [528, 624) 'q_next_oid.i.i' (line 529) [656, 752) 'recv_oid.i.i' (line 529) [784, 792) 'recv_items.i.i' (line 531) [816, 1071) 'buf' (line 611) [1136, 1256) 'iter' (line 614) <== Memory access at offset 1136 partially overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: memcpy-param-overlap /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2 in hid_get_next_from_oid ==17517==ABORTING ```
mcuee commented 2025-03-29 21:31:27 -05:00 (Migrated from github.com)

More detailed build log using CMake.

At least the shared version of hidtest will depend on the new FreeBSD hidraw backend.


mcuee@freebsd14:~/build/hidapi_pr730 $  cmake -B build/shared -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/shared -DHIDAPI_BUILD_HIDTEST=ON
-- The C compiler identification is Clang 18.1.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- hidapi: v0.15.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.2.0")
-- Checking for module 'libusb-1.0>=1.0.9'
--   Found libusb-1.0, version 1.0.13
-- Checking for module 'libusb-1.0>=1.0.9'
--   Found libusb-1.0, version 1.0.13
-- Check for Iconv
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Success
-- Found Iconv: built in to C library
-- Performing Test HIDAPI_ICONV_CONST
-- Performing Test HIDAPI_ICONV_CONST - Failed
-- Building hidtest
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/hidapi_pr730/build/shared

mcuee@freebsd14:~/build/hidapi_pr730 $ cmake --build build/shared
[ 16%] Building C object src/freebsd/CMakeFiles/hidapi_hidraw.dir/hid.c.o
[ 33%] Linking C shared library libhidapi-hidraw.so
[ 33%] Built target hidapi_hidraw
[ 50%] Building C object src/libusb/CMakeFiles/hidapi_libusb.dir/hid.c.o
[ 66%] Linking C shared library libhidapi-libusb.so
[ 66%] Built target hidapi_libusb
[ 83%] Building C object hidtest/CMakeFiles/hidtest.dir/test.c.o
[100%] Linking C executable hidtest
[100%] Built target hidtest

mcuee@freebsd14:~/build/hidapi_pr730 $ cmake -B build/static -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/static -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON 
-- The C compiler identification is Clang 18.1.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- hidapi: v0.15.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.2.0")
-- Checking for module 'libusb-1.0>=1.0.9'
--   Found libusb-1.0, version 1.0.13
-- Checking for module 'libusb-1.0>=1.0.9'
--   Found libusb-1.0, version 1.0.13
-- Check for Iconv
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Success
-- Found Iconv: built in to C library
-- Performing Test HIDAPI_ICONV_CONST
-- Performing Test HIDAPI_ICONV_CONST - Failed
-- Building hidtest
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/hidapi_pr730/build/static

mcuee@freebsd14:~/build/hidapi_pr730 $ cmake --build build/static
[ 16%] Building C object src/freebsd/CMakeFiles/hidapi_hidraw.dir/hid.c.o
[ 33%] Linking C static library libhidapi-hidraw.a
[ 33%] Built target hidapi_hidraw
[ 50%] Building C object src/libusb/CMakeFiles/hidapi_libusb.dir/hid.c.o
[ 66%] Linking C static library libhidapi-libusb.a
[ 66%] Built target hidapi_libusb
[ 83%] Building C object hidtest/CMakeFiles/hidtest.dir/test.c.o
[100%] Linking C executable hidtest
[100%] Built target hidtest

mcuee@freebsd14:~/build/hidapi_pr730 $ ldd ./build/shared/hidtest/hidtest 
./build/shared/hidtest/hidtest:
	libhidapi-hidraw.so.0 => /home/mcuee/build/hidapi_pr730/build/shared/src/freebsd/libhidapi-hidraw.so.0 (0x504ab6e1000)
	libthr.so.3 => /lib/libthr.so.3 (0x504aaa6f000)
	librt.so.1 => /lib/librt.so.1 (0x504aba0e000)
	libm.so.5 => /lib/libm.so.5 (0x504abcec000)
	libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x504ac03d000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x504ace1c000)
	libc.so.7 => /lib/libc.so.7 (0x504aed6d000)
	libusb.so.3 => /usr/lib/libusb.so.3 (0x504ada6d000)
	libelf.so.2 => /lib/libelf.so.2 (0x504add6c000)
	[vdso] (0x504aa327000)

mcuee@freebsd14:~/build/hidapi_pr730 $ ldd ./build/stativ/hidtest/hidtest
ldd: ./build/stativ/hidtest/hidtest: No such file or directory
mcuee@freebsd14:~/build/hidapi_pr730 $ ldd ./build/static/hidtest/hidtest
./build/static/hidtest/hidtest:
	libusb.so.3 => /usr/lib/libusb.so.3 (0x1c3e5e8ab000)
	libthr.so.3 => /lib/libthr.so.3 (0x1c3e5ee41000)
	librt.so.1 => /lib/librt.so.1 (0x1c3e602c6000)
	libm.so.5 => /lib/libm.so.5 (0x1c3e5f34c000)
	libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x1c3e61301000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x1c3e60f96000)
	libc.so.7 => /lib/libc.so.7 (0x1c3e616fe000)
	libelf.so.2 => /lib/libelf.so.2 (0x1c3e623b0000)
	[vdso] (0x1c3e5da87000)

mcuee@freebsd14:~/build/hidapi_pr730 $ ./build/shared/hidtest/hidtest 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

=================================================================
==17789==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x7fffffffde30,0x802000c87e50) and [0x7fffffffe010, 0x802000c88030) overlap
    #0 0x2c64b5 in __asan_memcpy /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:63:3
    #1 0x80034827d in hid_get_next_from_oid /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2
    #2 0x80034827d in hid_get_next_from_sysctl_iter /home/mcuee/build/hidapi_pr730/freebsd/hid.c:567:14
    #3 0x80034827d in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:621:8
    #4 0x2fbeb3 in main /home/mcuee/build/hidapi_pr730/hidtest/test.c:181:9
    #5 0x800474a69 in __libc_start1 (/lib/libc.so.7+0x85a69)
    #6 0x24e36f in _start /usr/src/lib/csu/amd64/crt1_s.S:83

Address 0x7fffffffde30 is located in stack of thread T0 at offset 656 in frame
    #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607

  This frame has 9 object(s):
    [32, 128) 'q_name_oid.i.i' (line 510)
    [160, 416) 'name_buffer.i.i' (line 511)
    [480, 488) 'buffer_size.i.i' (line 512)
    [512, 516) 'result.i.i' (line 513)
    [528, 624) 'q_next_oid.i.i' (line 529)
    [656, 752) 'recv_oid.i.i' (line 529) <== Memory access at offset 656 partially overflows this variable
    [784, 792) 'recv_items.i.i' (line 531) <== Memory access at offset 656 partially underflows this variable
    [816, 1071) 'buf' (line 611) <== Memory access at offset 656 partially underflows this variable
    [1136, 1256) 'iter' (line 614) <== Memory access at offset 656 partially underflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
Address 0x7fffffffe010 is located in stack of thread T0 at offset 1136 in frame
    #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607

  This frame has 9 object(s):
    [32, 128) 'q_name_oid.i.i' (line 510)
    [160, 416) 'name_buffer.i.i' (line 511)
    [480, 488) 'buffer_size.i.i' (line 512)
    [512, 516) 'result.i.i' (line 513)
    [528, 624) 'q_next_oid.i.i' (line 529)
    [656, 752) 'recv_oid.i.i' (line 529)
    [784, 792) 'recv_items.i.i' (line 531)
    [816, 1071) 'buf' (line 611)
    [1136, 1256) 'iter' (line 614) <== Memory access at offset 1136 partially overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: memcpy-param-overlap /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2 in hid_get_next_from_oid
==17789==ABORTING

More detailed build log using CMake. At least the shared version of hidtest will depend on the new FreeBSD hidraw backend. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ cmake -B build/shared -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/shared -DHIDAPI_BUILD_HIDTEST=ON -- The C compiler identification is Clang 18.1.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- hidapi: v0.15.0 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.2.0") -- Checking for module 'libusb-1.0>=1.0.9' -- Found libusb-1.0, version 1.0.13 -- Checking for module 'libusb-1.0>=1.0.9' -- Found libusb-1.0, version 1.0.13 -- Check for Iconv -- Performing Test Iconv_IS_BUILT_IN -- Performing Test Iconv_IS_BUILT_IN - Success -- Found Iconv: built in to C library -- Performing Test HIDAPI_ICONV_CONST -- Performing Test HIDAPI_ICONV_CONST - Failed -- Building hidtest -- Configuring done (0.9s) -- Generating done (0.0s) -- Build files have been written to: /home/mcuee/build/hidapi_pr730/build/shared mcuee@freebsd14:~/build/hidapi_pr730 $ cmake --build build/shared [ 16%] Building C object src/freebsd/CMakeFiles/hidapi_hidraw.dir/hid.c.o [ 33%] Linking C shared library libhidapi-hidraw.so [ 33%] Built target hidapi_hidraw [ 50%] Building C object src/libusb/CMakeFiles/hidapi_libusb.dir/hid.c.o [ 66%] Linking C shared library libhidapi-libusb.so [ 66%] Built target hidapi_libusb [ 83%] Building C object hidtest/CMakeFiles/hidtest.dir/test.c.o [100%] Linking C executable hidtest [100%] Built target hidtest mcuee@freebsd14:~/build/hidapi_pr730 $ cmake -B build/static -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/static -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON -- The C compiler identification is Clang 18.1.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- hidapi: v0.15.0 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.2.0") -- Checking for module 'libusb-1.0>=1.0.9' -- Found libusb-1.0, version 1.0.13 -- Checking for module 'libusb-1.0>=1.0.9' -- Found libusb-1.0, version 1.0.13 -- Check for Iconv -- Performing Test Iconv_IS_BUILT_IN -- Performing Test Iconv_IS_BUILT_IN - Success -- Found Iconv: built in to C library -- Performing Test HIDAPI_ICONV_CONST -- Performing Test HIDAPI_ICONV_CONST - Failed -- Building hidtest -- Configuring done (0.9s) -- Generating done (0.0s) -- Build files have been written to: /home/mcuee/build/hidapi_pr730/build/static mcuee@freebsd14:~/build/hidapi_pr730 $ cmake --build build/static [ 16%] Building C object src/freebsd/CMakeFiles/hidapi_hidraw.dir/hid.c.o [ 33%] Linking C static library libhidapi-hidraw.a [ 33%] Built target hidapi_hidraw [ 50%] Building C object src/libusb/CMakeFiles/hidapi_libusb.dir/hid.c.o [ 66%] Linking C static library libhidapi-libusb.a [ 66%] Built target hidapi_libusb [ 83%] Building C object hidtest/CMakeFiles/hidtest.dir/test.c.o [100%] Linking C executable hidtest [100%] Built target hidtest mcuee@freebsd14:~/build/hidapi_pr730 $ ldd ./build/shared/hidtest/hidtest ./build/shared/hidtest/hidtest: libhidapi-hidraw.so.0 => /home/mcuee/build/hidapi_pr730/build/shared/src/freebsd/libhidapi-hidraw.so.0 (0x504ab6e1000) libthr.so.3 => /lib/libthr.so.3 (0x504aaa6f000) librt.so.1 => /lib/librt.so.1 (0x504aba0e000) libm.so.5 => /lib/libm.so.5 (0x504abcec000) libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x504ac03d000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x504ace1c000) libc.so.7 => /lib/libc.so.7 (0x504aed6d000) libusb.so.3 => /usr/lib/libusb.so.3 (0x504ada6d000) libelf.so.2 => /lib/libelf.so.2 (0x504add6c000) [vdso] (0x504aa327000) mcuee@freebsd14:~/build/hidapi_pr730 $ ldd ./build/stativ/hidtest/hidtest ldd: ./build/stativ/hidtest/hidtest: No such file or directory mcuee@freebsd14:~/build/hidapi_pr730 $ ldd ./build/static/hidtest/hidtest ./build/static/hidtest/hidtest: libusb.so.3 => /usr/lib/libusb.so.3 (0x1c3e5e8ab000) libthr.so.3 => /lib/libthr.so.3 (0x1c3e5ee41000) librt.so.1 => /lib/librt.so.1 (0x1c3e602c6000) libm.so.5 => /lib/libm.so.5 (0x1c3e5f34c000) libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x1c3e61301000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x1c3e60f96000) libc.so.7 => /lib/libc.so.7 (0x1c3e616fe000) libelf.so.2 => /lib/libelf.so.2 (0x1c3e623b0000) [vdso] (0x1c3e5da87000) mcuee@freebsd14:~/build/hidapi_pr730 $ ./build/shared/hidtest/hidtest hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. ================================================================= ==17789==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x7fffffffde30,0x802000c87e50) and [0x7fffffffe010, 0x802000c88030) overlap #0 0x2c64b5 in __asan_memcpy /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:63:3 #1 0x80034827d in hid_get_next_from_oid /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2 #2 0x80034827d in hid_get_next_from_sysctl_iter /home/mcuee/build/hidapi_pr730/freebsd/hid.c:567:14 #3 0x80034827d in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:621:8 #4 0x2fbeb3 in main /home/mcuee/build/hidapi_pr730/hidtest/test.c:181:9 #5 0x800474a69 in __libc_start1 (/lib/libc.so.7+0x85a69) #6 0x24e36f in _start /usr/src/lib/csu/amd64/crt1_s.S:83 Address 0x7fffffffde30 is located in stack of thread T0 at offset 656 in frame #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607 This frame has 9 object(s): [32, 128) 'q_name_oid.i.i' (line 510) [160, 416) 'name_buffer.i.i' (line 511) [480, 488) 'buffer_size.i.i' (line 512) [512, 516) 'result.i.i' (line 513) [528, 624) 'q_next_oid.i.i' (line 529) [656, 752) 'recv_oid.i.i' (line 529) <== Memory access at offset 656 partially overflows this variable [784, 792) 'recv_items.i.i' (line 531) <== Memory access at offset 656 partially underflows this variable [816, 1071) 'buf' (line 611) <== Memory access at offset 656 partially underflows this variable [1136, 1256) 'iter' (line 614) <== Memory access at offset 656 partially underflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) Address 0x7fffffffe010 is located in stack of thread T0 at offset 1136 in frame #0 0x800347fbf in hid_enumerate /home/mcuee/build/hidapi_pr730/freebsd/hid.c:607 This frame has 9 object(s): [32, 128) 'q_name_oid.i.i' (line 510) [160, 416) 'name_buffer.i.i' (line 511) [480, 488) 'buffer_size.i.i' (line 512) [512, 516) 'result.i.i' (line 513) [528, 624) 'q_next_oid.i.i' (line 529) [656, 752) 'recv_oid.i.i' (line 529) [784, 792) 'recv_items.i.i' (line 531) [816, 1071) 'buf' (line 611) [1136, 1256) 'iter' (line 614) <== Memory access at offset 1136 partially overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: memcpy-param-overlap /home/mcuee/build/hidapi_pr730/freebsd/hid.c:535:2 in hid_get_next_from_oid ==17789==ABORTING ```
mcuee commented 2025-03-29 21:39:27 -05:00 (Migrated from github.com)

lldb does not seem to give much info.

mcuee@freebsd14:~/build/hidapi_pr730 $ lldb ./build/shared/hidtest/hidtest
(lldb) target create "./build/shared/hidtest/hidtest"
Current executable set to '/home/mcuee/build/hidapi_pr730/build/shared/hidtest/hidtest' (x86_64).
(lldb) r
Process 17816 launched: '/home/mcuee/build/hidapi_pr730/build/shared/hidtest/hidtest' (x86_64)
Process 17816 stopped
* thread #1, name = 'hidtest', stop reason = exec
    frame #0: 0x0000000800305de0
->  0x800305de0: xorq   %rbp, %rbp
    0x800305de3: subq   $0x18, %rsp
    0x800305de7: movq   %rdi, %r12
    0x800305dea: movq   %rsp, %rsi
(lldb) bt
* thread #1, name = 'hidtest', stop reason = exec
  * frame #0: 0x0000000800305de0
(lldb) quit
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y
lldb does not seem to give much info. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ lldb ./build/shared/hidtest/hidtest (lldb) target create "./build/shared/hidtest/hidtest" Current executable set to '/home/mcuee/build/hidapi_pr730/build/shared/hidtest/hidtest' (x86_64). (lldb) r Process 17816 launched: '/home/mcuee/build/hidapi_pr730/build/shared/hidtest/hidtest' (x86_64) Process 17816 stopped * thread #1, name = 'hidtest', stop reason = exec frame #0: 0x0000000800305de0 -> 0x800305de0: xorq %rbp, %rbp 0x800305de3: subq $0x18, %rsp 0x800305de7: movq %rdi, %r12 0x800305dea: movq %rsp, %rsi (lldb) bt * thread #1, name = 'hidtest', stop reason = exec * frame #0: 0x0000000800305de0 (lldb) quit Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y ```
mcuee commented 2025-03-29 21:54:39 -05:00 (Migrated from github.com)

After this is fixed, next test will be using hidapitester.

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd 
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread
After this is fixed, next test will be using hidapitester. ``` mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread ```
aokblast commented 2025-03-30 00:04:34 -05:00 (Migrated from github.com)

I do some small fix. Can you help me on testing this?

I do some small fix. Can you help me on testing this?
mcuee commented 2025-03-30 05:24:26 -05:00 (Migrated from github.com)

No more crashing. But somehow it cannot open any devices.

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

unable to open device

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./build/shared/hidtest/hidtest
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

unable to open device
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./build/static/hidtest/hidtest
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

unable to open device

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 04d8 003f
  path: 0-1:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-3:1.0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (65 bytes)
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 
0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 
0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 
0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 
0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 
0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 
0xff, 0x00, 0x81, 0x00, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-3:1.1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 1ea7 0064
  path: 0-4:1.0
  serial_number: (null)
  Manufacturer: (null)
  Product:      2.4G Mouse
  Release:      200
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (105 bytes)
0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 
0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 
0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 
0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 
0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 
0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 
0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 
0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 
0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 
0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 
0x01, 0x81, 0x06, 0xc0, 0xc0, 
Manufacturer String: Microchip Technology Inc.
Product String: Simple HID Device Demo
Unable to read serial number string
Serial Number String: (0) 
  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04d8 003f
  path: 0-1:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Indexed String 1: Microchip Technology Inc.
Unable to send a feature report: hid_error is not implemented yet
Unable to get a feature report: hid_error is not implemented yet
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
read() timeout
No more crashing. But somehow it cannot open any devices. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. unable to open device mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./build/shared/hidtest/hidtest hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. unable to open device mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./build/static/hidtest/hidtest hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. unable to open device mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 04d8 003f path: 0-1:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04f2 0760 path: 0-3:1.0 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (65 bytes) 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0, Device Found type: 04f2 0760 path: 0-3:1.1 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 1 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 1ea7 0064 path: 0-4:1.0 serial_number: (null) Manufacturer: (null) Product: 2.4G Mouse Release: 200 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (105 bytes) 0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xc0, 0xc0, Manufacturer String: Microchip Technology Inc. Product String: Simple HID Device Demo Unable to read serial number string Serial Number String: (0) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04d8 003f path: 0-1:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Indexed String 1: Microchip Technology Inc. Unable to send a feature report: hid_error is not implemented yet Unable to get a feature report: hid_error is not implemented yet waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... read() timeout ```
aokblast commented 2025-03-30 05:54:08 -05:00 (Migrated from github.com)

Please load the hidraw driver first by

sudo kldload hidraw
Please load the hidraw driver first by ``` sudo kldload hidraw ```
mcuee commented 2025-03-30 05:57:08 -05:00 (Migrated from github.com)

Please load the hidraw driver first by

sudo kldload hidraw

I have done that but somehow the HID devices are not recognized by hidraw driver, only by ugen and uhid.

mcuee@freebsd14:~/build $ sudo kldload hidraw
kldload: can't load hidraw: module already loaded or in kernel

mcuee@freebsd14:~/build $ sudo kldstat | grep hid
 4    1 0xffffffff8270e000     7928 hidraw.ko
 5    3 0xffffffff82716000     7868 hidbus.ko
16    1 0xffffffff83441000     3360 uhid.ko
17    1 0xffffffff83445000     33c0 usbhid.ko

mcuee@freebsd14:~/build $ cat /boot/loader.conf
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
hidraw_load="YES"

mcuee@freebsd14:~/build $ sudo lsusb
Bus /dev/usb Device /dev/ugen0.3: ID 0925:1234 Lakeview Research 
Bus /dev/usb Device /dev/ugen0.2: ID 04d8:003f Microchip Technology, Inc. 
Bus /dev/usb Device /dev/ugen0.6: ID 13d3:3503 IMC Networks 
Bus /dev/usb Device /dev/ugen0.5: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better]
Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  

mcuee@freebsd14:~/build $ sudo ls -la /dev/uhid*
crw-r--r--  1 root operator  0x69 Mar 30 18:44 /dev/uhid0
crw-r--r--  1 root operator 0x187 Mar 30 18:31 /dev/uhid1
crw-r--r--  1 root operator  0x6b Mar 30 18:50 /dev/uhid2

mcuee@freebsd14:~/build $ sudo ls -la /dev/hidraw*
ls: /dev/hidraw*: No such file or directory

mcuee@freebsd14:~/build $ uname -a
FreeBSD freebsd14 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 04f2 0760
  path: 0-3:1.0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (65 bytes)
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 
0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 
0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 
0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 
0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 
0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 
0xff, 0x00, 0x81, 0x00, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-3:1.1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 1ea7 0064
  path: 0-4:1.0
  serial_number: (null)
  Manufacturer: (null)
  Product:      2.4G Mouse
  Release:      200
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (105 bytes)
0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 
0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 
0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 
0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 
0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 
0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 
0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 
0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 
0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 
0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 
0x01, 0x81, 0x06, 0xc0, 0xc0, 
Device Found
  type: 04d8 003f
  path: 0-1:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 0925 1234
  path: 0-2:1.0
  serial_number: (null)
  Manufacturer: CYPRESS
  Product:      EZ-USB FX2 HID USBHIDIO
  Release:      0
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (52 bytes)
0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 
0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 
0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 
0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 
0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 
0xc0, 0xc0, 
Manufacturer String: Microchip Technology Inc.
Product String: Simple HID Device Demo
Unable to read serial number string
Serial Number String: (0) 
  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04d8 003f
  path: 0-1:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Indexed String 1: Microchip Technology Inc.
Unable to send a feature report: hid_error is not implemented yet
Unable to get a feature report: hid_error is not implemented yet
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
read() timeout

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

unable to open device
> Please load the hidraw driver first by > > ``` > sudo kldload hidraw > ``` I have done that but somehow the HID devices are not recognized by hidraw driver, only by ugen and uhid. ``` mcuee@freebsd14:~/build $ sudo kldload hidraw kldload: can't load hidraw: module already loaded or in kernel mcuee@freebsd14:~/build $ sudo kldstat | grep hid 4 1 0xffffffff8270e000 7928 hidraw.ko 5 3 0xffffffff82716000 7868 hidbus.ko 16 1 0xffffffff83441000 3360 uhid.ko 17 1 0xffffffff83445000 33c0 usbhid.ko mcuee@freebsd14:~/build $ cat /boot/loader.conf kern.geom.label.disk_ident.enable="0" kern.geom.label.gptid.enable="0" cryptodev_load="YES" zfs_load="YES" hidraw_load="YES" mcuee@freebsd14:~/build $ sudo lsusb Bus /dev/usb Device /dev/ugen0.3: ID 0925:1234 Lakeview Research Bus /dev/usb Device /dev/ugen0.2: ID 04d8:003f Microchip Technology, Inc. Bus /dev/usb Device /dev/ugen0.6: ID 13d3:3503 IMC Networks Bus /dev/usb Device /dev/ugen0.5: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better] Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 mcuee@freebsd14:~/build $ sudo ls -la /dev/uhid* crw-r--r-- 1 root operator 0x69 Mar 30 18:44 /dev/uhid0 crw-r--r-- 1 root operator 0x187 Mar 30 18:31 /dev/uhid1 crw-r--r-- 1 root operator 0x6b Mar 30 18:50 /dev/uhid2 mcuee@freebsd14:~/build $ sudo ls -la /dev/hidraw* ls: /dev/hidraw*: No such file or directory mcuee@freebsd14:~/build $ uname -a FreeBSD freebsd14 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 04f2 0760 path: 0-3:1.0 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (65 bytes) 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0, Device Found type: 04f2 0760 path: 0-3:1.1 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 1 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 1ea7 0064 path: 0-4:1.0 serial_number: (null) Manufacturer: (null) Product: 2.4G Mouse Release: 200 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (105 bytes) 0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xc0, 0xc0, Device Found type: 04d8 003f path: 0-1:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 0925 1234 path: 0-2:1.0 serial_number: (null) Manufacturer: CYPRESS Product: EZ-USB FX2 HID USBHIDIO Release: 0 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (52 bytes) 0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 0xc0, 0xc0, Manufacturer String: Microchip Technology Inc. Product String: Simple HID Device Demo Unable to read serial number string Serial Number String: (0) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04d8 003f path: 0-1:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Indexed String 1: Microchip Technology Inc. Unable to send a feature report: hid_error is not implemented yet Unable to get a feature report: hid_error is not implemented yet waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... read() timeout mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. unable to open device ```
aokblast commented 2025-03-30 06:57:47 -05:00 (Migrated from github.com)

I found the reason. There are two usb hid driver in FreeBSD. One is uhid, another is usbhid. Only usbhid is compatible with hidraw. Also, unload and try to load usbhid is useless. The effective way to enable usbhid is through

 sudo sysctl hw.usb.usbhid.enable=1

Then when next time it is auto-loaded, the usbhid will replace the uhid:

sudo kldunload uhid.

If uhid is not auto reload:

sudo kldload uhid
I found the reason. There are two usb hid driver in FreeBSD. One is uhid, another is usbhid. Only usbhid is compatible with hidraw. Also, unload and try to load usbhid is useless. The effective way to enable usbhid is through ``` sudo sysctl hw.usb.usbhid.enable=1 ``` Then when next time it is auto-loaded, the usbhid will replace the uhid: ``` sudo kldunload uhid. ``` If uhid is not auto reload: ``` sudo kldload uhid ```
Youw commented 2025-03-30 09:33:31 -05:00 (Migrated from github.com)

Oops. I forget we have udev-devd stuff. Maybe we should use udev also?

I lost context here. What for? Seem like you have all the functionality implemented already. Aren't you?

Yes, all functionality is fully implemented. I am just thinking if we should use libudev make hidapi more portable.

If udev is generally available on FreeBSD and can be used in a similar way as in Linux/hidraw - it is probably a good idea to do so. And probably linux shouldn't be used in that case at all.
But I imagine that is a large change to this PR, so it is up to you.

> > > Oops. I forget we have udev-devd stuff. Maybe we should use udev also? > > > > > > I lost context here. What for? Seem like you have all the functionality implemented already. Aren't you? > > Yes, all functionality is fully implemented. I am just thinking if we should use libudev make hidapi more portable. If udev is generally available on FreeBSD and can be used in a similar way as in Linux/hidraw - it is probably a good idea to do so. And probably linux shouldn't be used in that case at all. But I imagine that is a large change to this PR, so it is up to you.
mcuee commented 2025-03-31 08:22:07 -05:00 (Migrated from github.com)

I found the reason. There are two usb hid driver in FreeBSD. One is uhid, another is usbhid. Only usbhid is compatible with hidraw. Also, unload and try to load usbhid is useless. The effective way to enable usbhid is through

 sudo sysctl hw.usb.usbhid.enable=1

Then when next time it is auto-loaded, the usbhid will replace the uhid:

sudo kldunload uhid.

If uhid is not auto reload:

sudo kldload uhid

Thanks. This method works to get hidraw to bound to the device.

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ls -la /dev/uhid*
ls: /dev/uhid*: No such file or directory
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ls -la /dev/hidraw*
crw-------  1 root operator 0x17f Mar 31 21:08 /dev/hidraw0
crw-------  1 root operator 0x180 Mar 31 21:08 /dev/hidraw1
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 04d8 003f
  path: 0-2:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 1ea7 0064
  path: 0-3:1.0
  serial_number: (null)
  Manufacturer: (null)
  Product:      2.4G Mouse
  Release:      200
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (105 bytes)
0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 
0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 
0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 
0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 
0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 
0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 
0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 
0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 
0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 
0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 
0x01, 0x81, 0x06, 0xc0, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-4:1.0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (65 bytes)
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 
0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 
0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 
0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 
0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 
0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 
0xff, 0x00, 0x81, 0x00, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-4:1.1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Manufacturer String: Microchip Technology Inc.
Product String: Simple HID Device Demo
Unable to read serial number string
Serial Number String: (0) 
  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04d8 003f
  path: 0-2:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Indexed String 1: Microchip Technology Inc.
Unable to send a feature report: hid_error is not implemented yet
Unable to get a feature report: hid_error is not implemented yet
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
read() timeout
> I found the reason. There are two usb hid driver in FreeBSD. One is uhid, another is usbhid. Only usbhid is compatible with hidraw. Also, unload and try to load usbhid is useless. The effective way to enable usbhid is through > > ``` > sudo sysctl hw.usb.usbhid.enable=1 > ``` > > Then when next time it is auto-loaded, the usbhid will replace the uhid: > > ``` > sudo kldunload uhid. > ``` > > If uhid is not auto reload: > > ``` > sudo kldload uhid > ``` Thanks. This method works to get hidraw to bound to the device. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ls -la /dev/uhid* ls: /dev/uhid*: No such file or directory mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ls -la /dev/hidraw* crw------- 1 root operator 0x17f Mar 31 21:08 /dev/hidraw0 crw------- 1 root operator 0x180 Mar 31 21:08 /dev/hidraw1 mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 04d8 003f path: 0-2:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 1ea7 0064 path: 0-3:1.0 serial_number: (null) Manufacturer: (null) Product: 2.4G Mouse Release: 200 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (105 bytes) 0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xc0, 0xc0, Device Found type: 04f2 0760 path: 0-4:1.0 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (65 bytes) 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0, Device Found type: 04f2 0760 path: 0-4:1.1 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 1 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Manufacturer String: Microchip Technology Inc. Product String: Simple HID Device Demo Unable to read serial number string Serial Number String: (0) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04d8 003f path: 0-2:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Indexed String 1: Microchip Technology Inc. Unable to send a feature report: hid_error is not implemented yet Unable to get a feature report: hid_error is not implemented yet waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... read() timeout ```
mcuee commented 2025-03-31 08:24:57 -05:00 (Migrated from github.com)

However, hidtest-hidraw is still problematic --> it cannot be stopped and keep repeating with the test device.

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw > hidraw_freebsd_hidtest.txt
^C
mcuee@freebsd14:~/build/hidapi_pr730 $ head -200 hidraw_freebsd_hidtest.txt
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x80 (0x1)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xc)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Manufacturer String: Microchip Technology Inc.
Product String: Microchip Technology Inc. Simple HID Device Demo
Serial Number String: (0) 
  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Device Found

However, `hidtest-hidraw` is still problematic --> it cannot be stopped and keep repeating with the test device. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw > hidraw_freebsd_hidtest.txt ^C mcuee@freebsd14:~/build/hidapi_pr730 $ head -200 hidraw_freebsd_hidtest.txt hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x80 (0x1) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xc) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Manufacturer String: Microchip Technology Inc. Product String: Microchip Technology Inc. Simple HID Device Demo Serial Number String: (0) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Device Found ```
mcuee commented 2025-03-31 08:32:18 -05:00 (Migrated from github.com)

If I unlug the test device and plug in another device, then it is working.

mcuee@freebsd14:~/build/fx2hid/fx2hid_128bytes_report/fx2hid_128bytes $ sudo fxload -t fx2lp -I fx2hid.hex -D vid=0x04b4,pid=0x8613

mcuee@freebsd14:~/build/fx2hid/fx2hid_128bytes_report/fx2hid_128bytes $ sudo lsusb
Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research 
Bus /dev/usb Device /dev/ugen0.5: ID 13d3:3503 IMC Networks 
Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard
Bus /dev/usb Device /dev/ugen0.3: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better]
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  

mcuee@freebsd14:~/build/fx2hid/fx2hid_128bytes_report/fx2hid_128bytes $ sudo ls -la /dev/hidraw*
crw-------  1 root operator 0x191 Mar 31 21:29 /dev/hidraw0
crw-------  1 root operator 0x180 Mar 31 21:08 /dev/hidraw1

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 1ea7 0064
  path: 0-3:1.0
  serial_number: (null)
  Manufacturer: (null)
  Product:      2.4G Mouse
  Release:      200
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (105 bytes)
0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 
0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 
0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 
0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 
0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 
0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 
0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 
0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 
0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 
0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 
0x01, 0x81, 0x06, 0xc0, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-4:1.0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (65 bytes)
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 
0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 
0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 
0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 
0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 
0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 
0xff, 0x00, 0x81, 0x00, 0xc0, 
Device Found
  type: 04f2 0760
  path: 0-4:1.1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 0925 1234
  path: 0-2:1.0
  serial_number: (null)
  Manufacturer: CYPRESS
  Product:      EZ-USB FX2 HID USBHIDIO
  Release:      0
  Interface:    0
  Usage (page): 0x0 (0x0)
  Bus type: 1 (USB)

  Report Descriptor: (52 bytes)
0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 
0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 
0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 
0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 
0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 
0xc0, 0xc0, 
unable to open device
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 0925 1234
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: CYPRESS
  Product:      CYPRESS EZ-USB FX2 HID USBHIDIO
  Release:      0
  Interface:    0
  Usage (page): 0x1 (0xffa0)
  Bus type: 1 (USB)

  Report Descriptor: (52 bytes)
0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 
0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 
0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 
0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 
0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 
0xc0, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x80 (0x1)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xc)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
unable to open device
If I unlug the test device and plug in another device, then it is working. ``` mcuee@freebsd14:~/build/fx2hid/fx2hid_128bytes_report/fx2hid_128bytes $ sudo fxload -t fx2lp -I fx2hid.hex -D vid=0x04b4,pid=0x8613 mcuee@freebsd14:~/build/fx2hid/fx2hid_128bytes_report/fx2hid_128bytes $ sudo lsusb Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research Bus /dev/usb Device /dev/ugen0.5: ID 13d3:3503 IMC Networks Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard Bus /dev/usb Device /dev/ugen0.3: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better] Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 mcuee@freebsd14:~/build/fx2hid/fx2hid_128bytes_report/fx2hid_128bytes $ sudo ls -la /dev/hidraw* crw------- 1 root operator 0x191 Mar 31 21:29 /dev/hidraw0 crw------- 1 root operator 0x180 Mar 31 21:08 /dev/hidraw1 mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-libusb hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 1ea7 0064 path: 0-3:1.0 serial_number: (null) Manufacturer: (null) Product: 2.4G Mouse Release: 200 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (105 bytes) 0x06, 0xb5, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0xb5, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x81, 0x02, 0x09, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x07, 0x91, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08, 0x15, 0x00, 0x25, 0x01, 0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xc0, 0xc0, Device Found type: 04f2 0760 path: 0-4:1.0 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (65 bytes) 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0, Device Found type: 04f2 0760 path: 0-4:1.1 serial_number: (null) Manufacturer: Chicony Product: USB Keyboard Release: 100 Interface: 1 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 0925 1234 path: 0-2:1.0 serial_number: (null) Manufacturer: CYPRESS Product: EZ-USB FX2 HID USBHIDIO Release: 0 Interface: 0 Usage (page): 0x0 (0x0) Bus type: 1 (USB) Report Descriptor: (52 bytes) 0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 0xc0, 0xc0, unable to open device mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 0925 1234 path: /dev/hidraw0 serial_number: (null) Manufacturer: CYPRESS Product: CYPRESS EZ-USB FX2 HID USBHIDIO Release: 0 Interface: 0 Usage (page): 0x1 (0xffa0) Bus type: 1 (USB) Report Descriptor: (52 bytes) 0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 0xc0, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x80 (0x1) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xc) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, unable to open device ```
mcuee commented 2025-03-31 08:33:48 -05:00 (Migrated from github.com)

@aokblast

Looks like it is getting close. To reproduce the above issue, you can probably change hidtest example to open one of your HID device instead of 04d8:003f.

@aokblast Looks like it is getting close. To reproduce the above issue, you can probably change hidtest example to open one of your HID device instead of 04d8:003f.
mcuee commented 2025-03-31 08:44:45 -05:00 (Migrated from github.com)

Using hidapitester and the FX2HID example to test.

Unfortunately the new hidraw backend does not work. The old libusb backend has the issue mentioned in #274.

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_hidraw_pr730 

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd clean
rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_libusb_pr730

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730 clean
rm -f ../hidapi_pr730/libusb/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device

Using hidapitester and the FX2HID example to test. Unfortunately the new hidraw backend does not work. The old libusb backend has the issue mentioned in #274. ``` mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_hidraw_pr730 mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd clean rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o rm -f hidapitester mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730 cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_libusb_pr730 mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730 clean rm -f ../hidapi_pr730/libusb/hid.o hidapitester.o rm -f hidapitester mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device ```
aokblast commented 2025-03-31 11:09:08 -05:00 (Migrated from github.com)

The loop problem should be fix. Still investigate the read error.

The loop problem should be fix. Still investigate the read error.
aokblast commented 2025-03-31 11:46:22 -05:00 (Migrated from github.com)

Emm I cannot reproduce the problem. If the hid interrupt sucessfully triggered. I can receive the event by hid_read. At least I have tested with my keyboard.

Emm I cannot reproduce the problem. If the hid interrupt sucessfully triggered. I can receive the event by hid_read. At least I have tested with my keyboard.
mcuee commented 2025-03-31 18:18:02 -05:00 (Migrated from github.com)

The loop problem should be fix. Still investigate the read error.

Yes this has been fixed.

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo sysctl hw.usb.usbhid.enable=1
hw.usb.usbhid.enable: 0 -> 1
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo kldunload uhid
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo lsusb
Bus /dev/usb Device /dev/ugen0.6: ID 04d8:003f Microchip Technology, Inc. 
Bus /dev/usb Device /dev/ugen0.5: ID 13d3:3503 IMC Networks 
Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard
Bus /dev/usb Device /dev/ugen0.3: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better]
Bus /dev/usb Device /dev/ugen0.2: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  
mcuee@freebsd14:~/build/hidapi_pr730 $ ls -la /dev/hid*
crw-------  1 root operator 0x185 Apr  1 07:16 /dev/hidraw0
crw-------  1 root operator 0x18d Apr  1 07:16 /dev/hidraw1
mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x80 (0x1)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xc)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Manufacturer String: Microchip Technology Inc.
Product String: Microchip Technology Inc. Simple HID Device Demo
Serial Number String: (0) 
  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Unable to read indexed string 1
Indexed String 1: 
Unable to send a feature report: ioctl (SFEATURE): Input/output error
Unable to get a feature report: ioctl (GFEATURE): Input/output error
Unable to write(): Invalid argument
Unable to write()/2: Invalid argument
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
read() timeout
> The loop problem should be fix. Still investigate the read error. Yes this has been fixed. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ sudo sysctl hw.usb.usbhid.enable=1 hw.usb.usbhid.enable: 0 -> 1 mcuee@freebsd14:~/build/hidapi_pr730 $ sudo kldunload uhid mcuee@freebsd14:~/build/hidapi_pr730 $ sudo lsusb Bus /dev/usb Device /dev/ugen0.6: ID 04d8:003f Microchip Technology, Inc. Bus /dev/usb Device /dev/ugen0.5: ID 13d3:3503 IMC Networks Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard Bus /dev/usb Device /dev/ugen0.3: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better] Bus /dev/usb Device /dev/ugen0.2: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 mcuee@freebsd14:~/build/hidapi_pr730 $ ls -la /dev/hid* crw------- 1 root operator 0x185 Apr 1 07:16 /dev/hidraw0 crw------- 1 root operator 0x18d Apr 1 07:16 /dev/hidraw1 mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x80 (0x1) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xc) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Manufacturer String: Microchip Technology Inc. Product String: Microchip Technology Inc. Simple HID Device Demo Serial Number String: (0) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Unable to read indexed string 1 Indexed String 1: Unable to send a feature report: ioctl (SFEATURE): Input/output error Unable to get a feature report: ioctl (GFEATURE): Input/output error Unable to write(): Invalid argument Unable to write()/2: Invalid argument waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... read() timeout ```
mcuee commented 2025-03-31 18:51:08 -05:00 (Migrated from github.com)

If I use the original fx2hid example (loop back of two bytes output report and input report), it seems to me this PR works fine.
http://janaxelson.com/hidpage.htm
http://janaxelson.com/files/fx2hid.zip

mcuee@freebsd14:~/build/fx2hid/fx2hid $ sudo sudo fxload -t fx2lp -I fx2hid.hex -D vid=0x04b4,pid=0x8613
mcuee@freebsd14:~/build/fx2hid/fx2hid $ sudo lsusb
Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research 
Bus /dev/usb Device /dev/ugen0.6: ID 04d8:003f Microchip Technology, Inc. 
Bus /dev/usb Device /dev/ugen0.5: ID 13d3:3503 IMC Networks 
Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard
Bus /dev/usb Device /dev/ugen0.3: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better]
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  

mcuee@freebsd14:~/build/fx2hid/fx2hid $ sudo ls -la /dev/hidraw*
crw-------  1 root operator 0x185 Apr  1 07:16 /dev/hidraw0
crw-------  1 root operator 0x18d Apr  1 07:16 /dev/hidraw1
crw-------  1 root operator 0x196 Apr  1 07:28 /dev/hidraw2

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 0925 1234
  path: /dev/hidraw2
  serial_number: (null)
  Manufacturer: CYPRESS
  Product:      CYPRESS EZ-USB FX2 HID USBHIDIO
  Release:      0
  Interface:    0
  Usage (page): 0x1 (0xffa0)
  Bus type: 1 (USB)

  Report Descriptor: (52 bytes)
0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 
0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 
0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x02, 
0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 
0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x02, 0x91, 0x02, 
0xc0, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x80 (0x1)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xc)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Manufacturer String: Microchip Technology Inc.
Product String: Microchip Technology Inc. Simple HID Device Demo
Serial Number String: (0) 
  Report Descriptor: (28 bytes)
0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 
0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 
0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, 
Device Found
  type: 04d8 003f
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Microchip Technology Inc. Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

Unable to read indexed string 1
Indexed String 1: 
Unable to send a feature report: ioctl (SFEATURE): Input/output error
Unable to get a feature report: ioctl (GFEATURE): Input/output error
Unable to write(): Invalid argument
Unable to write()/2: Invalid argument
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
read() timeout

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 3 -l 3 --send-output 0,1,2 --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 3 -l 3 --send-output 0,1,2 --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device
If I use the original fx2hid example (loop back of two bytes output report and input report), it seems to me this PR works fine. http://janaxelson.com/hidpage.htm http://janaxelson.com/files/fx2hid.zip ``` mcuee@freebsd14:~/build/fx2hid/fx2hid $ sudo sudo fxload -t fx2lp -I fx2hid.hex -D vid=0x04b4,pid=0x8613 mcuee@freebsd14:~/build/fx2hid/fx2hid $ sudo lsusb Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research Bus /dev/usb Device /dev/ugen0.6: ID 04d8:003f Microchip Technology, Inc. Bus /dev/usb Device /dev/ugen0.5: ID 13d3:3503 IMC Networks Bus /dev/usb Device /dev/ugen0.4: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard Bus /dev/usb Device /dev/ugen0.3: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better] Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 mcuee@freebsd14:~/build/fx2hid/fx2hid $ sudo ls -la /dev/hidraw* crw------- 1 root operator 0x185 Apr 1 07:16 /dev/hidraw0 crw------- 1 root operator 0x18d Apr 1 07:16 /dev/hidraw1 crw------- 1 root operator 0x196 Apr 1 07:28 /dev/hidraw2 mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 0925 1234 path: /dev/hidraw2 serial_number: (null) Manufacturer: CYPRESS Product: CYPRESS EZ-USB FX2 HID USBHIDIO Release: 0 Interface: 0 Usage (page): 0x1 (0xffa0) Bus type: 1 (USB) Report Descriptor: (52 bytes) 0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x02, 0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x02, 0x91, 0x02, 0xc0, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x80 (0x1) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xc) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw1 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Manufacturer String: Microchip Technology Inc. Product String: Microchip Technology Inc. Simple HID Device Demo Serial Number String: (0) Report Descriptor: (28 bytes) 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x19, 0x01, 0x29, 0x40, 0x15, 0x01, 0x25, 0x40, 0x75, 0x08, 0x95, 0x40, 0x81, 0x00, 0x19, 0x01, 0x29, 0x40, 0x91, 0x00, 0xc0, Device Found type: 04d8 003f path: /dev/hidraw0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Microchip Technology Inc. Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Unable to read indexed string 1 Indexed String 1: Unable to send a feature report: ioctl (SFEATURE): Input/output error Unable to get a feature report: ioctl (GFEATURE): Input/output error Unable to write(): Invalid argument Unable to write()/2: Invalid argument waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... read() timeout mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 3 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 3 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device ```
aokblast commented 2025-04-01 06:01:52 -05:00 (Migrated from github.com)

Using hidapitester and the FX2HID example to test.

Unfortunately the new hidraw backend does not work. The old libusb backend has the issue mentioned in #274.

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_hidraw_pr730 

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd clean
rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_libusb_pr730

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730 clean
rm -f ../hidapi_pr730/libusb/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device

I read the issue he describe. So you think it is because usbhid does pass interrupt that report more 64bytes?

> Using hidapitester and the FX2HID example to test. > > Unfortunately the new hidraw backend does not work. The old libusb backend has the issue mentioned in #274. > > ``` > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd > cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o > cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o > cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread > > mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_hidraw_pr730 > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd clean > rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o > rm -f hidapitester > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730 > cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o > cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread > > mcuee@freebsd14:~/build/hidapitester $ mv hidapitester hidapitester_freebsd_libusb_pr730 > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730 clean > rm -f ../hidapi_pr730/libusb/hid.o hidapitester.o > rm -f hidapitester > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 129-bytes...wrote 129 bytes: > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > 80 > Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: > 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 > 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 129-bytes...wrote 129 bytes: > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > 80 > Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: > Closing device > ``` I read the issue he describe. So you think it is because usbhid does pass interrupt that report more 64bytes?
mcuee commented 2025-04-01 06:40:18 -05:00 (Migrated from github.com)

Using hidapitester and the FX2HID example to test.
Unfortunately the new hidraw backend does not work. The old libusb backend has the issue mentioned in #274.

I read the issue he describe. So you think it is because usbhid does pass interrupt that report more 64bytes?

No, I am not so sure why this PR (FreeBSD usbhid/hidraw backend) does not work with HID device with reports length greater than 64 bytes.

The original libusb implementation under Linux/FreeBSD will suffer from #274. #728 is supposed to fix that but unfortunately it does not work for me.

Just wondering if which version of FreeBSD you are using to test this PR. Thanks. I will try to test with FreeBSD 14.2 Release as well to see if that makes any difference.

> > Using hidapitester and the FX2HID example to test. > > Unfortunately the new hidraw backend does not work. The old libusb backend has the issue mentioned in #274. > I read the issue he describe. So you think it is because usbhid does pass interrupt that report more 64bytes? No, I am not so sure why this PR (FreeBSD usbhid/hidraw backend) does not work with HID device with reports length greater than 64 bytes. The original libusb implementation under Linux/FreeBSD will suffer from #274. #728 is supposed to fix that but unfortunately it does not work for me. * #274 * #728 Just wondering if which version of FreeBSD you are using to test this PR. Thanks. I will try to test with FreeBSD 14.2 Release as well to see if that makes any difference.
mcuee commented 2025-04-01 06:43:38 -05:00 (Migrated from github.com)

@wulf7

It will be greatly appreciated that you can take a look at this PR. Thanks.

Just wondering if FreeBSD hidraw implementation has any limitation with regard to report length. Thanks.

@wulf7 It will be greatly appreciated that you can take a look at this PR. Thanks. Just wondering if FreeBSD hidraw implementation has any limitation with regard to report length. Thanks.
aokblast commented 2025-04-01 06:47:35 -05:00 (Migrated from github.com)

I think it is the problem but I have no way to verify it.

The hidraw works as follow:

  1. hidraw register a interrupt to parent device(hidbus)
  2. hidbus register a interrupt to parent device(usbhid, iichid .. etc)
  3. usbhid register interrupt config to usb_bus
  4. usb_bus read device speed and limit the packet size according to the speed.
I think it is the problem but I have no way to verify it. The hidraw works as follow: 1. hidraw register a interrupt to parent device(hidbus) 2. hidbus register a interrupt to parent device(usbhid, iichid .. etc) 3. usbhid register interrupt config to usb_bus 4. usb_bus read device speed and limit the packet size according to the speed.
aokblast commented 2025-04-01 06:59:34 -05:00 (Migrated from github.com)

@mcuee If I would like to build the test environment like you, I have to buy a development board like this, right?

@mcuee If I would like to build the test environment like you, I have to buy a development board like [this](https://www.elecrow.com/ezusb-fx2lp-cy7c68013a-usb-development-board-p-787.html?srsltid=AfmBOor8w76JawXIOXxAjo9GkjkJ9NR2LmoTd1aQaDW_P5lMm3-kcjtw), right?
aokblast commented 2025-04-01 07:05:57 -05:00 (Migrated from github.com)

4. device

I tested this PR with 15.0 which is compiled 1 weeks ago.

> 4\. device I tested this PR with 15.0 which is compiled 1 weeks ago.
mcuee commented 2025-04-01 07:08:10 -05:00 (Migrated from github.com)

@mcuee If I would like to build the test environment like you, I have to buy a development board like this, right?

Yes, that is the one I am using now.

If you buy from AliExpress, maybe it will be even cheaper.

> @mcuee If I would like to build the test environment like you, I have to buy a development board like [this](https://www.elecrow.com/ezusb-fx2lp-cy7c68013a-usb-development-board-p-787.html?srsltid=AfmBOor8w76JawXIOXxAjo9GkjkJ9NR2LmoTd1aQaDW_P5lMm3-kcjtw), right? Yes, that is the one I am using now. If you buy from AliExpress, maybe it will be even cheaper.
Youw (Migrated from github.com) reviewed 2025-04-03 10:18:27 -05:00
@ -0,0 +488,4 @@
}
libusb_free_device_list(list, 1);
return handler;
Youw (Migrated from github.com) commented 2025-04-03 10:18:27 -05:00

before return: if (handle == NULL) - register_global_error

before return: `if (handle == NULL)` - register_global_error
Youw (Migrated from github.com) reviewed 2025-04-03 10:19:28 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-03 10:19:27 -05:00
		register_global_error_format("hid_find_device_handle_by_bus_and_port: %s", libusb_strerror(num_devs));

libusb doesn't specify that it would set the errno

```suggestion register_global_error_format("hid_find_device_handle_by_bus_and_port: %s", libusb_strerror(num_devs)); ``` libusb doesn't specify that it would set the `errno`
Youw (Migrated from github.com) reviewed 2025-04-03 10:24:38 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-03 10:24:38 -05:00

I don't see where we're registering device error in case of failure

I don't see where we're registering device error in case of failure
Youw (Migrated from github.com) reviewed 2025-04-03 10:24:58 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-03 10:24:58 -05:00

this is a copy-paste and not accurate

this is a copy-paste and not accurate
Youw (Migrated from github.com) reviewed 2025-04-03 10:34:30 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-03 10:34:30 -05:00

we set a device_path inside of hid_open_path, and user may provide a simlink, which may not be in format /dev/hidrawX

I'm thinking maybe resolving symlinks would help inside of hid_open_path, but I don't know if there could be other special files that are hidraw devices but not located at /dev/hidrawX but otherwise a valid hidraw devices...

(at least on Linux I believe something like that possible with udev rules)

we set a `device_path` inside of `hid_open_path`, and user may provide a simlink, which may not be in format `/dev/hidrawX` I'm thinking maybe resolving symlinks would help inside of `hid_open_path`, but I don't know if there could be other special files that are hidraw devices but not located at `/dev/hidrawX` but otherwise a valid hidraw devices... (at least on Linux I believe something like that possible with udev rules)
Youw (Migrated from github.com) reviewed 2025-04-03 10:37:59 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-03 10:37:59 -05:00

and looks like we're leaking devinfo here
and why do we skip the first element?

and looks like we're leaking `devinfo` here and why do we skip the first element?
aokblast (Migrated from github.com) reviewed 2025-04-03 11:11:23 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
aokblast (Migrated from github.com) commented 2025-04-03 11:11:22 -05:00

Fix first problem.

For second problem, please see the comment at hid_create_device_info_by_hidraw_idx.
This function return the last element. Before return, it set the next element of the last element as the first element.
So using devinfo->next actually get the first element. Also, we have to set the devinfo->next = NULL as it point to the first element. That is the reason why we have infinity loop previously.

Fix first problem. For second problem, please see the comment at hid_create_device_info_by_hidraw_idx. This function return the last element. Before return, it set the next element of the last element as the first element. So using devinfo->next actually get the first element. Also, we have to set the devinfo->next = NULL as it point to the first element. That is the reason why we have infinity loop previously.
Youw (Migrated from github.com) reviewed 2025-04-03 11:33:44 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-03 11:33:44 -05:00
		register_global_error_format("hid_find_device_handle_by_bus_and_port: %s", libusb_strerror(error));
```suggestion register_global_error_format("hid_find_device_handle_by_bus_and_port: %s", libusb_strerror(error)); ```
Youw commented 2025-04-04 05:52:55 -05:00 (Migrated from github.com)

ignore Archlinux failure and revert your CI changes - not related to this PR - master is failing as well, I'll check

ignore Archlinux failure and revert your CI changes - not related to this PR - master is failing as well, I'll check
aokblast commented 2025-04-12 05:14:23 -05:00 (Migrated from github.com)

I am stupid. The get report and set report should return the actual length. @mcuee could you please help me test again?

I am stupid. The get report and set report should return the actual length. @mcuee could you please help me test again?
mcuee commented 2025-04-13 00:38:13 -05:00 (Migrated from github.com)

Somehow it still does not work.

mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw 
hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 0925 1234
  path: /dev/hidraw1
  serial_number: (null)
  Manufacturer: CYPRESS
  Product:      CYPRESS EZ-USB FX2 HID USBHIDIO
  Release:      0
  Interface:    0
  Usage (page): 0x1 (0xffa0)
  Bus type: 1 (USB)

  Report Descriptor: (52 bytes)
0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 
0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 
0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 
0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 
0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 
0xc0, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x80 (0x1)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xc)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
Device Found
  type: 04f2 0760
  path: /dev/hidraw0
  serial_number: (null)
  Manufacturer: Chicony
  Product:      Chicony USB Keyboard
  Release:      100
  Interface:    1
  Usage (page): 0x1 (0xff00)
  Bus type: 1 (USB)

  Report Descriptor: (127 bytes)
0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 
0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 
0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 
0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 
0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 
0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 
0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 
0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 
0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 
0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 
0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 
0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 
0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, 
unable to open device


mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device

Somehow it still does not work. ``` mcuee@freebsd14:~/build/hidapi_pr730 $ sudo ./hidtest/hidtest-hidraw hidapi test/example tool. Compiled with hidapi version 0.15.0, runtime version 0.15.0. Compile-time version matches runtime version of hidapi. Device Found type: 0925 1234 path: /dev/hidraw1 serial_number: (null) Manufacturer: CYPRESS Product: CYPRESS EZ-USB FX2 HID USBHIDIO Release: 0 Interface: 0 Usage (page): 0x1 (0xffa0) Bus type: 1 (USB) Report Descriptor: (52 bytes) 0x06, 0xa0, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x02, 0xa1, 0x00, 0x06, 0xa1, 0xff, 0x09, 0x03, 0x09, 0x04, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x81, 0x02, 0x09, 0x05, 0x09, 0x06, 0x15, 0x80, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x75, 0x08, 0x95, 0x80, 0x91, 0x02, 0xc0, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw0 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x80 (0x1) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw0 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xc) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, Device Found type: 04f2 0760 path: /dev/hidraw0 serial_number: (null) Manufacturer: Chicony Product: Chicony USB Keyboard Release: 100 Interface: 1 Usage (page): 0x1 (0xff00) Bus type: 1 (USB) Report Descriptor: (127 bytes) 0x06, 0x01, 0x00, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x01, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x19, 0xb5, 0x29, 0xb8, 0x09, 0xcd, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x81, 0x02, 0x0a, 0x83, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x92, 0x01, 0x0a, 0x94, 0x01, 0x0a, 0x21, 0x02, 0x1a, 0x23, 0x02, 0x2a, 0x25, 0x02, 0x81, 0x02, 0x0a, 0x26, 0x02, 0x0a, 0x27, 0x02, 0x0a, 0x2a, 0x02, 0x95, 0x03, 0x81, 0x02, 0x95, 0x05, 0x81, 0x01, 0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x02, 0x25, 0x01, 0x15, 0x00, 0x75, 0x01, 0x95, 0x08, 0x1a, 0xf1, 0x00, 0x2a, 0xf8, 0x00, 0x81, 0x02, 0xc0, unable to open device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device ```
wulf7 (Migrated from github.com) reviewed 2025-04-13 06:58:51 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
wulf7 (Migrated from github.com) commented 2025-04-12 07:00:31 -05:00

HID_INPUT_REPORT ?

HID_INPUT_REPORT ?
@ -0,0 +190,4 @@
if (hid_get_name_from_mib(mib, items, name_buffer, sizeof(name_buffer)) == 0)
return -1;
return sscanf(name_buffer, "dev.hidraw.%d", &result) == 1 ? result : -1;
wulf7 (Migrated from github.com) commented 2025-04-12 06:31:45 -05:00

you may add "dev.uhid.%d" nodes here too as they are compatible with hidraw(4) in uhid mode on binary level.

you may add "dev.uhid.%d" nodes here too as they are compatible with hidraw(4) in uhid mode on binary level.
@ -0,0 +629,4 @@
info_template->next = NULL;
hid_device_handle_bus_dependent(&devinfo, info_template, idx);
error = ioctl(fd, HIDIOCGRDESCSIZE, &desc_size);
wulf7 (Migrated from github.com) commented 2025-04-12 06:06:26 -05:00

Please, do not mix uhid and hidraw modes. If you choose uhid mode, replace HIDIOCGRDESCSIZE/HIDIOCGRDESC ioctl pair with HIDRAW_GET_REPORT_DESC

Please, do not mix uhid and hidraw modes. If you choose uhid mode, replace HIDIOCGRDESCSIZE/HIDIOCGRDESC ioctl pair with HIDRAW_GET_REPORT_DESC
@ -0,0 +895,4 @@
int res, desc_size = 0;
/* Make sure this is a HIDRAW device - responds to HIDIOCGRDESCSIZE */
res = ioctl(dev->device_handle, HIDIOCGRDESCSIZE, &desc_size);
wulf7 (Migrated from github.com) commented 2025-04-12 06:11:37 -05:00

In uhid mode it is better to execute e.g. HIDRAW_GET_REPORT_ID ioctl to test availability.

In uhid mode it is better to execute e.g. HIDRAW_GET_REPORT_ID ioctl to test availability.
@ -0,0 +924,4 @@
return -1;
}
bytes_written = write(dev->device_handle, data, length);
wulf7 (Migrated from github.com) commented 2025-04-12 06:18:12 -05:00

Strip leading zero for unnumbered reports. See write section of FreeBSD hidraw(4) man.
Don't forget to account for this byte in return value.

Strip leading zero for unnumbered reports. See `write` section of FreeBSD hidraw(4) man. Don't forget to account for this byte in return value.
wulf7 (Migrated from github.com) commented 2025-04-13 06:58:06 -05:00

HIDRAW_GET_REPORT and HIDRAW_SET_REPORT callers should strip leading zero for unnumbered reports too

HIDRAW_GET_REPORT and HIDRAW_SET_REPORT callers should strip leading zero for unnumbered reports too
Youw (Migrated from github.com) reviewed 2025-04-13 10:27:13 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-13 10:27:13 -05:00

updated my comment: should be error not errno

updated my comment: should be `error` not `errno`
Youw (Migrated from github.com) reviewed 2025-04-13 10:32:21 -05:00
@ -0,0 +924,4 @@
return -1;
}
bytes_written = write(dev->device_handle, data, length);
Youw (Migrated from github.com) commented 2025-04-13 10:32:21 -05:00

@wulf7 are you sure?
I believe this entire implementation should be about hidraw, not uhid, and according to https://man.freebsd.org/cgi/man.cgi?hidraw(4)

In the hidraw mode, the first byte should be set to 0 and the report data itself should begin at the second byte.

I.e. - no strip.

@wulf7 are you sure? I believe this entire implementation should be about `hidraw`, not `uhid`, and according to https://man.freebsd.org/cgi/man.cgi?hidraw(4) > In the hidraw mode, the **_first byte should be set to 0_** and the report data itself should begin at the second byte. I.e. - no strip.
Youw (Migrated from github.com) reviewed 2025-04-13 10:53:48 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
Youw (Migrated from github.com) commented 2025-04-13 10:53:48 -05:00

thans @wulf7 for the hint
We do not want to use HIDRAW_GET_REPORT_DESC here, since it switches operation mode to uhid.
Use HIDIOCGRDESC instead.

thans @wulf7 for the hint We do not want to use `HIDRAW_GET_REPORT_DESC` here, since it [switches operation mode](https://github.com/freebsd/freebsd-src/blob/d8cf519492523f6dd239ab153029db62749afa52/sys/dev/hid/hidraw.c#L643) to `uhid`. Use `HIDIOCGRDESC` instead.
aokblast commented 2025-04-13 21:24:13 -05:00 (Migrated from github.com)

Sorry about the confusing code. I would like to clarify first that I think using hidraw mode is better for supporting non-usb hid device (e.g. iichid). I clean up the code so that there is hidraw mode only.

Sorry about the confusing code. I would like to clarify first that I think using hidraw mode is better for supporting non-usb hid device (e.g. iichid). I clean up the code so that there is hidraw mode only.
aokblast (Migrated from github.com) reviewed 2025-04-13 21:25:26 -05:00
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
aokblast (Migrated from github.com) commented 2025-04-13 21:25:26 -05:00

@mcuee Could you help me test on this. I have apply the fix in my latest code.

@mcuee Could you help me test on this. I have apply the fix in my latest code.
wulf7 commented 2025-04-14 04:46:03 -05:00 (Migrated from github.com)

uhid mode supports non-USB HID devices too. Both modes are comparable.

uhid mode supports non-USB HID devices too. Both modes are comparable.
Youw commented 2025-04-14 04:55:02 -05:00 (Migrated from github.com)

If they are compatible, then what point of using both?

HIDAPI is intended to be as thin wrapper as possible for HID device drivers (libusb backend is a different story, of course), with uniform API across platforms.
The way I see it - hidraw mode has simpler and more alike API for HIDAPI to be used as is, when uhid requires additional tracking of current operational mode and handling report IDs in some cases.

Do I miss something about uhid worth mentioning in this scope?

If they are compatible, then what point of using both? HIDAPI is intended to be as thin wrapper as possible for HID device drivers (libusb backend is a different story, of course), with uniform API across platforms. The way I see it - hidraw mode has simpler and more alike API for HIDAPI to be used as is, when uhid requires additional tracking of current operational mode and handling report IDs in some cases. Do I miss something about uhid worth mentioning in this scope?
wulf7 commented 2025-04-14 05:09:54 -05:00 (Migrated from github.com)

They are comparable but not compatible.

uhid API may be used with old uhid(4) driver.
hidraw API is simpler for implementation and may reuse existing Linux support code.

FreeBSD hidraw(4) supports both. Choose one you prefer but do not mix them.

They are comparable but not compatible. uhid API may be used with old uhid(4) driver. hidraw API is simpler for implementation and may reuse existing Linux support code. FreeBSD hidraw(4) supports both. Choose one you prefer but do not mix them.
wulf7 commented 2025-04-14 10:06:57 -05:00 (Migrated from github.com)

Sorry about the confusing code. I would like to clarify first that I think using hidraw mode is better for supporting non-usb hid device (e.g. iichid). I clean up the code so that there is hidraw mode only.

Now after switching to hidraw mode, it is better to replace all remaining HIDRAW_* ioctls with HIDIOC* ones.
The only exception may be HIDRAW_GET_DEVICEINFO as it provides device serial number which is unavailable through hidraw API

> Sorry about the confusing code. I would like to clarify first that I think using hidraw mode is better for supporting non-usb hid device (e.g. iichid). I clean up the code so that there is hidraw mode only. Now after switching to hidraw mode, it is better to replace all remaining HIDRAW_* ioctls with HIDIOC* ones. The only exception may be HIDRAW_GET_DEVICEINFO as it provides device serial number which is unavailable through hidraw API
wulf7 commented 2025-04-14 10:12:12 -05:00 (Migrated from github.com)

Ooops. FreeBSD hidraw API is outdated. It misses HIDIOCSOUTPUT and HIDIOCGINPUT ioctls.
Although it is easy to implement them, they won`t hit the tree until FreeBSD 14.3 or even 14.4.
So, the uhid API is the only option for 14.2 and earlier.

Ooops. FreeBSD hidraw API is outdated. It misses HIDIOCSOUTPUT and HIDIOCGINPUT ioctls. Although it is easy to implement them, they won`t hit the tree until FreeBSD 14.3 or even 14.4. So, the uhid API is the only option for 14.2 and earlier.
mcuee commented 2025-04-14 18:26:38 -05:00 (Migrated from github.com)

Ooops. FreeBSD hidraw API is outdated. It misses HIDIOCSOUTPUT and HIDIOCGINPUT ioctls. Although it is easy to implement them, they won`t hit the tree until FreeBSD 14.3 or even 14.4. So, the uhid API is the only option for 14.2 and earlier.

Hmm, what about FreeBSD 15.0-Current? Does it have the two IOCTLs you mentioned?

@aokblast is indeed using FreeBSD 15.0-Current for testing.

> Ooops. FreeBSD hidraw API is outdated. It misses HIDIOCSOUTPUT and HIDIOCGINPUT ioctls. Although it is easy to implement them, they won`t hit the tree until FreeBSD 14.3 or even 14.4. So, the uhid API is the only option for 14.2 and earlier. Hmm, what about FreeBSD 15.0-Current? Does it have the two IOCTLs you mentioned? @aokblast is indeed using FreeBSD 15.0-Current for testing.
wulf7 commented 2025-04-15 08:25:14 -05:00 (Migrated from github.com)

Hmm, what about FreeBSD 15.0-Current? Does it have the two IOCTLs you mentioned?

Not yet. I made a patch with both ioctls(). It is only compile tested. I'll commit after one has tested it.

hidraw.patch.txt

> Hmm, what about FreeBSD 15.0-Current? Does it have the two IOCTLs you mentioned? Not yet. I made a patch with both ioctls(). It is only compile tested. I'll commit after one has tested it. [hidraw.patch.txt](https://github.com/user-attachments/files/19758883/hidraw.patch.txt)
mcuee commented 2025-04-30 06:14:50 -05:00 (Migrated from github.com)

The IOCTLs have been added to FreeBSD on 27-April-2025.

 #define	HIDIOCSINPUT(len)	_IOC(IOC_IN,    'U', 38, len)
 #define	HIDIOCGINPUT(len)	_IOC(IOC_INOUT, 'U', 39, len)
 #define	HIDIOCSOUTPUT(len)	_IOC(IOC_IN,    'U', 40, len)
 #define	HIDIOCGOUTPUT(len)	_IOC(IOC_INOUT, 'U', 41, len)
The IOCTLs have been added to FreeBSD on 27-April-2025. * https://github.com/freebsd/freebsd-src/commit/fd6690e2d5cd5b15fce2c74ab0cac77a83514f6a ``` #define HIDIOCSINPUT(len) _IOC(IOC_IN, 'U', 38, len) #define HIDIOCGINPUT(len) _IOC(IOC_INOUT, 'U', 39, len) #define HIDIOCSOUTPUT(len) _IOC(IOC_IN, 'U', 40, len) #define HIDIOCGOUTPUT(len) _IOC(IOC_INOUT, 'U', 41, len) ```
aokblast commented 2025-04-30 09:50:38 -05:00 (Migrated from github.com)

The IOCTLs have been added to FreeBSD on 27-April-2025.

 #define	HIDIOCSINPUT(len)	_IOC(IOC_IN,    'U', 38, len)
 #define	HIDIOCGINPUT(len)	_IOC(IOC_INOUT, 'U', 39, len)
 #define	HIDIOCSOUTPUT(len)	_IOC(IOC_IN,    'U', 40, len)
 #define	HIDIOCGOUTPUT(len)	_IOC(IOC_INOUT, 'U', 41, len)

Can I do it seperately? I think it needs some version check code to enable it.

BTW, thought I don't buy the chip you have, I found 1 stm32f103 in my bedroom yesterday. Then I try to reproduce your environment.

I have the following questions:

Is the wMaxPacket under 64bytes with multiple transport of blocks or wMaxPacket > 64?

Is your condition as following?

  1. Had a device's descriptor larger than 64 byte on full speed device.
  2. Try to send the report
  3. hidapi_read return immediately and the length is 0.

If so, I can reproduce it throught stm32f103 as I set the Input Descriptor to 1023 bytes.

Or

  1. Had a device's descriptor larger than 64 byte on full speed device.
  2. Try to send the report
  3. hidapi_read blocking and never return, returned by timeout.
> The IOCTLs have been added to FreeBSD on 27-April-2025. > > * [freebsd/freebsd-src@fd6690e](https://github.com/freebsd/freebsd-src/commit/fd6690e2d5cd5b15fce2c74ab0cac77a83514f6a) > > ``` > #define HIDIOCSINPUT(len) _IOC(IOC_IN, 'U', 38, len) > #define HIDIOCGINPUT(len) _IOC(IOC_INOUT, 'U', 39, len) > #define HIDIOCSOUTPUT(len) _IOC(IOC_IN, 'U', 40, len) > #define HIDIOCGOUTPUT(len) _IOC(IOC_INOUT, 'U', 41, len) > ``` Can I do it seperately? I think it needs some version check code to enable it. BTW, thought I don't buy the chip you have, I found 1 stm32f103 in my bedroom yesterday. Then I try to reproduce your environment. I have the following questions: Is the wMaxPacket under 64bytes with multiple transport of blocks or wMaxPacket > 64? Is your condition as following? 1. Had a device's descriptor larger than 64 byte on full speed device. 2. Try to send the report 3. hidapi_read return immediately and the length is 0. If so, I can reproduce it throught stm32f103 as I set the Input Descriptor to 1023 bytes. Or 1. Had a device's descriptor larger than 64 byte on full speed device. 2. Try to send the report 3. hidapi_read blocking and never return, returned by timeout.
wulf7 commented 2025-04-30 09:55:28 -05:00 (Migrated from github.com)

The IOCTLs have been added to FreeBSD on 27-April-2025.

Also, they have been merged to 14-STABLE today.

> The IOCTLs have been added to FreeBSD on 27-April-2025. Also, they have been merged to 14-STABLE today.
mcuee commented 2025-05-01 06:53:25 -05:00 (Migrated from github.com)

The IOCTLs have been added to FreeBSD on 27-April-2025.

 #define	HIDIOCSINPUT(len)	_IOC(IOC_IN,    'U', 38, len)
 #define	HIDIOCGINPUT(len)	_IOC(IOC_INOUT, 'U', 39, len)
 #define	HIDIOCSOUTPUT(len)	_IOC(IOC_IN,    'U', 40, len)
 #define	HIDIOCGOUTPUT(len)	_IOC(IOC_INOUT, 'U', 41, len)

Can I do it seperately? I think it needs some version check code to enable it.

Yes. That can be another follow-up PR.

BTW, thought I don't buy the chip you have, I found 1 stm32f103 in my bedroom yesterday.

Yes, STM32 MCU is a good one to use.

Then I try to reproduce your environment.

I have the following questions:

Is the wMaxPacket under 64bytes with multiple transport of blocks or wMaxPacket > 64?

No matter the wMaxPacket number, but rather the HID report length (Input report or Output report in my test, not so sure about Feature report).

BTW, my device is a high speed USB device (Cypress EZ-USB FX2LP). But it does not matter.

Is your condition as following?

  1. Had a device's descriptor larger than 64 byte on full speed device.
  2. Try to send the report
  3. hidapi_read return immediately and the length is 0.

If so, I can reproduce it throught stm32f103 as I set the Input Descriptor to 1023 bytes.

Or

  1. Had a device's descriptor larger than 64 byte on full speed device.
  2. Try to send the report
  3. hidapi_read blocking and never return, returned by timeout.

HID report length greater than 64 bytes will cause issus to this PR. The current libusb backend also got the issue.

I am using hidapitester to carry out the test so it is not that easy to differentiate the two cases you mentioned.

In any case, it is good that you can at least reproduce the issue (first case). You can also try to change 1023 to something like 80, 128 or 512 to see if the issue still exist.

Then you can try to debug the issue to see if it is related to FreeBSD hidraw implementation or your PR.

> > The IOCTLs have been added to FreeBSD on 27-April-2025. > > > > * [freebsd/freebsd-src@fd6690e](https://github.com/freebsd/freebsd-src/commit/fd6690e2d5cd5b15fce2c74ab0cac77a83514f6a) > > > > ``` > > #define HIDIOCSINPUT(len) _IOC(IOC_IN, 'U', 38, len) > > #define HIDIOCGINPUT(len) _IOC(IOC_INOUT, 'U', 39, len) > > #define HIDIOCSOUTPUT(len) _IOC(IOC_IN, 'U', 40, len) > > #define HIDIOCGOUTPUT(len) _IOC(IOC_INOUT, 'U', 41, len) > > ``` > > Can I do it seperately? I think it needs some version check code to enable it. Yes. That can be another follow-up PR. > BTW, thought I don't buy the chip you have, I found 1 stm32f103 in my bedroom yesterday. Yes, STM32 MCU is a good one to use. > Then I try to reproduce your environment. > > I have the following questions: > > Is the wMaxPacket under 64bytes with multiple transport of blocks or wMaxPacket > 64? No matter the wMaxPacket number, but rather the HID report length (Input report or Output report in my test, not so sure about Feature report). BTW, my device is a high speed USB device (Cypress EZ-USB FX2LP). But it does not matter. > Is your condition as following? > > 1. Had a device's descriptor larger than 64 byte on full speed device. > 2. Try to send the report > 3. hidapi_read return immediately and the length is 0. > > If so, I can reproduce it throught stm32f103 as I set the Input Descriptor to 1023 bytes. > > Or > > 1. Had a device's descriptor larger than 64 byte on full speed device. > 2. Try to send the report > 3. hidapi_read blocking and never return, returned by timeout. HID report length greater than 64 bytes will cause issus to this PR. The current libusb backend also got the issue. I am using hidapitester to carry out the test so it is not that easy to differentiate the two cases you mentioned. In any case, it is good that you can at least reproduce the issue (first case). You can also try to change 1023 to something like 80, 128 or 512 to see if the issue still exist. Then you can try to debug the issue to see if it is related to FreeBSD hidraw implementation or your PR.
aokblast commented 2025-05-07 04:59:51 -05:00 (Migrated from github.com)

The IOCTLs have been added to FreeBSD on 27-April-2025.

 #define	HIDIOCSINPUT(len)	_IOC(IOC_IN,    'U', 38, len)
 #define	HIDIOCGINPUT(len)	_IOC(IOC_INOUT, 'U', 39, len)
 #define	HIDIOCSOUTPUT(len)	_IOC(IOC_IN,    'U', 40, len)
 #define	HIDIOCGOUTPUT(len)	_IOC(IOC_INOUT, 'U', 41, len)

Can I do it seperately? I think it needs some version check code to enable it.

Yes. That can be another follow-up PR.

BTW, thought I don't buy the chip you have, I found 1 stm32f103 in my bedroom yesterday.

Yes, STM32 MCU is a good one to use.

Then I try to reproduce your environment.
I have the following questions:
Is the wMaxPacket under 64bytes with multiple transport of blocks or wMaxPacket > 64?

No matter the wMaxPacket number, but rather the HID report length (Input report or Output report in my test, not so sure about Feature report).

BTW, my device is a high speed USB device (Cypress EZ-USB FX2LP). But it does not matter.

Is your condition as following?

  1. Had a device's descriptor larger than 64 byte on full speed device.
  2. Try to send the report
  3. hidapi_read return immediately and the length is 0.

If so, I can reproduce it throught stm32f103 as I set the Input Descriptor to 1023 bytes.
Or

  1. Had a device's descriptor larger than 64 byte on full speed device.
  2. Try to send the report
  3. hidapi_read blocking and never return, returned by timeout.

HID report length greater than 64 bytes will cause issus to this PR. The current libusb backend also got the issue.

I am using hidapitester to carry out the test so it is not that easy to differentiate the two cases you mentioned.

In any case, it is good that you can at least reproduce the issue (first case). You can also try to change 1023 to something like 80, 128 or 512 to see if the issue still exist.

Then you can try to debug the issue to see if it is related to FreeBSD hidraw implementation or your PR.

Oops, I thought you are using FULL speed device (64byte packets) with hid descriptor larger than 64byte. That is why I ask you what is the value of wMaxPakcet. Because I though you are using an device unable to configure from stm32cubemx(If you type you want to configure packet size higher than 64, you needs to be the HIGH speed device)

So you are using the HIGH speed? If so, I needs extra hardware to test it. HIGH speed needs MCU have clock higher than 120Mhz. It is impossible for stm32f103. I am trying to find an available stm32f405 to test it.

In the current modification, I support HIDIOC family ioctl for all and use ifdef to provide backward support, you can test it with the new 14-STABLE or 15-CURRENT but I thought they will have the same result.

Besides, I make hidtest compiles hidtest_hidraw and hidtest_libusb.

> > > The IOCTLs have been added to FreeBSD on 27-April-2025. > > > > > > * [freebsd/freebsd-src@fd6690e](https://github.com/freebsd/freebsd-src/commit/fd6690e2d5cd5b15fce2c74ab0cac77a83514f6a) > > > > > > ``` > > > #define HIDIOCSINPUT(len) _IOC(IOC_IN, 'U', 38, len) > > > #define HIDIOCGINPUT(len) _IOC(IOC_INOUT, 'U', 39, len) > > > #define HIDIOCSOUTPUT(len) _IOC(IOC_IN, 'U', 40, len) > > > #define HIDIOCGOUTPUT(len) _IOC(IOC_INOUT, 'U', 41, len) > > > ``` > > > > > > Can I do it seperately? I think it needs some version check code to enable it. > > Yes. That can be another follow-up PR. > > > BTW, thought I don't buy the chip you have, I found 1 stm32f103 in my bedroom yesterday. > > Yes, STM32 MCU is a good one to use. > > > Then I try to reproduce your environment. > > I have the following questions: > > Is the wMaxPacket under 64bytes with multiple transport of blocks or wMaxPacket > 64? > > No matter the wMaxPacket number, but rather the HID report length (Input report or Output report in my test, not so sure about Feature report). > > BTW, my device is a high speed USB device (Cypress EZ-USB FX2LP). But it does not matter. > > > Is your condition as following? > > > > 1. Had a device's descriptor larger than 64 byte on full speed device. > > 2. Try to send the report > > 3. hidapi_read return immediately and the length is 0. > > > > If so, I can reproduce it throught stm32f103 as I set the Input Descriptor to 1023 bytes. > > Or > > > > 1. Had a device's descriptor larger than 64 byte on full speed device. > > 2. Try to send the report > > 3. hidapi_read blocking and never return, returned by timeout. > > HID report length greater than 64 bytes will cause issus to this PR. The current libusb backend also got the issue. > > I am using hidapitester to carry out the test so it is not that easy to differentiate the two cases you mentioned. > > In any case, it is good that you can at least reproduce the issue (first case). You can also try to change 1023 to something like 80, 128 or 512 to see if the issue still exist. > > Then you can try to debug the issue to see if it is related to FreeBSD hidraw implementation or your PR. Oops, I thought you are using FULL speed device (64byte packets) with hid descriptor larger than 64byte. That is why I ask you what is the value of wMaxPakcet. Because I though you are using an device unable to configure from stm32cubemx(If you type you want to configure packet size higher than 64, you needs to be the HIGH speed device) So you are using the HIGH speed? If so, I needs extra hardware to test it. HIGH speed needs MCU have clock higher than 120Mhz. It is impossible for stm32f103. I am trying to find an available stm32f405 to test it. In the current modification, I support HIDIOC family ioctl for all and use ifdef to provide backward support, you can test it with the new 14-STABLE or 15-CURRENT but I thought they will have the same result. Besides, I make hidtest compiles hidtest_hidraw and hidtest_libusb.
mcuee commented 2025-05-07 07:10:39 -05:00 (Migrated from github.com)

My FW is based on this one, with Cypress EZ-USB FX2LP.
http://janaxelson.com/hidpage.htm
http://janaxelson.com/files/fx2hid.zip

USB Descriptors

; dscr.a51
; Contains the Device Descriptor, Configuration(Interface, HID and Endpoint) Descriptor,
; and String descriptors.
;


DSCR_DEVICE   	 equ   1   			;; Descriptor type: Device
DSCR_CONFIG  	 equ   2   			;; Descriptor type: Configuration
DSCR_STRING   	 equ   3  		 	;; Descriptor type: String
DSCR_INTRFC   	 equ   4   			;; Descriptor type: Interface
DSCR_ENDPNT   	 equ   5   			;; Descriptor type: Endpoint
DSCR_DEVQUAL  	 equ   6   			;; Descriptor type: Device Qualifier
DSCR_OTHERSPEED  equ   7 


ET_CONTROL   equ   0   				;; Endpoint type: Control
ET_ISO       equ   1   				;; Endpoint type: Isochronous
ET_BULK      equ   2   				;; Endpoint type: Bulk
ET_INT       equ   3   				;; Endpoint type: Interrupt

public	DeviceDscr,ConfigDscr,StringDscr,HIDDscr,ReportDscr,ReportDscrEnd,StringDscr0, StringDscr1, StringDscr2
public  HighSpeedConfigDscr,FullSpeedConfigDscr,DeviceQualDscr, UserDscr
 
;EZ USB FX2 control panel Vendor ID 0h, product ID 2131h
; Lakeview Research VID is 0925h.   
VID	equ	0925h
PID	equ	1234h
DID 	equ	0000h

;cseg at 0x90
DSCR   SEGMENT   CODE PAGE

;;-----------------------------------------------------------------------------
;; Global Variables
;;-----------------------------------------------------------------------------
      rseg DSCR      ;; locate the descriptor table in on-part memory.

DeviceDscr:	
	db	DeviceDscrEnd - DeviceDscr		; Descriptor length
	db	DSCR_DEVICE			; Descriptor type = DEVICE
	db	00h,02h				; spec version (BCD) is 2.00               
	db	0,0,0				; HID class is defined in the interface descriptor
	db	64				; maxPacketSize
	db	LOW(VID),HIGH(VID)
	db	LOW(PID),HIGH(PID)
	db	LOW(DID),HIGH(DID)
	db  	 1        			; Manufacturer string index
      	db  	 2         			; Product string index
      	db  	 0         			; Serial number string index
      	db  	 1         			; Number of configurations
DeviceDscrEnd:

DeviceQualDscr:
    db  DeviceQualDscrEnd - DeviceQualDscr      ;Descriptor Length
    db  DSCR_DEVQUAL        			;Descriptor Type
    db  00h,02h            			;spec version (BCD) is 2.00
    db  0,0,0               			;Device class, sub-class, and sub-sub-class
    db  04h                 			;Max Packet Size
    db  1                  		 	;Number of configurations
    db  0                   			;Reserved
DeviceQualDscrEnd:

HighSpeedConfigDscr:
ConfigDscr:
	db	ConfigDscrEnd - ConfigDscr	; Descriptor length
        db	DSCR_CONFIG			; Descriptor type = CONFIG
	db	LOW(HS_End-ConfigDscr)		; total length (conf+interface+HID+EP's)
	db	HIGH(HS_End-ConfigDscr)
	db	01h				; number of interfaces
	db	01h				; value to select this interface
	db	03h				; string index to describe this config
	db	10000000b			; b7=1; b6=self-powered; b5=Remote WU
	db	40d				; bus power = 80 ma
ConfigDscrEnd:

IntrfcDscr:		; Interface Descriptor
	db	IntrfcDscrEnd -  IntrfcDscr	; Descriptor length
	db	DSCR_INTRFC			; Descriptor type = INTERFACE
	db	0,0				; Interface 0, Alternate setting 0
	db	02h				; number of endpoints
	db	03h,0,0				; class(03)HID, no subclass or protocol
	db	0h				; string index for this interface
IntrfcDscrEnd:

HIDDscr:
	db	HIDDscrEnd - HIDDscr		; Descriptor length
	db	21h				; Descriptor type - HID
	db	10h,01h				; HID Spec version 1.10
	db	0				; country code(none)
	db	01h				; number of HID class descriptors
	db	22h				; class descriptor type: REPORT
	db	LOW(ReportDscrEnd - ReportDscr)
        db	HIGH(ReportDscrEnd - ReportDscr)
HIDDscrEnd:

EpInDscr:	; I-0, AS-0 first endpoint descriptor (EP1IN)
	db	EpInDscrEnd - EpInDscr		; Descriptor length
	db	DSCR_ENDPNT			; Descriptor type = ENDPOINT
	db	81h				; IN-1
	db	03h				; Type: INTERRUPT
	db	40h,0				; MaxPacketSize = 64
	db	05h				; polling interval is 2^(5-1) x 125us = 2 mSec
EpInDscrEnd:

EpOutDscr:
	db	EpOutDscrEnd - EpOutDscr	; Descriptor length
	db	DSCR_ENDPNT			; Descriptor type = ENDPOINT
	db	01h				; OUT-1
	db	03h				; Type ; INTERRUPT
	db	40h,0				; MaxPacketSize = 64
	db	05h				; polling interval is 2^(5-1) x 125us = 2 mSec
EpOutDscrEnd:	
HS_End:

    db  00h         ; Word alignment

FullSpeedConfigDscr:
	db	FullSpeedConfigDscrEnd - FullSpeedConfigDscr		; Descriptor length
	db	DSCR_OTHERSPEED			; Descriptor type = OTHER SPEED CONFIG
	db	LOW(FS_End-FullSpeedConfigDscr)	; Total length (conf+interface+HID+EP's)
	db	HIGH(FS_End-FullSpeedConfigDscr)
	db	01h				; Number of interfaces
	db	01h				; Value to select this interface
	db	03h				; String index to describe this config
	db	10100000b			; b7=1; b6=self-powered; b5=Remote WU
	db	0d				; bus power = 80 ma
FullSpeedConfigDscrEnd:
 
FullSpeedIntrfcDscr:				; Interface Descriptor
	db	FullSpeedIntrfcDscrEnd -  FullSpeedIntrfcDscr	; Descriptor length
	db	DSCR_INTRFC			; Descriptor type: INTERFACE
	db	0,0				; Interface 0, Alternate setting 0
	db	02h				; Number of endpoints
	db	03h,0,0				; Class(03)HID, no subclass or protocol
	db	0h				; string index for this interface
FullSpeedIntrfcDscrEnd:


FullSpeedHIDDscr:
	db	FullSpeedHIDDscrEnd -FullSpeedHIDDscr	; Descriptor length
	db	21h				; Descriptor type - HID
	db	10h,01h				; HID Spec version 1.10
	db	0				; country code(none)
	db	01h				; number of HID class descriptors
	db	22h				; class descriptor type: REPORT
	db	LOW(ReportDscrEnd - ReportDscr)
	db	HIGH(ReportDscrEnd - ReportDscr)
FullSpeedHIDDscrEnd:

FSEpInDscr:	
	db	FSEpInDscrEnd - FSEpInDscr	; Descriptor length
	db	DSCR_ENDPNT			; Descriptor type : ENDPOINT
	db	81h				; IN-1
	db	ET_INT				; Type: INTERRUPT
	db	40h,0				; maxPacketSize = 64
	db	01h				; polling interval is 50 msec
FSEpInDscrEnd:

FSEpOutDscr:	
	db	FSEpOutDscrEnd - FSEpOutDscr	; Descriptor length
	db	DSCR_ENDPNT			; Descriptor type = ENDPOINT
	db	01h				; OUT-1
	db	ET_INT				; type - INTERRUPT
	db	40h,0				; maxPacketSize = 64
	db	01h				; polling interval is 50 msec
FSEpOutDscrEnd:
FS_End:

    	db  00h         ;Word alignment

;; usbhidio code start
ReportDscr:

	db 06h, 0A0h, 0FFh ;    Usage Page (FFA0h, vendor defined)
	db 09h, 01h     ;       Usage (vendor defined)
	db 0A1h, 01h    ;       Collection (Application)
	db 09h, 02h     ;       Usage (vendor defined)
	db 0A1h, 00h    ;       Collection (Physical)
	db 06h, 0A1h, 0FFh ;    Usage Page (vendor defined)

;; The Input report
	db 09h, 03h     ;       Usage (vendor defined)
	db 09h, 04h     ;       Usage (vendor defined)
	db 15h, 80h	;	Logical minimum (80h or -128)
	db 25h, 7Fh	;	Logical maximum (7Fh or 127)
	db 35h, 00h	;	Physical minimum (0)
	db 45h, 0FFh	;	Physical maximum (255)
	db 75h, 08h	;	Report size (8 bits)
	db 95h, 80h	;	Report count (128 fields)
	db 81h, 02h	;	Input (data, variable, absolute)

;; The Output report
	db 09h, 05h     ;       Usage (vendor defined)
	db 09h, 06h     ;       Usage (vendor defined)
	db 15h, 80h	;	Logical minimum (80h or -128)
	db 25h, 7Fh	;	Logical maximum (7Fh or 127)
	db 35h, 00h	;	Physical minimum (0)
	db 45h, 0FFh	;	Physical maximum (255)
	db 75h, 08h	;	Report size (8 bits)
	db 95h, 80h	;	Report count (128 fields)
	db 91h, 02h	;	Output (data, variable, absolute)

	db 0C0h         ;       End Collection (Physical)
	db 0C0h         ;       End Collection (Application)

ReportDscrEnd:

ReportEnd_word_allignment:
;; Alignment unneeded for usbhidio report because it has an even number of bytes.
;;   	db  00h         ;Force word alignment

;; usbhdio code end

/* Descriptor for Cypress keyboard example (unused by usbhidio)
ReportDscr:
	db 05h, 01h     ; Usage Page (Generic Desktop)
	db 09h, 06h     ; Usage (Keyboard)
	db 0A1h, 01h     ; Collection (Application)
	db 05h, 07h     ;       Usage Page (Key codes)
	db 19h, 0E0h	;	Usage minimum (234)
	db 29h, 0E7h	;	Usage maximum (231)
	db 15h, 00h	;	Logical minimum (0)
	db 25h, 01h	;	Logical maximum (1)
	db 75h, 01h	;	Report size (1)
	db 95h, 08h	;	Report count (8)
	db 81h, 02h	;	Input (data, variable, absolute)
	db 95h, 01h	;	Report count (1)
	db 75h, 08h	;	Report size (8)
	db 81h, 01h	;	Input (constant)
	db 95h, 05h	;	Report count (5)
	db 75h, 01h	;	Report size (1)
	db 05h, 08h	;	Usage Page (LED)
	db 19h, 01h	;	Usage minimum (1)
	db 29h, 05h	;	Usage maximum (5)
	db 91h, 02h	;	Output (data, variable, absolute)
	db 95h, 01h	;	Report count (1)
	db 75h, 03h	;	Report size (3)
	db 91h, 01h	;	Output (constant)
	db 95h, 03h	;	Report count (3)
	db 75h, 08h	;	Report size (8)
	db 15h, 00h	;	Logical minimum (0)
	db 25h, 65h	;	Logical maximum (101)
	db 05h, 07h	;	Usage page (key codes)
	db 19h, 00h	;	Usage minimum (0)
	db 29h, 65h	;	Usage maximum (101)
	db 81h, 00h	;	Input (data, array)
	db 0C0h          ; End Collection
ReportDscrEnd:

ReportEnd_word_allignment:
   	db  00h         ;Force word alignment

*/

StringDscr:
StringDscr0:
		db	StringDscr0End-StringDscr0		;; String descriptor length
		db	DSCR_STRING
		db	09H,04H
StringDscr0End:

StringDscr1:	
		db	StringDscr1End-StringDscr1		;; String descriptor length
		db	DSCR_STRING
		db	'C',00
		db	'Y',00
		db	'P',00
		db	'R',00
		db	'E',00
		db	'S',00
		db	'S',00

StringDscr1End:
StringDscr2:	
		db	StringDscr2End-StringDscr2		;; Descriptor length
		db	DSCR_STRING
		db	'E',00
		db	'Z',00
		db	'-',00
		db	'U',00
		db	'S',00
		db	'B',00
		db	' ',00
		db	'F',00
		db	'X',00
		db	'2',00
		db	' ',00
		db	'H',00
		db	'I',00
		db	'D',00
		db	' ',00
		db	'U',00
		db	'S',00
		db	'B',00
		db	'H',00
		db	'I',00
		db	'D',00
		db	'I',00
		db	'O',00
	
StringDscr2End:
	
UserDscr:		
		dw	0000H
		end

Full source codes and binaries:
fx2hid_128bytes_report.zip

My FW is based on this one, with Cypress EZ-USB FX2LP. http://janaxelson.com/hidpage.htm http://janaxelson.com/files/fx2hid.zip USB Descriptors <details> ``` ; dscr.a51 ; Contains the Device Descriptor, Configuration(Interface, HID and Endpoint) Descriptor, ; and String descriptors. ; DSCR_DEVICE equ 1 ;; Descriptor type: Device DSCR_CONFIG equ 2 ;; Descriptor type: Configuration DSCR_STRING equ 3 ;; Descriptor type: String DSCR_INTRFC equ 4 ;; Descriptor type: Interface DSCR_ENDPNT equ 5 ;; Descriptor type: Endpoint DSCR_DEVQUAL equ 6 ;; Descriptor type: Device Qualifier DSCR_OTHERSPEED equ 7 ET_CONTROL equ 0 ;; Endpoint type: Control ET_ISO equ 1 ;; Endpoint type: Isochronous ET_BULK equ 2 ;; Endpoint type: Bulk ET_INT equ 3 ;; Endpoint type: Interrupt public DeviceDscr,ConfigDscr,StringDscr,HIDDscr,ReportDscr,ReportDscrEnd,StringDscr0, StringDscr1, StringDscr2 public HighSpeedConfigDscr,FullSpeedConfigDscr,DeviceQualDscr, UserDscr ;EZ USB FX2 control panel Vendor ID 0h, product ID 2131h ; Lakeview Research VID is 0925h. VID equ 0925h PID equ 1234h DID equ 0000h ;cseg at 0x90 DSCR SEGMENT CODE PAGE ;;----------------------------------------------------------------------------- ;; Global Variables ;;----------------------------------------------------------------------------- rseg DSCR ;; locate the descriptor table in on-part memory. DeviceDscr: db DeviceDscrEnd - DeviceDscr ; Descriptor length db DSCR_DEVICE ; Descriptor type = DEVICE db 00h,02h ; spec version (BCD) is 2.00 db 0,0,0 ; HID class is defined in the interface descriptor db 64 ; maxPacketSize db LOW(VID),HIGH(VID) db LOW(PID),HIGH(PID) db LOW(DID),HIGH(DID) db 1 ; Manufacturer string index db 2 ; Product string index db 0 ; Serial number string index db 1 ; Number of configurations DeviceDscrEnd: DeviceQualDscr: db DeviceQualDscrEnd - DeviceQualDscr ;Descriptor Length db DSCR_DEVQUAL ;Descriptor Type db 00h,02h ;spec version (BCD) is 2.00 db 0,0,0 ;Device class, sub-class, and sub-sub-class db 04h ;Max Packet Size db 1 ;Number of configurations db 0 ;Reserved DeviceQualDscrEnd: HighSpeedConfigDscr: ConfigDscr: db ConfigDscrEnd - ConfigDscr ; Descriptor length db DSCR_CONFIG ; Descriptor type = CONFIG db LOW(HS_End-ConfigDscr) ; total length (conf+interface+HID+EP's) db HIGH(HS_End-ConfigDscr) db 01h ; number of interfaces db 01h ; value to select this interface db 03h ; string index to describe this config db 10000000b ; b7=1; b6=self-powered; b5=Remote WU db 40d ; bus power = 80 ma ConfigDscrEnd: IntrfcDscr: ; Interface Descriptor db IntrfcDscrEnd - IntrfcDscr ; Descriptor length db DSCR_INTRFC ; Descriptor type = INTERFACE db 0,0 ; Interface 0, Alternate setting 0 db 02h ; number of endpoints db 03h,0,0 ; class(03)HID, no subclass or protocol db 0h ; string index for this interface IntrfcDscrEnd: HIDDscr: db HIDDscrEnd - HIDDscr ; Descriptor length db 21h ; Descriptor type - HID db 10h,01h ; HID Spec version 1.10 db 0 ; country code(none) db 01h ; number of HID class descriptors db 22h ; class descriptor type: REPORT db LOW(ReportDscrEnd - ReportDscr) db HIGH(ReportDscrEnd - ReportDscr) HIDDscrEnd: EpInDscr: ; I-0, AS-0 first endpoint descriptor (EP1IN) db EpInDscrEnd - EpInDscr ; Descriptor length db DSCR_ENDPNT ; Descriptor type = ENDPOINT db 81h ; IN-1 db 03h ; Type: INTERRUPT db 40h,0 ; MaxPacketSize = 64 db 05h ; polling interval is 2^(5-1) x 125us = 2 mSec EpInDscrEnd: EpOutDscr: db EpOutDscrEnd - EpOutDscr ; Descriptor length db DSCR_ENDPNT ; Descriptor type = ENDPOINT db 01h ; OUT-1 db 03h ; Type ; INTERRUPT db 40h,0 ; MaxPacketSize = 64 db 05h ; polling interval is 2^(5-1) x 125us = 2 mSec EpOutDscrEnd: HS_End: db 00h ; Word alignment FullSpeedConfigDscr: db FullSpeedConfigDscrEnd - FullSpeedConfigDscr ; Descriptor length db DSCR_OTHERSPEED ; Descriptor type = OTHER SPEED CONFIG db LOW(FS_End-FullSpeedConfigDscr) ; Total length (conf+interface+HID+EP's) db HIGH(FS_End-FullSpeedConfigDscr) db 01h ; Number of interfaces db 01h ; Value to select this interface db 03h ; String index to describe this config db 10100000b ; b7=1; b6=self-powered; b5=Remote WU db 0d ; bus power = 80 ma FullSpeedConfigDscrEnd: FullSpeedIntrfcDscr: ; Interface Descriptor db FullSpeedIntrfcDscrEnd - FullSpeedIntrfcDscr ; Descriptor length db DSCR_INTRFC ; Descriptor type: INTERFACE db 0,0 ; Interface 0, Alternate setting 0 db 02h ; Number of endpoints db 03h,0,0 ; Class(03)HID, no subclass or protocol db 0h ; string index for this interface FullSpeedIntrfcDscrEnd: FullSpeedHIDDscr: db FullSpeedHIDDscrEnd -FullSpeedHIDDscr ; Descriptor length db 21h ; Descriptor type - HID db 10h,01h ; HID Spec version 1.10 db 0 ; country code(none) db 01h ; number of HID class descriptors db 22h ; class descriptor type: REPORT db LOW(ReportDscrEnd - ReportDscr) db HIGH(ReportDscrEnd - ReportDscr) FullSpeedHIDDscrEnd: FSEpInDscr: db FSEpInDscrEnd - FSEpInDscr ; Descriptor length db DSCR_ENDPNT ; Descriptor type : ENDPOINT db 81h ; IN-1 db ET_INT ; Type: INTERRUPT db 40h,0 ; maxPacketSize = 64 db 01h ; polling interval is 50 msec FSEpInDscrEnd: FSEpOutDscr: db FSEpOutDscrEnd - FSEpOutDscr ; Descriptor length db DSCR_ENDPNT ; Descriptor type = ENDPOINT db 01h ; OUT-1 db ET_INT ; type - INTERRUPT db 40h,0 ; maxPacketSize = 64 db 01h ; polling interval is 50 msec FSEpOutDscrEnd: FS_End: db 00h ;Word alignment ;; usbhidio code start ReportDscr: db 06h, 0A0h, 0FFh ; Usage Page (FFA0h, vendor defined) db 09h, 01h ; Usage (vendor defined) db 0A1h, 01h ; Collection (Application) db 09h, 02h ; Usage (vendor defined) db 0A1h, 00h ; Collection (Physical) db 06h, 0A1h, 0FFh ; Usage Page (vendor defined) ;; The Input report db 09h, 03h ; Usage (vendor defined) db 09h, 04h ; Usage (vendor defined) db 15h, 80h ; Logical minimum (80h or -128) db 25h, 7Fh ; Logical maximum (7Fh or 127) db 35h, 00h ; Physical minimum (0) db 45h, 0FFh ; Physical maximum (255) db 75h, 08h ; Report size (8 bits) db 95h, 80h ; Report count (128 fields) db 81h, 02h ; Input (data, variable, absolute) ;; The Output report db 09h, 05h ; Usage (vendor defined) db 09h, 06h ; Usage (vendor defined) db 15h, 80h ; Logical minimum (80h or -128) db 25h, 7Fh ; Logical maximum (7Fh or 127) db 35h, 00h ; Physical minimum (0) db 45h, 0FFh ; Physical maximum (255) db 75h, 08h ; Report size (8 bits) db 95h, 80h ; Report count (128 fields) db 91h, 02h ; Output (data, variable, absolute) db 0C0h ; End Collection (Physical) db 0C0h ; End Collection (Application) ReportDscrEnd: ReportEnd_word_allignment: ;; Alignment unneeded for usbhidio report because it has an even number of bytes. ;; db 00h ;Force word alignment ;; usbhdio code end /* Descriptor for Cypress keyboard example (unused by usbhidio) ReportDscr: db 05h, 01h ; Usage Page (Generic Desktop) db 09h, 06h ; Usage (Keyboard) db 0A1h, 01h ; Collection (Application) db 05h, 07h ; Usage Page (Key codes) db 19h, 0E0h ; Usage minimum (234) db 29h, 0E7h ; Usage maximum (231) db 15h, 00h ; Logical minimum (0) db 25h, 01h ; Logical maximum (1) db 75h, 01h ; Report size (1) db 95h, 08h ; Report count (8) db 81h, 02h ; Input (data, variable, absolute) db 95h, 01h ; Report count (1) db 75h, 08h ; Report size (8) db 81h, 01h ; Input (constant) db 95h, 05h ; Report count (5) db 75h, 01h ; Report size (1) db 05h, 08h ; Usage Page (LED) db 19h, 01h ; Usage minimum (1) db 29h, 05h ; Usage maximum (5) db 91h, 02h ; Output (data, variable, absolute) db 95h, 01h ; Report count (1) db 75h, 03h ; Report size (3) db 91h, 01h ; Output (constant) db 95h, 03h ; Report count (3) db 75h, 08h ; Report size (8) db 15h, 00h ; Logical minimum (0) db 25h, 65h ; Logical maximum (101) db 05h, 07h ; Usage page (key codes) db 19h, 00h ; Usage minimum (0) db 29h, 65h ; Usage maximum (101) db 81h, 00h ; Input (data, array) db 0C0h ; End Collection ReportDscrEnd: ReportEnd_word_allignment: db 00h ;Force word alignment */ StringDscr: StringDscr0: db StringDscr0End-StringDscr0 ;; String descriptor length db DSCR_STRING db 09H,04H StringDscr0End: StringDscr1: db StringDscr1End-StringDscr1 ;; String descriptor length db DSCR_STRING db 'C',00 db 'Y',00 db 'P',00 db 'R',00 db 'E',00 db 'S',00 db 'S',00 StringDscr1End: StringDscr2: db StringDscr2End-StringDscr2 ;; Descriptor length db DSCR_STRING db 'E',00 db 'Z',00 db '-',00 db 'U',00 db 'S',00 db 'B',00 db ' ',00 db 'F',00 db 'X',00 db '2',00 db ' ',00 db 'H',00 db 'I',00 db 'D',00 db ' ',00 db 'U',00 db 'S',00 db 'B',00 db 'H',00 db 'I',00 db 'D',00 db 'I',00 db 'O',00 StringDscr2End: UserDscr: dw 0000H end ``` </details> Full source codes and binaries: [fx2hid_128bytes_report.zip](https://github.com/user-attachments/files/20083567/fx2hid_128bytes_report.zip)
mcuee commented 2025-05-07 09:29:49 -05:00 (Migrated from github.com)

Using FreeBSD 15 Current snapshot 1-May-2025.

So we can see that the hidraw backend does not work from this PR. But at least it does not have regression on the libusb backend since the problem is the same as current hidapi git in terms of libusb backend.

mcuee@freebsd15vboxvm:~ $ cd build/hidapitester/

mcuee@freebsd15vboxvm:~/build/hidapitester $ uname -a
FreeBSD freebsd15vboxvm 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n276914-f676c13d4226: Thu May  1 05:11:20 UTC 2025     root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo sysctl hw.usb.usbhid.enable=1
Password:
hw.usb.usbhid.enable: 0 -> 1

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo kldunload uhid

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo kldload hidraw

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device
Using FreeBSD 15 Current snapshot 1-May-2025. So we can see that the hidraw backend does not work from this PR. But at least it does not have regression on the libusb backend since the problem is the same as current hidapi git in terms of libusb backend. ``` mcuee@freebsd15vboxvm:~ $ cd build/hidapitester/ mcuee@freebsd15vboxvm:~/build/hidapitester $ uname -a FreeBSD freebsd15vboxvm 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n276914-f676c13d4226: Thu May 1 05:11:20 UTC 2025 root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo sysctl hw.usb.usbhid.enable=1 Password: hw.usb.usbhid.enable: 0 -> 1 mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo kldunload uhid mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo kldload hidraw mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device ```
mcuee commented 2025-05-07 09:35:00 -05:00 (Migrated from github.com)

@aokblast

Now I am clean of the fault, it is the same as what you see. No timeout, immediately exit.

hidapi_read return immediately and the length is 0

@aokblast Now I am clean of the fault, it is the same as what you see. No timeout, immediately exit. > hidapi_read return immediately and the length is 0
aokblast commented 2025-05-07 10:56:52 -05:00 (Migrated from github.com)

Ok, I see. I should take some time to get a device able to afford USB HIGH speed

Ok, I see. I should take some time to get a device able to afford USB HIGH speed
mcuee commented 2025-05-07 17:45:09 -05:00 (Migrated from github.com)

Ok, I see. I should take some time to get a device able to afford USB HIGH speed

Are you saying that you no longer have issuses with your own full speed STM32 MCU implementation if the HID Input/Output report length are larger than 64 Bytes? Or you still have the issue?

If possible, please post the USB descriptors of your device and the test results. Thanks.

> Ok, I see. I should take some time to get a device able to afford USB HIGH speed Are you saying that you no longer have issuses with your own full speed STM32 MCU implementation if the HID Input/Output report length are larger than 64 Bytes? Or you still have the issue? If possible, please post the USB descriptors of your device and the test results. Thanks.
mcuee commented 2025-05-07 18:01:56 -05:00 (Migrated from github.com)

More about the test device.

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --list-detail
0925/1234: CYPRESS - EZ-USB FX2 HID USBHIDIO
  vendorId:      0x0925
  productId:     0x1234
  usagePage:     0x0000
  usage:         0x0000
  serial_number: (null) 
  interface:     0 
  path: 1-1:1.0

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --list-detail
0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO
  vendorId:      0x0925
  productId:     0x1234
  usagePage:     0xFFA0
  usage:         0x0001
  serial_number: (null) 
  interface:     0 
  path: /dev/hidraw0

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo usbconfig
ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen1.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA)

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234

Bus /dev/usb Device /dev/ugen1.2: ID 0925:1234 Lakeview Research 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0925 Lakeview Research
  idProduct          0x1234 
  bcdDevice            0.00
  iManufacturer           1 CYPRESS
  iProduct                2 EZ-USB FX2 HID USBHIDIO
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               80mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         4
  bNumConfigurations      1
can't get debug descriptor: Input/output error
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

More about the test device. ``` mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --list-detail 0925/1234: CYPRESS - EZ-USB FX2 HID USBHIDIO vendorId: 0x0925 productId: 0x1234 usagePage: 0x0000 usage: 0x0000 serial_number: (null) interface: 0 path: 1-1:1.0 mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --list-detail 0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO vendorId: 0x0925 productId: 0x1234 usagePage: 0xFFA0 usage: 0x0001 serial_number: (null) interface: 0 path: /dev/hidraw0 mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo usbconfig ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) ugen1.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA) mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234 Bus /dev/usb Device /dev/ugen1.2: ID 0925:1234 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x1234 bcdDevice 0.00 iManufacturer 1 CYPRESS iProduct 2 EZ-USB FX2 HID USBHIDIO iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 3 bmAttributes 0x80 (Bus Powered) MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptor: (length is 52) Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x02 ] 2 (null) Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 (null) Item(Local ): Usage, data= [ 0x03 ] 3 (null) Item(Local ): Usage, data= [ 0x04 ] 4 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x05 ] 5 (null) Item(Local ): Usage, data= [ 0x06 ] 6 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 4 bNumConfigurations 1 can't get debug descriptor: Input/output error Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled ```
mcuee commented 2025-05-07 18:16:29 -05:00 (Migrated from github.com)

Forcing the device to run in Full Speed mode and now this PR works.

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo usbconfig
ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA)

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb
Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research 
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234

Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0925 Lakeview Research
  idProduct          0x1234 
  bcdDevice            0.00
  iManufacturer           1 CYPRESS
  iProduct                2 EZ-USB FX2 HID USBHIDIO
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               80mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

Forcing the device to run in Full Speed mode and now this PR works. ``` mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo usbconfig ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA) mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234 Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x1234 bcdDevice 0.00 iManufacturer 1 CYPRESS iProduct 2 EZ-USB FX2 HID USBHIDIO iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 3 bmAttributes 0x80 (Bus Powered) MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptor: (length is 52) Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x02 ] 2 (null) Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 (null) Item(Local ): Usage, data= [ 0x03 ] 3 (null) Item(Local ): Usage, data= [ 0x04 ] 4 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x05 ] 5 (null) Item(Local ): Usage, data= [ 0x06 ] 6 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device ```
mcuee commented 2025-05-07 18:19:21 -05:00 (Migrated from github.com)

@aokblast
Now this PR is much better -- at least it works for USB Full Speed device under FreeBSD 15 Current. I will test under FreeBSD 14.2 Release later.

@wulf7
Just wondering if you have some inputs in the test results. Thanks. Just wonddering if you have some tests with regard to High Speed USB HID devices? Thanks.

@aokblast Now this PR is much better -- at least it works for USB Full Speed device under FreeBSD 15 Current. I will test under FreeBSD 14.2 Release later. @wulf7 Just wondering if you have some inputs in the test results. Thanks. Just wonddering if you have some tests with regard to High Speed USB HID devices? Thanks.
aokblast commented 2025-05-08 12:23:10 -05:00 (Migrated from github.com)

Ok, I see. I should take some time to get a device able to afford USB HIGH speed

Are you saying that you no longer have issuses with your own full speed STM32 MCU implementation if the HID Input/Output report length are larger than 64 Bytes? Or you still have the issue?

If possible, please post the USB descriptors of your device and the test results. Thanks.

Yes, hid full speed with larger than 64 byte report works.

Code and result:

blast@fbsd-dev:~/hid $ cat hid.c
#include <stdint.h>
#include <stdio.h>
#include <assert.h>

#include "hidapi/hidapi.h"

static const char buffer[] = "Hello World\n";

int main() {
  int res;
  hid_device *device, *head;
  struct hid_device_info *devs;
  uint8_t buffer[1024]  = {};
  uint8_t command[] = {0x87, 0x87};
  int sz;

  assert(hid_init() == 0);

  device = hid_open(0x0483, 0x5750, NULL);
  assert(device != NULL);
  assert(hid_write(device, command, sizeof(command)) != -1);
  sz = hid_read(device, buffer, sizeof(buffer));
  printf("%ls\n", hid_error(device));
  printf("%d\n", sz);
  printf("%x\n", (uint32_t)buffer[0]);
  printf("%x\n", (uint32_t)buffer[1]);

  hid_close(device);

  hid_free_enumeration(devs);

  assert(hid_exit() == 0);
}
blast@fbsd-dev:~/hid $ make
blast@fbsd-dev:~/hid $ sudo LD_LIBRARY_PATH=/home/blast/hidapi/build/install/lib/ ./hid
Success
1023
1
2

usbconfig -d0.3 dump_all_desc:

bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0002
      bInterfaceClass = 0x0003  <HID device>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x21
      bDescriptorSubType = 0x11
       RAW dump:
       0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x23,
       0x08 | 0x00

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040
        bInterval = 0x0005
        bRefresh = 0x0000
        bSynchAddress = 0x0000

     Endpoint 1
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0001  <OUT>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040
        bInterval = 0x0005
        bRefresh = 0x0000
        bSynchAddress = 0x0000

Report Descriptor:

image

> > Ok, I see. I should take some time to get a device able to afford USB HIGH speed > > Are you saying that you no longer have issuses with your own full speed STM32 MCU implementation if the HID Input/Output report length are larger than 64 Bytes? Or you still have the issue? > > If possible, please post the USB descriptors of your device and the test results. Thanks. Yes, hid full speed with larger than 64 byte report works. Code and result: ``` blast@fbsd-dev:~/hid $ cat hid.c #include <stdint.h> #include <stdio.h> #include <assert.h> #include "hidapi/hidapi.h" static const char buffer[] = "Hello World\n"; int main() { int res; hid_device *device, *head; struct hid_device_info *devs; uint8_t buffer[1024] = {}; uint8_t command[] = {0x87, 0x87}; int sz; assert(hid_init() == 0); device = hid_open(0x0483, 0x5750, NULL); assert(device != NULL); assert(hid_write(device, command, sizeof(command)) != -1); sz = hid_read(device, buffer, sizeof(buffer)); printf("%ls\n", hid_error(device)); printf("%d\n", sz); printf("%x\n", (uint32_t)buffer[0]); printf("%x\n", (uint32_t)buffer[1]); hid_close(device); hid_free_enumeration(devs); assert(hid_exit() == 0); } blast@fbsd-dev:~/hid $ make blast@fbsd-dev:~/hid $ sudo LD_LIBRARY_PATH=/home/blast/hidapi/build/install/lib/ ./hid Success 1023 1 2 ``` usbconfig -d0.3 dump_all_desc: ``` bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0000 bNumEndpoints = 0x0002 bInterfaceClass = 0x0003 <HID device> bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Additional Descriptor bLength = 0x09 bDescriptorType = 0x21 bDescriptorSubType = 0x11 RAW dump: 0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x23, 0x08 | 0x00 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0003 <INTERRUPT> wMaxPacketSize = 0x0040 bInterval = 0x0005 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0003 <INTERRUPT> wMaxPacketSize = 0x0040 bInterval = 0x0005 bRefresh = 0x0000 bSynchAddress = 0x0000 ``` Report Descriptor: ![image](https://github.com/user-attachments/assets/3f7deb76-4d6f-41fb-9f34-74ea9e599d74)
mcuee commented 2025-06-16 00:55:30 -05:00 (Migrated from github.com)

@aokblast

If you can, please get the FX2LP break-out board from Taobao/AliExpress/Amazon/etc. It is pretty cheap.
FX2LP

FW binary and source codes are here.

It is a quick minor modification of Jan Axelson's FX2HID example from here.
http://janaxelson.com/hidpage.htm
http://janaxelson.com/files/fx2hid.zip

There may be a bit of challenge if you want to rebuild the source code as it may require a full version of Keil C51 compiler. I happen to have access to a pretty old version of Keil C51 compiler at work. I am not so sure about the efforts to port the code to use the free sdcc toolchain. It may be possible because of the nice sdcc based libraries.

  1. https://github.com/djmuhlestein/fx2lib
  2. https://github.com/whitequark/libfx2

Jan's HID page has some other FW as well, for example, for Microchip USB PIC18. I was able to use that as a base for my other HIDAPI testing but I have not figured out how to increase the HID report size above 64 bytes with that FW. I have the PIC18F87J50 USB PIM (free tool from Microchip many years ago).

More testing device discussions:

@aokblast If you can, please get the FX2LP break-out board from Taobao/AliExpress/Amazon/etc. It is pretty cheap. ![FX2LP](https://github.com/user-attachments/assets/81492ff5-dde7-4a52-ab0c-59b125ce951d) FW binary and source codes are here. * https://github.com/libusb/hidapi/issues/478#issuecomment-1547963784 It is a quick minor modification of Jan Axelson's FX2HID example from here. http://janaxelson.com/hidpage.htm http://janaxelson.com/files/fx2hid.zip There may be a bit of challenge if you want to rebuild the source code as it may require a full version of Keil C51 compiler. I happen to have access to a pretty old version of Keil C51 compiler at work. I am not so sure about the efforts to port the code to use the free sdcc toolchain. It may be possible because of the nice sdcc based libraries. 1. https://github.com/djmuhlestein/fx2lib 2. https://github.com/whitequark/libfx2 Jan's HID page has some other FW as well, for example, for Microchip USB PIC18. I was able to use that as a base for my other HIDAPI testing but I have not figured out how to increase the HID report size above 64 bytes with that FW. I have the PIC18F87J50 USB PIM (free tool from Microchip many years ago). More testing device discussions: * https://github.com/libusb/hidapi/discussions/743
mcuee commented 2025-06-16 00:58:48 -05:00 (Migrated from github.com)

Update with the main git branch to trigger another CI run.

Update with the main git branch to trigger another CI run.
mcuee commented 2025-06-16 19:17:52 -05:00 (Migrated from github.com)

@cederom and @dl8dtl

Since you two are the FreeBSD power user I know of, please help to check if you can give this PR a try. You need to use FreeBSD 14 Stable or 15 Current. Thanks.

This has something to do with avrdude as well. For example, if it works, it is a potential workaround for Issue #274.

FreeBSD HIDAPI is now based on libusb, so it is affected by the Issue #274.

@cederom and @dl8dtl Since you two are the FreeBSD power user I know of, please help to check if you can give this PR a try. You need to use FreeBSD 14 Stable or 15 Current. Thanks. This has something to do with avrdude as well. For example, if it works, it is a potential workaround for Issue #274. FreeBSD HIDAPI is now based on libusb, so it is affected by the Issue #274. * #274
cederom commented 2025-06-16 21:08:45 -05:00 (Migrated from github.com)

@mcuee builds okay, could you please provide test steps, its a long thread and I am quite short on time sorry :-P

@mcuee builds okay, could you please provide test steps, its a long thread and I am quite short on time sorry :-P
mcuee commented 2025-06-17 00:29:03 -05:00 (Migrated from github.com)

@mcuee builds okay, could you please provide test steps, its a long thread and I am quite short on time sorry :-P

Great.

Test steps: make sure you use the hidraw driver.

  1. Test with your normal generic USB HID device using hidapi's built-in hidtest and hidapitester. This should be okay.
    https://github.com/todbot/hidapitester

  2. Test with USB Full Speed HID device with >64 Bytes HID report size. This should be okay.

  3. Test with USB High Speed HID device with >64 Bytes HID report side. This somehow failed for my test device.

I have mentioned my test device in the comments above.

> @mcuee builds okay, could you please provide test steps, its a long thread and I am quite short on time sorry :-P Great. Test steps: make sure you use the hidraw driver. 1) Test with your normal generic USB HID device using hidapi's built-in hidtest and hidapitester. This should be okay. https://github.com/todbot/hidapitester 2) Test with USB Full Speed HID device with >64 Bytes HID report size. This should be okay. 3) Test with USB High Speed HID device with >64 Bytes HID report side. This somehow failed for my test device. I have mentioned my test device in the comments above. * https://github.com/libusb/hidapi/pull/730#issuecomment-2975196771
dl8dtl commented 2025-06-17 00:54:27 -05:00 (Migrated from github.com)

I have mentioned my test device in the comments above.

I just ordered one. Let's seen when it arrives.

> I have mentioned my test device in the comments above. I just ordered one. Let's seen when it arrives.
aokblast commented 2025-06-17 09:49:21 -05:00 (Migrated from github.com)

I am in Canada right now. I get the USB3320 and try to setup the experiment environment with my stm32h750. I will test with it later after my experiment environment is setup with other patches you have mentioned.

I am in Canada right now. I get the USB3320 and try to setup the experiment environment with my stm32h750. I will test with it later after my experiment environment is setup with other patches you have mentioned.
mcuee commented 2025-06-19 20:42:20 -05:00 (Migrated from github.com)

I am in Canada right now. I get the USB3320 and try to setup the experiment environment with my stm32h750. I will test with it later after my experiment environment is setup with other patches you have mentioned.

@aokblast
That will be great. It will be good to test this PR with different test devices.

I tend to believe my modification FW may not be totally correct (interrupt transfer for the IN/OUT endpoint may be correct; Control Transfer to the IN/OUT endpoint may need to be checked). I am not a progammer myself and my main contributions for the Open Source projects (eg: libusb, libusb-win32, libusbK, avrdude, pyusb, libusbdotnet, libftdi and OpenOCD) are mainly on the testing and technical side.

STM32 is a popular ARM Cortex MCU family and STM32H750 is a powerful one, very good for libusb and hidapi related testing.

If you need Super Speed USB testing device (probably not needed for hidapi but more for libusb project), I will highly recomemend EZ-USB FX3 board, CYUSB3KIT-003 EZ-USB™ FX3 SuperSpeed explorer kit, at US$$45.93 plus shipment.
https://www.infineon.com/cms/en/product/evaluation-boards/cyusb3kit-003/

Example test FW used in libusbK project, based on Cypress (now part of Infineon) FW examples.
https://github.com/mcuee/libusbk/tree/master/BmFW/CYPRESS_FX3

> I am in Canada right now. I get the USB3320 and try to setup the experiment environment with my stm32h750. I will test with it later after my experiment environment is setup with other patches you have mentioned. @aokblast That will be great. It will be good to test this PR with different test devices. I tend to believe my modification FW may not be totally correct (interrupt transfer for the IN/OUT endpoint may be correct; Control Transfer to the IN/OUT endpoint may need to be checked). I am not a progammer myself and my main contributions for the Open Source projects (eg: libusb, libusb-win32, libusbK, avrdude, pyusb, libusbdotnet, libftdi and OpenOCD) are mainly on the testing and technical side. STM32 is a popular ARM Cortex MCU family and STM32H750 is a powerful one, very good for libusb and hidapi related testing. If you need Super Speed USB testing device (probably not needed for hidapi but more for libusb project), I will highly recomemend EZ-USB FX3 board, CYUSB3KIT-003 EZ-USB™ FX3 SuperSpeed explorer kit, at US$$45.93 plus shipment. https://www.infineon.com/cms/en/product/evaluation-boards/cyusb3kit-003/ Example test FW used in libusbK project, based on Cypress (now part of Infineon) FW examples. https://github.com/mcuee/libusbk/tree/master/BmFW/CYPRESS_FX3
mcuee commented 2025-12-29 20:05:00 -06:00 (Migrated from github.com)

@aokblast

Just wondering if you have any updates on this PR. Thanks.

@aokblast Just wondering if you have any updates on this PR. Thanks.
mcuee commented 2026-03-19 21:05:00 -05:00 (Migrated from github.com)

Just update the branch to trigger a new build.

It will be good to move this PR forward. May need more testing and reviews.

Just update the branch to trigger a new build. It will be good to move this PR forward. May need more testing and reviews.
cederom commented 2026-03-19 21:13:37 -05:00 (Migrated from github.com)

I am on FreeBSD 14.4-RELEASE AMD64 just in case :-)

I am on FreeBSD 14.4-RELEASE AMD64 just in case :-)
mcuee commented 2026-04-19 02:58:58 -05:00 (Migrated from github.com)

@Youw

Just wondering if it is worth asking Github Copilot to review this PR.

@Youw Just wondering if it is worth asking Github Copilot to review this PR.
aokblast commented 2026-04-19 03:03:33 -05:00 (Migrated from github.com)

@aokblast

Just wondering if you have any updates on this PR. Thanks.

Sorry that I was super busy in previous 6 months. I am back now and will start to setup the hardware for usb development on next monday.

> @aokblast > > Just wondering if you have any updates on this PR. Thanks. Sorry that I was super busy in previous 6 months. I am back now and will start to setup the hardware for usb development on next monday.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-04-19 03:16:59 -05:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR adds a new FreeBSD HIDRAW backend to HIDAPI so FreeBSD (13.0+) can enumerate and access HID devices via /dev/hidraw*, while still leveraging libusb for USB-specific metadata (e.g., manufacturer string).

Changes:

  • Introduce a new freebsd/ backend implementation (hid.c) and integrate it into both CMake and Autotools builds.
  • Update build/test targets to build both hidraw and libusb variants on FreeBSD (hidtest + testgui).
  • Adjust FreeBSD libusb build artifacts naming to match the -libusb convention.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
testgui/Makefile.am Build FreeBSD testgui against both freebsd hidraw and libusb backends.
src/CMakeLists.txt Add FreeBSD platform branch to build/export the hidraw backend from freebsd/.
libusb/Makefile.freebsd Rename manual FreeBSD libusb targets to *-libusb naming.
libusb/Makefile.am Rename FreeBSD libusb Automake library target to libhidapi-libusb.la.
hidtest/Makefile.am Build both hidtest-hidraw and hidtest-libusb on FreeBSD.
hidtest/CMakeLists.txt Enable building hidtest_hidraw on FreeBSD when hidapi::hidraw exists.
freebsd/hid.c New FreeBSD hidraw backend implementation (enumeration, IO, descriptors, strings).
freebsd/Makefile.am Automake build for freebsd hidraw library.
freebsd/Makefile-manual Manual makefile to build the FreeBSD hidraw backend.
freebsd/CMakeLists.txt CMake target for FreeBSD hidraw backend and pkg-config generation.
freebsd/.gitignore Ignore build artifacts under freebsd/.
configure.ac Switch FreeBSD Autotools backend to freebsd and add FreeBSD Makefile/config vars.
Makefile.am Add freebsd/ subdir and install FreeBSD pkg-config files for hidraw+libusb.
CMakeLists.txt Add FreeBSD options for building hidraw and libusb implementations.
Comments suppressed due to low confidence (1)

configure.ac:249

  • Autotools config only generates pc/hidapi-hidraw.pc and pc/hidapi-libusb.pc when os == linux, but the top-level Makefile.am now installs those pc files for FreeBSD as well. This will break make/make install on FreeBSD because the .pc files won't be configured/generated. Update this conditional to include FreeBSD (or generate the correct pc files based on OS_FREEBSD).
if test "x$os" = xlinux; then
	AC_CONFIG_FILES([pc/hidapi-hidraw.pc])
	AC_CONFIG_FILES([pc/hidapi-libusb.pc])
else
	AC_CONFIG_FILES([pc/hidapi.pc])
fi

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This PR adds a new FreeBSD HIDRAW backend to HIDAPI so FreeBSD (13.0+) can enumerate and access HID devices via `/dev/hidraw*`, while still leveraging libusb for USB-specific metadata (e.g., manufacturer string). **Changes:** - Introduce a new `freebsd/` backend implementation (`hid.c`) and integrate it into both CMake and Autotools builds. - Update build/test targets to build both `hidraw` and `libusb` variants on FreeBSD (hidtest + testgui). - Adjust FreeBSD libusb build artifacts naming to match the `-libusb` convention. ### Reviewed changes Copilot reviewed 14 out of 14 changed files in this pull request and generated 18 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | testgui/Makefile.am | Build FreeBSD testgui against both `freebsd` hidraw and `libusb` backends. | | src/CMakeLists.txt | Add FreeBSD platform branch to build/export the hidraw backend from `freebsd/`. | | libusb/Makefile.freebsd | Rename manual FreeBSD libusb targets to `*-libusb` naming. | | libusb/Makefile.am | Rename FreeBSD libusb Automake library target to `libhidapi-libusb.la`. | | hidtest/Makefile.am | Build both `hidtest-hidraw` and `hidtest-libusb` on FreeBSD. | | hidtest/CMakeLists.txt | Enable building `hidtest_hidraw` on FreeBSD when `hidapi::hidraw` exists. | | freebsd/hid.c | New FreeBSD hidraw backend implementation (enumeration, IO, descriptors, strings). | | freebsd/Makefile.am | Automake build for `freebsd` hidraw library. | | freebsd/Makefile-manual | Manual makefile to build the FreeBSD hidraw backend. | | freebsd/CMakeLists.txt | CMake target for FreeBSD hidraw backend and pkg-config generation. | | freebsd/.gitignore | Ignore build artifacts under `freebsd/`. | | configure.ac | Switch FreeBSD Autotools backend to `freebsd` and add FreeBSD Makefile/config vars. | | Makefile.am | Add `freebsd/` subdir and install FreeBSD pkg-config files for hidraw+libusb. | | CMakeLists.txt | Add FreeBSD options for building hidraw and libusb implementations. | </details> <details> <summary>Comments suppressed due to low confidence (1)</summary> **configure.ac:249** * Autotools config only generates `pc/hidapi-hidraw.pc` and `pc/hidapi-libusb.pc` when `os == linux`, but the top-level `Makefile.am` now installs those pc files for FreeBSD as well. This will break `make`/`make install` on FreeBSD because the `.pc` files won't be configured/generated. Update this conditional to include FreeBSD (or generate the correct pc files based on `OS_FREEBSD`). ``` if test "x$os" = xlinux; then AC_CONFIG_FILES([pc/hidapi-hidraw.pc]) AC_CONFIG_FILES([pc/hidapi-libusb.pc]) else AC_CONFIG_FILES([pc/hidapi.pc]) fi ``` </details> --- 💡 <a href="/libusb/hidapi/new/master?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -0,0 +1,46 @@
cmake_minimum_required(VERSION 3.6.3...3.25 FATAL_ERROR)
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:57 -05:00

pkg_check_modules(libusb-1.0 ...) uses a prefix containing a hyphen, which is not a valid CMake identifier and typically breaks FindPkgConfig (it tries to create variables/targets like libusb-1.0_*). Follow the pattern in libusb/CMakeLists.txt and use a valid prefix (e.g. libusb) and link PkgConfig::libusb.

pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.9)

target_link_libraries(hidapi_hidraw PRIVATE PkgConfig::libusb Threads::Threads)
`pkg_check_modules(libusb-1.0 ...)` uses a prefix containing a hyphen, which is not a valid CMake identifier and typically breaks `FindPkgConfig` (it tries to create variables/targets like `libusb-1.0_*`). Follow the pattern in `libusb/CMakeLists.txt` and use a valid prefix (e.g. `libusb`) and link `PkgConfig::libusb`. ```suggestion pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.9) target_link_libraries(hidapi_hidraw PRIVATE PkgConfig::libusb Threads::Threads) ```
@ -0,0 +1,1356 @@
#include <dev/evdev/input.h>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:55 -05:00

In the BUS_USB branch, the return value of hid_get_udev_location_from_hidraw_idx() is ignored, but bus/addr are then used even if the lookup failed (they're uninitialized). Also, on libusb_get_device_descriptor() failure the handle is closed but the code continues and uses handler afterward. Check both errors and bail out before using bus/addr or a closed handle.

		if (hid_get_udev_location_from_hidraw_idx(idx, &bus,
		    &addr, &info->interface_number) != 0)
			break;
		handler = hid_find_device_handle_by_bus_and_port(bus, addr);
		if (!handler)
			break;
		device = libusb_get_device(handler);
		if (libusb_get_device_descriptor(device, &desc)) {
			libusb_close(handler);
			break;
In the `BUS_USB` branch, the return value of `hid_get_udev_location_from_hidraw_idx()` is ignored, but `bus`/`addr` are then used even if the lookup failed (they're uninitialized). Also, on `libusb_get_device_descriptor()` failure the handle is closed but the code continues and uses `handler` afterward. Check both errors and bail out before using `bus`/`addr` or a closed handle. ```suggestion if (hid_get_udev_location_from_hidraw_idx(idx, &bus, &addr, &info->interface_number) != 0) break; handler = hid_find_device_handle_by_bus_and_port(bus, addr); if (!handler) break; device = libusb_get_device(handler); if (libusb_get_device_descriptor(device, &desc)) { libusb_close(handler); break; ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:55 -05:00

libusb_get_string_descriptor_ascii() returns a negative libusb error code on failure, not 0. The current len == 0 check will miss errors. Also, mbstowcs(..., sizeof(namebuffer)) passes a byte count instead of the number of wchar_t elements and can overflow namebuffer. Validate len > 0 and pass the correct element count (and ensure null-termination) before wcsdup().

		if (len <= 0) {
			libusb_close(handler);
			break;
		}
		if ((size_t) len >= sizeof(buffer))
			len = sizeof(buffer) - 1;
		buffer[len] = '\0';
		{
			size_t converted;
			size_t namebuffer_len = sizeof(namebuffer) / sizeof(namebuffer[0]);

			converted = mbstowcs(namebuffer, (char *)buffer, namebuffer_len - 1);
			if (converted == (size_t)-1)
				namebuffer[0] = L'\0';
			else
				namebuffer[converted] = L'\0';
		}
`libusb_get_string_descriptor_ascii()` returns a negative libusb error code on failure, not `0`. The current `len == 0` check will miss errors. Also, `mbstowcs(..., sizeof(namebuffer))` passes a byte count instead of the number of `wchar_t` elements and can overflow `namebuffer`. Validate `len > 0` and pass the correct element count (and ensure null-termination) before `wcsdup()`. ```suggestion if (len <= 0) { libusb_close(handler); break; } if ((size_t) len >= sizeof(buffer)) len = sizeof(buffer) - 1; buffer[len] = '\0'; { size_t converted; size_t namebuffer_len = sizeof(namebuffer) / sizeof(namebuffer[0]); converted = mbstowcs(namebuffer, (char *)buffer, namebuffer_len - 1); if (converted == (size_t)-1) namebuffer[0] = L'\0'; else namebuffer[converted] = L'\0'; } ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:55 -05:00

template is allocated with malloc() and then partially initialized. Any fields not explicitly set (e.g., usage_page, usage, bus_type, etc.) remain uninitialized and may be copied later. Prefer calloc() (or memset) and check for allocation failures before dereferencing template.

`template` is allocated with `malloc()` and then partially initialized. Any fields not explicitly set (e.g., `usage_page`, `usage`, `bus_type`, etc.) remain uninitialized and may be copied later. Prefer `calloc()` (or `memset`) and check for allocation failures before dereferencing `template`.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:55 -05:00

Both mbstowcs(namebuffer, ..., sizeof(namebuffer)) calls pass a byte size instead of the number of wchar_t elements. This can overflow namebuffer (256 elements) because sizeof(namebuffer) is typically 1024 bytes. Use sizeof(namebuffer)/sizeof(namebuffer[0]) (and handle truncation / ensure termination) before wcsdup().

	if (strlen(devinfo.hdi_uniq)) {
		size_t converted = mbstowcs(namebuffer, devinfo.hdi_uniq,
			(sizeof(namebuffer) / sizeof(namebuffer[0])) - 1);
		if (converted != (size_t)-1) {
			namebuffer[converted] = L'\0';
			template->serial_number = wcsdup(namebuffer);
		} else {
			template->serial_number = NULL;
		}
	} else {
		template->serial_number = NULL;
	}
	template->release_number = devinfo.hdi_version;
	if (strlen(devinfo.hdi_name)) {
		size_t converted = mbstowcs(namebuffer, devinfo.hdi_name,
			(sizeof(namebuffer) / sizeof(namebuffer[0])) - 1);
		if (converted != (size_t)-1) {
			namebuffer[converted] = L'\0';
			template->product_string = wcsdup(namebuffer);
		} else {
			template->product_string = NULL;
		}
	} else {
		template->product_string = NULL;
	}
Both `mbstowcs(namebuffer, ..., sizeof(namebuffer))` calls pass a byte size instead of the number of `wchar_t` elements. This can overflow `namebuffer` (256 elements) because `sizeof(namebuffer)` is typically 1024 bytes. Use `sizeof(namebuffer)/sizeof(namebuffer[0])` (and handle truncation / ensure termination) before `wcsdup()`. ```suggestion if (strlen(devinfo.hdi_uniq)) { size_t converted = mbstowcs(namebuffer, devinfo.hdi_uniq, (sizeof(namebuffer) / sizeof(namebuffer[0])) - 1); if (converted != (size_t)-1) { namebuffer[converted] = L'\0'; template->serial_number = wcsdup(namebuffer); } else { template->serial_number = NULL; } } else { template->serial_number = NULL; } template->release_number = devinfo.hdi_version; if (strlen(devinfo.hdi_name)) { size_t converted = mbstowcs(namebuffer, devinfo.hdi_name, (sizeof(namebuffer) / sizeof(namebuffer[0])) - 1); if (converted != (size_t)-1) { namebuffer[converted] = L'\0'; template->product_string = wcsdup(namebuffer); } else { template->product_string = NULL; } } else { template->product_string = NULL; } ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:56 -05:00

hid_get_report_descriptor() returns buf_size (a size_t) from a function returning int. This can trigger warnings and truncation on large descriptors. Follow the pattern used by other backends: clamp to INT_MAX if needed and return (int)buf_size after copying.

`hid_get_report_descriptor()` returns `buf_size` (a `size_t`) from a function returning `int`. This can trigger warnings and truncation on large descriptors. Follow the pattern used by other backends: clamp to `INT_MAX` if needed and return `(int)buf_size` after copying.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:56 -05:00

Typo in comment: "Semilar" should be "Similar".

/* Similar to register_error_str, but allows passing a format string with va_list args into this function. */
Typo in comment: "Semilar" should be "Similar". ```suggestion /* Similar to register_error_str, but allows passing a format string with va_list args into this function. */ ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:56 -05:00

hid_create_device_info_by_hidraw_idx() always frees template at end: but returns cur. If get_next_hid_usage() never yields a usage (loop not entered), cur is still template, so this returns a pointer to freed memory. Rework the list construction/cleanup so the returned node is never freed (and consider avoiding the circular-list hack).

`hid_create_device_info_by_hidraw_idx()` always frees `template` at `end:` but returns `cur`. If `get_next_hid_usage()` never yields a usage (loop not entered), `cur` is still `template`, so this returns a pointer to freed memory. Rework the list construction/cleanup so the returned node is never freed (and consider avoiding the circular-list hack).
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:56 -05:00

hid_get_device_info() ignores the return value of realpath() and the result of sscanf(). If realpath() fails or the path doesn't match /dev/hidraw%d, idx will be uninitialized and passed into hid_create_device_info_by_hidraw_idx(). Check both calls and register an error on failure.

		if (realpath(dev->device_path, path_buffer) == NULL) {
			register_device_error(dev, "Failed to resolve device path");
			return NULL;
		}
		if (sscanf(path_buffer, "/dev/hidraw%d", &idx) != 1) {
			errno = EINVAL;
			register_device_error(dev, "Resolved device path is not a hidraw device");
			return NULL;
		}
`hid_get_device_info()` ignores the return value of `realpath()` and the result of `sscanf()`. If `realpath()` fails or the path doesn't match `/dev/hidraw%d`, `idx` will be uninitialized and passed into `hid_create_device_info_by_hidraw_idx()`. Check both calls and register an error on failure. ```suggestion if (realpath(dev->device_path, path_buffer) == NULL) { register_device_error(dev, "Failed to resolve device path"); return NULL; } if (sscanf(path_buffer, "/dev/hidraw%d", &idx) != 1) { errno = EINVAL; register_device_error(dev, "Resolved device path is not a hidraw device"); return NULL; } ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:57 -05:00

The VID/PID filter is incorrect: (vendor_id != tmp->vendor_id && product_id != tmp->product_id) will keep devices when either VID or PID matches. It should filter each field independently (like the Linux backend). Also, when the device is filtered out, tmp (and its linked list) is leaked because the code continues without freeing it.

		if ((vendor_id != 0 && vendor_id != tmp->vendor_id) ||
			(product_id != 0 && product_id != tmp->product_id)) {
			hid_free_enumeration(tmp);
The VID/PID filter is incorrect: `(vendor_id != tmp->vendor_id && product_id != tmp->product_id)` will keep devices when either VID or PID matches. It should filter each field independently (like the Linux backend). Also, when the device is filtered out, `tmp` (and its linked list) is leaked because the code `continue`s without freeing it. ```suggestion if ((vendor_id != 0 && vendor_id != tmp->vendor_id) || (product_id != 0 && product_id != tmp->product_id)) { hid_free_enumeration(tmp); ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:57 -05:00

freebsd/hid_find_device_handle_by_bus_and_port() passes errno to libusb_strerror(), but libusb_get_device_list() returns a libusb error code in error. This can produce a misleading message (and errno may be unrelated). Use the libusb return code when formatting the error.

		register_global_error_format("hid_find_device_handle_by_bus_and_port: %s", libusb_strerror(error));
`freebsd/hid_find_device_handle_by_bus_and_port()` passes `errno` to `libusb_strerror()`, but `libusb_get_device_list()` returns a libusb error code in `error`. This can produce a misleading message (and `errno` may be unrelated). Use the libusb return code when formatting the error. ```suggestion register_global_error_format("hid_find_device_handle_by_bus_and_port: %s", libusb_strerror(error)); ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:58 -05:00

libusb_free_device_list(list, 0) does not unref the devices in the list and can leak references. The rest of the codebase uses libusb_free_device_list(..., 1) after enumeration; do the same here.

	libusb_free_device_list(list, 1);
`libusb_free_device_list(list, 0)` does not unref the devices in the list and can leak references. The rest of the codebase uses `libusb_free_device_list(..., 1)` after enumeration; do the same here. ```suggestion libusb_free_device_list(list, 1); ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:58 -05:00

hid_get_udev_location_from_hidraw_idx() writes buff[len] = '\0' after sysctlbyname(). If the returned len equals sizeof(buff), this writes 1 byte past the buffer. Guard len (or ensure null termination by reserving a byte / clamping).

`hid_get_udev_location_from_hidraw_idx()` writes `buff[len] = '\0'` after `sysctlbyname()`. If the returned `len` equals `sizeof(buff)`, this writes 1 byte past the buffer. Guard `len` (or ensure null termination by reserving a byte / clamping).
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:58 -05:00

When a serial_number is provided, wcscmp(serial_number, cur_dev->serial_number) will crash if cur_dev->serial_number is NULL (which can happen when hdi_uniq is empty). Add a null check before calling wcscmp() and only compare when a serial is present.

				if (cur_dev->serial_number &&
				    wcscmp(serial_number, cur_dev->serial_number) == 0) {
When a `serial_number` is provided, `wcscmp(serial_number, cur_dev->serial_number)` will crash if `cur_dev->serial_number` is `NULL` (which can happen when `hdi_uniq` is empty). Add a null check before calling `wcscmp()` and only compare when a serial is present. ```suggestion if (cur_dev->serial_number && wcscmp(serial_number, cur_dev->serial_number) == 0) { ```
@ -0,0 +19,4 @@
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <unistd.h>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:58 -05:00

This file calls ioctl() but does not include <sys/ioctl.h>. On some toolchains this will fail to compile (implicit declaration is an error with modern C standards / -Werror). Add the proper include near the other system headers.

This file calls `ioctl()` but does not include `<sys/ioctl.h>`. On some toolchains this will fail to compile (implicit declaration is an error with modern C standards / -Werror). Add the proper include near the other system headers.
@ -0,0 +525,4 @@
buff[len] = '\0';
return sscanf(buff, "bus=%d hubaddr=%d port=%d devaddr=%d interface=%d",
bus, &hub_addr, &port, addr, inf) == 5;
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:57 -05:00

After the second sysctlbyname(), buff[len] = '\0' has the same potential off-by-one overflow if len == sizeof(buff). Additionally, the sscanf() parses 5 fields but passes the same addr pointer for multiple outputs and then checks == 4, so the parsed location values will be wrong. Guard len and parse into distinct variables with the correct expected conversion count.

After the second `sysctlbyname()`, `buff[len] = '\0'` has the same potential off-by-one overflow if `len == sizeof(buff)`. Additionally, the `sscanf()` parses 5 fields but passes the same `addr` pointer for multiple outputs and then checks `== 4`, so the parsed location values will be wrong. Guard `len` and parse into distinct variables with the correct expected conversion count.
@ -0,0 +746,4 @@
libusb_exit(global_usb_context);
global_usb_context = NULL;
}
return 0;
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:57 -05:00

hid_init() calls libusb_init(&global_usb_context) unconditionally and hid_open_path() calls hid_init() each time. This can reinitialize libusb repeatedly, overwrite global_usb_context, and leak previous contexts. Mirror the libusb backend pattern: only call libusb_init() once when the context is NULL, and in hid_exit() set global_usb_context = NULL after libusb_exit().

`hid_init()` calls `libusb_init(&global_usb_context)` unconditionally and `hid_open_path()` calls `hid_init()` each time. This can reinitialize libusb repeatedly, overwrite `global_usb_context`, and leak previous contexts. Mirror the libusb backend pattern: only call `libusb_init()` once when the context is NULL, and in `hid_exit()` set `global_usb_context = NULL` after `libusb_exit()`.
@ -0,0 +754,4 @@
struct hid_device_info *root;
struct hid_device_info *head;
struct hid_sysctl_iter iter;
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-19 03:16:58 -05:00

hid_enumerate() doesn't call hid_init(), but the enumeration path can call into libusb (via hid_device_handle_bus_dependent() -> hid_find_device_handle_by_bus_and_port()). Without initializing libusb first, libusb_get_device_list() may fail/behave unexpectedly. Call hid_init() early in hid_enumerate() (as other backends do) and handle/init errors appropriately.


	if (hid_init() != 0)
		return NULL;
`hid_enumerate()` doesn't call `hid_init()`, but the enumeration path can call into libusb (via `hid_device_handle_bus_dependent()` -> `hid_find_device_handle_by_bus_and_port()`). Without initializing libusb first, `libusb_get_device_list()` may fail/behave unexpectedly. Call `hid_init()` early in `hid_enumerate()` (as other backends do) and handle/init errors appropriately. ```suggestion if (hid_init() != 0) return NULL; ```
cederom commented 2026-04-19 12:31:23 -05:00 (Migrated from github.com)

@Youw
Just wondering if it is worth asking Github Copilot to review this PR.

Although some reluctance it seems to provide reasonable and constructive review at least there will be some hints :-)

> @Youw > Just wondering if it is worth asking Github Copilot to review this PR. Although some reluctance it seems to provide reasonable and constructive review at least there will be some hints :-)
aokblast commented 2026-04-20 04:33:49 -05:00 (Migrated from github.com)

I don't see any huge change over behavior. The comments from AI are just missing boundary checks.

I don't see any huge change over behavior. The comments from AI are just missing boundary checks.
aokblast commented 2026-04-23 05:26:31 -05:00 (Migrated from github.com)

Forcing the device to run in Full Speed mode and now this PR works.


mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo usbconfig

ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)

ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA)



mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb

Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research 

Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  



mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234



Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research 

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.10

  bDeviceClass            0 (Defined at Interface level)

  bDeviceSubClass         0 

  bDeviceProtocol         0 

  bMaxPacketSize0        64

  idVendor           0x0925 Lakeview Research

  idProduct          0x1234 

  bcdDevice            0.00

  iManufacturer           1 CYPRESS

  iProduct                2 EZ-USB FX2 HID USBHIDIO

  iSerial                 0 

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           41

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          3 

    bmAttributes         0x80

      (Bus Powered)

    MaxPower               80mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           2

      bInterfaceClass         3 Human Interface Device

      bInterfaceSubClass      0 No Subclass

      bInterfaceProtocol      0 None

      iInterface              0 

        HID Device Descriptor:

          bLength                 9

          bDescriptorType        33

          bcdHID               1.10

          bCountryCode            0 Not supported

          bNumDescriptors         1

          bDescriptorType        34 Report

          wDescriptorLength      52

          Report Descriptor: (length is 52)

            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440

                            (null)

            Item(Local ): Usage, data= [ 0x01 ] 1

                            (null)

            Item(Main  ): Collection, data= [ 0x01 ] 1

                            Application

            Item(Local ): Usage, data= [ 0x02 ] 2

                            (null)

            Item(Main  ): Collection, data= [ 0x00 ] 0

                            Physical

            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441

                            (null)

            Item(Local ): Usage, data= [ 0x03 ] 3

                            (null)

            Item(Local ): Usage, data= [ 0x04 ] 4

                            (null)

            Item(Global): Logical Minimum, data= [ 0x80 ] 128

            Item(Global): Logical Maximum, data= [ 0x7f ] 127

            Item(Global): Physical Minimum, data= [ 0x00 ] 0

            Item(Global): Physical Maximum, data= [ 0xff ] 255

            Item(Global): Report Size, data= [ 0x08 ] 8

            Item(Global): Report Count, data= [ 0x80 ] 128

            Item(Main  ): Input, data= [ 0x02 ] 2

                            Data Variable Absolute No_Wrap Linear

                            Preferred_State No_Null_Position Non_Volatile Bitfield

            Item(Local ): Usage, data= [ 0x05 ] 5

                            (null)

            Item(Local ): Usage, data= [ 0x06 ] 6

                            (null)

            Item(Global): Logical Minimum, data= [ 0x80 ] 128

            Item(Global): Logical Maximum, data= [ 0x7f ] 127

            Item(Global): Physical Minimum, data= [ 0x00 ] 0

            Item(Global): Physical Maximum, data= [ 0xff ] 255

            Item(Global): Report Size, data= [ 0x08 ] 8

            Item(Global): Report Count, data= [ 0x80 ] 128

            Item(Main  ): Output, data= [ 0x02 ] 2

                            Data Variable Absolute No_Wrap Linear

                            Preferred_State No_Null_Position Non_Volatile Bitfield

            Item(Main  ): End Collection, data=none

            Item(Main  ): End Collection, data=none

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0040  1x 64 bytes

        bInterval               5

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x01  EP 1 OUT

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0040  1x 64 bytes

        bInterval               5

Device Status:     0x0002

  (Bus Powered)

  Remote Wakeup Enabled



mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input

Opening device, vid/pid: 0x0925/0x1234

Writing output report of 129-bytes...wrote 129 bytes:

 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F

 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F

 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F

 80

Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:

 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20

 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40

 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

 00 00 00 00 00 00 00 00 00 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@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input

Opening device, vid/pid: 0x0925/0x1234

Writing output report of 129-bytes...wrote 129 bytes:

 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F

 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F

 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F

 80

Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:

 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20

 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40

 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60

 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80

 00

Closing device



Hi. I just take a look at this again. Could you please try to make your payload 128bytes?

> Forcing the device to run in Full Speed mode and now this PR works. > > > > ``` > > mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo usbconfig > > ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) > > ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA) > > > > mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb > > Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research > > Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 > > > > mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234 > > > > Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research > > Device Descriptor: > > bLength 18 > > bDescriptorType 1 > > bcdUSB 1.10 > > bDeviceClass 0 (Defined at Interface level) > > bDeviceSubClass 0 > > bDeviceProtocol 0 > > bMaxPacketSize0 64 > > idVendor 0x0925 Lakeview Research > > idProduct 0x1234 > > bcdDevice 0.00 > > iManufacturer 1 CYPRESS > > iProduct 2 EZ-USB FX2 HID USBHIDIO > > iSerial 0 > > bNumConfigurations 1 > > Configuration Descriptor: > > bLength 9 > > bDescriptorType 2 > > wTotalLength 41 > > bNumInterfaces 1 > > bConfigurationValue 1 > > iConfiguration 3 > > bmAttributes 0x80 > > (Bus Powered) > > MaxPower 80mA > > Interface Descriptor: > > bLength 9 > > bDescriptorType 4 > > bInterfaceNumber 0 > > bAlternateSetting 0 > > bNumEndpoints 2 > > bInterfaceClass 3 Human Interface Device > > bInterfaceSubClass 0 No Subclass > > bInterfaceProtocol 0 None > > iInterface 0 > > HID Device Descriptor: > > bLength 9 > > bDescriptorType 33 > > bcdHID 1.10 > > bCountryCode 0 Not supported > > bNumDescriptors 1 > > bDescriptorType 34 Report > > wDescriptorLength 52 > > Report Descriptor: (length is 52) > > Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 > > (null) > > Item(Local ): Usage, data= [ 0x01 ] 1 > > (null) > > Item(Main ): Collection, data= [ 0x01 ] 1 > > Application > > Item(Local ): Usage, data= [ 0x02 ] 2 > > (null) > > Item(Main ): Collection, data= [ 0x00 ] 0 > > Physical > > Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 > > (null) > > Item(Local ): Usage, data= [ 0x03 ] 3 > > (null) > > Item(Local ): Usage, data= [ 0x04 ] 4 > > (null) > > Item(Global): Logical Minimum, data= [ 0x80 ] 128 > > Item(Global): Logical Maximum, data= [ 0x7f ] 127 > > Item(Global): Physical Minimum, data= [ 0x00 ] 0 > > Item(Global): Physical Maximum, data= [ 0xff ] 255 > > Item(Global): Report Size, data= [ 0x08 ] 8 > > Item(Global): Report Count, data= [ 0x80 ] 128 > > Item(Main ): Input, data= [ 0x02 ] 2 > > Data Variable Absolute No_Wrap Linear > > Preferred_State No_Null_Position Non_Volatile Bitfield > > Item(Local ): Usage, data= [ 0x05 ] 5 > > (null) > > Item(Local ): Usage, data= [ 0x06 ] 6 > > (null) > > Item(Global): Logical Minimum, data= [ 0x80 ] 128 > > Item(Global): Logical Maximum, data= [ 0x7f ] 127 > > Item(Global): Physical Minimum, data= [ 0x00 ] 0 > > Item(Global): Physical Maximum, data= [ 0xff ] 255 > > Item(Global): Report Size, data= [ 0x08 ] 8 > > Item(Global): Report Count, data= [ 0x80 ] 128 > > Item(Main ): Output, data= [ 0x02 ] 2 > > Data Variable Absolute No_Wrap Linear > > Preferred_State No_Null_Position Non_Volatile Bitfield > > Item(Main ): End Collection, data=none > > Item(Main ): End Collection, data=none > > Endpoint Descriptor: > > bLength 7 > > bDescriptorType 5 > > bEndpointAddress 0x81 EP 1 IN > > bmAttributes 3 > > Transfer Type Interrupt > > Synch Type None > > Usage Type Data > > wMaxPacketSize 0x0040 1x 64 bytes > > bInterval 5 > > Endpoint Descriptor: > > bLength 7 > > bDescriptorType 5 > > bEndpointAddress 0x01 EP 1 OUT > > bmAttributes 3 > > Transfer Type Interrupt > > Synch Type None > > Usage Type Data > > wMaxPacketSize 0x0040 1x 64 bytes > > bInterval 5 > > Device Status: 0x0002 > > (Bus Powered) > > Remote Wakeup Enabled > > > > mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_libusb_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > > Opening device, vid/pid: 0x0925/0x1234 > > Writing output report of 129-bytes...wrote 129 bytes: > > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > > 80 > > Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: > > 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 > > 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > > 00 00 00 00 00 00 00 00 00 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@freebsd15vboxvm:~/build/hidapitester $ sudo ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > > Opening device, vid/pid: 0x0925/0x1234 > > Writing output report of 129-bytes...wrote 129 bytes: > > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > > 80 > > Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: > > 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 > > 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 > > 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 > > 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 > > 00 > > Closing device > > > > ``` Hi. I just take a look at this again. Could you please try to make your payload 128bytes?
mcuee commented 2026-04-24 05:32:09 -05:00 (Migrated from github.com)

Hi. I just take a look at this again. Could you please try to make your payload 128bytes?

@aokblast

Yes, I will try to carry out some tests over the weekend and report the results from FreeBSD 15.0 release.

> Hi. I just take a look at this again. Could you please try to make your payload 128bytes? @aokblast Yes, I will try to carry out some tests over the weekend and report the results from FreeBSD 15.0 release.
mcuee commented 2026-04-24 23:16:31 -05:00 (Migrated from github.com)

Here are the latest test results under FreeBSD 15.0 release.

mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730 clean
rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o
rm -f hidapitester
mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread
mcuee@freebsdvm:~/build/hidapitester $ cp ./hidapitester ./hidapitester_pr730_hidraw

mcuee@freebsdvm:~/build/hidapitester $ diff -u Makefile_pr730 Makefile_pr730_libusb
--- Makefile_pr730      2026-04-25 11:50:25.193243000 +0800
+++ Makefile_pr730_libusb       2026-04-25 12:09:01.784542000 +0800
@@ -80,11 +80,11 @@

 endif

-########### FreeBSD (hidraw)
+########### FreeBSD (libusb)
 ifeq "$(OS)" "freebsd"

 CFLAGS += -I/usr/local/include
-OBJS = $(HIDAPI_DIR)/freebsd/hid.o
+OBJS = $(HIDAPI_DIR)/libusb/hid.o
 LIBS += -L/usr/local/lib -lusb -liconv -pthread
 EXE=

mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730_libusb clean
rm -f ../hidapi_pr730/libusb/hid.o hidapitester.o
rm -f hidapitester
mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730_libusb
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/libusb/hid.c -o ../hidapi_pr730/libusb/hid.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread
mcuee@freebsdvm:~/build/hidapitester $ cp hidapitester hidapitester_pr730_libusb

mcuee@freebsdvm:~/build/hidapitester $ uname -a
FreeBSD freebsdvm 15.0-RELEASE-p4 FreeBSD 15.0-RELEASE-p4 releng/15.0-n281010-8ef0ed690df2 GENERIC amd64

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo sysctl hw.usb.usbhid.enable=1
Password:
hw.usb.usbhid.enable: 0 -> 1

mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo kldunload uhid

mcuee@freebsdvm:~/build/hidapitester $ sudo kldload hidraw

mcuee@freebsdvm:~/build/hidapitester $ ls -la /dev/hidraw0
crw-------  1 root operator 0x66 Apr 25 11:52 /dev/hidraw0

mcuee@freebsdvm:~/build/hidapitester $ sudo chmod 666 /dev/hidraw0

mcuee@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --list
0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO
mcuee@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --vidpid 0925:1234 --list
0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO
mcuee@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --vidpid 0925:1234 --list-detail
0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO
  vendorId:      0x0925
  productId:     0x1234
  usagePage:     0xFFA0
  usage:         0x0001
  serial_number: (null)
  interface:     0
  path: /dev/hidraw0

mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig
ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen1.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA)

mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234

Bus /dev/usb Device /dev/ugen1.2: ID 0925:1234 Lakeview Research
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0925 Lakeview Research
  idProduct          0x1234
  bcdDevice            0.00
  iManufacturer           1 CYPRESS
  iProduct                2 EZ-USB FX2 HID USBHIDIO
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               80mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         4
  bNumConfigurations      1
can't get debug descriptor: Input/output error
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_git_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,
9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58
,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,
106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr728_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,
8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,
58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,10
5,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,
8,9,10
58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,10
5,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device
Here are the latest test results under FreeBSD 15.0 release. ``` mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730 clean rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o rm -f hidapitester mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730 cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsdvm:~/build/hidapitester $ cp ./hidapitester ./hidapitester_pr730_hidraw mcuee@freebsdvm:~/build/hidapitester $ diff -u Makefile_pr730 Makefile_pr730_libusb --- Makefile_pr730 2026-04-25 11:50:25.193243000 +0800 +++ Makefile_pr730_libusb 2026-04-25 12:09:01.784542000 +0800 @@ -80,11 +80,11 @@ endif -########### FreeBSD (hidraw) +########### FreeBSD (libusb) ifeq "$(OS)" "freebsd" CFLAGS += -I/usr/local/include -OBJS = $(HIDAPI_DIR)/freebsd/hid.o +OBJS = $(HIDAPI_DIR)/libusb/hid.o LIBS += -L/usr/local/lib -lusb -liconv -pthread EXE= mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730_libusb clean rm -f ../hidapi_pr730/libusb/hid.o hidapitester.o rm -f hidapitester mcuee@freebsdvm:~/build/hidapitester $ gmake -f Makefile_pr730_libusb cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/libusb/hid.c -o ../hidapi_pr730/libusb/hid.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsdvm:~/build/hidapitester $ cp hidapitester hidapitester_pr730_libusb mcuee@freebsdvm:~/build/hidapitester $ uname -a FreeBSD freebsdvm 15.0-RELEASE-p4 FreeBSD 15.0-RELEASE-p4 releng/15.0-n281010-8ef0ed690df2 GENERIC amd64 mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo sysctl hw.usb.usbhid.enable=1 Password: hw.usb.usbhid.enable: 0 -> 1 mcuee@freebsd15vboxvm:~/build/hidapitester $ sudo kldunload uhid mcuee@freebsdvm:~/build/hidapitester $ sudo kldload hidraw mcuee@freebsdvm:~/build/hidapitester $ ls -la /dev/hidraw0 crw------- 1 root operator 0x66 Apr 25 11:52 /dev/hidraw0 mcuee@freebsdvm:~/build/hidapitester $ sudo chmod 666 /dev/hidraw0 mcuee@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --list 0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO mcuee@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --vidpid 0925:1234 --list 0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO mcuee@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --vidpid 0925:1234 --list-detail 0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO vendorId: 0x0925 productId: 0x1234 usagePage: 0xFFA0 usage: 0x0001 serial_number: (null) interface: 0 path: /dev/hidraw0 mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) ugen1.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA) mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234 Bus /dev/usb Device /dev/ugen1.2: ID 0925:1234 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x1234 bcdDevice 0.00 iManufacturer 1 CYPRESS iProduct 2 EZ-USB FX2 HID USBHIDIO iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 3 bmAttributes 0x80 (Bus Powered) MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptor: (length is 52) Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x02 ] 2 (null) Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 (null) Item(Local ): Usage, data= [ 0x03 ] 3 (null) Item(Local ): Usage, data= [ 0x04 ] 4 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x05 ] 5 (null) Item(Local ): Usage, data= [ 0x06 ] 6 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 4 bNumConfigurations 1 can't get debug descriptor: Input/output error Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_git_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58 ,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105, 106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr728_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7, 8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57, 58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,10 5,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7, 8,9,10 58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,10 5,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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@freebsdvm:~/build/hidapitester $ ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device ```
mcuee commented 2026-04-24 23:20:52 -05:00 (Migrated from github.com)

Summary of the above test for the EZ-USB FX2LP modified Generic HID example with 128 Bytes report size (high speed USB device).

  1. libusb backend from git (same for PR #730) will only be able to get 64 bytes Input Report. This is a known issue.
  1. PR #728 fixed the above issue and it is able to read back 128 bytes Input Report
  1. Somehow FreeBSD hidraw backend does not work in this case.
Summary of the above test for the EZ-USB FX2LP modified Generic HID example with 128 Bytes report size (high speed USB device). 1) libusb backend from git (same for PR #730) will only be able to get 64 bytes Input Report. This is a known issue. * https://github.com/libusb/hidapi/pull/274 2) PR #728 fixed the above issue and it is able to read back 128 bytes Input Report * https://github.com/libusb/hidapi/pull/728 3) Somehow FreeBSD hidraw backend does not work in this case.
mcuee commented 2026-04-24 23:29:07 -05:00 (Migrated from github.com)

Sanity check under Windows, with latest hidapi git.

PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

PS C:\work\libusb\hidapitester> .\hidapitester_git_libusb.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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

PS C:\work\libusb\hidapitester> .\hidapitester_pr728_libusb_new.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device
Sanity check under Windows, with latest hidapi git. ``` PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device PS C:\work\libusb\hidapitester> .\hidapitester_git_libusb.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 PS C:\work\libusb\hidapitester> .\hidapitester_pr728_libusb_new.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device ```
aokblast commented 2026-04-25 03:31:37 -05:00 (Migrated from github.com)

Sanity check under Windows, with latest hidapi git.

PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

PS C:\work\libusb\hidapitester> .\hidapitester_git_libusb.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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

PS C:\work\libusb\hidapitester> .\hidapitester_pr728_libusb_new.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

Does output of payload less than 128 bytes work? FreeBSD check if the device can handle the report by checking the size in report descriptor. You report descriptor shows that we can only handle 128 bytes.

> Sanity check under Windows, with latest hidapi git. > > ``` > PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 129-bytes...wrote 129 bytes: > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > 80 > Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: > 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 > 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 > 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 > 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 > 00 > Closing device > > PS C:\work\libusb\hidapitester> .\hidapitester_git_libusb.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 129-bytes...wrote 129 bytes: > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > 80 > Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: > 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 > 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > 00 00 00 00 00 00 00 00 00 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 > > PS C:\work\libusb\hidapitester> .\hidapitester_pr728_libusb_new.exe --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 129-bytes...wrote 129 bytes: > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > 80 > Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: > 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 > 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 > 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 > 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 > 00 > Closing device > ``` Does output of payload less than 128 bytes work? FreeBSD check if the device can handle the report by checking the size in report descriptor. You report descriptor shows that we can only handle 128 bytes.
wulf7 commented 2026-04-25 03:51:33 -05:00 (Migrated from github.com)

Does output of payload less than 128 bytes work? FreeBSD check if the device can handle the report by checking the size in report descriptor. You report descriptor shows that we can only handle 128 bytes.

usbhid allocates internal buffers based on report size. They are 128 bytes long in that case. 129 bytes wont fit them.

There is a difference between input and output unnumbered reports.
In Linux and hidraw after than leading byte of output unnumbered report is stripped so it becomes a 128 byte. But input reports still go AS IS.

> Does output of payload less than 128 bytes work? FreeBSD check if the device can handle the report by checking the size in report descriptor. You report descriptor shows that we can only handle 128 bytes. usbhid allocates internal buffers based on report size. They are 128 bytes long in that case. 129 bytes wont fit them. There is a difference between input and output unnumbered reports. In Linux and hidraw after than leading byte of output unnumbered report is stripped so it becomes a 128 byte. But input reports still go AS IS.
mcuee commented 2026-04-25 03:57:18 -05:00 (Migrated from github.com)

Does output of payload less than 128 bytes work? FreeBSD check if the device can handle the report by checking the size in report descriptor. You report descriptor shows that we can only handle 128 bytes.

This is under Linux.

Linux hidraw backend does not work if I send 64 bytes payload.
Linux libusb backend does work if I send 64 bytes payload.

mcuee  ~/build/cypress  16:48  cyusb_linux
QSocketNotifier: Can only be used with threads started with QThread

(cyusb_linux:26002): Gdk-CRITICAL **: 16:48:33.678: gdk_wayland_window_set_dbus_properties_libgtk_only: assertion 'GDK_IS_WAYLAND_WINDOW (window)' failed
Found Hex format file
Releasing FX2 CPU from reset

mcuee  …/hidapitester   main ?    v15.2.0  16:54  sudo ./hidapitester_git_hidraw --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

mcuee  …/hidapitester   main ?    v15.2.0  16:54  sudo ./hidapitester_git_hidraw --vidpid 0925:1234 --open --buflen 256 -l 65 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 65-bytes...wrote 65 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40
Reading up to 65-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee  …/hidapitester   main ?    v15.2.0  16:54  sudo ./hidapitester_git_libusb --vidpid 0925:1234 --open --buflen 256 -l 65 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 65-bytes...wrote 65 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40
Reading up to 65-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00
Closing device

> Does output of payload less than 128 bytes work? FreeBSD check if the device can handle the report by checking the size in report descriptor. You report descriptor shows that we can only handle 128 bytes. This is under Linux. Linux hidraw backend does not work if I send 64 bytes payload. Linux libusb backend does work if I send 64 bytes payload. ``` mcuee  ~/build/cypress  16:48  cyusb_linux QSocketNotifier: Can only be used with threads started with QThread (cyusb_linux:26002): Gdk-CRITICAL **: 16:48:33.678: gdk_wayland_window_set_dbus_properties_libgtk_only: assertion 'GDK_IS_WAYLAND_WINDOW (window)' failed Found Hex format file Releasing FX2 CPU from reset mcuee  …/hidapitester   main ?   v15.2.0  16:54  sudo ./hidapitester_git_hidraw --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device mcuee  …/hidapitester   main ?   v15.2.0  16:54  sudo ./hidapitester_git_hidraw --vidpid 0925:1234 --open --buflen 256 -l 65 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 65-bytes...wrote 65 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 Reading up to 65-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee  …/hidapitester   main ?   v15.2.0  16:54  sudo ./hidapitester_git_libusb --vidpid 0925:1234 --open --buflen 256 -l 65 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 65-bytes...wrote 65 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 Reading up to 65-byte input report, 250 msec timeout...read 64 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 00 Closing device ```
wulf7 commented 2026-04-25 04:03:44 -05:00 (Migrated from github.com)

Ouch. It seems that input is really 128 bytes no 129.

Ouch. It seems that input is really 128 bytes no 129.
mcuee commented 2026-04-25 04:11:20 -05:00 (Migrated from github.com)

Ouch. It seems that input is really 128 bytes no 129.

That should be the correct one.

The report ID 00 for the output report is not really on the wire. It is more needed because of Windows native HID API.
The report ID 00 is also not on the wire.

> Ouch. It seems that input is really 128 bytes no 129. That should be the correct one. The report ID 00 for the output report is not really on the wire. It is more needed because of Windows native HID API. The report ID 00 is also not on the wire.
wulf7 commented 2026-04-25 04:34:52 -05:00 (Migrated from github.com)

Strange. I have just tested FreeBSD hidraw on MBP8,1 with USB touchpad. Touching of surface with all 10 fingers gave me 338bytes packets successfully received.

Strange. I have just tested FreeBSD hidraw on MBP8,1 with USB touchpad. Touching of surface with all 10 fingers gave me 338bytes packets successfully received.
mcuee commented 2026-04-25 04:50:24 -05:00 (Migrated from github.com)

Strange. I have just tested FreeBSD hidraw on MBP8,1 with USB touchpad. Touching of surface with all 10 fingers gave me 338bytes packets successfully received.

Good one. Do you have any High Speed USB HID device?

As I mentioned before, "forcing the device to run in Full Speed mode and now this PR works". So your device is most likely a Full Speed USB device.

Latest version of VirtualBox does not seem to allow me to disable EHCI support so I can not carry out the test. I am not so sure if I still have working USB 1.1 Hub to try.

> Strange. I have just tested FreeBSD hidraw on MBP8,1 with USB touchpad. Touching of surface with all 10 fingers gave me 338bytes packets successfully received. Good one. Do you have any High Speed USB HID device? As I mentioned before, "forcing the device to run in Full Speed mode and now this PR works". So your device is most likely a Full Speed USB device. * https://github.com/libusb/hidapi/pull/730#issuecomment-2860669765 Latest version of VirtualBox does not seem to allow me to disable EHCI support so I can not carry out the test. I am not so sure if I still have working USB 1.1 Hub to try.
mcuee commented 2026-04-25 04:53:13 -05:00 (Migrated from github.com)

On the other hand, High Speed USB HID device is probably rare. In that case, we may still want to merge this PR first and then debug the issue later.

Maybe it has nothing to do with this PR but rather the hidraw (usbhid driver) of FreeBSD.

On the other hand, High Speed USB HID device is probably rare. In that case, we may still want to merge this PR first and then debug the issue later. Maybe it has nothing to do with this PR but rather the hidraw (usbhid driver) of FreeBSD.
wulf7 commented 2026-04-25 06:27:57 -05:00 (Migrated from github.com)

Good one. Do you have any High Speed USB HID device?

It is Full Speed device.

> Good one. Do you have any High Speed USB HID device? It is Full Speed device.
wulf7 commented 2026-04-25 06:32:32 -05:00 (Migrated from github.com)

Latest version of VirtualBox does not seem to allow me to disable EHCI support so I can not carry out the test. I am not so sure if I still have working USB 1.1 Hub to try.

man ehci tells us about hw.usb.ehci.no_hs loader tunable that disables High Speed.
Try to add hw.usb.ehci.no_hs="1" to /boot/loader.conf and reboot after than

> Latest version of VirtualBox does not seem to allow me to disable EHCI support so I can not carry out the test. I am not so sure if I still have working USB 1.1 Hub to try. `man ehci` tells us about `hw.usb.ehci.no_hs` loader tunable that disables High Speed. Try to add `hw.usb.ehci.no_hs="1"` to `/boot/loader.conf` and reboot after than
mcuee commented 2026-04-25 06:39:07 -05:00 (Migrated from github.com)

Going back to original FX2HID example from Jan Axelson, this PR still does not work.
http://janaxelson.com/hidpage.htm
http://janaxelson.com/files/fx2hid.zip
fx2hid.zip

No issues under Windows.

PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

No issues under FreeBSD with the libusb backend.

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

This PR still does not work.

mcuee@freebsdvm:~/build/hidapitester $ sudo kldload hidraw

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --list
0925/1234: CYPRESS - CYPRESS EZ-USB FX2 HID USBHIDIO

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 2 --sen
d-output 1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 2-bytes...wrote 2 bytes:
 01 02
Reading up to 2-byte input report, 250 msec timeout...read 0 bytes:
Closing device
Going back to original FX2HID example from Jan Axelson, this PR still does not work. http://janaxelson.com/hidpage.htm http://janaxelson.com/files/fx2hid.zip [fx2hid.zip](https://github.com/user-attachments/files/27083981/fx2hid.zip) No issues under Windows. ``` PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device ``` No issues under FreeBSD with the libusb backend. ``` mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device ``` This PR still does not work. ``` mcuee@freebsdvm:~/build/hidapitester $ sudo kldload hidraw mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --list 0925/1234: CYPRESS - CYPRESS EZ-USB FX2 HID USBHIDIO mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 2 --sen d-output 1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 2-bytes...wrote 2 bytes: 01 02 Reading up to 2-byte input report, 250 msec timeout...read 0 bytes: Closing device ```
mcuee commented 2026-04-25 06:39:57 -05:00 (Migrated from github.com)

Latest version of VirtualBox does not seem to allow me to disable EHCI support so I can not carry out the test. I am not so sure if I still have working USB 1.1 Hub to try.

man ehci tells us about hw.usb.ehci.no_hs loader tunable that disables High Speed. Try to add hw.usb.ehci.no_hs="1" to /boot/loader.conf and reboot after than

Thanks for the tip. I will try this soon.

> > Latest version of VirtualBox does not seem to allow me to disable EHCI support so I can not carry out the test. I am not so sure if I still have working USB 1.1 Hub to try. > > `man ehci` tells us about `hw.usb.ehci.no_hs` loader tunable that disables High Speed. Try to add `hw.usb.ehci.no_hs="1"` to `/boot/loader.conf` and reboot after than Thanks for the tip. I will try this soon.
mcuee commented 2026-04-25 07:16:09 -05:00 (Migrated from github.com)

man ehci tells us about hw.usb.ehci.no_hs loader tunable that disables High Speed. Try to add hw.usb.ehci.no_hs="1" to /boot/loader.conf and reboot after than

Somehow this does not work. The device is still enumerated as a high speed USB device.

mcuee@freebsdvm:~/build/hidapitester $ sudo cat /boot/loader.conf
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
hw.usb.ehci.no_hs="1"

mcuee@freebsdvm:~/build/hidapitester $ sudo reboot
Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.

PS C:\work> ssh mcuee@127.0.0.1 -p 3224
(mcuee@127.0.0.1) Password for mcuee@freebsdvm:
Last login: Sat Apr 25 19:58:23 2026 from 10.0.2.2
FreeBSD 15.0-RELEASE-p4 (GENERIC) releng/15.0-n281010-8ef0ed690df2

Welcome to FreeBSD!
...
...

mcuee@freebsdvm:~ $ cd build/

mcuee@freebsdvm:~/build $ cd hidapitester/

mcuee@freebsdvm:~/build/hidapitester $ sudo kldload hidraw

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --list
0925/1234: CYPRESS - CYPRESS EZ-USB FX2 HID USBHIDIO

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 64 -l 3 --sen
d-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 3 --sen
d-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig list
ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen1.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA)

Bus /dev/usb Device /dev/ugen1.2: ID 0925:1234 Lakeview Research
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0925 Lakeview Research
  idProduct          0x1234
  bcdDevice            0.00
  iManufacturer           1 CYPRESS
  iProduct                2 EZ-USB FX2 HID USBHIDIO
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               80mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         4
  bNumConfigurations      1
can't get debug descriptor: Input/output error
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x0000
  idProduct          0x0000
  bcdDevice            1.00
  iManufacturer           1 Apple
  iProduct                2 OHCI root HUB
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x40
      (Missing must-be-set bit!)
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval             255
Hub Descriptor:
  bLength              10
  bDescriptorType      41
  nNbrPorts            12
  wHubCharacteristic 0x0002
    No power switching (usb 1.0)
    Ganged overcurrent protection
  bPwrOn2PwrGood        0 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00 0x00
  PortPwrCtrlMask    0x00 0x00
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0100 power
   Port 5: 0000.0100 power
   Port 6: 0000.0100 power
   Port 7: 0000.0100 power
   Port 8: 0000.0100 power
   Port 9: 0000.0100 power
   Port 10: 0000.0100 power
   Port 11: 0000.0100 power
   Port 12: 0000.0100 power
Device Status:     0x0001
  Self Powered

Bus /dev/usb Device /dev/ugen1.1: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x0000
  idProduct          0x0000
  bcdDevice            1.00
  iManufacturer           1 Intel
  iProduct                2 EHCI root HUB
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x40
      (Missing must-be-set bit!)
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval             255
Hub Descriptor:
  bLength              10
  bDescriptorType      41
  nNbrPorts            12
  wHubCharacteristic 0x0002
    No power switching (usb 1.0)
    Ganged overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood      200 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00 0x00
  PortPwrCtrlMask    0x00 0x00
 Hub Port Status:
   Port 1: 0000.0501 highspeed power connect
   Port 2: 0000.0500 highspeed power
   Port 3: 0000.0500 highspeed power
   Port 4: 0000.0500 highspeed power
   Port 5: 0000.0500 highspeed power
   Port 6: 0000.0500 highspeed power
   Port 7: 0000.0500 highspeed power
   Port 8: 0000.0500 highspeed power
   Port 9: 0000.0500 highspeed power
   Port 10: 0000.0500 highspeed power
   Port 11: 0000.0500 highspeed power
   Port 12: 0000.0500 highspeed power
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0         0
  bNumConfigurations      0
can't get debug descriptor: Input/output error
Device Status:     0x0001
  Self Powered
> `man ehci` tells us about `hw.usb.ehci.no_hs` loader tunable that disables High Speed. Try to add `hw.usb.ehci.no_hs="1"` to `/boot/loader.conf` and reboot after than Somehow this does not work. The device is still enumerated as a high speed USB device. ``` mcuee@freebsdvm:~/build/hidapitester $ sudo cat /boot/loader.conf kern.geom.label.disk_ident.enable="0" kern.geom.label.gptid.enable="0" zfs_load="YES" hw.usb.ehci.no_hs="1" mcuee@freebsdvm:~/build/hidapitester $ sudo reboot Connection to 127.0.0.1 closed by remote host. Connection to 127.0.0.1 closed. PS C:\work> ssh mcuee@127.0.0.1 -p 3224 (mcuee@127.0.0.1) Password for mcuee@freebsdvm: Last login: Sat Apr 25 19:58:23 2026 from 10.0.2.2 FreeBSD 15.0-RELEASE-p4 (GENERIC) releng/15.0-n281010-8ef0ed690df2 Welcome to FreeBSD! ... ... mcuee@freebsdvm:~ $ cd build/ mcuee@freebsdvm:~/build $ cd hidapitester/ mcuee@freebsdvm:~/build/hidapitester $ sudo kldload hidraw mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --list 0925/1234: CYPRESS - CYPRESS EZ-USB FX2 HID USBHIDIO mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 64 -l 3 --sen d-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 3 --sen d-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig list ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) ugen1.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA) Bus /dev/usb Device /dev/ugen1.2: ID 0925:1234 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x1234 bcdDevice 0.00 iManufacturer 1 CYPRESS iProduct 2 EZ-USB FX2 HID USBHIDIO iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 3 bmAttributes 0x80 (Bus Powered) MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptor: (length is 52) Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x02 ] 2 (null) Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 (null) Item(Local ): Usage, data= [ 0x03 ] 3 (null) Item(Local ): Usage, data= [ 0x04 ] 4 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x05 ] 5 (null) Item(Local ): Usage, data= [ 0x06 ] 6 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 4 bNumConfigurations 1 can't get debug descriptor: Input/output error Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 9 Hub bDeviceSubClass 0 Unused bDeviceProtocol 0 Full speed (or root) hub bMaxPacketSize0 64 idVendor 0x0000 idProduct 0x0000 bcdDevice 1.00 iManufacturer 1 Apple iProduct 2 OHCI root HUB iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 25 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x40 (Missing must-be-set bit!) Self Powered MaxPower 0mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 9 Hub bInterfaceSubClass 0 Unused bInterfaceProtocol 0 Full speed (or root) hub iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0020 1x 32 bytes bInterval 255 Hub Descriptor: bLength 10 bDescriptorType 41 nNbrPorts 12 wHubCharacteristic 0x0002 No power switching (usb 1.0) Ganged overcurrent protection bPwrOn2PwrGood 0 * 2 milli seconds bHubContrCurrent 0 milli Ampere DeviceRemovable 0x00 0x00 PortPwrCtrlMask 0x00 0x00 Hub Port Status: Port 1: 0000.0100 power Port 2: 0000.0100 power Port 3: 0000.0100 power Port 4: 0000.0100 power Port 5: 0000.0100 power Port 6: 0000.0100 power Port 7: 0000.0100 power Port 8: 0000.0100 power Port 9: 0000.0100 power Port 10: 0000.0100 power Port 11: 0000.0100 power Port 12: 0000.0100 power Device Status: 0x0001 Self Powered Bus /dev/usb Device /dev/ugen1.1: ID 0000:0000 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 9 Hub bDeviceSubClass 0 Unused bDeviceProtocol 1 Single TT bMaxPacketSize0 64 idVendor 0x0000 idProduct 0x0000 bcdDevice 1.00 iManufacturer 1 Intel iProduct 2 EHCI root HUB iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 25 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x40 (Missing must-be-set bit!) Self Powered MaxPower 0mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 9 Hub bInterfaceSubClass 0 Unused bInterfaceProtocol 0 Full speed (or root) hub iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 255 Hub Descriptor: bLength 10 bDescriptorType 41 nNbrPorts 12 wHubCharacteristic 0x0002 No power switching (usb 1.0) Ganged overcurrent protection TT think time 8 FS bits bPwrOn2PwrGood 200 * 2 milli seconds bHubContrCurrent 0 milli Ampere DeviceRemovable 0x00 0x00 PortPwrCtrlMask 0x00 0x00 Hub Port Status: Port 1: 0000.0501 highspeed power connect Port 2: 0000.0500 highspeed power Port 3: 0000.0500 highspeed power Port 4: 0000.0500 highspeed power Port 5: 0000.0500 highspeed power Port 6: 0000.0500 highspeed power Port 7: 0000.0500 highspeed power Port 8: 0000.0500 highspeed power Port 9: 0000.0500 highspeed power Port 10: 0000.0500 highspeed power Port 11: 0000.0500 highspeed power Port 12: 0000.0500 highspeed power Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 9 Hub bDeviceSubClass 0 Unused bDeviceProtocol 0 Full speed (or root) hub bMaxPacketSize0 0 bNumConfigurations 0 can't get debug descriptor: Input/output error Device Status: 0x0001 Self Powered ```
mcuee commented 2026-04-25 07:49:22 -05:00 (Migrated from github.com)

The following command seems to disable EHCI driver completely, but then somehow I cannot attach the FX2LP USB HID device. Only a generic Atmel STK600 can be attached.

mcuee@freebsdvm:~/build/hidapitester $ sudo cat /boot/loader.conf
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
hint.ehci.0.disabled="1"
hint.ehci.1.disabled="1"

mcuee@freebsdvm:~/build/hidapitester $ sudo reboot
Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.

PS C:\work> ssh mcuee@127.0.0.1 -p 3224
(mcuee@127.0.0.1) Password for mcuee@freebsdvm:
Last login: Sat Apr 25 20:26:59 2026 from 10.0.2.2
FreeBSD 15.0-RELEASE-p4 (GENERIC) releng/15.0-n281010-8ef0ed690df2

Welcome to FreeBSD!
...
...
mcuee@freebsdvm:~ $ sudo usbconfig list
ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen0.2: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)

mcuee@freebsdvm:~ $ sudo dmesg | grep usb
usbus0 on ohci0
usbus0: 12Mbps Full Speed USB v1.0
ugen0.1: <Apple OHCI root HUB> at usbus0
uhub0 on usbus0
uhub0: <Apple OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen0.2: <ATMEL STK600> at usbus0
The following command seems to disable EHCI driver completely, but then somehow I cannot attach the FX2LP USB HID device. Only a generic Atmel STK600 can be attached. ``` mcuee@freebsdvm:~/build/hidapitester $ sudo cat /boot/loader.conf kern.geom.label.disk_ident.enable="0" kern.geom.label.gptid.enable="0" zfs_load="YES" hint.ehci.0.disabled="1" hint.ehci.1.disabled="1" mcuee@freebsdvm:~/build/hidapitester $ sudo reboot Connection to 127.0.0.1 closed by remote host. Connection to 127.0.0.1 closed. PS C:\work> ssh mcuee@127.0.0.1 -p 3224 (mcuee@127.0.0.1) Password for mcuee@freebsdvm: Last login: Sat Apr 25 20:26:59 2026 from 10.0.2.2 FreeBSD 15.0-RELEASE-p4 (GENERIC) releng/15.0-n281010-8ef0ed690df2 Welcome to FreeBSD! ... ... mcuee@freebsdvm:~ $ sudo usbconfig list ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) ugen0.2: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA) mcuee@freebsdvm:~ $ sudo dmesg | grep usb usbus0 on ohci0 usbus0: 12Mbps Full Speed USB v1.0 ugen0.1: <Apple OHCI root HUB> at usbus0 uhub0 on usbus0 uhub0: <Apple OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0 ugen0.2: <ATMEL STK600> at usbus0 ```
mcuee commented 2026-04-25 08:22:30 -05:00 (Migrated from github.com)

Okay, this seems to work.

PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage modifyvm "freebsd" --usb-ohci on --usb-ehci off --usb-xhci off

Now it seems to work.

mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig list
ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA)

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 64 -l 3 --sen
d-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:1234 -vvv

Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0925 Lakeview Research
  idProduct          0x1234
  bcdDevice            0.00
  iManufacturer           1 CYPRESS
  iProduct                2 EZ-USB FX2 HID USBHIDIO
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               80mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled
Okay, this seems to work. ``` PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage modifyvm "freebsd" --usb-ohci on --usb-ehci off --usb-xhci off ``` Now it seems to work. ``` mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig list ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA) mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_libusb --vidpid 0925:1234 --open --buflen 64 -l 3 --sen d-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:1234 -vvv Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x1234 bcdDevice 0.00 iManufacturer 1 CYPRESS iProduct 2 EZ-USB FX2 HID USBHIDIO iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 3 bmAttributes 0x80 (Bus Powered) MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptor: (length is 52) Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x02 ] 2 (null) Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 (null) Item(Local ): Usage, data= [ 0x03 ] 3 (null) Item(Local ): Usage, data= [ 0x04 ] 4 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x05 ] 5 (null) Item(Local ): Usage, data= [ 0x06 ] 6 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled ```
mcuee commented 2026-04-25 08:28:35 -05:00 (Migrated from github.com)

Going back to the device with HID Input/Output report size of 128 bytes.

It seems to this PR will work fine as well.

Good thing -- PR #728 also works fine.

mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig list
ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA)
mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:1234 -vvv

Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0925 Lakeview Research
  idProduct          0x1234
  bcdDevice            0.00
  iManufacturer           1 CYPRESS
  iProduct                2 EZ-USB FX2 HID USBHIDIO
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               80mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x80 ] 128
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr728_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 --
send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,3
9,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,7
9,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,11
4,115
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device
Going back to the device with HID Input/Output report size of 128 bytes. It seems to this PR will work fine as well. Good thing -- PR #728 also works fine. ``` mcuee@freebsdvm:~/build/hidapitester $ sudo usbconfig list ugen0.1: <OHCI root HUB Apple> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA) ugen0.2: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (80mA) mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:1234 -vvv Bus /dev/usb Device /dev/ugen0.2: ID 0925:1234 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x1234 bcdDevice 0.00 iManufacturer 1 CYPRESS iProduct 2 EZ-USB FX2 HID USBHIDIO iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 3 bmAttributes 0x80 (Bus Powered) MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptor: (length is 52) Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x02 ] 2 (null) Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 (null) Item(Local ): Usage, data= [ 0x03 ] 3 (null) Item(Local ): Usage, data= [ 0x04 ] 4 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x05 ] 5 (null) Item(Local ): Usage, data= [ 0x06 ] 6 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x80 ] 128 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr728_libusb --vidpid 0925:1234 --open --buflen 256 -l 129 -- send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,3 9,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,7 9,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,11 4,115 Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device ```
mcuee commented 2026-04-25 08:29:39 -05:00 (Migrated from github.com)

@aokblast @wulf7 and @cederom

So basically this PR works with Full Speed USB HID device, but somehow it does not work with High Speed USB HID device. It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD.

@aokblast @wulf7 and @cederom So basically this PR works with Full Speed USB HID device, but somehow it does not work with High Speed USB HID device. It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD.
mcuee commented 2026-04-25 08:31:46 -05:00 (Migrated from github.com)

@Youw

I am still in favour of merging this PR after your review. The reason is that High Speed USB HID devices are not that common. But you can decide.

@Youw I am still in favour of merging this PR after your review. The reason is that High Speed USB HID devices are not that common. But you can decide.
wulf7 commented 2026-04-25 09:08:13 -05:00 (Migrated from github.com)

It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD.

It is definitely FreeBSD usbhid issue or may be bad interaction between FreeBSD and VBox.

> It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD. It is definitely FreeBSD usbhid issue or may be bad interaction between FreeBSD and VBox.
mcuee commented 2026-04-25 09:23:25 -05:00 (Migrated from github.com)

It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD.

It is definitely FreeBSD usbhid issue or may be bad interaction between FreeBSD and VBox.

I will test with a physical machine tomorrow.

> > It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD. > > It is definitely FreeBSD usbhid issue or may be bad interaction between FreeBSD and VBox. I will test with a physical machine tomorrow.
aokblast commented 2026-04-25 09:40:02 -05:00 (Migrated from github.com)

@aokblast @wulf7 and @cederom

So basically this PR works with Full Speed USB HID device, but somehow it does not work with High Speed USB HID device. It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD.

I will do a quick reviw from the AI comment again and do rebasing tomorrow.

> @aokblast @wulf7 and @cederom > > So basically this PR works with Full Speed USB HID device, but somehow it does not work with High Speed USB HID device. It may not be an issue with this PR, but rather the hidraw driver issue under FreeBSD. I will do a quick reviw from the AI comment again and do rebasing tomorrow.
aokblast commented 2026-04-25 09:40:45 -05:00 (Migrated from github.com)

Ouch. It seems that input is really 128 bytes no 129.

That should be the correct one.

The report ID 00 for the output report is not really on the wire. It is more needed because of Windows native HID API. The report ID 00 is also not on the wire.

Ah yes. Sorry for missing this.

> > Ouch. It seems that input is really 128 bytes no 129. > > That should be the correct one. > > The report ID 00 for the output report is not really on the wire. It is more needed because of Windows native HID API. The report ID 00 is also not on the wire. Ah yes. Sorry for missing this.
aokblast commented 2026-04-26 03:47:45 -05:00 (Migrated from github.com)

I just rebase and clean up the commit. All AI's feedback is fixed.

I just rebase and clean up the commit. All AI's feedback is fixed.
mcuee commented 2026-04-26 05:45:48 -05:00 (Migrated from github.com)

Preparing to test with a physical machine, an Chuwi mini PC with Intel J4125 CPU.

mcuee@freebsd14:~/build/hidapitester $ uname -a
FreeBSD freebsd14 15.0-RELEASE-p2 FreeBSD 15.0-RELEASE-p2 GENERIC amd64

mcuee@freebsd14:~/build/hidapitester $ fxload -v -D vid=0x04b4,pid=0x8613 -t fx2lp -I ../fx2hid/fx2hid/fx2hid.hex
microcontroller type: fx2lp
single stage:  load on-chip memory
open RAM hexfile image ../fx2hid/fx2hid/fx2hid.hex
stop CPU
write on-chip, addr 0x0600 len  234 (0x00ea)
write on-chip, addr 0x09d1 len   10 (0x000a)
write on-chip, addr 0x0380 len  428 (0x01ac)
write on-chip, addr 0x0080 len  768 (0x0300)
write on-chip, addr 0x0033 len    3 (0x0003)
write on-chip, addr 0x09eb len    4 (0x0004)
write on-chip, addr 0x08b6 len   44 (0x002c)
write on-chip, addr 0x0931 len   20 (0x0014)
write on-chip, addr 0x0887 len   47 (0x002f)
write on-chip, addr 0x05b8 len   70 (0x0046)
write on-chip, addr 0x0945 len   17 (0x0011)
write on-chip, addr 0x0043 len    3 (0x0003)
write on-chip, addr 0x0053 len    3 (0x0003)
write on-chip, addr 0x0700 len  184 (0x00b8)
write on-chip, addr 0x09ef len    3 (0x0003)
write on-chip, addr 0x07b8 len   92 (0x005c)
write on-chip, addr 0x090a len   39 (0x0027)
write on-chip, addr 0x05fe len    2 (0x0002)
write on-chip, addr 0x09f3 len    4 (0x0004)
write on-chip, addr 0x09db len    8 (0x0008)
write on-chip, addr 0x099c len   18 (0x0012)
write on-chip, addr 0x09e3 len    8 (0x0008)
write on-chip, addr 0x09ae len   18 (0x0012)
write on-chip, addr 0x09f7 len    6 (0x0006)
write on-chip, addr 0x08e2 len   40 (0x0028)
write on-chip, addr 0x0956 len   24 (0x0018)
write on-chip, addr 0x06ea len   22 (0x0016)
write on-chip, addr 0x0986 len   22 (0x0016)
write on-chip, addr 0x0851 len   54 (0x0036)
write on-chip, addr 0x096e len   24 (0x0018)
write on-chip, addr 0x0814 len   61 (0x003d)
write on-chip, addr 0x09fd len   36 (0x0024)
write on-chip, addr 0x0000 len    3 (0x0003)
write on-chip, addr 0x052c len   12 (0x000c)
write on-chip, addr 0x09c0 len   17 (0x0011)
write on-chip, addr 0x0538 len  128 (0x0080)
write on-chip, addr 0x09f2 len    1 (0x0001)
... WROTE: 2477 bytes, 37 segments, avg 66
reset CPU

mcuee@freebsd14:~/build/hidapitester $ sudo lsusb
Bus /dev/usb Device /dev/ugen0.6: ID 0925:1234 Lakeview Research 
Bus /dev/usb Device /dev/ugen0.10: ID 05e3:0747 Genesys Logic, Inc. 
Bus /dev/usb Device /dev/ugen0.9: ID 0bda:8156 Realtek Semiconductor Corp. 
Bus /dev/usb Device /dev/ugen0.8: ID 05e3:0625 Genesys Logic, Inc. 
Bus /dev/usb Device /dev/ugen0.7: ID 13d3:3503 IMC Networks 
Bus /dev/usb Device /dev/ugen0.5: ID 03eb:2106 Atmel Corp. STK600 development board
Bus /dev/usb Device /dev/ugen0.4: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus /dev/usb Device /dev/ugen0.3: ID 25a7:fa61 Areson Technology Corp Elecom Co., Ltd MR-K013 Multicard Reader
Bus /dev/usb Device /dev/ugen0.2: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better]
Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000  

mcuee@freebsd14:~/build/hidapitester $ sudo kldunload uhid
kldunload: can't find file uhid

mcuee@freebsd14:~/build/hidapitester $ ls -la /dev/hidraw*
crw-------  1 root operator  0x65 Apr 26 17:15 /dev/hidraw0
crw-------  1 root operator  0x6d Apr 26 17:15 /dev/hidraw1
crw-------  1 root operator  0x6e Apr 26 17:15 /dev/hidraw2
crw-------  1 root operator 0x1ba Apr 26 18:24 /dev/hidraw3

mcuee@freebsd14:~/build/hidapitester $ gmake
cc -I/usr/local/include -I ../hidapi/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi/libusb/hid.c -o ../hidapi/libusb/hid.o
cc -I/usr/local/include -I ../hidapi/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester --list
1EA7/0064: (null) - 2.4G Mouse
25A7/FA61: Compx - 2.4G Receiver
25A7/FA61: Compx - 2.4G Receiver
0925/1234: CYPRESS - EZ-USB FX2 HID USBHIDIO

mcuee@freebsd14:~/build/hidapitester $ sudo chmod 666 /dev/hidraw3

mcuee@freebsd14:~/build/hidapitester $ ./hidapitester_freebsd_hidraw_pr730  --list
0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO

mcuee@freebsd14:~/build/hidapitester $ ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --list-detail
0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO
  vendorId:      0x0925
  productId:     0x1234
  usagePage:     0xFFA0
  usage:         0x0001
  serial_number: (null) 
  interface:     0 
  path: /dev/hidraw3

mcuee@freebsd14:~/build/hidapitester $ sudo usbconfig
ugen0.1: <XHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <2.4GHz Wireless rechargeable vertical mouse [More&Better] SHARKOON Technologies GmbH> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.3: <Elecom Co., Ltd MR-K013 Multicard Reader Areson Technology Corp> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.4: <Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.5: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)
ugen0.7: <product 0x3503 IMC Networks> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.8: <USB3.2 Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.9: <USB 10/100/1G/2.5G LAN Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (64mA)
ugen0.10: <USB Storage Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)
ugen0.6: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA)

mcuee@freebsd14:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234

Bus /dev/usb Device /dev/ugen0.6: ID 0925:1234 Lakeview Research 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0925 Lakeview Research
  idProduct          0x1234 
  bcdDevice            0.00
  iManufacturer           1 CYPRESS
  iProduct                2 EZ-USB FX2 HID USBHIDIO
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               80mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
          Report Descriptor: (length is 52)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441
                            (null)
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Local ): Usage, data= [ 0x04 ] 4
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x05 ] 5
                            (null)
            Item(Local ): Usage, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         4
  bNumConfigurations      1
can't get debug descriptor: Input/output error
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled
Preparing to test with a physical machine, an Chuwi mini PC with Intel J4125 CPU. ``` mcuee@freebsd14:~/build/hidapitester $ uname -a FreeBSD freebsd14 15.0-RELEASE-p2 FreeBSD 15.0-RELEASE-p2 GENERIC amd64 mcuee@freebsd14:~/build/hidapitester $ fxload -v -D vid=0x04b4,pid=0x8613 -t fx2lp -I ../fx2hid/fx2hid/fx2hid.hex microcontroller type: fx2lp single stage: load on-chip memory open RAM hexfile image ../fx2hid/fx2hid/fx2hid.hex stop CPU write on-chip, addr 0x0600 len 234 (0x00ea) write on-chip, addr 0x09d1 len 10 (0x000a) write on-chip, addr 0x0380 len 428 (0x01ac) write on-chip, addr 0x0080 len 768 (0x0300) write on-chip, addr 0x0033 len 3 (0x0003) write on-chip, addr 0x09eb len 4 (0x0004) write on-chip, addr 0x08b6 len 44 (0x002c) write on-chip, addr 0x0931 len 20 (0x0014) write on-chip, addr 0x0887 len 47 (0x002f) write on-chip, addr 0x05b8 len 70 (0x0046) write on-chip, addr 0x0945 len 17 (0x0011) write on-chip, addr 0x0043 len 3 (0x0003) write on-chip, addr 0x0053 len 3 (0x0003) write on-chip, addr 0x0700 len 184 (0x00b8) write on-chip, addr 0x09ef len 3 (0x0003) write on-chip, addr 0x07b8 len 92 (0x005c) write on-chip, addr 0x090a len 39 (0x0027) write on-chip, addr 0x05fe len 2 (0x0002) write on-chip, addr 0x09f3 len 4 (0x0004) write on-chip, addr 0x09db len 8 (0x0008) write on-chip, addr 0x099c len 18 (0x0012) write on-chip, addr 0x09e3 len 8 (0x0008) write on-chip, addr 0x09ae len 18 (0x0012) write on-chip, addr 0x09f7 len 6 (0x0006) write on-chip, addr 0x08e2 len 40 (0x0028) write on-chip, addr 0x0956 len 24 (0x0018) write on-chip, addr 0x06ea len 22 (0x0016) write on-chip, addr 0x0986 len 22 (0x0016) write on-chip, addr 0x0851 len 54 (0x0036) write on-chip, addr 0x096e len 24 (0x0018) write on-chip, addr 0x0814 len 61 (0x003d) write on-chip, addr 0x09fd len 36 (0x0024) write on-chip, addr 0x0000 len 3 (0x0003) write on-chip, addr 0x052c len 12 (0x000c) write on-chip, addr 0x09c0 len 17 (0x0011) write on-chip, addr 0x0538 len 128 (0x0080) write on-chip, addr 0x09f2 len 1 (0x0001) ... WROTE: 2477 bytes, 37 segments, avg 66 reset CPU mcuee@freebsd14:~/build/hidapitester $ sudo lsusb Bus /dev/usb Device /dev/ugen0.6: ID 0925:1234 Lakeview Research Bus /dev/usb Device /dev/ugen0.10: ID 05e3:0747 Genesys Logic, Inc. Bus /dev/usb Device /dev/ugen0.9: ID 0bda:8156 Realtek Semiconductor Corp. Bus /dev/usb Device /dev/ugen0.8: ID 05e3:0625 Genesys Logic, Inc. Bus /dev/usb Device /dev/ugen0.7: ID 13d3:3503 IMC Networks Bus /dev/usb Device /dev/ugen0.5: ID 03eb:2106 Atmel Corp. STK600 development board Bus /dev/usb Device /dev/ugen0.4: ID 05e3:0610 Genesys Logic, Inc. Hub Bus /dev/usb Device /dev/ugen0.3: ID 25a7:fa61 Areson Technology Corp Elecom Co., Ltd MR-K013 Multicard Reader Bus /dev/usb Device /dev/ugen0.2: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better] Bus /dev/usb Device /dev/ugen0.1: ID 0000:0000 mcuee@freebsd14:~/build/hidapitester $ sudo kldunload uhid kldunload: can't find file uhid mcuee@freebsd14:~/build/hidapitester $ ls -la /dev/hidraw* crw------- 1 root operator 0x65 Apr 26 17:15 /dev/hidraw0 crw------- 1 root operator 0x6d Apr 26 17:15 /dev/hidraw1 crw------- 1 root operator 0x6e Apr 26 17:15 /dev/hidraw2 crw------- 1 root operator 0x1ba Apr 26 18:24 /dev/hidraw3 mcuee@freebsd14:~/build/hidapitester $ gmake cc -I/usr/local/include -I ../hidapi/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi/libusb/hid.c -o ../hidapi/libusb/hid.o cc -I/usr/local/include -I ../hidapi/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester --list 1EA7/0064: (null) - 2.4G Mouse 25A7/FA61: Compx - 2.4G Receiver 25A7/FA61: Compx - 2.4G Receiver 0925/1234: CYPRESS - EZ-USB FX2 HID USBHIDIO mcuee@freebsd14:~/build/hidapitester $ sudo chmod 666 /dev/hidraw3 mcuee@freebsd14:~/build/hidapitester $ ./hidapitester_freebsd_hidraw_pr730 --list 0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO mcuee@freebsd14:~/build/hidapitester $ ./hidapitester_freebsd_hidraw_pr730 --vidpid 0925:1234 --list-detail 0925/1234: (null) - CYPRESS EZ-USB FX2 HID USBHIDIO vendorId: 0x0925 productId: 0x1234 usagePage: 0xFFA0 usage: 0x0001 serial_number: (null) interface: 0 path: /dev/hidraw3 mcuee@freebsd14:~/build/hidapitester $ sudo usbconfig ugen0.1: <XHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.2: <2.4GHz Wireless rechargeable vertical mouse [More&Better] SHARKOON Technologies GmbH> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.3: <Elecom Co., Ltd MR-K013 Multicard Reader Areson Technology Corp> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.4: <Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.5: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA) ugen0.7: <product 0x3503 IMC Networks> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.8: <USB3.2 Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.9: <USB 10/100/1G/2.5G LAN Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (64mA) ugen0.10: <USB Storage Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA) ugen0.6: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA) mcuee@freebsd14:~/build/hidapitester $ sudo lsusb -vvv -d 0925:1234 Bus /dev/usb Device /dev/ugen0.6: ID 0925:1234 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x1234 bcdDevice 0.00 iManufacturer 1 CYPRESS iProduct 2 EZ-USB FX2 HID USBHIDIO iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 3 bmAttributes 0x80 (Bus Powered) MaxPower 80mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.10 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptor: (length is 52) Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x02 ] 2 (null) Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0xa1 0xff ] 65441 (null) Item(Local ): Usage, data= [ 0x03 ] 3 (null) Item(Local ): Usage, data= [ 0x04 ] 4 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x05 ] 5 (null) Item(Local ): Usage, data= [ 0x06 ] 6 (null) Item(Global): Logical Minimum, data= [ 0x80 ] 128 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0xff ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 5 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 4 bNumConfigurations 1 can't get debug descriptor: Input/output error Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled ```
mcuee commented 2026-04-26 05:54:34 -05:00 (Migrated from github.com)

Test log.

Edit: this test is not using the latest push today but previous version. I will test that later.

Interestingly it works every other time. Looks like there may be a data toggle related issues.

Supposedly EZ-USB FX2LP can handle data toggle bit automatically.

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd clean
rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o
rm -f hidapitester
mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd 
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread
mcuee@freebsd14:~/build/hidapitester $ cp hidapitester hidapitester_hidraw_pr730 

mcuee@freebsd14:~/build/hidapitester $ ls -la
total 243
drwxr-xr-x   7 mcuee mcuee    21 Apr 26 18:50 .
drwxr-xr-x  24 mcuee mcuee    28 Sep 13  2025 ..
drwxr-xr-x   8 mcuee mcuee    15 Apr 26 17:18 .git
drwxr-xr-x   3 mcuee mcuee     3 Sep 29  2024 .github
-rw-r--r--   1 mcuee mcuee   577 Apr 26 17:18 .gitignore
drwxr-xr-x   2 mcuee mcuee     4 Apr 26 17:18 .vscode
-rw-r--r--   1 mcuee mcuee  1940 Apr 26 17:18 CMakeLists.txt
-rw-r--r--   1 mcuee mcuee 35149 Sep 29  2024 LICENSE
-rw-r--r--   1 mcuee mcuee  2323 Sep 29  2024 Makefile
-rw-r--r--   1 mcuee mcuee  2329 Mar 30  2025 Makefile_pr728
-rw-r--r--   1 mcuee mcuee  2329 Mar 30  2025 Makefile_pr730
-rw-r--r--   1 mcuee mcuee  2330 Mar 30  2025 Makefile_pr730_hidraw_freebsd
-rw-r--r--   1 mcuee mcuee  8328 Apr 26 17:18 README.md
drwxr-xr-x   2 mcuee mcuee     8 Sep 29  2024 docs
-rw-r--r--   1 mcuee mcuee 21029 Apr 26 17:18 hidapitester.c
-rwxr-xr-x   1 mcuee mcuee 43360 Apr 26 18:50 hidapitester_hidraw_pr730
-rwxr-xr-x   1 mcuee mcuee 55560 Apr 26 17:19 hidapitester_libusb_git
-rwxr-xr-x   1 mcuee mcuee 56256 Apr 26 18:42 hidapitester_libusb_pr728
-rwxr-xr-x   1 mcuee mcuee 55560 Apr 26 18:42 hidapitester_libusb_pr730
-rw-r--r--   1 mcuee mcuee  1525 Mar 31  2025 test.txt
drwxr-xr-x   6 mcuee mcuee     6 Sep 29  2024 test_hardware

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730  --vidpi
d 0925:1234 --o
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device
mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device
mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device
mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device
Test log. **Edit: this test is not using the latest push today but previous version. I will test that later.** Interestingly it works every other time. Looks like there may be a data toggle related issues. Supposedly EZ-USB FX2LP can handle data toggle bit automatically. ``` mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd clean rm -f ../hidapi_pr730/freebsd/hid.o hidapitester.o rm -f hidapitester mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730/freebsd/hid.c -o ../hidapi_pr730/freebsd/hid.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsd14:~/build/hidapitester $ cp hidapitester hidapitester_hidraw_pr730 mcuee@freebsd14:~/build/hidapitester $ ls -la total 243 drwxr-xr-x 7 mcuee mcuee 21 Apr 26 18:50 . drwxr-xr-x 24 mcuee mcuee 28 Sep 13 2025 .. drwxr-xr-x 8 mcuee mcuee 15 Apr 26 17:18 .git drwxr-xr-x 3 mcuee mcuee 3 Sep 29 2024 .github -rw-r--r-- 1 mcuee mcuee 577 Apr 26 17:18 .gitignore drwxr-xr-x 2 mcuee mcuee 4 Apr 26 17:18 .vscode -rw-r--r-- 1 mcuee mcuee 1940 Apr 26 17:18 CMakeLists.txt -rw-r--r-- 1 mcuee mcuee 35149 Sep 29 2024 LICENSE -rw-r--r-- 1 mcuee mcuee 2323 Sep 29 2024 Makefile -rw-r--r-- 1 mcuee mcuee 2329 Mar 30 2025 Makefile_pr728 -rw-r--r-- 1 mcuee mcuee 2329 Mar 30 2025 Makefile_pr730 -rw-r--r-- 1 mcuee mcuee 2330 Mar 30 2025 Makefile_pr730_hidraw_freebsd -rw-r--r-- 1 mcuee mcuee 8328 Apr 26 17:18 README.md drwxr-xr-x 2 mcuee mcuee 8 Sep 29 2024 docs -rw-r--r-- 1 mcuee mcuee 21029 Apr 26 17:18 hidapitester.c -rwxr-xr-x 1 mcuee mcuee 43360 Apr 26 18:50 hidapitester_hidraw_pr730 -rwxr-xr-x 1 mcuee mcuee 55560 Apr 26 17:19 hidapitester_libusb_git -rwxr-xr-x 1 mcuee mcuee 56256 Apr 26 18:42 hidapitester_libusb_pr728 -rwxr-xr-x 1 mcuee mcuee 55560 Apr 26 18:42 hidapitester_libusb_pr730 -rw-r--r-- 1 mcuee mcuee 1525 Mar 31 2025 test.txt drwxr-xr-x 6 mcuee mcuee 6 Sep 29 2024 test_hardware mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpi d 0925:1234 --o Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device ``` ```
mcuee commented 2026-04-26 05:59:51 -05:00 (Migrated from github.com)

The above is not the issue of this PR though. libusb backend has the same issue. So does PR #728.

Edit: this test is not using the latest push today but previous version. I will test that later.

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git  --vidpid
0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730  --vidpi
d 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730  --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device
The above is not the issue of this PR though. libusb backend has the same issue. So does PR #728. **Edit: this test is not using the latest push today but previous version. I will test that later.** ``` mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730 --vidpi d 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730 --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device ```
mcuee commented 2026-04-26 06:15:19 -05:00 (Migrated from github.com)

Using the latest git push of this PR #730.

mcuee@freebsd14:~/build $ git clone https://github.com/aokblast/hidapi.git -b use_hid_raw hidapi_pr730_new
Cloning into 'hidapi_pr730_new'...
remote: Enumerating objects: 3537, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 3537 (delta 0), reused 3 (delta 0), pack-reused 3533 (from 1)
Receiving objects: 100% (3537/3537), 3.30 MiB | 8.42 MiB/s, done.
Resolving deltas: 100% (2290/2290), done.

mcuee@freebsd14:~/build $ cd hidapitester/

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean
rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new 
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/libusb/hid.c -o ../hidapi_pr730_new/libusb/hid.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_libusb_pr730_new

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean
rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean
rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new 
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/freebsd/hid.c -o ../hidapi_pr730_new/freebsd/hid.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_hidraw_pr730_new

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean
rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ ls
CMakeLists.txt				hidapitester.c
LICENSE					hidapitester_hidraw_pr730
Makefile				hidapitester_hidraw_pr730_new
Makefile_pr728				hidapitester_libusb_git
Makefile_pr730				hidapitester_libusb_pr728
Makefile_pr730_hidraw_freebsd		hidapitester_libusb_pr730
Makefile_pr730_hidraw_freebsd_new	hidapitester_libusb_pr730_new
Makefile_pr730_new			test.txt
README.md				test_hardware
docs

As expected, no changing of the test results.

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--o
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

Using the latest git push of this PR #730. ``` mcuee@freebsd14:~/build $ git clone https://github.com/aokblast/hidapi.git -b use_hid_raw hidapi_pr730_new Cloning into 'hidapi_pr730_new'... remote: Enumerating objects: 3537, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done. remote: Total 3537 (delta 0), reused 3 (delta 0), pack-reused 3533 (from 1) Receiving objects: 100% (3537/3537), 3.30 MiB | 8.42 MiB/s, done. Resolving deltas: 100% (2290/2290), done. mcuee@freebsd14:~/build $ cd hidapitester/ mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o rm -f hidapitester mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/libusb/hid.c -o ../hidapi_pr730_new/libusb/hid.o cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_libusb_pr730_new mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o rm -f hidapitester mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o rm -f hidapitester mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/freebsd/hid.c -o ../hidapi_pr730_new/freebsd/hid.o cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_hidraw_pr730_new mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o rm -f hidapitester mcuee@freebsd14:~/build/hidapitester $ ls CMakeLists.txt hidapitester.c LICENSE hidapitester_hidraw_pr730 Makefile hidapitester_hidraw_pr730_new Makefile_pr728 hidapitester_libusb_git Makefile_pr730 hidapitester_libusb_pr728 Makefile_pr730_hidraw_freebsd hidapitester_libusb_pr730 Makefile_pr730_hidraw_freebsd_new hidapitester_libusb_pr730_new Makefile_pr730_new test.txt README.md test_hardware docs ``` As expected, no changing of the test results. ``` mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 --o Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: Closing device ```
mcuee commented 2026-04-26 06:44:16 -05:00 (Migrated from github.com)

Now I will continue the 128bytes FX2HID mod firmware testing.

Unfortunately this PR does not work.

PR #728 also does not seems to work either. Strange.

mcuee@freebsd14:~/build/hidapitester $ sudo fxload -v -D vid=0x04b4,pid=0x8613 -t fx2lp -I ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex
microcontroller type: fx2lp
single stage:  load on-chip memory
open RAM hexfile image ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex
stop CPU
write on-chip, addr 0x0600 len  234 (0x00ea)
write on-chip, addr 0x09e5 len   10 (0x000a)
write on-chip, addr 0x0380 len  428 (0x01ac)
write on-chip, addr 0x0080 len  768 (0x0300)
write on-chip, addr 0x0033 len    3 (0x0003)
write on-chip, addr 0x09ff len    7 (0x0007)
write on-chip, addr 0x07b8 len   92 (0x005c)
write on-chip, addr 0x0851 len   59 (0x003b)
write on-chip, addr 0x05fe len    2 (0x0002)
write on-chip, addr 0x0a07 len    4 (0x0004)
write on-chip, addr 0x09ef len    8 (0x0008)
write on-chip, addr 0x09b0 len   18 (0x0012)
write on-chip, addr 0x09f7 len    8 (0x0008)
write on-chip, addr 0x09c2 len   18 (0x0012)
write on-chip, addr 0x0a0b len    6 (0x0006)
write on-chip, addr 0x091d len   40 (0x0028)
write on-chip, addr 0x096a len   24 (0x0018)
write on-chip, addr 0x06ea len   22 (0x0016)
write on-chip, addr 0x099a len   22 (0x0016)
write on-chip, addr 0x088c len   54 (0x0036)
write on-chip, addr 0x0982 len   24 (0x0018)
write on-chip, addr 0x0814 len   61 (0x003d)
write on-chip, addr 0x0a11 len   36 (0x0024)
write on-chip, addr 0x08f1 len   44 (0x002c)
write on-chip, addr 0x08c2 len   47 (0x002f)
write on-chip, addr 0x0945 len   20 (0x0014)
write on-chip, addr 0x05b8 len   70 (0x0046)
write on-chip, addr 0x0959 len   17 (0x0011)
write on-chip, addr 0x0043 len    3 (0x0003)
write on-chip, addr 0x0053 len    3 (0x0003)
write on-chip, addr 0x0700 len  184 (0x00b8)
write on-chip, addr 0x0000 len    3 (0x0003)
write on-chip, addr 0x052c len   12 (0x000c)
write on-chip, addr 0x09d4 len   17 (0x0011)
write on-chip, addr 0x0538 len  128 (0x0080)
write on-chip, addr 0x0a06 len    1 (0x0001)
... WROTE: 2497 bytes, 36 segments, avg 69
reset CPU

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728  --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728  --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 0 bytes:
Closing device

Interestingly hidapi git libusb backend (same as PR#730 libusb backend works a bit better and returns 64 bytes of data. But there is an offset of 64 bytes.

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git  --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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
Now I will continue the 128bytes FX2HID mod firmware testing. Unfortunately this PR does not work. PR #728 also does not seems to work either. Strange. ``` mcuee@freebsd14:~/build/hidapitester $ sudo fxload -v -D vid=0x04b4,pid=0x8613 -t fx2lp -I ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex microcontroller type: fx2lp single stage: load on-chip memory open RAM hexfile image ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex stop CPU write on-chip, addr 0x0600 len 234 (0x00ea) write on-chip, addr 0x09e5 len 10 (0x000a) write on-chip, addr 0x0380 len 428 (0x01ac) write on-chip, addr 0x0080 len 768 (0x0300) write on-chip, addr 0x0033 len 3 (0x0003) write on-chip, addr 0x09ff len 7 (0x0007) write on-chip, addr 0x07b8 len 92 (0x005c) write on-chip, addr 0x0851 len 59 (0x003b) write on-chip, addr 0x05fe len 2 (0x0002) write on-chip, addr 0x0a07 len 4 (0x0004) write on-chip, addr 0x09ef len 8 (0x0008) write on-chip, addr 0x09b0 len 18 (0x0012) write on-chip, addr 0x09f7 len 8 (0x0008) write on-chip, addr 0x09c2 len 18 (0x0012) write on-chip, addr 0x0a0b len 6 (0x0006) write on-chip, addr 0x091d len 40 (0x0028) write on-chip, addr 0x096a len 24 (0x0018) write on-chip, addr 0x06ea len 22 (0x0016) write on-chip, addr 0x099a len 22 (0x0016) write on-chip, addr 0x088c len 54 (0x0036) write on-chip, addr 0x0982 len 24 (0x0018) write on-chip, addr 0x0814 len 61 (0x003d) write on-chip, addr 0x0a11 len 36 (0x0024) write on-chip, addr 0x08f1 len 44 (0x002c) write on-chip, addr 0x08c2 len 47 (0x002f) write on-chip, addr 0x0945 len 20 (0x0014) write on-chip, addr 0x05b8 len 70 (0x0046) write on-chip, addr 0x0959 len 17 (0x0011) write on-chip, addr 0x0043 len 3 (0x0003) write on-chip, addr 0x0053 len 3 (0x0003) write on-chip, addr 0x0700 len 184 (0x00b8) write on-chip, addr 0x0000 len 3 (0x0003) write on-chip, addr 0x052c len 12 (0x000c) write on-chip, addr 0x09d4 len 17 (0x0011) write on-chip, addr 0x0538 len 128 (0x0080) write on-chip, addr 0x0a06 len 1 (0x0001) ... WROTE: 2497 bytes, 36 segments, avg 69 reset CPU mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 0 bytes: Closing device ``` Interestingly hidapi git libusb backend (same as PR#730 libusb backend works a bit better and returns 64 bytes of data. But there is an offset of 64 bytes. ``` mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 2026-04-26 07:08:19 -05:00 (Migrated from github.com)

Unfortunately I am not so sure how to force it to Full Speed mode using the physical machine.

mcuee@freebsd14:~/build/hidapitester $ sudo fxload -v -D vid=0x04b4,pid=0x8613 -t fx2lp -I ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex
microcontroller type: fx2lpmicrocontroller type: fx2lp
single stage:  load on-chip memory
open RAM hexfile image ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex
stop CPU
write on-chip, addr 0x0600 len  234 (0x00ea)
write on-chip, addr 0x09e5 len   10 (0x000a)
write on-chip, addr 0x0380 len  428 (0x01ac)
write on-chip, addr 0x0080 len  768 (0x0300)
write on-chip, addr 0x0033 len    3 (0x0003)
write on-chip, addr 0x09ff len    7 (0x0007)
write on-chip, addr 0x07b8 len   92 (0x005c)
write on-chip, addr 0x0851 len   59 (0x003b)
write on-chip, addr 0x05fe len    2 (0x0002)
write on-chip, addr 0x0a07 len    4 (0x0004)
write on-chip, addr 0x09ef len    8 (0x0008)
write on-chip, addr 0x09b0 len   18 (0x0012)
write on-chip, addr 0x09f7 len    8 (0x0008)
write on-chip, addr 0x09c2 len   18 (0x0012)
write on-chip, addr 0x0a0b len    6 (0x0006)
write on-chip, addr 0x091d len   40 (0x0028)
write on-chip, addr 0x096a len   24 (0x0018)
write on-chip, addr 0x06ea len   22 (0x0016)
write on-chip, addr 0x099a len   22 (0x0016)
write on-chip, addr 0x088c len   54 (0x0036)
write on-chip, addr 0x0982 len   24 (0x0018)
write on-chip, addr 0x0814 len   61 (0x003d)
write on-chip, addr 0x0a11 len   36 (0x0024)
write on-chip, addr 0x08f1 len   44 (0x002c)
write on-chip, addr 0x08c2 len   47 (0x002f)
write on-chip, addr 0x0945 len   20 (0x0014)
write on-chip, addr 0x05b8 len   70 (0x0046)
write on-chip, addr 0x0959 len   17 (0x0011)
write on-chip, addr 0x0043 len    3 (0x0003)
write on-chip, addr 0x0053 len    3 (0x0003)
write on-chip, addr 0x0700 len  184 (0x00b8)
write on-chip, addr 0x0000 len    3 (0x0003)
write on-chip, addr 0x052c len   12 (0x000c)
write on-chip, addr 0x09d4 len   17 (0x0011)
write on-chip, addr 0x0538 len  128 (0x0080)
write on-chip, addr 0x0a06 len    1 (0x0001)
... WROTE: 2497 bytes, 36 segments, avg 69
reset CPU
mcuee@freebsd14:~/build/hidapitester $ sudo usbconfig
ugen0.1: <XHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <2.4GHz Wireless rechargeable vertical mouse [More&Better] SHARKOON Technologies GmbH> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.3: <Elecom Co., Ltd MR-K013 Multicard Reader Areson Technology Corp> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.4: <Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.5: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)
ugen0.7: <product 0x3503 IMC Networks> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.8: <USB3.2 Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.9: <USB 10/100/1G/2.5G LAN Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (64mA)
ugen0.10: <USB Storage Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)
ugen0.6: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA)

I already applied the changes to /boot/loader.conf and reboot the machine.

mcuee@freebsd14:~/build/hidapitester $ sudo cat /boot/loader.conf
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
hidraw_load="YES"
hw.usb.ehci.no_hs="1"
Unfortunately I am not so sure how to force it to Full Speed mode using the physical machine. ``` mcuee@freebsd14:~/build/hidapitester $ sudo fxload -v -D vid=0x04b4,pid=0x8613 -t fx2lp -I ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex microcontroller type: fx2lpmicrocontroller type: fx2lp single stage: load on-chip memory open RAM hexfile image ../fx2hid/fx2hid_128bytes_report/fx2hid_128bytes/fx2hid.hex stop CPU write on-chip, addr 0x0600 len 234 (0x00ea) write on-chip, addr 0x09e5 len 10 (0x000a) write on-chip, addr 0x0380 len 428 (0x01ac) write on-chip, addr 0x0080 len 768 (0x0300) write on-chip, addr 0x0033 len 3 (0x0003) write on-chip, addr 0x09ff len 7 (0x0007) write on-chip, addr 0x07b8 len 92 (0x005c) write on-chip, addr 0x0851 len 59 (0x003b) write on-chip, addr 0x05fe len 2 (0x0002) write on-chip, addr 0x0a07 len 4 (0x0004) write on-chip, addr 0x09ef len 8 (0x0008) write on-chip, addr 0x09b0 len 18 (0x0012) write on-chip, addr 0x09f7 len 8 (0x0008) write on-chip, addr 0x09c2 len 18 (0x0012) write on-chip, addr 0x0a0b len 6 (0x0006) write on-chip, addr 0x091d len 40 (0x0028) write on-chip, addr 0x096a len 24 (0x0018) write on-chip, addr 0x06ea len 22 (0x0016) write on-chip, addr 0x099a len 22 (0x0016) write on-chip, addr 0x088c len 54 (0x0036) write on-chip, addr 0x0982 len 24 (0x0018) write on-chip, addr 0x0814 len 61 (0x003d) write on-chip, addr 0x0a11 len 36 (0x0024) write on-chip, addr 0x08f1 len 44 (0x002c) write on-chip, addr 0x08c2 len 47 (0x002f) write on-chip, addr 0x0945 len 20 (0x0014) write on-chip, addr 0x05b8 len 70 (0x0046) write on-chip, addr 0x0959 len 17 (0x0011) write on-chip, addr 0x0043 len 3 (0x0003) write on-chip, addr 0x0053 len 3 (0x0003) write on-chip, addr 0x0700 len 184 (0x00b8) write on-chip, addr 0x0000 len 3 (0x0003) write on-chip, addr 0x052c len 12 (0x000c) write on-chip, addr 0x09d4 len 17 (0x0011) write on-chip, addr 0x0538 len 128 (0x0080) write on-chip, addr 0x0a06 len 1 (0x0001) ... WROTE: 2497 bytes, 36 segments, avg 69 reset CPU mcuee@freebsd14:~/build/hidapitester $ sudo usbconfig ugen0.1: <XHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.2: <2.4GHz Wireless rechargeable vertical mouse [More&Better] SHARKOON Technologies GmbH> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.3: <Elecom Co., Ltd MR-K013 Multicard Reader Areson Technology Corp> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.4: <Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.5: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA) ugen0.7: <product 0x3503 IMC Networks> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.8: <USB3.2 Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.9: <USB 10/100/1G/2.5G LAN Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (64mA) ugen0.10: <USB Storage Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA) ugen0.6: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA) ``` I already applied the changes to /boot/loader.conf and reboot the machine. ``` mcuee@freebsd14:~/build/hidapitester $ sudo cat /boot/loader.conf kern.geom.label.disk_ident.enable="0" kern.geom.label.gptid.enable="0" cryptodev_load="YES" zfs_load="YES" hidraw_load="YES" hw.usb.ehci.no_hs="1" ```
mcuee commented 2026-04-26 07:15:00 -05:00 (Migrated from github.com)

The following bootloader.conf does not work either even after the reboot.

mcuee@freebsd14:~/build/hidapitester $ uname -a
FreeBSD freebsd14 15.0-RELEASE-p6 FreeBSD 15.0-RELEASE-p6 GENERIC amd64

mcuee@freebsd14:~/build/hidapitester $ sudo cat /boot/loader.conf
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
hidraw_load="YES"
#hw.usb.ehci.no_hs="1"
hint.ehci.0.disabled="1"
hint.ehci.1.disabled="1"

mcuee@freebsd14:~/build/hidapitester $ sudo kldstat
Id Refs Address                Size Name
 1  140 0xffffffff80200000  1f4dad0 kernel
 2    1 0xffffffff8214f000     79b0 hidraw.ko
 3    1 0xffffffff82157000   620c10 zfs.ko
 4    1 0xffffffff82778000     8808 cryptodev.ko
 5    1 0xffffffff831e5000     3570 fdescfs.ko
 6    1 0xffffffff83200000   210318 i915kms.ko
 7    2 0xffffffff83411000    8a190 drm.ko
 8    1 0xffffffff831e9000     22b8 iic.ko
 9    2 0xffffffff831ec000     4120 linuxkpi_video.ko
10    3 0xffffffff831f1000     7358 dmabuf.ko
11    3 0xffffffff831f9000     3378 lindebugfs.ko
12    1 0xffffffff8349c000     b480 ttm.ko
13    1 0xffffffff831fd000     21e8 hcons.ko
14    3 0xffffffff834a8000     30a8 hidmap.ko
15    1 0xffffffff834ac000     21e8 hms.ko
16    1 0xffffffff834af000     21e8 hsctrl.ko
17    1 0xffffffff834b2000     4250 ichsmb.ko
18    1 0xffffffff834b7000     2178 smbus.ko
19    1 0xffffffff834ba000     6210 ig4.ko
20    1 0xffffffff834c1000    32320 linux.ko
21    2 0xffffffff834f4000     6d98 mqueuefs.ko
22    4 0xffffffff834fb000     ce68 linux_common.ko
23    1 0xffffffff83508000    2e3f0 linux64.ko
24    1 0xffffffff83537000     2278 pty.ko
25    1 0xffffffff8353a000     73c0 linprocfs.ko
26    1 0xffffffff83542000     440c linsysfs.ko
27    1 0xffffffff83547000     58c0 ng_ubt.ko
28    7 0xffffffff8354d000     abb8 netgraph.ko
29    3 0xffffffff83558000     a330 ng_hci.ko
30    4 0xffffffff83563000     2670 ng_bluetooth.ko
31    1 0xffffffff83566000     8580 if_ure.ko
32    1 0xffffffff8356f000     31d0 uether.ko
33    1 0xffffffff83573000     e4a8 ng_l2cap.ko
34    1 0xffffffff83582000    1c0c8 ng_btsocket.ko
35    1 0xffffffff8359f000     3908 ng_socket.ko
36    1 0xffffffff835a3000     4860 nullfs.ko
37    1 0xffffffff835a8000     2a80 mac_ntpd.ko

mcuee@freebsd14:~/build/hidapitester $ sudo usbconfig
ugen0.1: <XHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <2.4GHz Wireless rechargeable vertical mouse [More&Better] SHARKOON Technologies GmbH> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.3: <Elecom Co., Ltd MR-K013 Multicard Reader Areson Technology Corp> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.4: <Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.5: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)
ugen0.6: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA)
ugen0.7: <product 0x3503 IMC Networks> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.8: <USB3.2 Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.9: <USB 10/100/1G/2.5G LAN Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (64mA)
ugen0.10: <USB Storage Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)

The following bootloader.conf does not work either even after the reboot. ``` mcuee@freebsd14:~/build/hidapitester $ uname -a FreeBSD freebsd14 15.0-RELEASE-p6 FreeBSD 15.0-RELEASE-p6 GENERIC amd64 mcuee@freebsd14:~/build/hidapitester $ sudo cat /boot/loader.conf kern.geom.label.disk_ident.enable="0" kern.geom.label.gptid.enable="0" cryptodev_load="YES" zfs_load="YES" hidraw_load="YES" #hw.usb.ehci.no_hs="1" hint.ehci.0.disabled="1" hint.ehci.1.disabled="1" mcuee@freebsd14:~/build/hidapitester $ sudo kldstat Id Refs Address Size Name 1 140 0xffffffff80200000 1f4dad0 kernel 2 1 0xffffffff8214f000 79b0 hidraw.ko 3 1 0xffffffff82157000 620c10 zfs.ko 4 1 0xffffffff82778000 8808 cryptodev.ko 5 1 0xffffffff831e5000 3570 fdescfs.ko 6 1 0xffffffff83200000 210318 i915kms.ko 7 2 0xffffffff83411000 8a190 drm.ko 8 1 0xffffffff831e9000 22b8 iic.ko 9 2 0xffffffff831ec000 4120 linuxkpi_video.ko 10 3 0xffffffff831f1000 7358 dmabuf.ko 11 3 0xffffffff831f9000 3378 lindebugfs.ko 12 1 0xffffffff8349c000 b480 ttm.ko 13 1 0xffffffff831fd000 21e8 hcons.ko 14 3 0xffffffff834a8000 30a8 hidmap.ko 15 1 0xffffffff834ac000 21e8 hms.ko 16 1 0xffffffff834af000 21e8 hsctrl.ko 17 1 0xffffffff834b2000 4250 ichsmb.ko 18 1 0xffffffff834b7000 2178 smbus.ko 19 1 0xffffffff834ba000 6210 ig4.ko 20 1 0xffffffff834c1000 32320 linux.ko 21 2 0xffffffff834f4000 6d98 mqueuefs.ko 22 4 0xffffffff834fb000 ce68 linux_common.ko 23 1 0xffffffff83508000 2e3f0 linux64.ko 24 1 0xffffffff83537000 2278 pty.ko 25 1 0xffffffff8353a000 73c0 linprocfs.ko 26 1 0xffffffff83542000 440c linsysfs.ko 27 1 0xffffffff83547000 58c0 ng_ubt.ko 28 7 0xffffffff8354d000 abb8 netgraph.ko 29 3 0xffffffff83558000 a330 ng_hci.ko 30 4 0xffffffff83563000 2670 ng_bluetooth.ko 31 1 0xffffffff83566000 8580 if_ure.ko 32 1 0xffffffff8356f000 31d0 uether.ko 33 1 0xffffffff83573000 e4a8 ng_l2cap.ko 34 1 0xffffffff83582000 1c0c8 ng_btsocket.ko 35 1 0xffffffff8359f000 3908 ng_socket.ko 36 1 0xffffffff835a3000 4860 nullfs.ko 37 1 0xffffffff835a8000 2a80 mac_ntpd.ko mcuee@freebsd14:~/build/hidapitester $ sudo usbconfig ugen0.1: <XHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.2: <2.4GHz Wireless rechargeable vertical mouse [More&Better] SHARKOON Technologies GmbH> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.3: <Elecom Co., Ltd MR-K013 Multicard Reader Areson Technology Corp> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.4: <Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.5: <STK600 development board Atmel Corp.> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA) ugen0.6: <EZ-USB FX2 HID USBHIDIO Lakeview Research> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (80mA) ugen0.7: <product 0x3503 IMC Networks> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA) ugen0.8: <USB3.2 Hub Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.9: <USB 10/100/1G/2.5G LAN Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (64mA) ugen0.10: <USB Storage Genesys Logic, Inc.> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA) ```
aokblast commented 2026-04-27 01:11:29 -05:00 (Migrated from github.com)

Using the latest git push of this PR #730.

mcuee@freebsd14:~/build $ git clone https://github.com/aokblast/hidapi.git -b use_hid_raw hidapi_pr730_new
Cloning into 'hidapi_pr730_new'...
remote: Enumerating objects: 3537, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 3537 (delta 0), reused 3 (delta 0), pack-reused 3533 (from 1)
Receiving objects: 100% (3537/3537), 3.30 MiB | 8.42 MiB/s, done.
Resolving deltas: 100% (2290/2290), done.

mcuee@freebsd14:~/build $ cd hidapitester/

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean
rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new 
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/libusb/hid.c -o ../hidapi_pr730_new/libusb/hid.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_libusb_pr730_new

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean
rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean
rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new 
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/freebsd/hid.c -o ../hidapi_pr730_new/freebsd/hid.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o
cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread

mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_hidraw_pr730_new

mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean
rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o
rm -f hidapitester

mcuee@freebsd14:~/build/hidapitester $ ls
CMakeLists.txt				hidapitester.c
LICENSE					hidapitester_hidraw_pr730
Makefile				hidapitester_hidraw_pr730_new
Makefile_pr728				hidapitester_libusb_git
Makefile_pr730				hidapitester_libusb_pr728
Makefile_pr730_hidraw_freebsd		hidapitester_libusb_pr730
Makefile_pr730_hidraw_freebsd_new	hidapitester_libusb_pr730_new
Makefile_pr730_new			test.txt
README.md				test_hardware
docs

As expected, no changing of the test results.

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--o
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--o
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new  --vidpid 0925:1234
--open --buflen 64 -l 3 --send-output 0,1,2  --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
Closing device

This looks like a firmware bug, right?

> Using the latest git push of this PR #730. > > ``` > mcuee@freebsd14:~/build $ git clone https://github.com/aokblast/hidapi.git -b use_hid_raw hidapi_pr730_new > Cloning into 'hidapi_pr730_new'... > remote: Enumerating objects: 3537, done. > remote: Counting objects: 100% (4/4), done. > remote: Compressing objects: 100% (4/4), done. > remote: Total 3537 (delta 0), reused 3 (delta 0), pack-reused 3533 (from 1) > Receiving objects: 100% (3537/3537), 3.30 MiB | 8.42 MiB/s, done. > Resolving deltas: 100% (2290/2290), done. > > mcuee@freebsd14:~/build $ cd hidapitester/ > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean > rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o > rm -f hidapitester > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new > cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/libusb/hid.c -o ../hidapi_pr730_new/libusb/hid.o > cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o > cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/libusb/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread > > mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_libusb_pr730_new > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_new clean > rm -f ../hidapi_pr730_new/libusb/hid.o hidapitester.o > rm -f hidapitester > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean > rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o > rm -f hidapitester > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new > cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c ../hidapi_pr730_new/freebsd/hid.c -o ../hidapi_pr730_new/freebsd/hid.o > cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" -c hidapitester.c -o hidapitester.o > cc -I/usr/local/include -I ../hidapi_pr730_new/hidapi -DHIDAPITESTER_VERSION=\"""v0.5""\" ../hidapi_pr730_new/freebsd/hid.o hidapitester.o -o hidapitester -L/usr/local/lib -lusb -liconv -pthread > > mcuee@freebsd14:~/build/hidapitester $ cp ./hidapitester ./hidapitester_hidraw_pr730_new > > mcuee@freebsd14:~/build/hidapitester $ gmake -f Makefile_pr730_hidraw_freebsd_new clean > rm -f ../hidapi_pr730_new/freebsd/hid.o hidapitester.o > rm -f hidapitester > > mcuee@freebsd14:~/build/hidapitester $ ls > CMakeLists.txt hidapitester.c > LICENSE hidapitester_hidraw_pr730 > Makefile hidapitester_hidraw_pr730_new > Makefile_pr728 hidapitester_libusb_git > Makefile_pr730 hidapitester_libusb_pr728 > Makefile_pr730_hidraw_freebsd hidapitester_libusb_pr730 > Makefile_pr730_hidraw_freebsd_new hidapitester_libusb_pr730_new > Makefile_pr730_new test.txt > README.md test_hardware > docs > ``` > > As expected, no changing of the test results. > > ``` > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 > --o > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: > 01 02 00 > Closing device > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 > --open --buflen 64 -l 3 --send-output 0,1,2 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: > Closing device > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 > --open --buflen 64 -l 3 --send-output 0,1,2 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: > 01 02 00 > Closing device > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730_new --vidpid 0925:1234 > --open --buflen 64 -l 3 --send-output 0,1,2 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: > Closing device > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 > --o > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: > 01 02 00 > Closing device > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 > --open --buflen 64 -l 3 --send-output 0,1,2 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: > Closing device > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 > --open --buflen 64 -l 3 --send-output 0,1,2 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: > 01 02 00 > Closing device > > mcuee@freebsd14:~/build/hidapitester $ sudo ./hidapitester_libusb_pr730_new --vidpid 0925:1234 > --open --buflen 64 -l 3 --send-output 0,1,2 --read-input > Opening device, vid/pid: 0x0925/0x1234 > Writing output report of 3-bytes...wrote 3 bytes: > 00 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: > Closing device > ``` This looks like a firmware bug, right?
mcuee commented 2026-04-27 01:38:55 -05:00 (Migrated from github.com)

This looks like a firmware bug, right?

Not really in this particular case.

More like a FreeBSD USB bug to me since other Operating Systems have no issues.

Also EZ-USB FX2LP is supposed to handle data toggle correctly from HW side.

BTW, this original FW comes from Jan Axelson, no modification from my side.

If possible, please get the cheap EZ-FX2LP board from online store and try yourself.

> This looks like a firmware bug, right? Not really in this particular case. More like a FreeBSD USB bug to me since other Operating Systems have no issues. Also EZ-USB FX2LP is supposed to handle data toggle correctly from HW side. BTW, this original FW comes from Jan Axelson, no modification from my side. If possible, please get the cheap EZ-FX2LP board from online store and try yourself.
mcuee commented 2026-04-27 01:43:32 -05:00 (Migrated from github.com)

For anyone interested in High Speed USB development and testing, EZ-USB FX2LP is highly recommended. The board is pretty cheap to get from 3rd party vendors (cheap clone of CY3689 EZ-USB FX2LP Discovery Kit)
https://www.infineon.com/assets/row/public/documents/24/44/infineon-cy3689-ez-usb-fx2lp-discovery-kit-quick-start-guide-usermanual-en.pdf

For anyone interested in Super Speed USB development and testing, EZ-USB FX3 is highly recommended. The board is not that cheap but still manageable. It used to be at around US$50 but now it is at US$90.15.
https://www.infineon.com/evaluation-board/cyusb3kit-003

For anyone interested in High Speed USB development and testing, EZ-USB FX2LP is highly recommended. The board is pretty cheap to get from 3rd party vendors (cheap clone of CY3689 EZ-USB FX2LP Discovery Kit) https://www.infineon.com/assets/row/public/documents/24/44/infineon-cy3689-ez-usb-fx2lp-discovery-kit-quick-start-guide-usermanual-en.pdf For anyone interested in Super Speed USB development and testing, EZ-USB FX3 is highly recommended. The board is not that cheap but still manageable. It used to be at around US$50 but now it is at US$90.15. https://www.infineon.com/evaluation-board/cyusb3kit-003
mcuee commented 2026-04-27 09:55:36 -05:00 (Migrated from github.com)

I am stilll using VirtualBox VM under Windows 11 for this test, but I have switched the VM back to the default USB configuration (OHCI + EHCI).

PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage modifyvm "freebsd" --usb-ohci on --usb-ehci on --usb-xhci off

Then I use my trusted modified Generic PIC USB HID example (modified from the Lakeview Research Generic HID example to add Input/Output/Feature report IDs). It is a Full Speed USB device.

It was mentioned in the following discussion.
https://github.com/libusb/hidapi/discussions/590

FW source code and old libusb test codes are here.
https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod

The device works well under Windows.

PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,1,2  --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 01 02
Reading up to 3-byte input report, 250 msec timeout...read 3 bytes:
 01 01 02
Closing device

PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-feature 3,7,8  --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 3-byte feature report...wrote 3 bytes:
 03 07 08
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 07 08
Closing device

It also works fine with this PR under FreeBSD VM.

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6  --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 05 06
Reading up to 3-byte input report, 250 msec timeout...read 3 bytes:
 01 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6  --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 05 06
Reading up to 3-byte input report, 250 msec timeout...read 3 bytes:
 01 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --open --buflen 64 -l 3 --send-feature 3,5,6  --read-feature 4
Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0
Device opened
Writing 3-byte feature report...wrote 3 bytes:
 03 05 06
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --open --buflen 64 -l 3 --send-feature 3,5,6  --read-feature 4
Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0
Device opened
Writing 3-byte feature report...wrote 3 bytes:
 03 05 06
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:7001 -vvv

Bus /dev/usb Device /dev/ugen0.2: ID 0925:7001 Lakeview Research
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0925 Lakeview Research
  idProduct          0x7001
  bcdDevice            0.01
  iManufacturer           1 Lakeview Research
  iProduct                2 Generic HID
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      45
          Report Descriptor: (length is 45)
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Global): Report ID, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Input, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Output, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Global): Report ID, data= [ 0x03 ] 3
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Feature, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Global): Report ID, data= [ 0x04 ] 4
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Feature, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
can't get device qualifier: Input/output error
can't get debug descriptor: Input/output error
Device Status:     0x0001
  Self Powered
I am stilll using VirtualBox VM under Windows 11 for this test, but I have switched the VM back to the default USB configuration (OHCI + EHCI). ``` PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage modifyvm "freebsd" --usb-ohci on --usb-ehci on --usb-xhci off ``` Then I use my trusted modified Generic PIC USB HID example (modified from the Lakeview Research Generic HID example to add Input/Output/Feature report IDs). It is a Full Speed USB device. It was mentioned in the following discussion. https://github.com/libusb/hidapi/discussions/590 FW source code and old libusb test codes are here. https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod The device works well under Windows. ``` PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,1,2 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 02 01 02 Reading up to 3-byte input report, 250 msec timeout...read 3 bytes: 01 01 02 Closing device PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-feature 3,7,8 --read-feature 4 Opening device, vid/pid: 0x0925/0x7001 Writing 3-byte feature report...wrote 3 bytes: 03 07 08 Reading 3-byte feature report, report_id 4...read 3 bytes: 04 07 08 Closing device ``` It also works fine with this PR under FreeBSD VM. ``` mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 02 05 06 Reading up to 3-byte input report, 250 msec timeout...read 3 bytes: 01 05 06 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 02 05 06 Reading up to 3-byte input report, 250 msec timeout...read 3 bytes: 01 05 06 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --open --buflen 64 -l 3 --send-feature 3,5,6 --read-feature 4 Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0 Device opened Writing 3-byte feature report...wrote 3 bytes: 03 05 06 Reading 3-byte feature report, report_id 4...read 3 bytes: 04 05 06 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --open --buflen 64 -l 3 --send-feature 3,5,6 --read-feature 4 Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0 Device opened Writing 3-byte feature report...wrote 3 bytes: 03 05 06 Reading 3-byte feature report, report_id 4...read 3 bytes: 04 05 06 Closing device mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:7001 -vvv Bus /dev/usb Device /dev/ugen0.2: ID 0925:7001 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x0925 Lakeview Research idProduct 0x7001 bcdDevice 0.01 iManufacturer 1 Lakeview Research iProduct 2 Generic HID iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.11 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 45 Report Descriptor: (length is 45) Item(Global): Usage Page, data= [ 0x00 0xff ] 65280 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Global): Report ID, data= [ 0x01 ] 1 Item(Local ): Usage, data= [ 0x00 ] 0 (null) Item(Main ): Input, data= [ 0x02 0x01 ] 258 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Buffered Bytes Item(Global): Report ID, data= [ 0x02 ] 2 Item(Local ): Usage, data= [ 0x00 ] 0 (null) Item(Main ): Output, data= [ 0x02 0x01 ] 258 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Buffered Bytes Item(Global): Report ID, data= [ 0x03 ] 3 Item(Local ): Usage, data= [ 0x00 ] 0 (null) Item(Main ): Feature, data= [ 0x02 0x01 ] 258 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Buffered Bytes Item(Global): Report ID, data= [ 0x04 ] 4 Item(Local ): Usage, data= [ 0x00 ] 0 (null) Item(Main ): Feature, data= [ 0x02 0x01 ] 258 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Buffered Bytes Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 can't get device qualifier: Input/output error can't get debug descriptor: Input/output error Device Status: 0x0001 Self Powered ```
aokblast commented 2026-04-28 03:11:18 -05:00 (Migrated from github.com)

EZ-USB FX2LP

Just buy a EZ-USB FX2LP. I spend two days on configuring stm32h750 + usb3320 and it fails. I think there are some design flaws on stm32h750 as some pin output doesn't follow the ulpi standard.

See: https://community.st.com/t5/stm32-mcus-embedded-software/stm32h750-usb3300-no-signals-on-ulpi/td-p/225293?fbclid=IwY2xjawRdSk5leHRuA2FlbQIxMABicmlkETF1eVg0M2d2OENpV1lWdnpjc3J0YwZhcHBfaWQQMjIyMDM5MTc4ODIwMDg5MgABHr4fjotlcri4aRfLeR3qxxa3_rOWLG8XdiaZHQXLlSejiReV3U-u7F052oj-_aem_DLqIO7VIk_LDjl6YhWkqEw

> EZ-USB FX2LP Just buy a EZ-USB FX2LP. I spend two days on configuring stm32h750 + usb3320 and it fails. I think there are some design flaws on stm32h750 as some pin output doesn't follow the ulpi standard. See: https://community.st.com/t5/stm32-mcus-embedded-software/stm32h750-usb3300-no-signals-on-ulpi/td-p/225293?fbclid=IwY2xjawRdSk5leHRuA2FlbQIxMABicmlkETF1eVg0M2d2OENpV1lWdnpjc3J0YwZhcHBfaWQQMjIyMDM5MTc4ODIwMDg5MgABHr4fjotlcri4aRfLeR3qxxa3_rOWLG8XdiaZHQXLlSejiReV3U-u7F052oj-_aem_DLqIO7VIk_LDjl6YhWkqEw
aokblast commented 2026-05-18 11:27:09 -05:00 (Migrated from github.com)

I am stilll using VirtualBox VM under Windows 11 for this test, but I have switched the VM back to the default USB configuration (OHCI + EHCI).

PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage modifyvm "freebsd" --usb-ohci on --usb-ehci on --usb-xhci off

Then I use my trusted modified Generic PIC USB HID example (modified from the Lakeview Research Generic HID example to add Input/Output/Feature report IDs). It is a Full Speed USB device.

It was mentioned in the following discussion. #590

FW source code and old libusb test codes are here. https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod

The device works well under Windows.

PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,1,2  --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 01 02
Reading up to 3-byte input report, 250 msec timeout...read 3 bytes:
 01 01 02
Closing device

PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-feature 3,7,8  --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 3-byte feature report...wrote 3 bytes:
 03 07 08
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 07 08
Closing device

It also works fine with this PR under FreeBSD VM.

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6  --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 05 06
Reading up to 3-byte input report, 250 msec timeout...read 3 bytes:
 01 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6  --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 05 06
Reading up to 3-byte input report, 250 msec timeout...read 3 bytes:
 01 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --open --buflen 64 -l 3 --send-feature 3,5,6  --read-feature 4
Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0
Device opened
Writing 3-byte feature report...wrote 3 bytes:
 03 05 06
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new  --open --buflen 64 -l 3 --send-feature 3,5,6  --read-feature 4
Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0
Device opened
Writing 3-byte feature report...wrote 3 bytes:
 03 05 06
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 05 06
Closing device

mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:7001 -vvv

Bus /dev/usb Device /dev/ugen0.2: ID 0925:7001 Lakeview Research
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0925 Lakeview Research
  idProduct          0x7001
  bcdDevice            0.01
  iManufacturer           1 Lakeview Research
  iProduct                2 Generic HID
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      45
          Report Descriptor: (length is 45)
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x02 ] 2
            Item(Global): Report ID, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Input, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Output, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Global): Report ID, data= [ 0x03 ] 3
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Feature, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Global): Report ID, data= [ 0x04 ] 4
            Item(Local ): Usage, data= [ 0x00 ] 0
                            (null)
            Item(Main  ): Feature, data= [ 0x02 0x01 ] 258
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Buffered Bytes
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
can't get device qualifier: Input/output error
can't get debug descriptor: Input/output error
Device Status:     0x0001
  Self Powered

Hi,

I received the EXUSB FX2 last week. I spent the weekend setting up the toolchain, since the SDK is very outdated and Infineon no longer maintains or provides the download link. I’ve fixed the firmware now.

The issue turned out to be quite simple: you forgot to arm EP1OUT the first time. To fix it, add:

EP1OUTBC = anynumber;

at the end of TD_Init().

sudo   ./hidapitester   --open-path /dev/hidraw4 --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input
Opening device. path: /dev/hidraw4
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
> I am stilll using VirtualBox VM under Windows 11 for this test, but I have switched the VM back to the default USB configuration (OHCI + EHCI). > > ``` > PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage modifyvm "freebsd" --usb-ohci on --usb-ehci on --usb-xhci off > ``` > > Then I use my trusted modified Generic PIC USB HID example (modified from the Lakeview Research Generic HID example to add Input/Output/Feature report IDs). It is a Full Speed USB device. > > It was mentioned in the following discussion. #590 > > FW source code and old libusb test codes are here. https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod > > The device works well under Windows. > > ``` > PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,1,2 --read-input > Opening device, vid/pid: 0x0925/0x7001 > Writing output report of 3-bytes...wrote 3 bytes: > 02 01 02 > Reading up to 3-byte input report, 250 msec timeout...read 3 bytes: > 01 01 02 > Closing device > > PS C:\work\libusb\hidapitester> .\hidapitester_git_winapi.exe --vidpid 0925:7001 --open --buflen 64 -l 3 --send-feature 3,7,8 --read-feature 4 > Opening device, vid/pid: 0x0925/0x7001 > Writing 3-byte feature report...wrote 3 bytes: > 03 07 08 > Reading 3-byte feature report, report_id 4...read 3 bytes: > 04 07 08 > Closing device > ``` > > It also works fine with this PR under FreeBSD VM. > > ``` > mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6 --read-input > Opening device, vid/pid: 0x0925/0x7001 > Writing output report of 3-bytes...wrote 3 bytes: > 02 05 06 > Reading up to 3-byte input report, 250 msec timeout...read 3 bytes: > 01 05 06 > Closing device > > mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,5,6 --read-input > Opening device, vid/pid: 0x0925/0x7001 > Writing output report of 3-bytes...wrote 3 bytes: > 02 05 06 > Reading up to 3-byte input report, 250 msec timeout...read 3 bytes: > 01 05 06 > Closing device > > mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --open --buflen 64 -l 3 --send-feature 3,5,6 --read-feature 4 > Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0 > Device opened > Writing 3-byte feature report...wrote 3 bytes: > 03 05 06 > Reading 3-byte feature report, report_id 4...read 3 bytes: > 04 05 06 > Closing device > > mcuee@freebsdvm:~/build/hidapitester $ sudo ./hidapitester_pr730_hidraw_new --open --buflen 64 -l 3 --send-feature 3,5,6 --read-feature 4 > Opening device, vid/pid:0x0000/0x0000, usagePage/usage: 0/0 > Device opened > Writing 3-byte feature report...wrote 3 bytes: > 03 05 06 > Reading 3-byte feature report, report_id 4...read 3 bytes: > 04 05 06 > Closing device > > mcuee@freebsdvm:~/build/hidapitester $ sudo lsusb -d 0925:7001 -vvv > > Bus /dev/usb Device /dev/ugen0.2: ID 0925:7001 Lakeview Research > Device Descriptor: > bLength 18 > bDescriptorType 1 > bcdUSB 2.00 > bDeviceClass 0 (Defined at Interface level) > bDeviceSubClass 0 > bDeviceProtocol 0 > bMaxPacketSize0 8 > idVendor 0x0925 Lakeview Research > idProduct 0x7001 > bcdDevice 0.01 > iManufacturer 1 Lakeview Research > iProduct 2 Generic HID > iSerial 0 > bNumConfigurations 1 > Configuration Descriptor: > bLength 9 > bDescriptorType 2 > wTotalLength 41 > bNumInterfaces 1 > bConfigurationValue 1 > iConfiguration 0 > bmAttributes 0xc0 > Self Powered > MaxPower 100mA > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 0 > bNumEndpoints 2 > bInterfaceClass 3 Human Interface Device > bInterfaceSubClass 0 No Subclass > bInterfaceProtocol 0 None > iInterface 0 > HID Device Descriptor: > bLength 9 > bDescriptorType 33 > bcdHID 1.11 > bCountryCode 0 Not supported > bNumDescriptors 1 > bDescriptorType 34 Report > wDescriptorLength 45 > Report Descriptor: (length is 45) > Item(Global): Usage Page, data= [ 0x00 0xff ] 65280 > (null) > Item(Local ): Usage, data= [ 0x01 ] 1 > (null) > Item(Main ): Collection, data= [ 0x01 ] 1 > Application > Item(Global): Logical Minimum, data= [ 0x00 ] 0 > Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 > Item(Global): Report Size, data= [ 0x08 ] 8 > Item(Global): Report Count, data= [ 0x02 ] 2 > Item(Global): Report ID, data= [ 0x01 ] 1 > Item(Local ): Usage, data= [ 0x00 ] 0 > (null) > Item(Main ): Input, data= [ 0x02 0x01 ] 258 > Data Variable Absolute No_Wrap Linear > Preferred_State No_Null_Position Non_Volatile Buffered Bytes > Item(Global): Report ID, data= [ 0x02 ] 2 > Item(Local ): Usage, data= [ 0x00 ] 0 > (null) > Item(Main ): Output, data= [ 0x02 0x01 ] 258 > Data Variable Absolute No_Wrap Linear > Preferred_State No_Null_Position Non_Volatile Buffered Bytes > Item(Global): Report ID, data= [ 0x03 ] 3 > Item(Local ): Usage, data= [ 0x00 ] 0 > (null) > Item(Main ): Feature, data= [ 0x02 0x01 ] 258 > Data Variable Absolute No_Wrap Linear > Preferred_State No_Null_Position Non_Volatile Buffered Bytes > Item(Global): Report ID, data= [ 0x04 ] 4 > Item(Local ): Usage, data= [ 0x00 ] 0 > (null) > Item(Main ): Feature, data= [ 0x02 0x01 ] 258 > Data Variable Absolute No_Wrap Linear > Preferred_State No_Null_Position Non_Volatile Buffered Bytes > Item(Main ): End Collection, data=none > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 3 > Transfer Type Interrupt > Synch Type None > Usage Type Data > wMaxPacketSize 0x0040 1x 64 bytes > bInterval 1 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x01 EP 1 OUT > bmAttributes 3 > Transfer Type Interrupt > Synch Type None > Usage Type Data > wMaxPacketSize 0x0040 1x 64 bytes > bInterval 1 > can't get device qualifier: Input/output error > can't get debug descriptor: Input/output error > Device Status: 0x0001 > Self Powered > ``` Hi, I received the EXUSB FX2 last week. I spent the weekend setting up the toolchain, since the SDK is very outdated and Infineon no longer maintains or provides the download link. I’ve fixed the firmware now. The issue turned out to be quite simple: you forgot to arm EP1OUT the first time. To fix it, add: EP1OUTBC = anynumber; at the end of TD_Init(). ``` sudo ./hidapitester --open-path /dev/hidraw4 --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device. path: /dev/hidraw4 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 ```
aokblast commented 2026-05-19 02:58:14 -05:00 (Migrated from github.com)

@mcuee I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes). The reason is the following:

xHCI assumes there will be 2 packets (128 / 64), so it sends the following sequence to the device:

IN token with size = 64
Device replies with 64 bytes
Host ACK
Another IN token with size = 64
Device replies with another 64 bytes
Host ACK

This completes a full cycle for receiving a 128-byte report from the device.

However, if the device sends a short packet, the sequence becomes:

IN token with size = 64
Device replies with a short packet (== 64 bytes)
Host ACK
Another IN token with size = 64
Device never replies, so xHCI never completes the transfer

As a result, the receive operation eventually hangs and fails.

@mcuee I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes). The reason is the following: xHCI assumes there will be 2 packets (128 / 64), so it sends the following sequence to the device: IN token with size = 64 Device replies with 64 bytes Host ACK Another IN token with size = 64 Device replies with another 64 bytes Host ACK This completes a full cycle for receiving a 128-byte report from the device. However, if the device sends a short packet, the sequence becomes: IN token with size = 64 Device replies with a short packet (== 64 bytes) Host ACK Another IN token with size = 64 Device never replies, so xHCI never completes the transfer As a result, the receive operation eventually hangs and fails.
mcuee commented 2026-05-19 03:52:01 -05:00 (Migrated from github.com)

@aokblast

Thanks a lot for the updates. Let me digest and check again.

The issue turned out to be quite simple: you forgot to arm EP1OUT the first time

You are absolute right here. I have seen strange issues previously with random data for the initial run. I am not the author of the origina FX2HID code. The original auther is Jan Axelson (author of the book "USB Complete").

I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes).

I am not so sure about this one. Different OS may be different as well. Let me check.

@aokblast Thanks a lot for the updates. Let me digest and check again. > The issue turned out to be quite simple: you forgot to arm EP1OUT the first time You are absolute right here. I have seen strange issues previously with random data for the initial run. I am not the author of the origina FX2HID code. The original auther is Jan Axelson (author of the book "USB Complete"). > I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes). I am not so sure about this one. Different OS may be different as well. Let me check.
mcuee commented 2026-05-19 03:57:27 -05:00 (Migrated from github.com)

@aokblast

I have some modified EZ-USB FX2HID firmware as well. I am not a programmer myself, please check as well. Thanks.

Modified version of the fx2hid firmware mods (with bug fixes in TD_Init function)
fx2hid_64bytes.zip
fx2hid_128bytes_report.zip
fx2hid_512bytes_packet.zip
fx2hid_512bytes_report.zip
fx2hid_1024bytes_packet.zip

Common files from Cypress
Target.zip

@aokblast I have some modified EZ-USB FX2HID firmware as well. I am not a programmer myself, please check as well. Thanks. * https://github.com/libusb/hidapi/discussions/590 Modified version of the fx2hid firmware mods (with bug fixes in `TD_Init` function) [fx2hid_64bytes.zip](https://github.com/user-attachments/files/28006258/fx2hid_64bytes.zip) [fx2hid_128bytes_report.zip](https://github.com/user-attachments/files/28006260/fx2hid_128bytes_report.zip) [fx2hid_512bytes_packet.zip](https://github.com/user-attachments/files/28006261/fx2hid_512bytes_packet.zip) [fx2hid_512bytes_report.zip](https://github.com/user-attachments/files/28006262/fx2hid_512bytes_report.zip) [fx2hid_1024bytes_packet.zip](https://github.com/user-attachments/files/28006264/fx2hid_1024bytes_packet.zip) Common files from Cypress [Target.zip](https://github.com/user-attachments/files/28006268/Target.zip)
mcuee commented 2026-05-19 04:05:16 -05:00 (Migrated from github.com)

@aokblast

Infineon/Cypress CY3689 and CY3684 download links (you need to register). The clones are mostly copy of CY3689.
https://www.infineon.com/products/universal-serial-bus/usb-2-0-peripheral-controllers/ez-usb-fx2lp-fx2g2-usb-2-0

Screenshot 2026-05-19 170425
@aokblast Infineon/Cypress CY3689 and CY3684 download links (you need to register). The clones are mostly copy of CY3689. https://www.infineon.com/products/universal-serial-bus/usb-2-0-peripheral-controllers/ez-usb-fx2lp-fx2g2-usb-2-0 <img width="1309" height="554" alt="Screenshot 2026-05-19 170425" src="https://github.com/user-attachments/assets/a4ca118b-d255-45fd-89de-61e954a7206f" />
mcuee commented 2026-05-20 20:59:05 -05:00 (Migrated from github.com)

xHCI assumes there will be 2 packets (128 / 64), so it sends the following sequence to the device:

@aokblast

BTW, EZ-USB FX2LP is a High Speed USB device, do you mean to say EHCI and not xHCI?

I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes).

Another thing, I have tested different firmwares. So you may get confused here.

  1. Some of the firwares only have 2 bytes HID reports, like the original FX2HID example (High Speed USB, which also works under Full Speed USB).
  2. Some of the firmwars only have 3 bytes HID reports, like the following USB PIC example (Full Speed USB). I have not tested the later mod with 32Bytes/64Bytes reports.
    https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod
  3. Then I have the modified FX2HID with 64Bytes/128Bytes/512Bytes/1024Bytes firmware. But the 512B/1024B firmware are not well tested across different OS. There may be more bugs inside.

I will carry out tests under FreeBSD over the weekend.

> xHCI assumes there will be 2 packets (128 / 64), so it sends the following sequence to the device: @aokblast BTW, EZ-USB FX2LP is a High Speed USB device, do you mean to say EHCI and not xHCI? > I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes). Another thing, I have tested different firmwares. So you may get confused here. 1) Some of the firwares only have 2 bytes HID reports, like the original FX2HID example (High Speed USB, which also works under Full Speed USB). 2) Some of the firmwars only have 3 bytes HID reports, like the following USB PIC example (Full Speed USB). I have not tested the later mod with 32Bytes/64Bytes reports. https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod 3) Then I have the modified FX2HID with 64Bytes/128Bytes/512Bytes/1024Bytes firmware. But the 512B/1024B firmware are not well tested across different OS. There may be more bugs inside. I will carry out tests under FreeBSD over the weekend.
aokblast commented 2026-05-21 08:47:46 -05:00 (Migrated from github.com)

xHCI assumes there will be 2 packets (128 / 64), so it sends the following sequence to the device:

@aokblast

BTW, EZ-USB FX2LP is a High Speed USB device, do you mean to say EHCI and not xHCI?

USB standard is a little bit confusing. You actually attached a USB 2.0 device to xHCI. But since the xHCI controller is a xHCI controller + eHCI controller internally, so...

I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes).

Another thing, I have tested different firmwares. So you may get confused here.

  1. Some of the firwares only have 2 bytes HID reports, like the original FX2HID example (High Speed USB, which also works under Full Speed USB).
  2. Some of the firmwars only have 3 bytes HID reports, like the following USB PIC example (Full Speed USB). I have not tested the later mod with 32Bytes/64Bytes reports.
    https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod
  3. Then I have the modified FX2HID with 64Bytes/128Bytes/512Bytes/1024Bytes firmware. But the 512B/1024B firmware are not well tested across different OS. There may be more bugs inside.

I will carry out tests under FreeBSD over the weekend.

I found a bug in the FreeBSD xHCI implementation that cause the data only receive bi-transfer in <= 64 byte case. Please also apply this patch while you are testing. https://reviews.freebsd.org/D57146.
I have tried send 64 bytes (report size is 64), send 63 bytes (report size is 64), send 128 bytes (report size is 128), send 63 bytes (report size is 128).

Send 64 bytes (report size is 128) can not be resolved as the problem I have explain previously. There is a flag in libusb call LIBUSB_TRANSFER_ADD_ZERO_PACKET that can solve this problem.

> > xHCI assumes there will be 2 packets (128 / 64), so it sends the following sequence to the device: > > @aokblast > > BTW, EZ-USB FX2LP is a High Speed USB device, do you mean to say EHCI and not xHCI? USB standard is a little bit confusing. You actually attached a USB 2.0 device to xHCI. But since the xHCI controller is a xHCI controller + eHCI controller internally, so... > > > I also did some experiments. FX2 is packet-based, which means if you set MPS = 64 and the report size = 128, it will not work correctly when the device wants to send a short packet (< 64 bytes). > > Another thing, I have tested different firmwares. So you may get confused here. > > 1. Some of the firwares only have 2 bytes HID reports, like the original FX2HID example (High Speed USB, which also works under Full Speed USB). > 2. Some of the firmwars only have 3 bytes HID reports, like the following USB PIC example (Full Speed USB). I have not tested the later mod with 32Bytes/64Bytes reports. > https://github.com/mcuee/picusb/tree/master/lvr_genhid_mod > 3. Then I have the modified FX2HID with 64Bytes/128Bytes/512Bytes/1024Bytes firmware. But the 512B/1024B firmware are not well tested across different OS. There may be more bugs inside. > > I will carry out tests under FreeBSD over the weekend. I found a bug in the FreeBSD xHCI implementation that cause the data only receive bi-transfer in <= 64 byte case. Please also apply this patch while you are testing. https://reviews.freebsd.org/D57146. I have tried send 64 bytes (report size is 64), send 63 bytes (report size is 64), send 128 bytes (report size is 128), send 63 bytes (report size is 128). Send 64 bytes (report size is 128) can not be resolved as the problem I have explain previously. There is a flag in libusb call LIBUSB_TRANSFER_ADD_ZERO_PACKET that can solve this problem.
aokblast commented 2026-05-22 02:56:06 -05:00 (Migrated from github.com)

@mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch.

@mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch.
mcuee commented 2026-05-22 02:59:56 -05:00 (Migrated from github.com)

@mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch.

@aokblast
An ISO image (x86_64) will be great. Thanks.

> @mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch. @aokblast An ISO image (x86_64) will be great. Thanks.
aokblast commented 2026-05-22 03:04:04 -05:00 (Migrated from github.com)

@mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch.

@aokblast An ISO image (x86_64) will be great. Thanks.

Ok, will build one later. I just merge my patch upstream and need times to build world and kernel.

> > @mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch. > > @aokblast An ISO image (x86_64) will be great. Thanks. Ok, will build one later. I just merge my patch upstream and need times to build world and kernel.
aokblast commented 2026-05-22 06:46:05 -05:00 (Migrated from github.com)

@mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch.

@aokblast An ISO image (x86_64) will be great. Thanks.

Ok, will build one later. I just merge my patch upstream and need times to build world and kernel.

Hi, I just send a link to your email. Please take a look.

> > > @mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch. > > > > > > @aokblast An ISO image (x86_64) will be great. Thanks. > > Ok, will build one later. I just merge my patch upstream and need times to build world and kernel. Hi, I just send a link to your email. Please take a look.
mcuee commented 2026-05-23 00:55:25 -05:00 (Migrated from github.com)

Thanks a lot for the updates. Let me digest and check again.

The issue turned out to be quite simple: you forgot to arm EP1OUT the first time

You are absolute right here. I have seen strange issues previously with random data for the initial run. I am not the author of the origina FX2HID code. The original auther is Jan Axelson (author of the book "USB Complete").

@aokblast

Great, now this PR works perfectly under your FreeBSD 16.0 Current build (tested with VirtualBox VM first).

mcuee@freebsd16vm:~/build/hidapitester $  ./hidapitester_hidraw_pr730 --open-path /dev/hidraw0 --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,1
06,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input
Opening device. path: /dev/hidraw0
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device
> Thanks a lot for the updates. Let me digest and check again. > > > The issue turned out to be quite simple: you forgot to arm EP1OUT the first time > > You are absolute right here. I have seen strange issues previously with random data for the initial run. I am not the author of the origina FX2HID code. The original auther is Jan Axelson (author of the book "USB Complete"). @aokblast Great, now this PR works perfectly under your FreeBSD 16.0 Current build (tested with VirtualBox VM first). ``` mcuee@freebsd16vm:~/build/hidapitester $ ./hidapitester_hidraw_pr730 --open-path /dev/hidraw0 --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58, 59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,1 06,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device. path: /dev/hidraw0 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device ```
mcuee commented 2026-05-23 00:57:03 -05:00 (Migrated from github.com)

PR #728 also works fine and hidapi git has the issue with #274.

mcuee@freebsd16vm:~/build/hidapitester $  ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,
9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,5
,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105
106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

mcuee@freebsd16vm:~/build/hidapitester $  ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9,
10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
9,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,1
6,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 64 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 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
PR #728 also works fine and hidapi git has the issue with #274. * #728 * #274 ``` mcuee@freebsd16vm:~/build/hidapitester $ ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,5 ,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105 106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 00 Closing device mcuee@freebsd16vm:~/build/hidapitester $ ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9, 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58, 9,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,1 6,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 129-bytes...wrote 129 bytes: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 Reading up to 129-byte input report, 250 msec timeout...read 64 bytes: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 2026-05-23 01:02:20 -05:00 (Migrated from github.com)

@mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch.

Indeed 2 bytes will not work with FreeBSD hidraw backend. libusb backend works fine (git or PR #728)

I will carry out more testing later today and tomorrow.

mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 256 -l 3 --send-output 0,1,2 --read-input
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 256 -l 3 --send-output 0,1,2 --read-inp
ut
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730  --vidpid 0925:1234 --open --buflen 256 -l 3 --send-output 0,1,2 --read-in
put
Opening device, vid/pid: 0x0925/0x1234
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 0 bytes:
 00 00 00
Closing device
> @mcuee 3 bytes also work in both 64 and 128 bytes report. 2 bytes won't work as it is a hard limit in FreeBSD hidraw interface. If you need a ISO image to test, I can build one for you with my patch. Indeed 2 bytes will not work with FreeBSD hidraw backend. libusb backend works fine (git or PR #728) I will carry out more testing later today and tomorrow. ``` mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_libusb_git --vidpid 0925:1234 --open --buflen 256 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:1234 --open --buflen 256 -l 3 --send-output 0,1,2 --read-inp ut Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:1234 --open --buflen 256 -l 3 --send-output 0,1,2 --read-in put Opening device, vid/pid: 0x0925/0x1234 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 0 bytes: 00 00 00 Closing device ```
aokblast commented 2026-05-23 03:51:13 -05:00 (Migrated from github.com)

Thanks a lot for the updates. Let me digest and check again.

The issue turned out to be quite simple: you forgot to arm EP1OUT the first time

You are absolute right here. I have seen strange issues previously with random data for the initial run. I am not the author of the origina FX2HID code. The original auther is Jan Axelson (author of the book "USB Complete").

@aokblast

Great, now this PR works perfectly under your FreeBSD 16.0 Current build (tested with VirtualBox VM first).

mcuee@freebsd16vm:~/build/hidapitester $  ./hidapitester_hidraw_pr730 --open-path /dev/hidraw0 --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,1
06,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input
Opening device. path: /dev/hidraw0
Writing output report of 129-bytes...wrote 129 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
 80
Reading up to 129-byte input report, 250 msec timeout...read 128 bytes:
 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80
 00
Closing device

Thanks! Hope we can merge this patch ASAP:).

> > Thanks a lot for the updates. Let me digest and check again. > > > The issue turned out to be quite simple: you forgot to arm EP1OUT the first time > > > > > > You are absolute right here. I have seen strange issues previously with random data for the initial run. I am not the author of the origina FX2HID code. The original auther is Jan Axelson (author of the book "USB Complete"). > > @aokblast > > Great, now this PR works perfectly under your FreeBSD 16.0 Current build (tested with VirtualBox VM first). > > ``` > mcuee@freebsd16vm:~/build/hidapitester $ ./hidapitester_hidraw_pr730 --open-path /dev/hidraw0 --buflen 256 -l 129 --send-output 0,1,2,3,4,5,6,7,8,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58, > 59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,1 > 06,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 --read-input > Opening device. path: /dev/hidraw0 > Writing output report of 129-bytes...wrote 129 bytes: > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F > 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F > 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F > 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F > 80 > Reading up to 129-byte input report, 250 msec timeout...read 128 bytes: > 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 > 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 > 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 > 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 > 00 > Closing device > ``` Thanks! Hope we can merge this patch ASAP:).
mcuee commented 2026-05-24 06:38:52 -05:00 (Migrated from github.com)

Going back to the Generic HID PIC FW example (Full Speed USB device), there are no issues.

mcuee@freebsd16vm:~/build/hidapitester $ uname -a
FreeBSD freebsd16vm 16.0-CURRENT FreeBSD 16.0-CURRENT #0 main-n286042-28d85db46b48-dirty: Fri May 22 16:36:08 CST 2026     blast@blast-devserv:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64

mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730  --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,3,4,5 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 02 03 04
Reading up to 3-byte input report, 250 msec timeout...read 3 bytes:
 01 03 04
Closing device

mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:7001 --open --buflen 64 -l 3 --send-feature 3,3,4,5 --read-feature 4
Opening device, vid/pid: 0x0925/0x7001
Writing 3-byte feature report...wrote 3 bytes:
 03 03 04
Reading 3-byte feature report, report_id 4...read 3 bytes:
 04 03 04
Closing device
Going back to the Generic HID PIC FW example (Full Speed USB device), there are no issues. ``` mcuee@freebsd16vm:~/build/hidapitester $ uname -a FreeBSD freebsd16vm 16.0-CURRENT FreeBSD 16.0-CURRENT #0 main-n286042-28d85db46b48-dirty: Fri May 22 16:36:08 CST 2026 blast@blast-devserv:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 2,3,4,5 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 02 03 04 Reading up to 3-byte input report, 250 msec timeout...read 3 bytes: 01 03 04 Closing device mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:7001 --open --buflen 64 -l 3 --send-feature 3,3,4,5 --read-feature 4 Opening device, vid/pid: 0x0925/0x7001 Writing 3-byte feature report...wrote 3 bytes: 03 03 04 Reading 3-byte feature report, report_id 4...read 3 bytes: 04 03 04 Closing device ```
mcuee commented 2026-05-24 06:46:37 -05:00 (Migrated from github.com)

Going to the original Generic PIC FW (unmodified, from Jan Axelson, Full Speed USB device) with two bytes reoort, it also works.

mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730  --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device

mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 0,1,2 --read-inpu
t
Opening device, vid/pid: 0x0925/0x7001
Writing output report of 3-bytes...wrote 3 bytes:
 00 01 02
Reading up to 3-byte input report, 250 msec timeout...read 2 bytes:
 01 02 00
Closing device
Going to the original Generic PIC FW (unmodified, from Jan Axelson, Full Speed USB device) with two bytes reoort, it also works. ``` mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_hidraw_pr730 --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 0,1,2 --read-input Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device mcuee@freebsd16vm:~/build/hidapitester $ sudo ./hidapitester_libusb_pr728 --vidpid 0925:7001 --open --buflen 64 -l 3 --send-output 0,1,2 --read-inpu t Opening device, vid/pid: 0x0925/0x7001 Writing output report of 3-bytes...wrote 3 bytes: 00 01 02 Reading up to 3-byte input report, 250 msec timeout...read 2 bytes: 01 02 00 Closing device ```
mcuee (Migrated from github.com) approved these changes 2026-05-24 06:47:56 -05:00
mcuee commented 2026-05-24 06:49:09 -05:00 (Migrated from github.com)

@aokblast
I have approved this PR.

@Youw
Please review and I think this is a good addition to hidapi under FreeBSD. Since this is a new backend, it does not affect much other codes. Issues specific to this backend can be fixed within this backend.

@aokblast I have approved this PR. @Youw Please review and I think this is a good addition to hidapi under FreeBSD. Since this is a new backend, it does not affect much other codes. Issues specific to this backend can be fixed within this backend.
mcuee (Migrated from github.com) approved these changes 2026-05-24 06:51:29 -05:00
mcuee commented 2026-05-24 06:51:59 -05:00 (Migrated from github.com)

@wulf7

Please re-review as well. Thanks.

@wulf7 Please re-review as well. Thanks.
mcuee commented 2026-05-26 22:38:58 -05:00 (Migrated from github.com)

@aokblast

BTW, somehow your ISO image only works under VirtualBox VMs, I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic). Therefore I cannot test it under physical machine as of now.

Just FYI only.

Now I am lazy to build FreeBSD using source code. I only did that a few times when HPS was developing the new FreeBSD USB Stack many years ago.

@aokblast BTW, somehow your ISO image only works under VirtualBox VMs, I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic). Therefore I cannot test it under physical machine as of now. Just FYI only. Now I am lazy to build FreeBSD using source code. I only did that a few times when HPS was developing the new FreeBSD USB Stack many years ago.
aokblast commented 2026-05-27 00:54:08 -05:00 (Migrated from github.com)

@aokblast

BTW, somehow your ISO image only works under VirtualBox VMs, I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic). Therefore I cannot test it under physical machine as of now.

Just FYI only.

Now I am lazy to build FreeBSD using source code. I only did that a few times when HPS was developing the new FreeBSD USB Stack many years ago.

Hi, is there any crash log?

> @aokblast > > BTW, somehow your ISO image only works under VirtualBox VMs, I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic). Therefore I cannot test it under physical machine as of now. > > Just FYI only. > > Now I am lazy to build FreeBSD using source code. I only did that a few times when HPS was developing the new FreeBSD USB Stack many years ago. Hi, is there any crash log?
wulf7 (Migrated from github.com) approved these changes 2026-05-28 00:05:57 -05:00
wulf7 (Migrated from github.com) left a comment

LGTM

LGTM
mcuee commented 2026-05-28 00:16:12 -05:00 (Migrated from github.com)

@aokblast

Hi, is there any crash log?

Let me capture the crash log over the weekend. I will also compare with FreeBSD 16.0-Current Snapshot.
https://download.freebsd.org/ftp/snapshots/amd64/amd64/ISO-IMAGES/16.0/

I have a few Chuwi Herobox mini PCs running Linux and BSDs. All of them have 8GB RAM. Each has the original 256GB SSD and one more SATA SSD (128GB or 256GB).

Intel N4500 Mini PC -- OpenBSD 7.8 (will upgrade to 7.9 later) and NetBSD 10.1
Intel J4125 Mini PC -- Debian 13 and FreeBSD 15 Release
Intel N100 Mini PC -- Ubuntu 26.04 + Fedora 44 on the main SSD, CachyOS on the secondary SSD
Intel N100 Mini PC -- Ubuntu 26.04 + Fedora 44 Silverblue on the main SSD, EndeavourOS on the secondary SSD.

I will kill the two Arch Based Linux distros (not really using them much) and install FreeBSD/OpenBSD.

> > @aokblast > > Hi, is there any crash log? Let me capture the crash log over the weekend. I will also compare with FreeBSD 16.0-Current Snapshot. https://download.freebsd.org/ftp/snapshots/amd64/amd64/ISO-IMAGES/16.0/ I have a few Chuwi Herobox mini PCs running Linux and BSDs. All of them have 8GB RAM. Each has the original 256GB SSD and one more SATA SSD (128GB or 256GB). Intel N4500 Mini PC -- OpenBSD 7.8 (will upgrade to 7.9 later) and NetBSD 10.1 Intel J4125 Mini PC -- Debian 13 and FreeBSD 15 Release Intel N100 Mini PC -- Ubuntu 26.04 + Fedora 44 on the main SSD, CachyOS on the secondary SSD Intel N100 Mini PC -- Ubuntu 26.04 + Fedora 44 Silverblue on the main SSD, EndeavourOS on the secondary SSD. I will kill the two Arch Based Linux distros (not really using them much) and install FreeBSD/OpenBSD.
cederom commented 2026-05-28 08:00:25 -05:00 (Migrated from github.com)

For quick testing I recommend VENTOY [1] it provides USB BOOT menu supporting MBR/GPT/BIOS/UEFI where you can choose ISO from the same pendrive to boot. So you can have multiple images on the same bootable pendrive.. and you can use it for storage as well :-)

Please let me know if there is anything to test on FreeBSD 14 :-) I can also boot of 15 or 16 if needed :-)

[1] https://www.ventoy.net/en/index.html

For quick testing I recommend VENTOY [1] it provides USB BOOT menu supporting MBR/GPT/BIOS/UEFI where you can choose ISO from the same pendrive to boot. So you can have multiple images on the same bootable pendrive.. and you can use it for storage as well :-) Please let me know if there is anything to test on FreeBSD 14 :-) I can also boot of 15 or 16 if needed :-) [1] https://www.ventoy.net/en/index.html
wulf7 commented 2026-05-28 09:27:29 -05:00 (Migrated from github.com)

I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic).

There is a known hardware bug in Alder Lake processors. See https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html

> I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic). There is a known hardware bug in Alder Lake processors. See https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html
mcuee commented 2026-05-29 08:59:35 -05:00 (Migrated from github.com)

I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic).
Hi, is there any crash log?

Sorry I made a mistake, it is not kernel panic, rather the system does not recognize the USB Flash Disk as bootable at all.

I tried the latest snapshot (FreeBSD-16.0-CURRENT-amd64-20260525-490c53e9353f-286096-disc1.iso) and the issue is the same, tested with two USB Flash disks.

Then I tested OpenBSD 7.9 release and it is able to boot (but then it does not recognize the wired and wireless network adapter).

There is a known hardware bug in Alder Lake processors. See https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html

Interesting.

> > I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic). > > Hi, is there any crash log? Sorry I made a mistake, it is not kernel panic, rather the system does not recognize the USB Flash Disk as bootable at all. I tried the latest snapshot (FreeBSD-16.0-CURRENT-amd64-20260525-490c53e9353f-286096-disc1.iso) and the issue is the same, tested with two USB Flash disks. Then I tested OpenBSD 7.9 release and it is able to boot (but then it does not recognize the wired and wireless network adapter). > There is a known hardware bug in Alder Lake processors. See https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html Interesting.
aokblast commented 2026-05-30 01:47:06 -05:00 (Migrated from github.com)

I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic).
Hi, is there any crash log?

Sorry I made a mistake, it is not kernel panic, rather the system does not recognize the USB Flash Disk as bootable at all.

I tried the latest snapshot (FreeBSD-16.0-CURRENT-amd64-20260525-490c53e9353f-286096-disc1.iso) and the issue is the same, tested with two USB Flash disks.

Then I tested OpenBSD 7.9 release and it is able to boot (but then it does not recognize the wired and wireless network adapter).

There is a known hardware bug in Alder Lake processors. See https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html

Interesting.

Is it possible to choose EFI file from your UEFI?

> > > I could not install it under an Intel N100 mini PC, not so sure about the reason (kernel panic). > > > Hi, is there any crash log? > > Sorry I made a mistake, it is not kernel panic, rather the system does not recognize the USB Flash Disk as bootable at all. > > I tried the latest snapshot (FreeBSD-16.0-CURRENT-amd64-20260525-490c53e9353f-286096-disc1.iso) and the issue is the same, tested with two USB Flash disks. > > Then I tested OpenBSD 7.9 release and it is able to boot (but then it does not recognize the wired and wireless network adapter). > > > There is a known hardware bug in Alder Lake processors. See https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html > > Interesting. Is it possible to choose EFI file from your UEFI?
mcuee commented 2026-05-30 22:07:52 -05:00 (Migrated from github.com)

Is it possible to choose EFI file from your UEFI?

Using Ventoy and then I can do that.

Interesting findings -- now FreeBSD 15.0 Release and OpenBSD 7.9 can boot and I have installed them to the second SATA SSDs of the two Intel N100 Mini PCs. Somehow I need to use HTTP install.

For the FreeBSD 16.0-Current images (your version or the snapshot version), both will fail to boot.

All in all, looks like the issue is related to file system corruption.
https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html

Screen photo taken from my mobile phone.

1000014734
> Is it possible to choose EFI file from your UEFI? Using Ventoy and then I can do that. Interesting findings -- now FreeBSD 15.0 Release and OpenBSD 7.9 can boot and I have installed them to the second SATA SSDs of the two Intel N100 Mini PCs. Somehow I need to use HTTP install. For the FreeBSD 16.0-Current images (your version or the snapshot version), both will fail to boot. All in all, looks like the issue is related to file system corruption. https://lists.freebsd.org/archives/freebsd-current/2025-January/006984.html Screen photo taken from my mobile phone. <img width="4096" height="3072" alt="1000014734" src="https://github.com/user-attachments/assets/6347c19c-72a3-45e5-91c7-49366148fd4b" />
Youw commented 2026-07-30 11:52:11 -05:00 (Migrated from github.com)

I've used gpt5.6-sol and found a number of issues with this implementation.
I'll run it to fix those issues and push here, instead of posting review comments

I've used gpt5.6-sol and found a number of issues with this implementation. I'll run it to fix those issues and push here, instead of posting review comments
Youw commented 2026-07-30 13:41:37 -05:00 (Migrated from github.com)

Codex updated the PR branch and pushed a186873:

  • Merged current master (518fbd1) and resolved the Autotools/build-system conflicts.
  • Fixed the FreeBSD hidraw backend findings around enumeration/list ownership, allocation and handle cleanup, bus/device metadata, report-ID/report-descriptor handling, error propagation, read-only enumeration, and C++ compatibility.
  • Integrated and exercised both FreeBSD backends through Autotools, CMake, Meson, manual builds, and pkg-config; added a warnings-as-errors C++ build for the new backend.
  • Added runtime pkg-config consumers plus installed shared/static CMake export consumer tests for both hidapi::hidraw and hidapi::libusb, following the pattern from #831.
  • Ran a fresh read-only Fable 5 review and addressed the new actionable findings.

Validation completed locally across Autotools, CMake shared/static, Meson, pkg-config, and installed export consumers. All PR checks are now green, including the native FreeBSD job and AppVeyor.

Related to #274. Fixes #543.

Generated by Codex (GPT-5).

Codex updated the PR branch and pushed a186873: - Merged current master (518fbd1) and resolved the Autotools/build-system conflicts. - Fixed the FreeBSD hidraw backend findings around enumeration/list ownership, allocation and handle cleanup, bus/device metadata, report-ID/report-descriptor handling, error propagation, read-only enumeration, and C++ compatibility. - Integrated and exercised both FreeBSD backends through Autotools, CMake, Meson, manual builds, and pkg-config; added a warnings-as-errors C++ build for the new backend. - Added runtime pkg-config consumers plus installed shared/static CMake export consumer tests for both hidapi::hidraw and hidapi::libusb, following the pattern from #831. - Ran a fresh read-only Fable 5 review and addressed the new actionable findings. Validation completed locally across Autotools, CMake shared/static, Meson, pkg-config, and installed export consumers. All PR checks are now green, including the native FreeBSD job and AppVeyor. Related to #274. Fixes #543. Generated by Codex (GPT-5).
Youw commented 2026-07-30 17:22:27 -05:00 (Migrated from github.com)

Now someone could test and tell if there anything else left to fix - that would be helpful to move this forward.

Now someone could test and tell if there anything else left to fix - that would be helpful to move this forward.
mcuee commented 2026-07-30 18:11:47 -05:00 (Migrated from github.com)

Now someone could test and tell if there anything else left to fix - that would be helpful to move this forward.

Yes I will test over the weekend.

> Now someone could test and tell if there anything else left to fix - that would be helpful to move this forward. Yes I will test over the weekend.
mcuee commented 2026-07-30 18:13:07 -05:00 (Migrated from github.com)

@aokblast and @cederom

Please carry out the test on your FreeBSD setup as well. Thanks.

@aokblast and @cederom Please carry out the test on your FreeBSD setup as well. Thanks.
mcuee commented 2026-08-06 21:17:43 -05:00 (Migrated from github.com)

Now someone could test and tell if there anything else left to fix - that would be helpful to move this forward.

Yes I will test over the weekend.

Sorry I was busy. I will try to do it this weekend or next week.

> > Now someone could test and tell if there anything else left to fix - that would be helpful to move this forward. > > Yes I will test over the weekend. Sorry I was busy. I will try to do it this weekend or next week.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'aokblast/use_hid_raw:aokblast/use_hid_raw'
git switch 'aokblast/use_hid_raw'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'aokblast/use_hid_raw'
git switch 'aokblast/use_hid_raw'
git rebase 'master'
git switch 'master'
git merge --ff-only 'aokblast/use_hid_raw'
git switch 'aokblast/use_hid_raw'
git rebase 'master'
git switch 'master'
git merge --no-ff 'aokblast/use_hid_raw'
git switch 'master'
git merge --squash 'aokblast/use_hid_raw'
git switch 'master'
git merge --ff-only 'aokblast/use_hid_raw'
git switch 'master'
git merge 'aokblast/use_hid_raw'
git push origin 'master'
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!730
No description provided.