Mishari
Mishari

Reputation: 476

Consistent USB Port numbering on disconnect

I have a project where I have several dozen cameras connected to my Ubuntu 12.04 laptop via USB and I need to grab images from these cameras via Gphoto2

The problem is that when I disconnect the USB cable and re-connect it, the USB port number increments so I'm unable to tell which camera I am communicating with when grabbing images as gphoto requires me to define a port number from which to grab images.

Is there any way of resetting the USB port numbers so that the USB Ports are assigned based on the sequence which they are plugged in? Or is there any other method that I can use to map the cameras so that I can retrieve images from the correct camera every time?

Upvotes: 0

Views: 1068

Answers (2)

Stephen Niedzielski
Stephen Niedzielski

Reputation: 2637

This probably isn't the answer you're looking for, but I always use an external hub when order matters. These tend to enumerate devices in a logical manner if they're all connected to the hub when the hub is attached to the PC. You have to figure out the hub logic by running a few trials. On many that I've played with, the order has generally been from one side to another. For example, my CyberPower hub enumerates like the numbering of pins on an integrated circuit DIP from the upper left most port, counter-clockwise. This means that when I attach six USB to serial devices and then connect the hub to the PC, they come up as /dev/ttyUSB0 - 5 in that same order.

Upvotes: 0

Vijay
Vijay

Reputation: 71

You can probably use a combination of Vendor id and serial number to track down the exact camera or any other usb device. Few devices such as USB flash drives do not have serial numbers (I haven't used a usb camera with linux so far). You can explore (/sys/bus/usb/devices/../ and 'lsusb -v') for more info on this.

Upvotes: 2

Related Questions