11.8Which Connector on the Back of my PC is ttyS1, etc?
Inspect the connectors
Inspecting the connectors may give some clues but is often not definitive. The serial connectors on the back side of a PC are usually DB connectors with male pins. 9-pin is the most common but some are 25-pin (especially older PCs like 486s). There may be one 9-pin (perhaps ttyS0 ??) and one 25-pin (perhaps ttyS1 ??). For two 9-pin ones the top one might be ttyS0.
If you only have one serial port connector on the back of your PC, this may be easy. If you also have an internal modem, a program like wvdial may be able to tell you what port it's on (unless it's a PnP that hasn't been enabled yet). A report from setserial (at boot-time or run by you from the command line) should help you identify the non-modem ports.
If you have two serial ports it may be more difficult. You could have only one serial connector but actually have 2 ports, one of which isn't used (but it's still there electronically). First check manuals (if any) for your computer. Look at the connectors for meaningful labels. You might even want to take off the PC's cover and see if there are any meaningful labels on the card where the internal ribbon serial cables plug in. Labels (if any) are likely to say something like "serial 1", "serial 2" or A, B. Which com port it actually is will depend on jumper or PnP settings (sometimes shown in a BIOS setup menu). But 1 or A are more likely to be ttyS0 with 2 or B ttyS1.
Send bytes to the port
Labels are not apt to be definitive so here's another method. If the serial ports have been configured correctly per setserial, then you may send some bytes out a port and try to detect which connector (if any) they are coming out of. One way to send such a signal is to copy a long text file to the port using a command like: cp my_file_name /dev/ttyS1. A voltmeter connected to the DTR pin (see Serial-HOWTO for Pinout) will display a positive voltage as soon as you give the copy command.
The transmit pin should go from several volts negative to a voltage fluctuating around zero after you start sending the bytes. If it doesn't (but the DTR went positive) then you've got the right port but it's blocked from sending. This may be due to a wrong IRQ, -clocal being set, etc. The command "stty -F /dev/ttyS1 -a " should show clocal (and not -clocal). If not, change it to clocal.
Another test is to jumper the transmit and receive pins (pins 2 and 3 of either the 25-pin or 9-pin connector) of a test serial port. Then send something to each port (from the PCs keyboard) and see if it gets sent back. If it does it's likely the port with the jumper on it. Then remove the jumper and verify that nothing gets sent back. Note that if "echo" is set (per stty) then a jumper creates an infinite loop. Bytes that pass thru the jumper go into the port and come right back out of the other pin back to the jumper. Then they go back in and out again and again. Whatever you send to the port repeats itself forever (until you interrupt it by removing the jumper, etc.). This may be a good way to test it as the repeating test messages halt when the jumper is removed.
As a jumper you could use a mini (or micro) jumper cable (sold in some electronic parts stores) with mini alligator clips. A small scrap of paper may be used to prevent the mini clips from making electrical contact where it shouldn't. Metal paper clips can sometimes be bent to use as jumpers. Whatever you use as a jumper take care not to bend or excessively scratch the pins. To receive something from a port, you can go to a virtual terminal (for example Alt-F2 and login) and type something like "cp /dev/ttyS2 /dev/tty". Then at another virtual terminal you may send something to ttyS2 (or whatever) by "echo test_message > /dev/ttyS2". Then go back to the receive virtual terminal and look for the test_message. See Serial Electrical Test Equipment for more info.
Connect a device to the connector
* License
* Linux Serial How-To Index