You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The essential part is simply "candle_dev_open()" followed by "candle_dev_close()".
When calling candle_dev_close(), the program hangs in the last CloseHandle() called with the device handle (right after WinUsb_Free()). If I force a device reset the call completes succesfully and the program exits cleanly.
If I modify candle_dev_open() to not prepare the URBs (i.e. disable candle_prepare_read() ), then CloseHandle() will work properly.
I'm not sure what's wrong with the URBs or associated events ?
Hah ! Adding a call to "CancelIo(dev->deviceHandle);" inside candle_close_rxurbs() seems to fix the issue here. However, MSDN docs state
The function does not cancel I/O operations that other threads issue for a file handle.
To cancel I/O operations from another thread, use the CancelIoEx function.
But, CancelIoEx is not supported on winXP (I'm trying to keep compatibility in my application), so I'm not sure how reliable CancelIo will be on multi-threaded applications.
I'm having trouble with the windows candleapi driver, which I'm trying to use for a personal project.
I reduced the test case to the following code:
https://gist.github.com/fenugrec/5322ba8ae2fb90f5c34dd435b1eade75
The essential part is simply "candle_dev_open()" followed by "candle_dev_close()".
When calling candle_dev_close(), the program hangs in the last CloseHandle() called with the device handle (right after WinUsb_Free()). If I force a device reset the call completes succesfully and the program exits cleanly.
If I modify candle_dev_open() to not prepare the URBs (i.e. disable candle_prepare_read() ), then CloseHandle() will work properly.
I'm not sure what's wrong with the URBs or associated events ?
Could be related to https://github.com/HubertD/candle_dll/pull/1/files#diff-6df29908f0b6ce54be11da5e7367e498R322 ?
The text was updated successfully, but these errors were encountered: