[vlc-devel] commit: udev ALSA: use vendor name if available ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 13 21:54:21 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 13 22:53:59 2010 +0200| [369166ac27a2b9164c26ad75d9f7208afb478bd5] | committer: Rémi Denis-Courmont 

udev ALSA: use vendor name if available

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=369166ac27a2b9164c26ad75d9f7208afb478bd5
---

 modules/services_discovery/udev.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index 79fff9f..2e3cb83 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -490,15 +490,17 @@ static char *alsa_get_name (struct udev_device *dev)
 
 static char *alsa_get_cat (struct udev_device *dev)
 {
-    char *name;
-    unsigned card, device;
+    const char *vnd;
 
-    if (alsa_get_device (dev, &card, &device))
+    dev = udev_device_get_parent (dev);
+    if (dev == NULL)
         return NULL;
 
-    if (asprintf (&name, _("Card %u"), card) == -1)
-        name = NULL;
-    return name;
+    vnd = udev_device_get_property_value (dev, "ID_VENDOR_FROM_DATABASE");
+    if (vnd == NULL)
+        /* FIXME: USB may take time to settle... the parent device */
+        vnd = udev_device_get_property_value (dev, "ID_BUS");
+    return vnd ? strdup (vnd) : NULL;
 }
 
 int OpenALSA (vlc_object_t *obj)




More information about the vlc-devel mailing list