next up previous contents
Next: Serial Hardware Up: Setting up the Serial Previous: Introduction to Serial Devices

Accessing Serial Devices

  Like all devices in a system, serial ports are accessed through device special files, located in the /dev directory. There are two varieties of device files related to serial drivers, and for each port, there is one device file from each of them. Depending on the file it is accessed by, the device will behave differently.

          The first variety is used whenever the port is used for dialing in; it has a major number of 4, and the files are named ttyS0, ttyS1, etc. The second variety is used when dialing out through a port; the files are called cua0, etc, and have a major number of 5.

    Minor numbers are identical for both types. If you have your modem on one of the ports COM1 through COM4, its minor number will be the COM port number plus 63. If your setup is different from that, for example when using a board supporting multiple serial lines, please refer to the Serial Howto.

Assume your modem is on COM2. Thus its minor number will be 65, and its major number will be 5 for dialing out. There should be a device cua1 which has these numbers. List the serial ttys in the /dev directory. Columns 5 and 6 should show major and minor numbers, respectively:

If there is no such device, you will have to create one: become super-user and type

  Some people suggest making /dev/modem a symbolic link to your modem device, so that casual users don't have to remember the somewhat unintuitive cua1. However, you cannot use modem in one program, and the real device file name in another. This is because these programs use so-called lock files to signal that the device is used. By convention, the lock file name for cua1, for instance, is LCK..cua1. Using different device files for the same port means that programs will fail to recognize each other's lock files, and will both use the device at the same time. As a result, both applications will not work at all.

   


next up previous contents
Next: Serial Hardware Up: Setting up the Serial Previous: Introduction to Serial Devices

Andrew Anderson
Thu Mar 7 23:22:06 EST 1996