From: Andrius S. <and...@gm...> - 2012-10-20 20:14:36
|
On Sat, Oct 20, 2012 at 8:07 PM, Juan Pablo Carbajal <aju...@gm...>wrote: > On Sat, Oct 20, 2012 at 3:11 AM, Andrius Sutas <and...@gm...> > wrote: > > On Wed, Oct 17, 2012 at 11:31 PM, Juan Pablo Carbajal > > <aju...@gm...> wrote: > >> > >> Hello, > >> > >> I am observing weird behaviors and I couldn't pin down at which level > >> things are going bad. Using instrument-control 0.1.0 from Forge. > >> Running Ubuntu 12.04 64 bit > >> Linux 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 > >> x86_64 x86_64 x86_64 GNU/Linux > >> > >> I am using serial communications. I am testing with a physical > >> loopback (RxD connected to TxD) in this USB2Serial adapter > >> https://www.sparkfun.com/products/718. > >> > >> Problem 1 [Ring bufffer?]: > >> s = serial (); # 8-N-1 > >> srl_baudrate (s,9600); > >> > >> srl_write(s,"hello") > >> ans = 5 > >> > >> char(srl_read (s,5)) > >> ans = hello > >> > >> char(srl_read (s,5)) > >> ans = hello > >> > >> char(srl_read (s,15)) > >> ans = hellohellohello > >> > >> char(srl_read (s,4)) > >> ans = hell > >> > >> char(srl_read (s,6)) > >> ans = ohello > >> > >> It looks like as if the buffer is a ring buffer or is really big and > >> filled with "hello". Maybe flushing the input after reading will solve > >> the problem? Continued from the example before I got this > >> > >> Problem 2 [Hang after flush]: > >> srl_flush (s, 1) > >> > >> char(srl_read (s,5)) # This blocks as expected but ... > >> srl_read: Interrupting... > >> ans = > >> > >> srl_write(s,"hello") > >> ans = 5 > >> > >> char(srl_read (s,5)) # This also blocks!!!! > >> srl_read: Interrupting... > >> ans = > >> > >> The only way of getting things to work from this point on is to close > >> the port and open it again. > >> > >> Can anybody reproduce this? any suggestions of tests to run to see > >> whether the problem is at hardware level? > >> > >> I also tested with a virtual loopback (command "socat -d -d PTY: > >> PTY:", this is simpler than the suggestion in the wiki. I can update > >> that), I do not observe Problem 1, but I can't interrupt the second > >> call to srl_read > >> > >> s = serial("/dev/ptmx", 9600); > >> srl_write(s,"hello") > >> ans = 5 > >> char(srl_read (s,5)) > >> ans = hello > >> octave:5> char(srl_read (s,5)) > >> srl_read: Interrupting... > >> srl_read: Interrupting... > >> srl_read: Interrupting... > >> srl_read: Interrupting... > >> > >> > >> Thanks > >> > >> > >> > ------------------------------------------------------------------------------ > >> Everyone hates slow websites. So do we. > >> Make your web apps faster with AppDynamics > >> Download AppDynamics Lite for free today: > >> http://p.sf.net/sfu/appdyn_sfd2d_oct > >> _______________________________________________ > >> Octave-dev mailing list > >> Oct...@li... > >> https://lists.sourceforge.net/lists/listinfo/octave-dev > > > > > > UPDATE: I did replicate the bug eventually. I can not reproduce it > > consistently, will look further into this behavior. > > Hi, > Thanks for taking action. > > I tested again the following commands (Ubuntu 12.04 Linux > 3.2.0-32-generic, FT232RL) > > Ring buffer > http://agora.octave.org/snippet/Xd6x/ > > Read hangs after flush > http://agora.octave.org/snippet/mu7J/ > > Weird data handling > http://agora.octave.org/snippet/62x8/ > > Still working unsatisfactorily. > > Cheers, > > JPi > A few minutes after this email I committed a possible fix, could you please check it again? (don't forget to pkg install !) Also, "weird data handling" is the same ring buffer problem. I assume "hang after flush" is also related to the same bug. I just tested the fix in ubuntu vm with two different adapters multiple times and everything seems works :) |