I'm working with a linux application which needs to talk with a remotely-located serial (rs-232) device. I've worked out how to use socat on the remote end to send the device's serial data over an IP connection, but how do I then convert that IP stream back into a (pseudo) serial device character device (e.g. /dev/fakesocatserial0) on the other side?
2 Answers
You should be able to use the PIPE
address type of socat
to create a Unix pipe to connect to, for example (assuming that the device with the real serial device creates the network connection):
socat PIPE:/dev/fakesocatserial0 TCP-LISTEN:1234
-
Maybe something like this?
socat PTY,link=/dev/fakeserial0,raw,echo=0,wait-slave TCP4:remote-board:1723
– Alex GMay 1, 2012 at 17:00
have you tried sshfs? You can simply mount remote:/dev
into somewhere like local:/remote/dev
and point to the actual character device
-
1Well, the remote device is an embedded board with no SSH, so I'm trying to avoid changing its configuration if at all possible.– Alex GMay 1, 2012 at 17:00
-
-
This wouldn't have worked anyway -- if you mount the remote /dev locally, it will still be the local kernel that translates the major and minor device numbers of devices into a driver entry point; that is, a /dev/ttyS0 node would still refer to the local serial port, not the remote one, even if the device node happens to be on a remote filesystem. Feb 21, 2023 at 12:36