need longer timeout with send_feature_report() for libusb under Linux #493
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi#493
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Some devices may require much longer timeout when submitting hid_send_feature_report() .
for such devices hid_send_feature_report() just notifies failure with return value of -1 .
I checked that internal error code libusb is reporting is LIBUSB_ERROR_TIMEOUT ( -7 ) .
Changing value here, from 1000 to, say, 5000 does make difference.
github.com/libusb/hidapi@c3a6150d88/libusb/hid.c (L1471)You curious what the device is?
It is USB-HID control capable LCD monitor from EIZO . ex. FlexScan EV2670
Most requests to the monitor, for example a request to change speaker volume, work fine with short timeout .
But one specific request that is to enable or disable picture-by-picture mode only works with long timeout .
So it is better to have a measure to somehow specify custom value for timeout.
I guess it was only a matter of time when that magic number would backfire at us.
On the other hand it's been years and no one complained, until now.
But we definitely need a workaround for that. I think a libusb-specific option (e.g.
int hid_libusb_set_output_timeout(hid_device *dev, unsigned int timeout)to be used withhid_writeandhid_send_feature_reportwould suffice.P.S.: PR is welcome.
Thank you for your quick response. I'm afraid I'm not sure if I want to do a PR myself for now.
It's like I spent way too much effort into finding this out , and so I felt like leaving a short note here.
Easiest workaround is to use libhidapi-hidraw instead of libhidapi-libusb .
I'd say - a perfect one.
For a historical reference:
HIDRAW has this timeout hard-coded as well:
github.com/torvalds/linux@69b41ac87e/drivers/hid/usbhid/hid-core.c (L931)And it is set to 5 seconds.
I think we may want to promote the use of the hidraw backend for Linux and not the libusb backend.
Totally agree. But that does not exclude having a potential fix for libusb backend.
Hi,
could please someone give a hint: is it possible to increase timeout for send_feature_report() on Windows? I also have a device, which takes a more than 5 sec sometimes for response. Thanks.
@Youw
That is interesting, what is the device? The original issue only mentions Linux and only libusb backend.
Sorry for asking in this topic. I've just created #670. Device is a tiny USB climate sensor on the stm32f4