Problem
I am connecting a device to a serial port of my computer that
sends data to my application. The device does not work if getty(M)
is enabled, and it will not work at the default terminal settings,
for example, speed = 9600.The serial port speed settings may be altered using the stty(C) utility when the port is enabled, but when the port is disabled to switch off getty(M), the settings revert back to the defaults.
Solution
One solution is to hold open the serial port using a background
process. This process may be started at boot time, as in the
example below.As root, add the following lines to the end of the file
/etc/rc2.d/P88USRDEFINE. In this example, the port /dev/tty1a is
being set to 1200 baud.#hold port open so stty settings are set
# port setting
/usr/bin/holdopen tty1a 1200 &Create a file called /usr/bin/holdopen with the contents:
# hold port open to retain stty settings(stty $2 #$2 is stty setting
while true
do
sleep 60000
done ) < /dev/$1 #1 is portMake /usr/bin/holdopen executable with the following:chmod u+x /usr/bin/holdopenThen reboot the system to make the change take effect.