[pulseaudio-commits] r1200 - /trunk/src/modules/module-hal-detect.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Aug 11 10:12:56 PDT 2006


Author: lennart
Date: Fri Aug 11 19:12:54 2006
New Revision: 1200

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1200&root=pulseaudio&view=rev
Log:
use the HAL UDI for naming input/output devices

Modified:
    trunk/src/modules/module-hal-detect.c

Modified: trunk/src/modules/module-hal-detect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-hal-detect.c?rev=1200&root=pulseaudio&r1=1199&r2=1200&view=diff
==============================================================================
--- trunk/src/modules/module-hal-detect.c (original)
+++ trunk/src/modules/module-hal-detect.c Fri Aug 11 19:12:54 2006
@@ -104,6 +104,14 @@
     hal_device_free((struct device*) d);
 }
 
+static const char *strip_udi(const char *udi) {
+    const char *slash;
+    if ((slash = strrchr(udi, '/')))
+        return slash+1;
+
+    return udi;
+}
+
 #ifdef HAVE_ALSA
 typedef enum {
     ALSA_TYPE_SINK,
@@ -166,9 +174,14 @@
     if (dbus_error_is_set(error))
         return NULL;
 
-    module_name = (type == ALSA_TYPE_SINK) ? "module-alsa-sink"
-                                           : "module-alsa-source";
-    snprintf(args, sizeof(args), "device=hw:%u", card);
+    if (type == ALSA_TYPE_SINK) {
+        module_name = "module-alsa-sink";
+        snprintf(args, sizeof(args), "device=hw:%u sink_name=alsa_output.%s", card, strip_udi(udi));
+    } else {
+        module_name = "module-alsa-source";
+        snprintf(args, sizeof(args), "device=hw:%u source_name=alsa_input.%s", card, strip_udi(udi));
+    }
+        
     return pa_module_load(u->core, module_name, args);
 }
 
@@ -216,7 +229,7 @@
     if (!device || dbus_error_is_set(error))
         return NULL;
 
-    snprintf(args, sizeof(args), "device=%s", device);
+    snprintf(args, sizeof(args), "device=%s sink_name=oss_output.%s source_name=oss_input.%s", device, strip_udi(udi), strip_udi(udi));
     libhal_free_string(device);
 
     return pa_module_load(u->core, "module-oss", args);




More information about the pulseaudio-commits mailing list