Next Previous Contents

7. Interesting Programs You Should Know About

Most info on getty has been moved to Modem-HOWTO with a little info on the use of getty with directly connected terminals now found in Text-Terminal-HOWTO.

7.1 Serial Monitoring/Diagnostics Programs

A few Linux programs will monitor the modem control lines and indicate if they are positive (1) or negative (0).

You may already have them. If not, download them from Serial Software. As of June 1998, I know of no diagnostic program in Linux for the serial port.

7.2 Changing Interrupt Priority

7.3 What is Setserial ?

Introduction

setserial is a program which allows you to tell the device driver software the I/O address of the serial port, which IRQ is set in the port's hardware, etc. With appropriate options, it can also probe (at a given I/O address) for a serial port but you must guess the I/O address (or it may use whatever address the driver thinks your /dev/ttySx is at). Setserial does not set either IRQ's nor I/O addresses in the serial port hardware itself. You must tell setserial the identical values that have been set in the hardware. It's set in the hardware either by jumpers or by plug-and-play. Do not just invent some values that you think would be nice to use. However, if you know the I/O address but don't know the IRQ you may command setserial to attempt to determine it.

You can see a list of possible commands to use (but not the one-letter options such as -v for verbose --which you should normally use when troubleshooting) by typing setserial with no arguments. Note that setserial calls an I/O address a "port". If the argument to setserial is for example just /dev/ttyS1, then you'll see some info about how that device driver is configured for that port. But this doesn't tell you if the hardware actually has these values set in it. If fact, you can run setserial and assign a purely fictitious I/O address, any IRQ, and whatever uart type you would like to have. Then the next time you type "setserial ..." it will display these bogus values without complaint. Note that assignments made by setserial are lost when the PC is powered down so it is usually run automatically somewhere each time that Linux is booted.

Probing

In order to try to find out if you have a certain piece of serial hardware you must first know its I/O address (or the device driver must have an I/O address for it, likely previously set by setserial). To try to detect the physical hardware use the -v (verbose) and autoconfig command to setserial. If the resulting message shows a uart type such as 16550A, then you're OK. If instead it shows "unknown" for the uart type, then there is likely no serial port at all at that I/O address. Some cheap serial ports don't identify themselves correctly so if you see "unknown" you still might have something there. See the file in which "setserial" is run at boot-time. Besides auto-probing for uart type, setserial can auto-probe for IRQ's but this doesn't always work right either.

Boot-time Configuration

There should be a file somewhere that runs setserial early at boot-time before any process uses the serial port. If it's not run at boot-time then your Linux system will automatically configure only ttyS{0-3} using the default IRQs of 4 and 3 (with the default IRQ conflicts). In 1998 it was (temporarily ?) changed to only ttyS{0-1}. So if you have more than 2 serial ports, or want to have control over how the ports are configured you should configure using setserial. In fact, your distribution may have set things up so that the setserial program runs automatically at boot-time. It's claimed that Redhat 6.0 failed to provide for this.

The file that runs setserial at boot-time is likely somewhere in the /etc directory-tree. You might use "locate" to find a file named: rc.serial, or 0setserial (Debian), etc. If no such file exists you may need to create it and make sure that it gets run at boot-time. If such a file is supplied, it should contain a number of commented-out examples. By uncommenting some of these and/or modifying them, you should be able to set things up correctly. Make sure that you are using a valid path for setserial, and a valid device name. You could do a test by executing this file manually (just type its name as the super-user) to see if it works right. Testing like this is a lot faster than doing repeated reboots to get it right. Of course you can also test a single setserial command by just typing it on the command line.

The file most commonly used to run setserial at boot-time is /etc/rc.d/rc.serial. The Debian distribution uses /etc/rc.boot/0setserial. Another file some have used is /etc/rc.d/rc.local but it's not a good idea to use this since it may not be run early enough. It's been reported that other processes may try to open the serial port before rc.local runs resulting in serial communication failure.

IRQs

By default, both ttyS0 and ttyS2 share IRQ 4, while ttyS0 and ttyS3 share IRQ 3. But sharing serial interrupts is not permitted unless you have kernel 2.2 or better. If you don't have this modern kernel but only have two serial ports ttyS0 and ttyS1 you're still OK since IRQ sharing conflicts don't exist for non-existent devices.

But if you do have more than 2 serial ports, then for kernels < 2.2 such sharing may be dangerous if the two devices with the same IRQ are being used at the same time. If you add an internal modem and retain ttyS0 and ttyS1, then you should attempt to find an unused IRQ and set it both on your modem card (or serial port) and then use setserial to assign it to your device driver. If IRQ 5 is not being used for a sound card, this may be one you can use for a modem. To set the IRQ in hardware you may need to use isapnp, a PnP BIOS or patch Linux to make it PnP. To help you determine which spare IRQ's you might have, type "man setserial" and search for say: "IRQ 11".

7.4 What is isapnp ?

isapnp is a program to configure Plug-and-Play (PnP) devices on the ISA bus including internal modems. It comes in a package called "isapnptools" and includes another program, "pnpdump" which finds all your ISA PnP devices and shows you options for configuring them in a format which may be added to the PnP configuration file: /etc/isapnp.conf. The isapnp command may be put into a startup file so that it runs each time you start the computer and thus will configure ISA PnP devices. It is able to do this even if your BIOS doesn't support PnP. See Plug-and-Play-HOWTO.


Next Previous Contents