Open AlainCo opened 6 years ago
I propose this patch that seems to solve my problem, without too much impact out of the close() function :
`if (!GetOverlappedResult(m_Handle, m_InputReportOverlapped, m_InputReportBytesRead, true/ wait /)) {
if (GetLastError() == ERROR_DEVICE_NOT_CONNECTED)
break; // early exit if the device disappears
if(m_StopThread && GetLastError() == ERROR_OPERATION_ABORTED)
break;// on close
System.out.println("GetOverlappedResult failed with GetLastError()==" + GetLastError());
} `
Looks good to me, thanks I will try to put that in when I get a minute of time to that.
nice. NB: I'm newbie on git, and I cannot push with confidence
Hi,
I'm using purejavahidapi to contact a HidDevice (a Ledger Nano S)
It works well, I can
PureJavaHidApi.enumerateDevices()
thenPureJavaHidApi.openDevice(HidDeviceInfo)
thenHidDevice.setOutputReport()
and I get a callbackInputReportListener.onInputReport()
with the data I expect.but when I make the HidDevice.close() It shows an error message :
from
purejavahidapi.windows.HidDevice.runReadOnBackground()
in: `if (!GetOverlappedResult(m_Handle, m_InputReportOverlapped, m_InputReportBytesRead, true/ wait /)) {}`
All seems OK, but the error message is not normal... Maybe I made a mistake in the call sequences...
Beside that, using a Logger like slf4j may helps to make the code more generic...
(By the way, thanks for the core functionality, it got me out of trouble.)