For creating devices in the device directory see: the Serial-HOWTO: "Creating Devices In the /dev directory".
This is a new type of device interface to Linux. 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 Also see the kernel documentation tree: filesystems/devfs.
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.
Devices 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 a "cua" name for each serial port and it behaved just a little differently. For example, ttyS2 would correspond to cua2. It was mainly used for modems. The cua major number was 5 and minor numbers started at 64. You may still have the cua devices in your /dev directory but they are now deprecated. For details see Modem-HOWTO, section: cua Device Obsolete.
Dos/Windows use the COM name while the
setserial program uses
tty00, tty01, etc. Don't confuse these with dev/tty0, dev/tty1, etc.
which are used for the console (your PC monitor) but are not serial
ports. The table below is for the "standard" case (but yours could be
different). The major/minor numbers don't exist with the devfs. For
the PCI bus the IO addresses are different.
ISA IO devfs usb dos major minor address devfs devfs usb acm modem COM1 /dev/ttyS0 4, 64; 3F8 /dev/tts/0 /dev/usb/tts/0 /dev/usb/acm/0 COM2 /dev/ttyS1 4, 65; 2F8 /dev/tts/1 /dev/usb/tts/1 /dev/usb/acm/1 COM3 /dev/ttyS2 4, 66; 3E8 /dev/tts/2 /dev/usb/tts/2 /dev/usb/acm/2 COM4 /dev/ttyS3 4, 67; 2E8 /dev/tts/3 /dev/usb/tts/3 /dev/usb/acm/3
The serial ports on the USB are: /dev/ttyUSB0, /dev/ttyUSB1, etc. The devfs names for these are: /dev/usb/tts/0, /dev/usb/tts/1, etc. For many modems they are /dev/usb/acm/0, etc. (in devfs notation). For more info see the usb subdirectory in the kernel documentation directory for files: acm and usb-serial.
On some installations, two extra devices will be created,
/dev/modem for your modem and
/dev/mouse for a
mouse. Both of these are symbolic links to the appropriate serial
/dev which you specified during the installation
Except if you have a bus mouse, then
/dev/mouse will point to
the bus mouse device).
Formerly (in the 1990s) the use of
/dev/modem was discouraged
since lock files might not realize that it was really say
/dev/ttyS2. The newer lock file system doesn't fall into
this trap so it's now OK to use such links.
Each 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.
Закладки на сайте
Проследить за страницей
Created 1996-2020 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру