/ dev / ttyS0和/ dev / ttys0之间的区别?

时间:2020-03-05 18:41:57  来源:igfitidea点击:

在Linux中,/ dev / ttyS0/ dev / ttys0有什么区别?

我知道第一个是串行端口,但是第二个是小的s呢?

解决方案

回答

看到这个

For a pseudo terminal pair such as
  ptyp3 and ttyp3, the pty... is the
  master or controlling terminal and the
  tty... is the slave. There are only 16
  ttyp's: ttyp0-ttypf (f is a
  hexadecimal digit). To get more
  pairs, the 3 letters q, r, s may be
  used instead of p. For example the
  pair ttys8, ptys8 is a pseudo terminal
  pair. The master and slave are really
  the same "port" but the slave is used
  by the application program and the
  master is used by a network program
  (or the like) which supplies (and
  gets) data to/from the slave port.

回答

这是:http://lists.opensuse.org/archive/opensuse/2003-12/msg02404.html

回答

在内核文档中的Linux devices.txt文件中,它表示:

3 char    Pseudo-TTY slaves
      0 = /dev/ttyp0    First PTY slave
      1 = /dev/ttyp1    Second PTY slave
        ...
    255 = /dev/ttyef    256th PTY slave

    These are the old-style (BSD) PTY devices; Unix98
    devices are on major 136 and above.

然后继续说

4 char    TTY devices
      0 = /dev/tty0     Current virtual console

      1 = /dev/tty1     First virtual console
        ...
     63 = /dev/tty63    63rd virtual console
     64 = /dev/ttyS0    First UART serial port
        ...
    255 = /dev/ttyS191  192nd UART serial port

    UART serial ports refer to 8250/16450/16550 series devices.

    Older versions of the Linux kernel used this major
    number for BSD PTY devices.  As of Linux 2.1.115, this
    is no longer supported.  Use major numbers 2 and 3.

我不知道这对我们有多大帮助,但是应该朝正确的方向开始。