2

I'm using Ubuntu 12.04.

I need to send a command to a device that I have connected on a port of my PC. I can send the command by finding out what the Bus and Device number are.

For example, lsusb will tell me that I have a device connected on Bus 007 and Device 003

"Bus 007 Device 003: ID 045e:00cb Google Inc."

However, the device number will change if I reboot the device.

"Bus 007 Device 004: ID 045e:00cb Google Inc."

Is there a way to make sure that I can send the commands to that PC USB port? By associating the device number to that phyical USB port? Or is there other fixes and workarounds?

1 Answer 1

0

A workaround is to check the current bus/device configuration for your device as it'll be portable too and I think the usb host controller allocates these numbers dynamically, here's using awk you can get the current bus and device

    lsusb | grep "045e:00cb" | tr -d ':'| awk '{print "Bus="$2 " Device="$4}' 

You use $2 and $4 in anyway for example : ls -l /dev/bus/usb/$2/$4

2
  • Is there a way to fix how the usb host controller allocates the numbers? Commented May 13, 2015 at 17:28
  • You will have to be more specific about what kind of USB device it is. If it is a device for some embedded controller that you send text to, and its tty or usbserial driver was installed--and some already are--it should show up as something like /dev/ttyACM0 unix.stackexchange.com/questions/88477/…
    – hellork
    Commented Feb 26, 2020 at 20:43

You must log in to answer this question.

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