Hi Carsten, On Wednesday 21 January 2009, Carsten Meier wrote: > > now I want to translate bus_info into a sysfs-path to obtain > device-info like serial numbers. Given a device reports > "usb-0000:00:1d.2-2" as bus_info, then the device-info is located > under "/sys/bus/usb/devices/2-2", which is a symlink to the > appropriate /sys/devices/ directory, right? I'm afraid not. In the above bus_info value, 0000:00:1d.2 is the PCI bus path of your USB controller, and the last digit after the dash is the USB device path. > All I have to do is to compare the first 4 chars of bus_info against > "usb-", get the chars after "." and append it to > "/sys/bus/usb/devices/" to obatin a sysfs-path, right? > > Is there a more elegant solution or already a function for this? Can > the "." appear more than once before the last one? Probably not before, but definitely after. Root hubs get a USB device path set to '0'. Every other device is numbered according to the hub port number it is connected to. If you have an external hub connected on port 2 of your root hub, and have a webcam connected to port 3 of the external hub, usb_make_path() will return "usb-0000:00:1d.2-2.3". Cheers, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html