On Sun Jan 14 03:17:40 2024 +0000, Tyson Whitehead wrote:
That makes sense. I had quite a hard time following the test code. I got it working, but I am still not clear on the `wait_hid_expect` calls. Comments indicate they are required for asynchronous items and they seem to be used in combination with
- gain report due to acquire,
- gain report due to set property,
- gain report due to send reset command,
- set parameters
Are these asynchronous due to the code writing writing the request out to the `hid_joystick` device handle (which uses the asynchronous `FILE_FLAG_OVERLAPPED` system)? What is it waiting for, and, even if they are asynchronous, why do you need to wait? Also, it seems the device handle used for various other routines that there is no `wait_hid_expect` calls after, such as downloading, unacquiring, etc.?
`wait_hid_expect` is used to synchronize the test with the virtual HID driver, blocking until all the previously set HID reports to expect (with `set_hid_expect`) have been seen or missed, or timeout.
This is most useful in some cases where the HID reports are sent asynchronously, because it's done from another thread, for instance on device acquire or some windows.gaming.input async operations.