How can I know the USB port?

60,743

I usually list the files in /dev, plug in the device, list the files in /dev again, and look to see which special file appeared. You could also redirect the output of each listing to two different files and use diff to show you which special file appeared when you plugged in the device:

ls /dev > notplugged
# plug in device
ls /dev > plugged
diff notplugged plugged

Once you know what file corresponds to the device (it's usually something like /dev/ttyUSB0), you just use that file in place of <port>.

Edit: Apparently dmesg can tell you which device file corresponds to your device. Run dmesg | grep tty after plugging in your device. The device file should be apparent in one of the lines.

Share:
60,743

Related videos on Youtube

DarkCoffee
Author by

DarkCoffee

Updated on November 23, 2022

Comments

  • DarkCoffee
    DarkCoffee over 1 year

    I'm working on a project with an ATmega1280 (Atmel) board. I want to take a look at the stack, so I'm trying to do an OCD (On Chip Debugging). In the tutorial it says:

    Use this AVRDUDE command to program the fuses on the ATMega1280 to enable OCD and JTAG:

    avrdude -P <port> -c <programmer> -p m1280 -U hfuse:w:0x1a:m -v
    

    Replace port with the port to which your programmer is connected, and programmer with the programmer type.

    At this point, my question is: How can I find out the port of the USB in Kubuntu?

    • Admin
      Admin about 11 years
      usbview provides technical info on the usb controllers/hubs: see my answer for this question
    • Admin
      Admin almost 7 years
      lsusb -t before and after inserting the USB device, will give you the details you need.
  • Admin
    Admin about 11 years
    Thank you for the answer it was useful! Yes, it is usually /dev/ttyusb0, but there isn't in my pc. When I do 'ls /dev' the file notplugged and plugged are the same.