0

I have an EC2 instance. I want to set up a listener on a serial port. However, I cannot get the serial port to respond. Nothing seems to fail, I can connect to it in dio (PHP) without error. But nothing gets passed through. So if in one terminal I listen (cat < /dev/ttyS0) and the other I send (echo "hi" > /dev/ttyS0), no result at all. Nothing shows when I try to listen using minicom.

I would guess this has something to do with the boot image attached; but nothing I do seems to remove it. I also have had no luck trying to turn "on" an additional serial port; ttyS1 doesn't seem to think it has a device accessible.

>  setserial -g /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
>dmesg | grep ttyS
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-1058-aws root=UUID=651cda91-e465-4685-b697-67aa07181279 ro console=tty1 console=ttyS0 nvme_core.io_timeout=4294967295
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-1058-aws root=UUID=651cda91-e465-4685-b697-67aa07181279 ro console=tty1 console=ttyS0 nvme_core.io_timeout=4294967295
[    0.004000] console [ttyS0] enabled
[    1.145458] 00:06: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A

I'd very much appreciate some help with this as it's a new area for me - either freeing up ttyS0, debugging if I misunderstood the issue, or attaching a new virtual serial port on ttyS1.

Many thanks to anyone who drops by to help!

  • Your cat & echo test would not be expected to work on a serial port unless there were a device (or a physical hard loop) on the other side of the port that was echoing characters back. It's unclear what possible use you could make of a serial port on an EC2 instance, so you might start a bit earlier by describing what you are *actually* trying to accomplish -- i.e. why a serial port? Is it actually a FIFO special file you're looking for? (One of those would pass the echo & cat test.) Or perhaps a Unix domain socket? – Michael - sqlbot Feb 04 '20 at 11:08
  • Many thanks for your comment, that was illuminating for me. I have to build a system that accepts data streams in udc, tcp and over serial port (to eventually be deployed on a physical machine). I'm fine with udc/tcp but have no experience with serial ports. Is there a way to "fake" a physical device for testing? – Laura Gilbert Feb 04 '20 at 11:33
  • Thanks for the clarification. Based on this, I'd say this question may be a duplicate of [Virtual Serial Port for Linux](https://stackoverflow.com/q/52187/1695906). – Michael - sqlbot Feb 04 '20 at 13:58

0 Answers0