Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've got instruments hooked up to /dev/ttyS1 through ttyS9 on a machine running Debian Wheezy. The various instruments communicate at various speeds.

Is there a better way to set the baud rates than to have a bunch of lines like

stty -F /dev/ttyS1 19200 raw -echo
stty -F /dev/ttyS2 4800  raw -echo
etc...

in rc.local?

share|improve this question
    
The kernel drivers might understand some kernel command line parameters, which you could use by default. Depends on the hardware (read driver), I guess. –  peterph Sep 19 '13 at 20:01
    
@peterph yeah, but /etc/rc.local seems way more elegant than to screw with the kernel command line. I agree with slm, /etc/rc.local is fine. –  Martin von Wittich Sep 19 '13 at 20:54

2 Answers 2

up vote 4 down vote accepted

Not to my knowledge.

The /etc/rc.local file is the best location for creating customization that are specific to the box. It was specifically created for these types of custom changes and is the first place that most system administrators are conditioned to look when dealing with Unix/Linux boxes.

share|improve this answer
    
One might also create a separate script for that, that will be sourced/executed from within /etc/rc.local –  peterph Sep 19 '13 at 21:41
    
@peterph - excellent point, yes if it's more elaborate, you might want to source a script with the contents of these commands in them instead. –  slm Sep 19 '13 at 21:54

Install the setserial package. It can save serial port settings and restore them at boot time.

Alternatively, run a program when the port is detected via an udev rule. Put something like this (untested) in /etc/udev/rules.d/zzz_serial.rules:

KERNEL=="ttyS1", RUN+="stty -F /dev/ttyS1 19200 raw -echo"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.