From: Hans de Goede Date: Sat, 18 Jun 2011 13:42:22 +0000 (+0200) Subject: get_media_devices: Consider multiple functions on the same pci dev as one dev X-Git-Tag: v4l-utils-0.8.5~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f326841723ca0aeaaa3616c9d663b5b3ab7bf85f;p=platform%2Fupstream%2Fv4l-utils.git get_media_devices: Consider multiple functions on the same pci dev as one dev 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 --- diff --git a/utils/libmedia_dev/get_media_devices.c b/utils/libmedia_dev/get_media_devices.c index cac006b..d120023 100644 --- a/utils/libmedia_dev/get_media_devices.c +++ b/utils/libmedia_dev/get_media_devices.c @@ -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; }