Previous Next Contents

3. What are the names of the serial ports?

There are the 4 serial devices corresponding to COM1 - COM4:

/dev/cua0, /dev/ttyS0 (COM1) address 0x3f8 IRQ 4
/dev/cua1, /dev/ttyS1 (COM2) address 0x2f8 IRQ 3
/dev/cua2, /dev/ttyS2 (COM3) address 0x3e8 IRQ 4
/dev/cua3, /dev/ttyS3 (COM4) address 0x2e8 IRQ 3

The /dev/ttySN devices are for incoming connections and /dev/cuaN devices for outgoing connections. N is the serial port number. In this document, I refer to COM1 as ttyS0, COM2 as ttyS1, COM3 as ttyS2, and COM4 as ttyS3. If I am referring to a specific device in /dev, I will always prepend /dev to avoid confusing you.

On some installations, two extra devices will be created, /dev/modem for your modem and /dev/mouse for your mouse. Both of these are symbolic links to the appropriate /dev/cuaN device which you specified during the installation (unless you have a bus mouse, then /dev/mouse will point to the bus mouse device).

There has been some discussion on the merits of /dev/mouse and /dev/modem. I strongly discourage the use of these links. In particular, if you are planning on using your modem for dialin you will run into problems because the lock files will not work correctly if you use /dev/modem. Use them if you like, but be sure they point to the right device.

3.1 Major and minor device numbers of serial devices in /dev

/dev/ttyS0 major 4, minor 64    /dev/cua0 major 5, minor 64
/dev/ttyS1 major 4, minor 65    /dev/cua1 major 5, minor 65
/dev/ttyS2 major 4, minor 66    /dev/cua2 major 5, minor 66
/dev/ttyS3 major 4, minor 67    /dev/cua3 major 5, minor 67

Note that all distributions should come with these devices already made correctly.

Creating devices in /dev

If you don't have a device, you will have to create it with the mknod command.

Example, suppose you needed to create devices for ttyS0:

linux# mknod -m 666 /dev/cua0 c 5 64
linux# mknod -m 666 /dev/ttyS0 c 4 64

You can also get the MAKEDEV script, available on the usual FTP sites. This simplifies the making of devices. For example, if you needed to make the devices for ttyS0 you would type:

linux# cd /dev
linux# MAKEDEV ttyS0

This handles the devices creation for the incoming and outgoing devices.

Notes for multiport boards

The devices your multiport board uses depends on what kind of board you have. These are listed in detail in the rc.serial which comes with the setserial program. You will probably need to create these devices. Either use the mknod command, or get the MAKEDEV script. Devices for multiport boards are made by adding ``64 + the port number''. So, if you wanted to create devices for ttyS17, you would type:

linux# mknod -m 666 /dev/cua17 c 5 81
linux# mknod -m 666 /dev/ttyS17 c 4 81

Note that ``64 + 17 = 81''. Using the MAKEDEV script, you would type:

linux# cd /dev
linux# MAKEDEV ttyS17


Previous Next Contents