get_media_devices: Consider multiple functions on the same pci dev as one dev
authorHans de Goede <hdegoede@redhat.com>
Sat, 18 Jun 2011 13:42:22 +0000 (15:42 +0200)
committerHans de Goede <hdegoede@redhat.com>
Sat, 18 Jun 2011 13:42:22 +0000 (15:42 +0200)
This fixes get_media_devices not seeing the video and the alsa input on
my bt878 card as associated devices.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
utils/libmedia_dev/get_media_devices.c

index cac006b..d120023 100644 (file)
@@ -159,6 +159,13 @@ static int get_class(char *class,
                        device += 13;
 
                        switch (bus) {
+                       case MEDIA_BUS_PCI:
+                               /* Remove the device function nr */
+                               p = strrchr(device, '.');
+                               if (!p)
+                                       continue;
+                               *p = '\0';
+                               break;                          
                        case MEDIA_BUS_USB:
                                /* Remove USB interface from the path */
                                p = strrchr(device, '/');
@@ -176,7 +183,7 @@ static int get_class(char *class,
                                sprintf(virt_dev, "virtual%d", virtual++);
                                device = virt_dev;
                                break;
-                        default:
+                        case MEDIA_BUS_UNKNOWN:
                                 break;
                        }