Hi,

I noticed on my DS9097U adapter, hooked on via FTDI USB dongle, that it 
would not come back up online after a owfs restart, if the latest 
executed command was in DATA mode.
After lots of testing and debugging, I got a patch which solves the 
problem. It introduces a 500ms delay before tcsendbreak. With this, it 
seems to work every time I tested.

How to reproduce:
$ owserver /dev/cuaXX --foreground --debug
...

Another console
$ owread /something # something which trigger a read, I used sensed.ALL 
on a ds2406

Now Ctrl-C owserver
Then, try to start owserver again. It will fail to reset and won't be 
found properly, complaining about wrong response:
   DEBUG: ow_ds9097U.c:(643) wrong response (0F not 00)

If I executed a dir before shutdown, it successfully started up again 
(since it was put in command mode).


I cannot really tell *why* it helps, or what causes it. It could be some 
OS-specific (FreeBSD) delays, or something with the FTDI dongle.
With the patch, the startup takes 500ms longer, but seems to work 
reliably every time. I did test with lower delays, but i.e. 200ms did 
not cut it.

/Johan

Diff against master:

diff --git a/module/owlib/src/c/ow_com.c b/module/owlib/src/c/ow_com.c
index 06b87fe..ae98a50 100644
--- a/module/owlib/src/c/ow_com.c
+++ b/module/owlib/src/c/ow_com.c
@@ -103,6 +103,7 @@ void COM_break(struct connection_in *in)
                         LEVEL_DEBUG("Unimplemented!!!");
                         return ;
                 case ct_serial:
+                       usleep(500000);
                         tcsendbreak(in->pown->file_descriptor, 0);
                         break ;
         }

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to