Serial communication OpenBSD cua00 vs Linux ttyS0. Hi
I am trying to run a piece of software compiled for Linux on my
OpenBSD box. Unfortunately I do not have the source code.
It works perfectly on my Debian Linux box but not on my OpenBSD box
(where I actually want to run the application.)
The software communicates via a serial port with an external hardware,
works perfectly on Linux but on OpenBSD it stops in the middle of the
communication.
To make this work I have:
* Installed linux emulation
$ pkg_info | grep redhat
redhat_base-8.0p8 Linux compatibility package based on RedHat 8.0
redhat_libc5-6.2p0 Linux libc5
* I have made a hard link from /dev/cua00 to /dev/ttyS0
$cd /dev/$ ls -l ttyS0
ls -l
crw-rw-rw- 2 root wheel 8, 128 Apr 27 02:26 ttyS0
crw-rw-rw- 2 root wheel 8, 128 Apr 27 02:26 cua00
+ a lot more files
* After doing this the software connects to the device via ttyS0
(cua00), it sends some stuff on the port however it does not work as
it should.
I have run the exact same binary on a Debian Linux box where it
succeeds.
I read on the internet about other people with somewhat similar
problems and the ioctl runned on the serial port in openbsd was
discussed, whether it's driver supported all the settings.
I decided to do stty -a -f ttyS0 and compare.
Here is stty -f /dev/ttyS0 -a on my OpenBSD box:
# stty -f /dev/ttyS0 -a
speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho -pendin -
nokerninfo
-extproc -xcase
iflags: -istrip icrnl -inlcr -igncr -iuclc ixon -ixoff ixany imaxbel
-ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl -onocr -onlret -olcuc oxtabs -onoeot
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -
mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status =
<undef>;
stop = ^S; susp = ^Z; time = 0; werase = ^W;
Here is stty -F /dev/ttyS0 -a on my Debian Linux box:
$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 = 1; 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
I am unable to see if there is any fundamental differences here,
anyone ?
Below is dmesg on the OpenBSD box:
# dmesg | grep pccom
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
Also on the Debian Linux box:
$ dmesg | grep ttyS
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:04: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
I am thankful for any help on:
* What can differ these two machines apart?
* Any way I can debug this? reverse engineer my binary and checn the
ioctl settings
* Anything else that I didnt thought about
Thanks in advance
BR
Jens |