<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Set the port in raw mode and then dump that out.</div><div><br></div><div>stty -gF /dev/ttyS0</div><div><br></div><div>In /etc/rc.local apply those settings</div><div><br></div><div>stty -F /dev/ttyS0 XXXXX</div><div><br></div><div>The g option will dump the settings in a form that can be used to set the settings.</div><div><br></div><div><p style="margin: 0px;" data-mce-style="margin: 0px;">cfowler@cfowler-desktop:/tmp$ stty -gF /dev/ttyS0<br>0:0:80001cb1:0:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0<br>cfowler@cfowler-desktop:/tmp$</p></div><div><br></div><div></div><div>Note that proper behavior of programs is to set the tty back to the way they found it. Other programs may change your settings and not set them back.</div><div>If this concerns you then you can write a cron job that would apply settings if there is no /var/lock/LCK..ttySO.</div><div><br></div><div>I sense you are using a script that writes to the port, but has no intelligence to set termios. If so, you could simply do this:</div><div><br></div><div>OLD_TERM=`stty -gF /dev/ttyS0`;</div><div># Set what I want</div><div>stty -F /dev/ttyS0 XXXXX</div><div># Now reset back to orig</div><div>stty -F /dev/ttyS0 ${OLD_TERM}</div><div># Exit</div><div>exit 0</div><div><br></div><div><br></div><div><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Alex Carver" <agcarver+ale@acarver.net><br><b>To: </b>"Atlanta Linux Enthusiasts" <ale@ale.org><br><b>Sent: </b>Friday, December 5, 2014 8:32:35 PM<br><b>Subject: </b>[ale] Configure serial port settings at boot<br><div><br></div>Does anyone happen to know if there's a way to set up the default state<br>of a serial port at boot? I want to switch the port into raw mode<br>instead of cooked. When everything is running I just use "stty -F<br>/dev/ttyS0 raw" but that will not survive a reboot.<br><div><br></div>setserial as far as I can tell only handles the base configuration<br>(address, IRQ, etc.)<br>_______________________________________________<br>Ale mailing list<br>Ale@ale.org<br>http://mail.ale.org/mailman/listinfo/ale<br>See JOBS, ANNOUNCE and SCHOOLS lists at<br>http://mail.ale.org/mailman/listinfo<br></blockquote><div><br></div></div></body></html>