I've just recently solved a serial port problem under linux that took me several days to figure out so I thought I would post the solution here so that it might help someone else. canuckInLA actually gave me this solution thanks again to hime.
My problem was that I could not conect to the player (a rio car mark 2) under linux using the serial port. My computer dual boots linux and NT and I fould that I could connect under NT with no problem. Under linux I found that I could connect with upgclient and with minicom with no problems.
Obviously upgclient and minicom knew how to set the port right; so the problem became - how to figure out what settings minicom was using.
I.E. with minicom its pretty easy to set 115200 baud, 8 data bits, no parity, 1 stop bit and no flow control (those are the settings the empeg units needs) - those entry are in minicom's setup almost exactly as I just showed them.
But the command a user must use to set the serial port is stty which uses arcane options like -parenb -cstopb -crtscts and whole bunch of others.Which ones are equivelent to 115200, 8, N, 1, no flow control?
The solution is deceptively simple. So simple I was completely over looking it. You connect with minicom, then examine the settings its using with stty.
For those that do not know, stty is a command that is used to set a serial port's characteristics. /dev/ttyS0 is com1, /dev/ttyS1 is com 2.
The first stty command you need is sane.
stty -F /dev/ttyS0 sane
This will set some default "sane" settings
To examine the serial port settings you type one of two commands:
stty -F /dev/ttyS0 (this just shows what different bewtween
the current settings and the sane settings)
stty -F /dev/ttyS0 -a (will all of the current settings)
So, you open two teminals. In one you start mincom and set it to 115200, 8, N, 1, no flow control, then cycle the power on the empeg unit to connect. After its connected, open another terminal and use stty to look at the current settings. The you can build a command to set the same settings (and save it to a script that you can use later)
So, here is the whole process:
(with minicom running and connected in another terminal)
> stty -F /dev/ttyS0
speed 115200 baud; line = 0;
min = 1; time = 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
(now close minicom,
then type the following command
built from the output above)
stty -F /dev/ttyS0 sane
stty -F /dev/ttyS0 115200 line 0 min 1 time 5 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
Note that you cannot take the `stty -F /dev/ttyS0` output directly. The syntax used to show the settings and the syntax used to set settings is slightly different.
You may have to do all of that as root, at least the stty commands. It depends on the permisions on you serial port device.
Hope that helps someone else.