diff --git a/0012-device-activation-show-device-name-in-logs.patch b/0012-device-activation-show-device-name-in-logs.patch new file mode 100644 index 0000000..d08804b --- /dev/null +++ b/0012-device-activation-show-device-name-in-logs.patch @@ -0,0 +1,135 @@ +From 8844cfb0743f3ce1b447120f4c012cfdae9c2aec Mon Sep 17 00:00:00 2001 +From: Julian Bouzas +Date: Wed, 12 Jan 2022 14:07:59 -0500 +Subject: [PATCH 12/14] device-activation: show device name in logs + +--- + modules/module-device-activation.c | 29 +++++++++++++++++------------ + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/modules/module-device-activation.c b/modules/module-device-activation.c +index a28f2ea..98978a2 100644 +--- a/modules/module-device-activation.c ++++ b/modules/module-device-activation.c +@@ -31,6 +31,7 @@ G_DEFINE_TYPE (WpDeviceActivation, wp_device_activation, WP_TYPE_PLUGIN) + static void + set_device_profile (WpDeviceActivation *self, WpPipewireObject *device, gint index) + { ++ const gchar *dn = wp_pipewire_object_get_property (device, PW_KEY_DEVICE_NAME); + gpointer active_ptr = NULL; + + g_return_if_fail (device); +@@ -38,7 +39,7 @@ set_device_profile (WpDeviceActivation *self, WpPipewireObject *device, gint ind + /* Make sure the profile we want to set is not active */ + active_ptr = g_object_get_qdata (G_OBJECT (device), active_profile_quark ()); + if (active_ptr && GPOINTER_TO_INT (active_ptr) - 1 == index) { +- wp_info_object (self, "profile %d is already active", index); ++ wp_info_object (self, "profile %d is already active in %s", index, dn); + return; + } + +@@ -49,8 +50,7 @@ set_device_profile (WpDeviceActivation *self, WpPipewireObject *device, gint ind + "index", "i", index, + NULL)); + +- wp_info_object (self, "profile %d set on device " WP_OBJECT_FORMAT, index, +- WP_OBJECT_ARGS (device)); ++ wp_info_object (self, "profile %d set on device %s", index, dn); + } + + static gint +@@ -184,6 +184,7 @@ static gint + handle_active_profile (WpDeviceActivation *self, WpPipewireObject *proxy, + WpIterator *profiles, gboolean *changed, gboolean *off) + { ++ const gchar *dn = wp_pipewire_object_get_property (proxy, PW_KEY_DEVICE_NAME); + gpointer active_ptr = NULL; + gint new_active = -1; + gint local_changed = FALSE; +@@ -191,7 +192,7 @@ handle_active_profile (WpDeviceActivation *self, WpPipewireObject *proxy, + /* Find the new active profile */ + new_active = find_active_profile (proxy, off); + if (new_active < 0) { +- wp_info_object (self, "cannot find active profile"); ++ wp_info_object (self, "cannot find active profile in %s", dn); + return new_active; + } + +@@ -199,7 +200,7 @@ handle_active_profile (WpDeviceActivation *self, WpPipewireObject *proxy, + active_ptr = g_object_get_qdata (G_OBJECT (proxy), active_profile_quark ()); + local_changed = !active_ptr || GPOINTER_TO_INT (active_ptr) - 1 != new_active; + if (local_changed) { +- wp_info_object (self, "active profile changed to: %d", new_active); ++ wp_info_object (self, "active profile changed to %d in %s", new_active, dn); + g_object_set_qdata (G_OBJECT (proxy), active_profile_quark (), + GINT_TO_POINTER (new_active + 1)); + } +@@ -214,6 +215,7 @@ static gint + handle_best_profile (WpDeviceActivation *self, WpPipewireObject *proxy, + WpIterator *profiles, gboolean *changed) + { ++ const gchar *dn = wp_pipewire_object_get_property (proxy, PW_KEY_DEVICE_NAME); + gpointer best_ptr = NULL; + gint new_best = -1; + gboolean local_changed = FALSE; +@@ -221,7 +223,7 @@ handle_best_profile (WpDeviceActivation *self, WpPipewireObject *proxy, + /* Get the new best profile index */ + new_best = find_best_profile (profiles); + if (new_best < 0) { +- wp_info_object (self, "cannot find best profile"); ++ wp_info_object (self, "cannot find best profile in %s", dn); + return new_best; + } + +@@ -229,7 +231,7 @@ handle_best_profile (WpDeviceActivation *self, WpPipewireObject *proxy, + best_ptr = g_object_get_qdata (G_OBJECT (proxy), best_profile_quark ()); + local_changed = !best_ptr || GPOINTER_TO_INT (best_ptr) - 1 != new_best; + if (local_changed) { +- wp_info_object (self, "found new best profile: %d", new_best); ++ wp_info_object (self, "best profile changed to %d in %s", new_best, dn); + g_object_set_qdata (G_OBJECT (proxy), best_profile_quark (), + GINT_TO_POINTER (new_best + 1)); + } +@@ -244,6 +246,7 @@ static void + handle_enum_profiles (WpDeviceActivation *self, WpPipewireObject *proxy, + WpIterator *profiles) + { ++ const gchar *dn = wp_pipewire_object_get_property (proxy, PW_KEY_DEVICE_NAME); + gint active_idx = FALSE, best_idx = FALSE; + gboolean active_changed = FALSE, best_changed = FALSE, active_off = FALSE; + +@@ -256,14 +259,16 @@ handle_enum_profiles (WpDeviceActivation *self, WpPipewireObject *proxy, + default_idx = find_default_profile (self, proxy, profiles, &default_avail); + if (default_idx >= 0) { + if (default_avail == SPA_PARAM_AVAILABILITY_no) { +- wp_info_object (self, "default profile %d unavailable", default_idx); ++ wp_info_object (self, "default profile %d unavailable for %s", ++ default_idx, dn); + } else { +- wp_info_object (self, "found default profile: %d", default_idx); ++ wp_info_object (self, "found default profile %d for %s", default_idx, ++ dn); + set_device_profile (self, proxy, default_idx); + return; + } + } else { +- wp_info_object (self, "cannot find default profile"); ++ wp_info_object (self, "cannot find default profile for %s", dn); + } + } + +@@ -272,9 +277,9 @@ handle_enum_profiles (WpDeviceActivation *self, WpPipewireObject *proxy, + if (best_idx >= 0 && best_changed) + set_device_profile (self, proxy, best_idx); + else if (best_idx >= 0) +- wp_info_object (self, "best profile already set: %d", best_idx); ++ wp_info_object (self, "best profile %d already set in %s", best_idx, dn); + else +- wp_info_object (self, "best profile not found"); ++ wp_info_object (self, "best profile not found in %s", dn); + } + + static void +-- +2.34.1 + diff --git a/0013-scripts-fallback-to-empty-config-table-if-args-were-.patch b/0013-scripts-fallback-to-empty-config-table-if-args-were-.patch new file mode 100644 index 0000000..c82b6ae --- /dev/null +++ b/0013-scripts-fallback-to-empty-config-table-if-args-were-.patch @@ -0,0 +1,139 @@ +From 18bc3d3596a1fac8ab21361160ac4e9c6ec37c89 Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis +Date: Thu, 13 Jan 2022 11:08:34 +0200 +Subject: [PATCH 13/14] scripts: fallback to empty config table if args were + not passed from the config files + +Fixes #158 +--- + src/scripts/access/access-default.lua | 2 +- + src/scripts/create-item.lua | 2 +- + src/scripts/default-routes.lua | 2 +- + src/scripts/monitors/alsa-midi.lua | 2 +- + src/scripts/monitors/alsa.lua | 2 +- + src/scripts/policy-endpoint-client-links.lua | 2 +- + src/scripts/policy-endpoint-client.lua | 2 +- + src/scripts/policy-endpoint-device.lua | 2 +- + src/scripts/policy-node.lua | 2 +- + 9 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/src/scripts/access/access-default.lua b/src/scripts/access/access-default.lua +index 3c27e90..0fac87b 100644 +--- a/src/scripts/access/access-default.lua ++++ b/src/scripts/access/access-default.lua +@@ -5,7 +5,7 @@ + -- + -- SPDX-License-Identifier: MIT + +-local config = ... ++local config = ... or {} + + -- preprocess rules and create Interest objects + for _, r in ipairs(config.rules or {}) do +diff --git a/src/scripts/create-item.lua b/src/scripts/create-item.lua +index ad4a6f6..f2c7562 100644 +--- a/src/scripts/create-item.lua ++++ b/src/scripts/create-item.lua +@@ -6,7 +6,7 @@ + -- SPDX-License-Identifier: MIT + + -- Receive script arguments from config.lua +-local config = ... ++local config = ... or {} + + items = {} + +diff --git a/src/scripts/default-routes.lua b/src/scripts/default-routes.lua +index 953cba3..075f5d6 100644 +--- a/src/scripts/default-routes.lua ++++ b/src/scripts/default-routes.lua +@@ -8,7 +8,7 @@ + -- + -- SPDX-License-Identifier: MIT + +-local config = ... ++local config = ... or {} + + -- whether to store state on the file system + use_persistent_storage = config["use-persistent-storage"] or false +diff --git a/src/scripts/monitors/alsa-midi.lua b/src/scripts/monitors/alsa-midi.lua +index bf4fde4..0efee34 100644 +--- a/src/scripts/monitors/alsa-midi.lua ++++ b/src/scripts/monitors/alsa-midi.lua +@@ -6,7 +6,7 @@ + -- SPDX-License-Identifier: MIT + + -- Receive script arguments from config.lua +-local config = ... ++local config = ... or {} + + -- ensure config.properties is not nil + config.properties = config.properties or {} +diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua +index c917a5c..3e8eda8 100644 +--- a/src/scripts/monitors/alsa.lua ++++ b/src/scripts/monitors/alsa.lua +@@ -6,7 +6,7 @@ + -- SPDX-License-Identifier: MIT + + -- Receive script arguments from config.lua +-local config = ... ++local config = ... or {} + + -- ensure config.properties is not nil + config.properties = config.properties or {} +diff --git a/src/scripts/policy-endpoint-client-links.lua b/src/scripts/policy-endpoint-client-links.lua +index 1a93294..eaa1c08 100644 +--- a/src/scripts/policy-endpoint-client-links.lua ++++ b/src/scripts/policy-endpoint-client-links.lua +@@ -5,7 +5,7 @@ + -- + -- SPDX-License-Identifier: MIT + +-local config = ... ++local config = ... or {} + config.roles = config.roles or {} + config["duck.level"] = config["duck.level"] or 0.3 + +diff --git a/src/scripts/policy-endpoint-client.lua b/src/scripts/policy-endpoint-client.lua +index e898e35..487d4b4 100644 +--- a/src/scripts/policy-endpoint-client.lua ++++ b/src/scripts/policy-endpoint-client.lua +@@ -6,7 +6,7 @@ + -- SPDX-License-Identifier: MIT + + -- Receive script arguments from config.lua +-local config = ... ++local config = ... or {} + config.roles = config.roles or {} + + local self = {} +diff --git a/src/scripts/policy-endpoint-device.lua b/src/scripts/policy-endpoint-device.lua +index b726cb3..71f7772 100644 +--- a/src/scripts/policy-endpoint-device.lua ++++ b/src/scripts/policy-endpoint-device.lua +@@ -6,7 +6,7 @@ + -- SPDX-License-Identifier: MIT + + -- Receive script arguments from config.lua +-local config = ... ++local config = ... or {} + + -- ensure config.move and config.follow are not nil + config.move = config.move or false +diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua +index 9df5007..51a5549 100644 +--- a/src/scripts/policy-node.lua ++++ b/src/scripts/policy-node.lua +@@ -6,7 +6,7 @@ + -- SPDX-License-Identifier: MIT + + -- Receive script arguments from config.lua +-local config = ... ++local config = ... or {} + + -- ensure config.move and config.follow are not nil + config.move = config.move or false +-- +2.34.1 + diff --git a/wireplumber.changes b/wireplumber.changes index 81d02d3..ee47498 100644 --- a/wireplumber.changes +++ b/wireplumber.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jan 25 10:33:09 UTC 2022 - Antonio Larrosa + +- Add two patches from upstream: + * 0012-device-activation-show-device-name-in-logs.patch + * 0013-scripts-fallback-to-empty-config-table-if-args-were-.patch + ------------------------------------------------------------------- Tue Jan 25 08:34:28 UTC 2022 - Antonio Larrosa diff --git a/wireplumber.spec b/wireplumber.spec index bd33ac1..9d73d5b 100644 --- a/wireplumber.spec +++ b/wireplumber.spec @@ -41,8 +41,8 @@ Patch8: 0008-scripts-monitors-log-warning-if-spa-devices-were-not.patch Patch9: 0009-default-nodes-check-if-default-node-has-available-ro.patch Patch10: 0010-added-support-for-disabling-nodes-and-devices-throug.patch Patch11: 0011-default-nodes-add-more-logs.patch -#0012-device-activation-show-device-name-in-logs.patch -#0013-scripts-fallback-to-empty-config-table-if-args-were-.patch +Patch12: 0012-device-activation-show-device-name-in-logs.patch +Patch13: 0013-scripts-fallback-to-empty-config-table-if-args-were-.patch Patch100: reduce-meson-required-version.patch # docs