It is possible to connect my laptop to any network equipment like managed switch or firewall via mini-USB port on them, then use screen to connect to its TTY.

Is it actually possible to connect to another computer, say laptop or server, by adhoc USB-to-USB connection? Like:

Terminal Client Linux Box - USB PORT ===> Target Machine - USB PORT

Assume operating system is Linux/Unix/BSD, hardware itself doesn't support emulation of terminal by USB port.

This question is purely out of curiosity. For example if I want TTY access to my RPI but I don't want to connect a monitor.


Yes, you can use USB serial cable to connect Terminal using lsusb and modprobe usbserial. USB to Serial Cable... The external conversion cable directly implements hardware support internally. So whether the original board has hardware support or not, the software operating system can solve it. USB to Serial Conversion Hardware Logics...

USB to Serial Conversion Hardware Logics

jay_k@jay_k ~ $ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 005: ID 2232:5005 Silicon Motion 
Bus 002 Device 004: ID 8087:07dc Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jay_k@jay_k ~ $ sudo modprobe usbserial vendor=VENDOR product=PRODUCT

VENDOR and PRODUCT are determined as XXXX:XXXX. this means that VENDOR:PRODUCT.

after executing modprobe, you can find a ttyXXX with dmesg. like;

jay_k@jay_k ~ $ dmesg | grep tty

it will be formatted as /dev/ttyUSB....

Even more, you can create a connection as USB to USB with Data Communication Converter Cable. but this products are just only in Korean Market, external link - Auction Korea.

Also, you can communicate with two Serial Converter. (but, it has overhead)

Laptop ---> USB to Serial ---> Serial to USB -> Target

and you can redirect your bash to /dev/ttyUSB....

redirect output from interface?

You should use the serial device much like a normal file. The only difference is that it needs some ioctl()s to do the speed and control line setup.

So don't use os.system("echo ... but f = open('/dev/ttyUSB3', 'rw') and then f.write() and f.read().

In theory you could use ioctl() to set the speed and so on, but at that stage it's simply easier to use pySerial than to do all of the parameter marshalling yourself. ser = serial.Serial(port='/dev/ttyUSB3', baudrate=9600, timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS) with ser.write() and ser.read().

Note that you should use udev to set a unique name for the serial port, rather than hard-coding /dev/ttyUSB3. Here's how to do that for a single USB/RS-232 adapter and here's how to do that for a multiport USB/RS-232 adapter.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.