Linux Network Administrator Manual (4)
2000-07-28 17:34
Publisher: NetBull Readings: 1276 Translation: Zhao Wei GoHigh@shtdu.edu.cn Chapter 4 Setting Serial Hardware has such a rumor, there are some people in the online world, they only have a PC and money to spend Connect to a T1-interconnection network. However, in order to carry out their news (news) and mail (Mail)'s daily work, they say that use public telephone networks, relying on SLIP connection, uucp network, and [electronic] Bulletin Board system (BULLETIN BOARD SYSTEMS BBS's) . This chapter intends to help all those who rely on MODEM to maintain their connections. However, there are many details this chapter will not discuss, for example, how to configure your MODEM for dialing. All of these topics will include in the upcoming HOWTO series of Greg Hankins, [1] it will periodically deliver to Comp.OS.Linux.announce. 4.1 MODEM Connection Communication Software Linux has many communication packages, many of which are Terminal Programs, which makes a user on another computer, just like she is sitting in front of a normal terminal. . The traditional dial-up terminal program is Kermit. However, this software is somewhat simple. There are now many more applicable programs that support phone numbers, dialing and login remote computer system scripting languages, etc. One of this software is Minicom, which is similar to some terminal programs that the previous DOS user may be very habit. There are also some X-based communication software packages, for example, Seyon. Similarly, there are also many Linux-based BBS software packages for those who want to run [electronic] bulletin system. These packages can be found in sunsite.unc.edu / pub / linux / system / network. In addition to the terminal program, there are some non-interactive use of serial connection software for your computer to send and receive data. The advantage of this technique is that the time required to browse the bullet card than some of the Mailbox programs that need to be read online and find a fun article, spend less time to automatically download dozens of KB data. On the other hand, because some of the useless information you often get, more disk storage is required. A summary of such communication software [reflect] is UUCP. This is a program group from a host copy file to another, executing a program, etc. on a remote host. It is often used to transfer Mail or NEWS in a private network. The UUCP package that runs under Linux will be discussed in the following sections. Other non-interactive communication software is, for example, for reflexonet. There is also a port that is like the fidonet application like IFMail. SLIP, serial line interconnection network protocols, relatively, is a middle type, which allows interactive or non-interactive use. Many people use SLIP dial-up to their campus network or some other public SLIP web server to run FTP sessions, and so on. However, SLIP can also be used for fixed and semi-fixed connections to the network, although this is actually only interested in using ISDN. 4.2 Serial Equipment Overview The UNIX core is typically referred to as TTYS to access the device provided by the serial device. This is the abbreviation of TeleTypeTM, which was once one of UNIX's major terminal manufacturers. Today this term is used to refer to any characteristic data terminal. Throughout this chapter, we will use this term to speculate on the kernel equipment [driver]. Different three types of TTYS: (virtual) console, pseudo terminal (similar to a two-way pipe, used for applications like X11), and serial devices. The latter kind is also known as TTYS because it allows interactive session operations on a serial connection; regardless of whether it is a fixed wiring connection, or a remote host through the telephone line.
TTYS has many configurable parameters that can be set using the system call IOCTL (2). Many of these parameters are useful to serial devices because they need to have very much flexibility to handle various types of connections. The most prominent line parameters are line rates and parity. However, there is also a transition sign of the case, and the carriage return is converted into a resolution, etc. The TTY driver can also support a variety of line disciplines, which makes the performance of the device driver. For example, Linux's SLIP driver is implemented in accordance with special line specifications. About how to test the line speed is somewhat embarrassed. The correct term is the bit rate, which is related to the line transmission speed measured by a bit number (or short-written BPS) per second. Sometimes you listen to it in baud rate, this is not very correct. However, these two terms are not interchangeable. The baud rate refers to the physical characteristics of certain serial devices, namely the clock rate of the pulse. The bit rate is more appropriately indicated by a known connection between two points, i.e., the average bit number of transmissions per second. It is important to know that these two values are often very important, because most devices can code more than one bit in each electrical pulse. 4.3 Accessing the serial device is like all devices in the UNIX system, the serial port is accessible by accessing a specific file located in the / dev directory. There are two device files related to the serial driver, and for each port, there are two device files. Depending on the file accessed by the device, the performance of the device will vary. The first use is for the port when the port is used as a dial-in; it has a main number 4, and the file is named TTYS0, TTYS1, etc. The second type is used for when the port is used as a diary; the file is called Cua0, etc., and there is an primary number 5. The secondary number is the same for both types. If you have a modem in one of the port COM1 to COM4, then its secondary number is the COM port number plus 63. If your settings are different from this, for example, see Serial HowTo when using a plate that supports multi-line lines. Assume your MODEM on COM2. In this way, its secondary number will be 65, and the main number will be 5 when it is allocated. There will be a device file CUA1 with these numbers. A list of serial TTYs in the / dev directory. The third column and the sixth column should display the main number and the secondary number, respectively: $ ls -l / dev / cur * CRW-RW-RW- 1 root root 5, 64 NOV 30 19:31 / dev / cua0 CRW-RW- RW- 1 root root 5, 65 NOV 30 22:08 / dev / cua1 CRW-RW-RW- 1 root root 5, 66 OCT 28 11:56 / dev / cua2 CRW-RW-RW- 1 root root 5, 67 Mar 19 1992 / dev / cua3 If there is no such device, you must create a: as a super user, type # mknod -m 666 / dev / cua1 c 5 65 #Chown root.root / dev / cua1 Some people recommend making a Symbol join / dev / modem to your MODEM device, so temporary users don't need to remember this less intuitive CUA1. However, you cannot use the MODEM name in a program, and use the actual device file name in another program. This is because these programs use so-called lock files to notify the device to be occupied. According to conventions, CUA1 lock files, for example, is LCK..CUA1. Use different device files to the same port means that programs will not recognize other lock files, and everyone uses this device simultaneously. As a result, both applications can't work at all. 4.4 Serial Hardware Currently Linux supports many types of serial boards using RS-232 standards.
RS-232 is the most versatile standard in the current PC world serial communications. It uses some circuits to transmit single bit data and synchronize. Other wiring can be used for carrier signals (for modems) and handshake signals. Although the hardware handshake signal is only supplied, it is useful. It makes any party of the two sites to inform the other party whether it is ready to receive more data, or if another site will be paused until the recipient has handled the data received. Wires for this purpose are called "Clear TO Send" and "Ready TO Send", which illustrates the common name of the hardware handshake signal, that is, "RTS / CTS". In the PC, the RS-232 interface is typically driven by the UART chip, which is derived from the 16450 chip of the National Semiconductor, or a new version of NSC16550A. [2] Some brands (most significant built-in modems are equipped with Rockwell chip) also use completely different chipsets, which are programmed as if they are 16550 chips. The main difference between 16450 and 16550 is that the latter has a 16-byte FIFO buffer, while the former has only one byte buffer. This makes 16450 suitable for speed up to 9600 baud, while a higher speed requires a 6550 compatible chip. In addition to these chips, Linux also supports 8250 chips, which is the original chip of PC-AT. In the case of default configuration, the kernel checks four standard serial ports COM1 to COM4. The secondary number 64 to 67 will be assigned to these ports, as described above. If you want to configure your serial port correctly, you should install the TED TSO's setserial command and Rc.Serial script. This script should call from / etc / rc when the system boot startup. It uses setserial to configure the serial device of the kernel. A typical rc.serial script looks like this: # /etc/rc.serial - Serial Line configure script. # # Do wild interrupt detection / sbin / setserial -w / dev / cua * # configure serial devices / sbin / setserial / dev / cua0 auto irq skip test autoconfig / sbin / setserial / dev / cua1 auto irq skip test autoconfig / sbin / setserial / dev / cua2 auto irq skip test autoconfig / sbin / setserial / dev / cua3 auto irq skip test autoconfig # Display Serial device configuration / sbin / setserial -bg / dev / cua * See the interpretation of the document included with the setserial. If your serial card is not detected, or the setserial -bg command shows that the setting is incorrect, you must make an forced configuration by clearly give the correct parameter value. It is reported that users with built-in MODEMS with Rockwell chips will encounter this issue. For example, if the UART chip is detected is NSC16450, when it is NSC16550, you must change the configuration command of the wrong port to / SBIN / SETSERIAL / DEV / CUA1 AUTO IRQ SKIP TEST AutoConfig UART 16550 to the COM port , Base sites, and IRQ settings have similar selection operations. See the SetSerial man page. If your MODEM supports hardware handshake, you must be sure to activate it. What is strange is that most communication procedures have not tried to activate it defaults; so you have to set it up.
This is best to use the stty command in the rc.serial script: $ stty crtscts dev / cua1 To check if the hardware handshake work, use $ stty dev / cua1 this will give all the flags of that device State; if there is a minus sign before the flag, such as -CRTSCTS, indicating that this flag is turned off. Note [1] can be contacted with GRegh@cc.gatech.edu. [2] There is also an NSC16550, but its FIFO has never worked properly. source:
Linux free pigeon