diff --git a/modules/module-device-activation.c b/modules/module-device-activation.c index cb9e76626ac3344eb6ea197a8f8e82b860a00510..9020d948024797b827dad478e6b3dc0c2bddcdad 100644 --- a/modules/module-device-activation.c +++ b/modules/module-device-activation.c @@ -89,7 +89,11 @@ on_device_added (WpObjectManager *om, WpProxy *proxy, gpointer d) /* ALSA */ if (g_str_has_prefix (device_api, "alsa")) { - set_device_profile (proxy, 1); + const gchar *acp = wp_proxy_get_property (proxy, "device.api.alsa.acp"); + + /* Skip ACP devices as they are automatically enabled when created */ + if (!acp || !atoi (acp)) + set_device_profile (proxy, 1); } /* Bluez5 */ diff --git a/modules/module-monitor.c b/modules/module-monitor.c index 41f5fa35edc8ea6bbf291802d45f8e936aac8e0a..fa6d740c7b9d12e48e9a662c011bd9a9bb8665cc 100644 --- a/modules/module-monitor.c +++ b/modules/module-monitor.c @@ -21,6 +21,7 @@ G_DEFINE_QUARK (wp-module-monitor-children, children); typedef enum { FLAG_LOCAL_NODES = (1 << 0), FLAG_USE_ADAPTER = (1 << 1), + FLAG_USE_ACP = (1 << 2), } MonitorFlags; static const struct { @@ -29,6 +30,7 @@ static const struct { } flag_names[] = { { FLAG_LOCAL_NODES, "local-nodes" }, { FLAG_USE_ADAPTER, "use-adapter" }, + { FLAG_USE_ACP, "use-acp" }, }; enum { @@ -80,12 +82,17 @@ device_data_free (gpointer data, GClosure *closure) } static void -setup_device_props (WpProperties *p) +setup_device_props (WpMonitor * self, WpProperties *p) { const gchar *s, *d, *api; api = wp_properties_get (p, SPA_KEY_DEVICE_API); + /* if alsa and ACP, set acp property to true */ + if (!g_strcmp0 (api, "alsa") && (self->flags & FLAG_USE_ACP)) + wp_properties_setf (p, "device.api.alsa.acp", "%d", + self->flags & FLAG_USE_ACP ? TRUE : FALSE); + /* set the device name if it's not already set */ if (!wp_properties_get (p, SPA_KEY_DEVICE_NAME)) { if ((s = wp_properties_get (p, SPA_KEY_DEVICE_BUS_ID)) == NULL) { @@ -339,14 +346,18 @@ create_device (WpMonitor * self, WpSpaDevice * parent, guint id, GList *children = NULL; GList *link = NULL; GObject *child = NULL; + const char *factory_name = NULL; g_return_val_if_fail (parent, NULL); g_return_val_if_fail (spa_factory, NULL); find_child (G_OBJECT (parent), id, &children, &link, &child); + factory_name = self->flags & FLAG_USE_ACP ? + SPA_NAME_API_ALSA_ACP_DEVICE : spa_factory; + /* Create the device */ - device = wp_spa_device_new_from_spa_factory (self->local_core, spa_factory, + device = wp_spa_device_new_from_spa_factory (self->local_core, factory_name, props); if (!device) return NULL; @@ -414,7 +425,7 @@ maybe_create_device (WpMonitor * self, WpSpaDevice * parent, guint id, /* Create the properties */ props = wp_properties_copy (props); - setup_device_props (props); + setup_device_props (self, props); /* If dbus reservation API exists, let dbus manage the device, otherwise just * create it and never destroy it */ diff --git a/src/config/wireplumber.conf b/src/config/wireplumber.conf index e068aef868c864b64524071899f555092817374f..80b645b7610607dc1dedf9d43a7c2edf212da2fe 100644 --- a/src/config/wireplumber.conf +++ b/src/config/wireplumber.conf @@ -40,7 +40,7 @@ load-module C libwireplumber-module-si-bluez5-endpoint # load-module C libwireplumber-module-monitor { - "alsa": <{"factory": <"api.alsa.enum.udev">, "flags": <["use-adapter"]>}>, + "alsa": <{"factory": <"api.alsa.enum.udev">, "flags": <["use-acp", "use-adapter"]>}>, "bluez5": <{"factory": <"api.bluez5.enum.dbus">, "flags": <["local-nodes", "use-adapter"]>}>, "v4l2": <{"factory": <"api.v4l2.enum.udev">}> }