On Sun, May 02, 2010 at 20:56:36 +1000, Aaron Mason wrote:
> On Sun, May 2, 2010 at 5:33 PM, Neil O'Brien <[email protected]> wrote:
> > On Sat, May 01, 2010 at 15:30:28 -0700, J.C. Roberts wrote:
> >> >   status = tcsetattr(fd, TCSANOW, &options);
> >>
> >> How does it behave if you use "TCSAFLUSH" rather than "TCSANOW" ?
> >
> > I made that substitution and added a
> > #define DEBUG 1
> >
> > The resulting binary sometimes fails to return and I then have to
> > hit ctrl-c.  I've tried it several times, and not seen any (repeating)
> > pattern in terms of when it works and when it fails.
> >
> Is the system running Linux running on the same type of board as your
> OpenBSD system?  If not, try running Linux on a system identical to
> the one you're using - see if it's the board causing the problem.
> 

Hi Aaron,

No, they are very different machines.  I don't have a spare ALIX system
that I can load Linux onto for testing.  If I can't resolve it any
other way I will switch my current machine to Linux; but having just
got everything set up in OpenBSD, I'd like to avoid that if possible.

I have however tried the code in my initial email on a different
OpenBSD machine (a Dell Optiplex Pentium II, dmesg is at
http://www.tigerturnings.dyndns.dk/dmesg-dell)

In this case I used cua0, the onboard serial port, on an ns16550a
controller.  Running the example from my initial post, with #define
DEBUG 1 added and /dev/ttyU0 replaced by /dev/cua00, I get sporadic
failures:

# time ./ex_obsd_now_cua0 ; sleep 3 ; time ./ex_obsd_now_cua0  
Port has been opened and set up
1 bytes available, read: 6
    0m0.12s real     0m0.00s user     0m0.00s system
Port has been opened and set up
^C    0m7.00s real     0m0.00s user     0m0.00s system

If I replace TCSANOW with TCSAFLUSH on this machine, it doesn't help,
though the instrument does sometimes send 21 (NAK) which I've never
seen it do when using TCSANOW.

# time ./ex_obsd_flush_cua0           
Port has been opened and set up
1 bytes available, read: 6
    0m0.14s real     0m0.00s user     0m0.00s system
# time ./ex_obsd_flush_cua0 
Port has been opened and set up
^C    0m3.97s real     0m0.00s user     0m0.01s system

# time ./ex_obsd_flush_cua0 
Port has been opened and set up
^C    0m3.65s real     0m0.00s user     0m0.00s system

# time ./ex_obsd_flush_cua0 
Port has been opened and set up
1 bytes available, read: 21
Expecting <ACK>, got 21
    0m0.23s real     0m0.00s user     0m0.00s system

I think that this should rule out any problems with the USB-RS232
converter or its drivers, and with the USB controller on the ALIX
system.

I'd be grateful for any further ideas or suggestions.

-- Neil

Reply via email to