1. Home
  2. Computing & Technology
  3. Linux

Text-Terminals on Linux

From Authors, for About.com

14.3 Setserial

This part is in 3 HOWTOs: Modem, Serial, and Text-Terminal. There are some minor differences, depending on which HOWTO it appears in.

Setserial problems with linmodems, laptops

If you have a Laptop (PCMCIA) don't use setserial until you read Laptops: PCMCIA.

Introduction

setserial is a program used for the user to communicate with the serial device driver. You normally never need to use it, provided that you only use the one or two serial ports that come as standard equipment with a PC. Even in other cases, most extra serial ports should be auto-detected by modern kernels. Except you'll need to use setserial if you have an old ISA serial port set by jumpers on the physical hardware or if your kernel (such as 2.2 or older) doesn't both detect and set your add-on PCI serial ports.

setserial allows you (or a shell script) to talk to the serial software. But there's also another program, tt/stty/, that also deals with the serial port and is used for setting the port speed, etc.

setserial deals with the lower-level configuring of the serial port, such as dealing with IRQs (such as 5), port addresses (such as 3f8), and the like. A major problem with it is that it can't set or configure the serial port hardware: It can't set the IRQ or port addresses into the hardware. Furthermore, when it seemingly reports the configuration of the hardware, it's sometimes wrong since it doesn't actually probe the hardware unless you specifically tell it to. Even then, it doesn't do the modern type of bus probing and some hardware may never be found by it. Still, what it shows is right most all the time but if you're having trouble getting a serial port to work, then there's a fair chance it's wrong.

In olden days, when the IRQ and port address was set by jumpers on the serial card, one would use setserial to tell the driver how these jumpers were set. Today, when plug-and-play methods detect how the jumperless serial port is set, setserial is not really needed anymore unless you're having problems or using old hardware. Furthermore, if the configuration file used by setserial is wrong, then there's trouble. In this case, if you use setserial to try to find out how the port is configured, it may just repeat the incorrect information in the configuration file.

setserial can sometimes be of help to find a serial port. But it's only of use if you know the port address and use the right options. For modern ports, there's usually better ways to look for them by plug-and-play methods.

Thus the name setserial is somewhat of a misnomer since it doesn't set the I/O address nor IRQ in the hardware, it just "sets" them in the driver software. And the driver naively believes that what setserial tells it, even if it conflicts with what the driver has found by using plug-and-play methods. Too bad that it fails to at least issue a warning message for such a conflict. Since the device driver is considered to be part of the kernel, the word "kernel" is often used in other documentation with no mention made of any "serial driver".

Some distributions (and versions) set things up so that setserial is run at boot-time by an initialization shell script (in the /etc directory tree). But the configuration file which this script uses may be either in the /etc tree or the /var tree. In some cases, if you want setserial to run at boot-time, you may have to take some action. setserialwill not work without either serial support built into the kernel or loaded as a module. The module may get loaded automatically if you (or a script) attempt to use setserial.

While setserial can be made to probe the hardware I0 port addresses to try to determine the UART type and IRQ, this has severe limitations. See Probing. It can't set the IRQ or the port address in the hardware of PnP or PCI serial ports (but the plug-and-play features of the serial driver may do this). It also can't directly read the PnP data stored in configuration registers in the hardware. But since the device

* License

* Text Terminal How-To Index

Explore Linux
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux HowTos
  5. Text-Terminals How-To
  6. Text-Terminals on Linux - 14.3 Setserial

©2009 About.com, a part of The New York Times Company.

All rights reserved.