[Nut-upsuser] Windows 2.6.0-1 usbhid-ups driver infinite loop on USB disconnect
David Bolen
db3l.net at gmail.com
Wed Jun 29 20:10:21 UTC 2011
Arnaud Quette <aquette.dev at gmail.com> writes:
> 2011/6/29 Frédéric Bohé <fredericbohe at eaton.com>
>> Another bug. errno has to be filled with the result of GetLastError() to
>> be really useful.
>>
>
> wasn't it suppose to be already the case?
> along with the equivalent winsock WSAGetLastError() where appropriate?
> otherwise, this should indeed fix tons of issues, as it did years ago on
> Linux...
Not sure if it was supposed to be the case, but the libusb module
wasn't doing it at the moment. I've finally been able to work up a
build environment, and setting errno to the libusb function result
(well, its negative) does appear to resolve the issue. And Frédéric's
other fix to the WaitForMultipleObjects in dstate.c does take care of
the otherwise tight polling loop.
Note that in this case you don't want to set errno directly to
GetLastError() since libusb is already doing a translation between the
Win32 value into an more standard errno E* value for the purpose of
the function result. The raw GetLastError() wouldn't be sensible for
the higher level code expecting errno values - would it ever be? Not
sure about any WSAGetLastError but there's no socket related actions
in this code path, so that could be for other use cases.
-- David
More information about the Nut-upsuser
mailing list