How To Check and Use Serial Ports Under Linux

來源:互聯網
上載者:User
How To Check and Use Serial Ports Under Linux

How do I check and configure serial ports under Linux for various purposes such as modem, connecting null
modems or connect a dumb terminal?


Linux offers various tools. Linux uses ttySx for a serial port device name. For example, COM1 (DOS/Windows name) is ttyS0, COM2 is ttyS1 and so on.

Task: Display Detected System's Serial Support

Simple run dmesg command
$
dmesg | grep tty


Output:

[   37.531286] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A[   37.531841] 00:0b: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A[   37.532138] 0000:04:00.3: ttyS1 at I/O 0x1020 (irq = 18) is a 16550A
setserial command

setserial is a program designed to set and/or report the configuration information associated with a serial port. This information includes what I/O port and IRQ a particular serial port is using, and whether or not the break key should be interpreted as the
Secure Attention Key, and so on. Just type the following command:
$
setserial -g /dev/ttyS[0123]


Output:

/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4/dev/ttyS1, UART: 16550A, Port: 0x1020, IRQ: 18/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3

setserial with -g option help to find out what physical serial ports your Linux box has.

Linux serial console programs

Once serial ports identified you can configure Linux box using various utilities:

  1. minicom-
    The best friendly serial communication program for controlling modems and connecting to dump devices
  2. wvidial
    or other GUI dial up networking program - a PPP dialer with built-in intelligence.
  3. getty / agetty - agetty opens a tty port, prompts for a login name and invokes the /bin/login command.
  4. grub / lilo configuration - To configure serial port as the system console

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.