Книга: Linux Network Administrator Guide, Second Edition

The Serial Device Special Files

The Serial Device Special Files

Minor numbers are identical for both types of serial devices. 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 you are using special serial hardware, such as a high-performance multiple port serial controller, you will probably need to create special device files for it; it probably won't use the standard device driver. The Serial-HOWTO should be able to assist you in finding the appropriate details.

Assume your modem is on COM2:. Its minor number will be 65, and its major number will be 4 for normal use. There should be a device called ttyS1 that has these numbers. List the serial ttys in the /dev/ directory. The fifth and sixth columns show the major and minor numbers, respectively:

$ ls -l /dev/ttyS*
0 crw-rw-- 1 uucp dialout 4, 64 Oct 13 1997 /dev/ttyS0
0 crw-rw-- 1 uucp dialout 4, 65 Jan 26 21:55 /dev/ttyS1
0 crw-rw-- 1 uucp dialout 4, 66 Oct 13 1997 /dev/ttyS2
0 crw-rw-- 1 uucp dialout 4, 67 Oct 13 1997 /dev/ttyS3

If there is no device with major number 4 and minor number 65, you will have to create one. Become the superuser and type:

# mknod -m 666 /dev/ttyS1 c 4 65
# chown uucp.dialout /dev/ttyS1

The various Linux distributions use slightly differing strategies for who should own the serial devices. Sometimes they will be owned by root, and other times they will be owned by another user, such as uucp in our example. Modern distributions have a group specifically for dial-out devices, and any users who are allowed to use them are added to this group.

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 ttyS1. However, you cannot use modem in one program and the real device file name in another. Their lock files would have different names and the locking mechanism wouldn't work.

Оглавление книги

Оглавление статьи/книги

Генерация: 1.284. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз