mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
avoid duplicate loading of modules
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1613 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
1e5ca51016
commit
10b135a4bf
1 changed files with 22 additions and 15 deletions
|
|
@ -299,7 +299,8 @@ static struct device* hal_device_add(struct userdata *u, const char *udi) {
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
pa_assert(u->capability);
|
pa_assert(u->capability);
|
||||||
|
pa_assert(!pa_hashmap_get(u->devices, udi));
|
||||||
|
|
||||||
#ifdef HAVE_ALSA
|
#ifdef HAVE_ALSA
|
||||||
if (strcmp(u->capability, CAPABILITY_ALSA) == 0)
|
if (strcmp(u->capability, CAPABILITY_ALSA) == 0)
|
||||||
m = hal_device_load_alsa(u, udi, &sink_name, &source_name);
|
m = hal_device_load_alsa(u, udi, &sink_name, &source_name);
|
||||||
|
|
@ -374,22 +375,25 @@ static dbus_bool_t device_has_capability(LibHalContext *context, const char *udi
|
||||||
static void device_added_time_cb(pa_mainloop_api *ea, pa_time_event *ev, const struct timeval *tv, void *userdata) {
|
static void device_added_time_cb(pa_mainloop_api *ea, pa_time_event *ev, const struct timeval *tv, void *userdata) {
|
||||||
DBusError error;
|
DBusError error;
|
||||||
struct timerdata *td = userdata;
|
struct timerdata *td = userdata;
|
||||||
int b;
|
|
||||||
struct device *d;
|
|
||||||
|
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
||||||
b = libhal_device_exists(td->u->context, td->udi, &error);
|
if (!pa_hashmap_get(td->u->devices, td->udi)) {
|
||||||
|
int b;
|
||||||
if (dbus_error_is_set(&error)) {
|
struct device *d;
|
||||||
pa_log_error("Error adding device: %s: %s", error.name, error.message);
|
|
||||||
dbus_error_free(&error);
|
b = libhal_device_exists(td->u->context, td->udi, &error);
|
||||||
} else if (b) {
|
|
||||||
if (!(d = hal_device_add(td->u, td->udi)))
|
if (dbus_error_is_set(&error)) {
|
||||||
pa_log_debug("Not loaded device %s", td->udi);
|
pa_log_error("Error adding device: %s: %s", error.name, error.message);
|
||||||
else {
|
dbus_error_free(&error);
|
||||||
if (d->sink_name)
|
} else if (b) {
|
||||||
pa_scache_play_item_by_name(td->u->core, "pulse-hotplug", d->sink_name, PA_VOLUME_NORM, 0);
|
if (!(d = 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -406,6 +410,9 @@ static void device_added_cb(LibHalContext *context, const char *udi) {
|
||||||
int good = 0;
|
int good = 0;
|
||||||
|
|
||||||
pa_assert_se(u = libhal_ctx_get_user_data(context));
|
pa_assert_se(u = libhal_ctx_get_user_data(context));
|
||||||
|
|
||||||
|
if (pa_hashmap_get(u->devices, udi))
|
||||||
|
return;
|
||||||
|
|
||||||
pa_log_debug("HAL Device added: %s", udi);
|
pa_log_debug("HAL Device added: %s", udi);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue