![]() |
s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
Next
Previous
Contents
9. Serial Port Devices /dev/ttyS2, etc.For creating devices in the device directory see: the Serial-HOWTO: "Creating Devices In the /dev directory".
9.1 Devfs (The new Device File System)This is a new type of device interface to Linix. It's optional starting with kernel 2.4. It's more efficient than the conventional interface and makes it easy to deal with a huge number of devices. The device names have all changed as well. But there's an option to continue using the old names. For a detailed description of it see: http://www.atnf.csiro.au/~rgooch/linux/docs/devfs.html The name changes (if used) are: ttyS2 becomes tts/2 (Serial port), tty3 becomes vc/3 (Virtual Console), ptyp1 becomes pty/m1 (PTY master), ttyp2 becomes pty/s2 (PTY slave). "tts" looks like a directory which contains devices "files": 0, 1, 2, etc. All of these new names should still be in the /dev directory although optionally one may put them elsewhere.
9.2 Serial Port Device Names & NumbersDevices in Linux have major and minor numbers (unless you use the new devfs). The serial port ttySx (x=0,1,2, etc.) has major number 4. You may see this (and the minor numbers too) by typing: "ls -l ttyS*" in the /dev directory. There formerly was an alternate name for each serial port. For example, ttyS2 would have cua2 as an alternate name. You may still have the cua devices in your /dev directory but they are now deprecated. Their drivers behave slightly different than for the ttyS ones. Device Obsolete">."') Dos/Windows use the COM name while the
9.3 Universal Serial Bus PortsAlthough the USB is not covered in this HOWTO, the serial ports on the USB are: /dev/ttyUSB0 /dev/ttyUSB1, etc.
9.4 Link ttySN to /dev/modem On some installations, two extra devices will be created,
Formerly the use of
9.5 cua Device ObsoleteEach ttyS device has a corresponding cua device. But the cua device is deprecated so it's best to use ttyS (unless cua is required). There is a difference between cua and ttyS but a savvy programmer can make a ttyS port behave just like a cua port so there is no real need for the cua anymore. Except that some older programs may need to use the cua. What's the difference? The main difference between cua and ttyS has to do with what happens in a C-program when an ordinary "open" command tries to open the port. If a cua port has been set to check modem control signals, the port can be opened even if the CD modem control signal says not to. Astute programming (by adding additional lines to the program) can force a ttyS port to behave this way also. But a cua port can be more easily programmed to open for dialing out on a modem even when the modem fails to assert CD (since no one has called into it and there's no carrier). That's why cua was once used for dial-out and ttyS used for dial-in. Starting with Linux kernel 2.2, a warning message is put in the kernel log when one uses cua. This is an omen that cua is defunct and should be avoided if possible.
Next Previous Contents |