2013-12-12

Quickly check serial ports with setserial

When I want to quickly check what serial ports are active on a machine, I use the setserial command:
# which setserial
/usr/bin/setserial
# man setserial
...
# setserial -g /dev/ttyS?
/dev/ttyS0, UART: unknown, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
/dev/ttyS4, UART: 16550A, Port: 0xf0e0, IRQ: 19
/dev/ttyS5, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS6, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS7, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS8, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS9, UART: unknown, Port: 0x0000, IRQ: 0

This is on my laptop, which of course has no physical serial port. The output of setserial -g shows whatever hardware the kernel thinks it can see. With today's laptops, one typically uses a USB-to-serial adapter. In that case, after connecting the adapter I would do:
# dmesg
... review the last few kernel log messages, which will hopefully confirm 
    that the device was recognized ... 
# setserial -g /dev/ttyUSB?
... hopefully see that the device is present, with UART, Port, and IRQ all 
    set up and ready to use ...

No comments:

Post a Comment