Call to hid_read_timeout sometimes never returns on Windows #652

Closed
opened 2023-12-01 01:23:51 -06:00 by shufps · 1 comment
shufps commented 2023-12-01 01:23:51 -06:00 (Migrated from github.com)

We have an application that works perfectly on Linux and Mac and most of the time for Windows.

But on Windows it happens that the call to read_timeout never returns and the entire app is hanging because we are cleanly using mutexes to prevent parallel accessing the USB device.

We tracked our problem down to the call of hid_read_timeout

    fn read_timeout(&self, buf: &mut [u8], timeout: i32) -> HidResult<usize> {
        let res = unsafe {
            ffi::hid_read_timeout(
                self._hid_device,
                buf.as_mut_ptr(),
                buf.len() as size_t,
                timeout,
            )
        };
        self.check_size(res)
    }

Timeout value is 10s but we can see in our logs that it's waiting forever there.

Has anyone heared about problem specific to Windows that the hid_read_timeout call would hang forever even if a timeout value of 10000 is specified?

Thx a lot for help - we are a bit clueless at this point.

We have an application that works perfectly on Linux and Mac and most of the time for Windows. But on Windows it happens that the call to `read_timeout` never returns and the entire app is hanging because we are cleanly using mutexes to prevent parallel accessing the USB device. We tracked our problem down to the call of `hid_read_timeout` ```rust fn read_timeout(&self, buf: &mut [u8], timeout: i32) -> HidResult<usize> { let res = unsafe { ffi::hid_read_timeout( self._hid_device, buf.as_mut_ptr(), buf.len() as size_t, timeout, ) }; self.check_size(res) } ``` Timeout value is 10s but we can see in our logs that it's waiting forever there. Has anyone heared about problem specific to Windows that the `hid_read_timeout` call would hang forever even if a timeout value of 10000 is specified? Thx a lot for help - we are a bit clueless at this point.
shufps commented 2023-12-01 01:28:22 -06:00 (Migrated from github.com)

upsi ... timeout is 10mio and not 10k 😑

closing this issue

upsi ... timeout is 10mio and not 10k :expressionless: closing this issue
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#652
No description provided.