The old code would strip to much, leading to different usb devices on the
same hub getting seen as the same device.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
switch (bus) {
case MEDIA_BUS_USB:
- /* Remove USB sub-devices from the path */
- do {
- p = strrchr(device, '/');
- if (!p)
- continue;
- if (!strpbrk(p, ":."))
- break;
- *p = '\0';
- } while (1);
+ /* Remove USB interface from the path */
+ p = strrchr(device, '/');
+ if (!p)
+ continue;
+ /* In case we have a device where the driver
+ attaches directly to the usb device rather
+ then to an interface */
+ if (!strchr(p, ':'))
+ break;
+ *p = '\0';
break;
case MEDIA_BUS_VIRTUAL:
/* Don't group virtual devices */