[vlc-devel] commit: udev ALSA: use model 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:44 2010 +0200| [d54c2b59db8d2825f5bf8d582ec7f63de59ba20d] | committer: Rémi Denis-Courmont 

udev ALSA: use model name if available

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

 modules/services_discovery/udev.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index c65c771..79fff9f 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -469,13 +469,21 @@ static char *alsa_get_mrl (struct udev_device *dev)
 
 static char *alsa_get_name (struct udev_device *dev)
 {
+    const char *model = NULL;
     char *name;
     unsigned card, device;
 
     if (alsa_get_device (dev, &card, &device))
         return NULL;
 
-    if (asprintf (&name, _("Device %u"), device) == -1)
+    dev = udev_device_get_parent (dev);
+    if (dev != NULL)
+        model = udev_device_get_property_value (dev,
+                                                "ID_MODEL_FROM_DATABASE");
+    if (model == NULL)
+        model = _("Device");
+
+    if (asprintf (&name, "%s (%u)", model, device) == -1)
         name = NULL;
     return name;
 }




More information about the vlc-devel mailing list