<br><br><div class="gmail_quote">2011/6/29 Frédéric Bohé <span dir="ltr"><<a href="mailto:fredericbohe@eaton.com">fredericbohe@eaton.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello David,<br>
<br>
First, thanks for this post. The Windows port is still in beta stage and<br>
this kind of post if very useful.<br>
<div class="im"><br>
<br>
On Tue, 2011-06-28 at 20:54 -0400, David Bolen wrote:<br>
> David Bolen <<a href="http://db3l.net" target="_blank">db3l.net</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>> writes:<br>
><br>
> > Attached below is an excerpt of debugging output from usbhid-ups.  It<br>
> > would appear that the interrupt and query failures have reasonably<br>
> > appropriate errors, so maybe it's just a difference in how such errors<br>
> > reflect under Windows vs. *nix.<br>
><br>
> Following up on my own note, I think I have a theory on what is<br>
> happening, but am having trouble compiling to test a change as while I<br>
> have an pre-existing Mingw/MSYS toolchain, it doesn't have a full<br>
> autoconf toolchain yet.  If anyone might have a pre-existing<br>
> "configure" script for Win32, that would help jump start things as I<br>
> could configure from there.<br>
<br>
</div>Setting up the build environnent in Windows is kind of complex. I will<br>
send you my configure file if it can help you. Don't hesitate to ask if<br>
you are still stuck.<br>
<div class="im"><br>
><br>
> I think I've run into two items.  The first is that the errors from<br>
> checking the interrupt pipe in upsdrv_updateinfo aren't actually<br>
> checked for cases where they could identify a disconnected UPS, so it<br>
> just assumes no information and continues.  That's not Win32 specific.<br>
> I'm not quite sure why it loops so quickly, as opposed to the top<br>
> level polltime, but perhaps the state of the driver connection is such<br>
> that it immediately satisfies the WaitForMultipleObjects call in the<br>
> Win32 version of dstate_poll_fds.<br>
<br>
</div>It's just a silly bug. The timeout of WaitForMultipleObject is supposed<br>
to be in milliseconds but it is passed in seconds.<br>
<div class="im"><br>
><br>
> Anyway, normally it looks like that would be short-lived anyway since<br>
> the periodic full poll would detect the disconnect a modest time<br>
> later.  Here I think I run into an assumption in the libhid code that<br>
> errno always identifies all errors, while in the case of a win32<br>
> failure inside of libusb-win32, it's only the result code of the<br>
> function calls that reflect the error, not errno.  So USB I/O level<br>
> errors while polling are getting hidden.<br>
<br>
</div>Another bug. errno has to be filled with the result of GetLastError() to<br>
be really useful.<br></blockquote><div><br>wasn't it suppose to be already the case?<br>along with the equivalent winsock WSAGetLastError() where appropriate?<br>otherwise, this should indeed fix tons of issues, as it did years ago on Linux...<br>
<br>cheers,<br>Arno<br></div></div>