SUMMARY
I'm running SL 5.0 (Boron) with kernel 2.6.18-92.1.22.el5. I have a 15 year old digitizer unit with vanilla 8N1 (8 bits, no parity, one stop bit) serial port parameters.
When I send the unit a status prompt which returns 55 characters, it comes back using a c "read(fd,data,80) (read in up to 80 bytes) as 8 bytes per read - as if there is an 8 byte buffer associated with the 16550A UART serial port.
I'm very surprised at this. I can set an input buffer size in matlab and can read into one line via matlab serial port code. Is this an UART issue? I read on the web that some older serial port UART versions had 8 or 16 byte buffer limitations. I guess I want to rule out that it is not SL kernel UART related.
Any thoughts on this?
Bill Lutter
DETAILS
C-CODE COMMENT
I did not set up the serial port with c posix (termios.h) but it looks ok. The c code does:
Code opens the port /dev/ttyS0:
fd = open("/dev/ttyS0",O_RDWR | O_NONBLOCK | O_SYNC);
I've fiddled with this dumped O_SYNC, tried O_NOCTTY. I've added a fcntl(fd,F_SETFL,0) and tried fnctl(fd,F_SETFL,FNDELAY). It doesn't matter as the result is always the same. Original 1992 code used: fd = open("/dev/3sp",O_RDWR | O_NDELAY | O_SYNCIO). I don't know what serial port settings they used then. O_SYNC is same as older O_SYNCIO. Ditto for O_NONBLOCK and O_NDELAY. Just a matter of posix names or doesn't matter according to web.
We send the digitizer (3space) a status prompt 'S':
strcpy(buf,"S");
wrtval = write(fdout,buf,1);
and we retrieve the output from the device by reading up to 80 bytes via rdval = read(fdin,xyz_data,80) and then copy them to a string array which is incremented per read call provided that rdval > 0.
SERIAL PORT
First, /dev/ttyS is owned by group uucp and the individual users using this are part of the uucp group:
[fetus@delta uwppi]$ ll /dev/ttyS0
crw-rw---- 1 root uucp 4, 64 Jul 27 16:19 /dev/ttyS0
[fetus@delta uwppi]$ sudo setserial -g /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
The linux port settings are set for 8N1, (8 bits, no parity and 1 stop bit). It is async with no flow control.
sudo stty -F /dev/ttyS0 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 0; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk inpck -istrip -inlcr -igncr -icrnl-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0
tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke
|