summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-04-03 06:05:47 +0000
committerOlivier Blin <oblin@mandriva.com>2008-04-03 06:05:47 +0000
commit0b5b4bfec7382c2dcc3c74a9116f10faa68b40a1 (patch)
treee446888d0b163730cc00c2c78e83ff0bb87da481
parent9d1712c824f25adab5029e6731479420c80d53c8 (diff)
downloadldetect-0b5b4bfec7382c2dcc3c74a9116f10faa68b40a1.tar
ldetect-0b5b4bfec7382c2dcc3c74a9116f10faa68b40a1.tar.gz
ldetect-0b5b4bfec7382c2dcc3c74a9116f10faa68b40a1.tar.bz2
ldetect-0b5b4bfec7382c2dcc3c74a9116f10faa68b40a1.tar.xz
ldetect-0b5b4bfec7382c2dcc3c74a9116f10faa68b40a1.zip
correctly use usbdev busnum and devnum when finding USB device in sysfs to get its modalias (#38721)
-rw-r--r--pciusb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pciusb.c b/pciusb.c
index 5b76a7f..f88f8c1 100644
--- a/pciusb.c
+++ b/pciusb.c
@@ -112,8 +112,9 @@ static void find_usb_modules_through_aliases(struct pciusb_entry *e) {
DIR *dir;
struct dirent *dent;
- asprintf(&device_prefix, "%x-%x", e->pci_bus, e->pci_device);
- asprintf(&sysfs_path, "/sys/bus/usb/devices/%s", device_prefix);
+ asprintf(&device_prefix, "%d-", e->pci_bus);
+ /* usbdev<busnum>.<devnum> */
+ asprintf(&sysfs_path, "/sys/class/usb_device/usbdev%d.%d/device", e->pci_bus, e->pci_device);
dir = opendir(sysfs_path);
if (!dir)