0

I found this topic (command to determine ports of a device (like /dev/ttyUSB0)) is useful, bu still hasn't resolved my question: how to find which tty port associates to which usb device. I mean I want to use minicom on Ubuntu 20.04, when I plug the device, I could see it by lsusb, but I don't know how to find the attribute for sudo minicom /dev/ttyxxx.

6
  • ls -d /sys/bus/usb/devices/*/tty* – Uncle Billy Feb 4 at 2:19
  • for f in /sys/bus/usb/devices/*/tty*; do echo "=== ${f##*/} === "; cat "${f%/tty*}/uevent"; done – Uncle Billy Feb 4 at 2:19
  • when i typed: ls -d /sys/bus/usb/devices/*/tty*, it prompted: ls: cannot access '/sys/bus/usb/devices/*/tty*': No such file or directory – Sunnyday Feb 4 at 2:26
  • I tried this method:unix.stackexchange.com/questions/144029/… while, it only listed mouse and keyboard. – Sunnyday Feb 4 at 2:37
  • Do you really have a /dev/ttyUSB0? If yes, realpath "/sys/dev/char/$(ls -l /dev/ttyUSB0 | awk -F'[ ,]+' '{print $5":"$6}')" should point you to the USB device. If you don't have any /dev/ttyUSB* (or /dev/ttyAMA*, etc) then no tty device is associated with it ;-) – Uncle Billy Feb 4 at 2:42

Your Answer

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

Browse other questions tagged or ask your own question.