Set Serial IRQ, Baud Rate, and More with ‘stty’ and/or ‘setserial’

The stty and setserial programs are useful for setting up serial ports on a Linux box. For example, today I needed to set the IRQ and baud rate of two serial ports in order to get them to play nicely. So, I used setserial to setup the IRQ and then stty to setup the baud rate, like this:

[email protected]:root# setserial /dev/tts/2
/dev/tts/2, UART: 16550A, Port: 0x89c003e8, IRQ: 33
[email protected]:root# setserial /dev/tts/3
/dev/tts/3, UART: 16550A, Port: 0x89c002e8, IRQ: 40
[email protected]:root# stty -F /dev/tts/2 115200
[email protected]:root# stty -F /dev/tts/3 115200

Now that I look at it, I could have set the baudrate with setserial /dev/tts/2 baud_base 115200, but then I wouldn’t have been introduced to the good little program stty!

Of course, I’d encourage you to take a look at the man pages that I linked to in the first sentence so you can learn all about the neat features of both programs.

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:

There's 0 Comment So Far

Share your thoughts, leave a comment!