[pulseaudio-commits] r1613 - /branches/lennart/src/modules/module-hal-detect.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Aug 9 17:33:48 PDT 2007


Author: lennart
Date: Fri Aug 10 02:33:47 2007
New Revision: 1613

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1613&root=3Dpulseaudio&vi=
ew=3Drev
Log:
avoid duplicate loading of modules

Modified:
    branches/lennart/src/modules/module-hal-detect.c

Modified: branches/lennart/src/modules/module-hal-detect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-hal-detect.c?rev=3D1613&root=3Dpulseaudio&r1=3D1612&r2=3D1613&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-hal-detect.c (original)
+++ branches/lennart/src/modules/module-hal-detect.c Fri Aug 10 02:33:47 20=
07
@@ -299,7 +299,8 @@
 =

     pa_assert(u);
     pa_assert(u->capability);
-
+    pa_assert(!pa_hashmap_get(u->devices, udi));
+    =

 #ifdef HAVE_ALSA
     if (strcmp(u->capability, CAPABILITY_ALSA) =3D=3D 0)
         m =3D hal_device_load_alsa(u, udi, &sink_name, &source_name);
@@ -374,22 +375,25 @@
 static void device_added_time_cb(pa_mainloop_api *ea, pa_time_event *ev, c=
onst struct timeval *tv, void *userdata) {
     DBusError error;
     struct timerdata *td =3D userdata;
-    int b;
-    struct device *d;
-
-    dbus_error_init(&error);
-    =

-    b =3D libhal_device_exists(td->u->context, td->udi, &error);
-    =

-    if (dbus_error_is_set(&error)) {
-        pa_log_error("Error adding device: %s: %s", error.name, error.mess=
age);
-        dbus_error_free(&error);
-    } else if (b) {
-        if (!(d =3D hal_device_add(td->u, td->udi))) =

-            pa_log_debug("Not loaded device %s", td->udi);
-        else {
-            if (d->sink_name)
-                pa_scache_play_item_by_name(td->u->core, "pulse-hotplug", =
d->sink_name, PA_VOLUME_NORM, 0);
+
+    dbus_error_init(&error);
+
+    if (!pa_hashmap_get(td->u->devices, td->udi)) {
+        int b;
+        struct device *d;
+        =

+        b =3D libhal_device_exists(td->u->context, td->udi, &error);
+        =

+        if (dbus_error_is_set(&error)) {
+            pa_log_error("Error adding device: %s: %s", error.name, error.=
message);
+            dbus_error_free(&error);
+        } else if (b) {
+            if (!(d =3D hal_device_add(td->u, td->udi))) =

+                pa_log_debug("Not loaded device %s", td->udi);
+            else {
+                if (d->sink_name)
+                    pa_scache_play_item_by_name(td->u->core, "pulse-hotplu=
g", d->sink_name, PA_VOLUME_NORM, 0);
+            }
         }
     }
 =

@@ -406,6 +410,9 @@
     int good =3D 0;
 =

     pa_assert_se(u =3D libhal_ctx_get_user_data(context));
+
+    if (pa_hashmap_get(u->devices, udi))
+        return;
     =

     pa_log_debug("HAL Device added: %s", udi);
 =





More information about the pulseaudio-commits mailing list