Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > comp.unix.bsd.openbsd.misc

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-29-2008, 08:24 PM
jens@zekra.se
 
Posts: n/a
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-02-2008, 05:04 AM
Joachim Schipper
 
Posts: n/a
Default Re: Serial communication OpenBSD cua00 vs Linux ttyS0.

jens@zekra.se wrote:
> 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 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


I don't really know anything about serial devices, but you could try
ktrace(1). That should at least show you what the program is trying to
send. (This is your "reverse engineer the binary", but a lot easier. It
doesn't get you quite as much information, but...)

Also, did you try running Linux - perhaps via a LiveCD - on your OpenBSD
box? That would at least conclusively prove that the hardware is able to
do this. (Although it's not very likely that it wouldn't, of course.)

Joachim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:35 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62