Ticket #25 (closed defect: needinfo)
USB bus and device numbers are not zero-padded in the file path on some Linux systems
|Reported by:||seanni||Owned by:|
On my system (Slackware 12.1 -- this may also apply to other distros?), the /dev/bus/usb/... file paths contain non zero-padded USB bus and device numbers. For example, if I want to access device 17 on bus 2, then libusb tries to access the path:
However, on my system, the actual path is:
The fix required the "obvious" modification to 2 lines in the file ~src/libusb/os/linux_usbfs.c -- I've included the output from diff below:
135c135 < snprintf(path, PATH_MAX, "%s/%03d/%03d", usbfs_path, dev->bus_number, --- > snprintf(path, PATH_MAX, "%s/%d/%d", usbfs_path, dev->bus_number, 832c832 < snprintf(dirpath, PATH_MAX, "%s/%03d", usbfs_path, busnum); --- > snprintf(dirpath, PATH_MAX, "%s/%d", usbfs_path, busnum);
With those changes, it now seems to work correctly.