Stephen Warren wrote:
Phil Dibowitz wrote:
FYI: I get the feeling that unistd.h may not be available on Windows - so
someone may want to test that and let me know...
Well, the attached patch fixes the compile failure.
However, it seems like there are some pretty serious issues with the
Windows USB code:
Ooops. Well, there was a nasty issue with my patch!
Windows' sleep is in milli-seconds, which my patch didn't account for.
So with my previous patch, concordance ended up not waiting long enough
for reset_remote to actually trigger the OS to see the device as having
gone away. Hence, enumeration found the device before the reset took
effect, but of course couldn't communicate with it.
See attached patch:
concordance/concordance.c
Fix Windows sleep() macro to wait seconds not milli-seconds.
This raises the question though: What happens if the current initial 5
second wait isn't long enough? It'd be nice if there was an event that
says "your handle just died" which we could wait for first. I can
certainly see a heavily loaded old machine take a long time to recognize
the USB device going away. Perhaps the loop should be more like
for number of attempts:
sleep
attempt to connect
fail -> loop
attempt to set time
fail -> loop
all ok, so exit loop
Or, perhaps:
while handle_still_seems_valid() {
// no sleep, so we're fast enough to catch device while it's gone
}
for number of attempts
sleep
attempt to reconnect
ok -> exit loop
set_time
where handle_still_seems_valid can't actually communicate with the
remote, because after reset_remote it won't respond, but perhaps
re-performs enumeration to check if the device still exists. The problem
then is what if we aren't fast enough to see when the device is not there...
? concordance/win/Debug
? libconcord/win/Debug
? win/concordance.ncb
Index: concordance/concordance.c
===================================================================
RCS file: /cvsroot/concordance/concordance/concordance/concordance.c,v
retrieving revision 1.31
diff -u -p -r1.31 concordance.c
--- concordance/concordance.c 15 Apr 2008 05:45:40 -0000 1.31
+++ concordance/concordance.c 15 Apr 2008 05:58:03 -0000
@@ -36,7 +36,7 @@
#define strcasecmp stricmp
#define strncasecmp strnicmp
-#define sleep Sleep
+#define sleep(x) Sleep((x) * 1000)
/*
* Windows, in it's infinite awesomeness doesn't include POSIX things
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel