Re: [concordance-devel] Sleep and Windows

2008-04-15 Thread Stephen Warren

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 -  1.31
+++ concordance/concordance.c   15 Apr 2008 05:58:03 -
@@ -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


Re: [concordance-devel] Firmware Upgrade 525

2008-04-15 Thread Stephen Warren
On Tue, April 15, 2008 9:35 am, Michael Frase wrote:
 Any Suggestions? Is it possible to log the usb transfer (firmware
 upgrade) in windows (like usbmon in linux)?

Yes. Use SnoopyPro, available from:

http://sourceforge.net/project/showfiles.php?group_id=34567

Once you have the captures in the tool, you'll want to perform an export
operation to the XML format. You can then send in the XML files. If
you're curious, the consnoop directory in CVS contains an application
that can analyze these XML files.


-
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


Re: [concordance-devel] Sleep and Windows

2008-04-15 Thread Stephen Warren
On Tue, April 15, 2008 12:18 am, Phil Dibowitz wrote:
 Stephen Warren wrote:
 This raises the question though: What happens if the current initial 5
 second wait isn't long enough?

 What do you mean? If my 5 second sleep isn't enough, I sleep for
 another 5. And then another 5. And then 5 more. 5 more. 5 more. THEN
 I give up.

I mean, what if, after the first 5 second sleep, the system hasn't noticed
USB disconnect due to remote reboot.

In this case (which I could easily imagine on a heavily swapping system),
the code will enumerate the original pre-reset Harmony device, and then
fail.

I guess with the call to identify in the loop now, that's not an issue,
because identify should fail, and cause the loop to loop again.


-
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


Re: [concordance-devel] Firmware Upgrade 525

2008-04-15 Thread Phil Dibowitz
Michael Frase wrote:
 Now I did a firmware updrade (v2.5 - v2.6) with the logitech windows
 software and dumped the firmware again with concordance... The firmware
 dump is exactly the same as the old one (that reported the wrong
 version). But now the firmware version is correctly recognised as v2.6.
 
 I tried to downgrade the firmware from v2.6 to v2.5 (with my old
 firmware dump). After downgrade concordance is also reporting the wrong
 version (v2.6 instead of v2.5).

Yeah, this seems to confirm my suspicion that we're upgrading the remote
properly and its running on the new firmware, but we're not updating
something somewhere to tell it what version it's running. My guess is that
these remotes can't dynamically determine their firmware version, unlike the
8 series.

 Any Suggestions? Is it possible to log the usb transfer (firmware
 upgrade) in windows (like usbmon in linux)?

Yes, as Stephen pointed out, SnoopyPro is what you want, and export to XML.
Please send that to me off list (or provide a link to the list, if you
prefer). I actually have a SnoopPro dump of a firmware upgrade, which is who
I got the existing code as far as I do, but another one can't hurt.

Thanks.
-- 
Phil Dibowitz [EMAIL PROTECTED]
Open Source software and tech docsInsanity Palace of Metallica
http://www.phildev.net/   http://www.ipom.com/

Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible -- Taylor's Laws of Programming




signature.asc
Description: OpenPGP digital signature
-
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


Re: [concordance-devel] Sleep and Windows

2008-04-15 Thread Phil Dibowitz
Stephen Warren wrote:
 On Tue, April 15, 2008 12:18 am, Phil Dibowitz wrote:
 Stephen Warren wrote:
 This raises the question though: What happens if the current initial 5
 second wait isn't long enough?
 What do you mean? If my 5 second sleep isn't enough, I sleep for
 another 5. And then another 5. And then 5 more. 5 more. 5 more. THEN
 I give up.
 
 I mean, what if, after the first 5 second sleep, the system hasn't noticed
 USB disconnect due to remote reboot.

Ah, I see. I suppose that's possible.

 I guess with the call to identify in the loop now, that's not an issue,
 because identify should fail, and cause the loop to loop again.

Indeed.

-- 
Phil Dibowitz [EMAIL PROTECTED]
Open Source software and tech docsInsanity Palace of Metallica
http://www.phildev.net/   http://www.ipom.com/

Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible -- Taylor's Laws of Programming




signature.asc
Description: OpenPGP digital signature
-
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