"Jerónimo Lopes" <(E-Mail Removed)> said:
>I have a problem connecting an old serial device (a weighing machine) in
>RedHat Enterprise Linux 4 ES.
....
>It seems I can't use the correct options and commands to configure the
>serial port. I tried to use a line on inittab with "m:2345
ff:/sbin/agetty
>9600 ixon .. ttyS1";
Issues with the above:
- it's "off" - so whatever values you have on that line have no effect
- even if it was not "off", you wouldn't want to have a getty talking
to a special piece of hardware (unless that thing somehow knows how
to log in to a system)
>I tried to put the stty line on rc.local.
....
>On SCO Openserver I used to turn around the problem editing the S80lp file
>and introduce the following line:
>
>(stty 9600 ixon ixoff -ixany parenb cs7 ; while :; do sleep 3600 ; done)
</dev/tty2a &
The above looks pretty much like something that would work on Linux
as well. Below is a description on what it does, to help in understanding
the key points (apologies if this is already all clear to you):
The "( ... ) < /dev/tty2a &" format starts a process to read something
from /dev/tty2a (and puts in into background, so that it doesn't
interrupt the startup process). This is significant, because serial devices
revert to system-specific default settings when they are closed. Here
what is run inside the parentheses is an interesting (and a good) trick:
it'll first set the interface parameters with stty - and then start
an endless loop that just sleeps. So, the parameters get set at
startup, and the device line stays open.
The "stty" parameters seem to be ok: 9600 bps, 7-bit characters and
a single parity bit. What is odd is that "polarity" of parity (even or
odd) is not specificed - so you may need to add parodd (for odd parity)
or -parodd (for even parity) to match the settings of the weighing
device.
Then, one thing that could be is that the serial port driver expects to
see some hardware handshake signals. This you should be able to set with
stty parameters "-clocal -crtscts". You might also wish to disable the
port lockouts with setserial ^pgrp_lockout ^session_lockout. Also,
do not use the cua device, but the ttyS device.
Hope this was of any help.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)