2

I am working with an embedded Linux system using a USB serial port as the system console. When I am local to it, I simply use a USB cable to my PC and run PuTTY, giving me an interactive console interface.

I want to do the same thing when I am remote, but don't know how. I would like to loop back the USB console cable to a USB host port on the same Linux machine. Once booted, I would like to be able to log in over the network with SSH and PuTTY, then do something to have the PuTTY login session redirect stdin and stdout to the console port. I want to be able to type command lines, sending them out the host serial port and into the console port. The results of running the command would come back out the console port and be echoed in my PuTTY SSH login session.

How do I do something like this? I have minicom installed.

2
  • Since you want to "do something" after you connect via SSH and only then reach the system console, I understand whatever interface is available via SSH is not the system console. Right? Please explain why you think you need the serial port after you have already logged in. Because it's another (virtual?) OS? A restricted shell? No way to elevate to root user? What am I missing? Or maybe there is no SSH access yet (XY problem?). Commented Nov 6, 2018 at 22:04
  • At startup, a firmware application is launched by inittab, using the system console directly for its I/O, i.e., no login required. Without a direct connection to that serial port, I'm blind as to what the firmware is printing there. Nor do I have the ability to feed command lines into the firmware for execution. I'm hoping to find the equivalent of a "serial chat" program without having to write it myself.
    – edj
    Commented Nov 7, 2018 at 14:39

1 Answer 1

2

The simple solution I was looking for was achieved with socat:

socat stdin,raw,echo=0 /dev/ttyUSB0,raw,echo=0

I simply log in via SSH after startup and type that command, assuming that I have connected the USB cable between the two USB ports (gadget and host) on my system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .