From 2c5d89ff19f0d37c24307547fc045dfca6794262 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 30 Jun 2021 11:52:57 +0200 Subject: [PATCH] pw-cli: allow '-' for port/node in create-link Passing a '-' as the port or node for create-link will omit sending the property to create-link so we can check if the link factory handles missing properties too. See #1365 --- src/tools/pw-cli.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tools/pw-cli.c b/src/tools/pw-cli.c index 9c34210d0..18e34c2ed 100644 --- a/src/tools/pw-cli.c +++ b/src/tools/pw-cli.c @@ -1387,10 +1387,14 @@ static bool do_create_link(struct data *data, const char *cmd, char *args, char else props = pw_properties_new(NULL, NULL); - pw_properties_set(props, PW_KEY_LINK_OUTPUT_NODE, a[0]); - pw_properties_set(props, PW_KEY_LINK_OUTPUT_PORT, a[1]); - pw_properties_set(props, PW_KEY_LINK_INPUT_NODE, a[2]); - pw_properties_set(props, PW_KEY_LINK_INPUT_PORT, a[3]); + if (!spa_streq(a[0], "-")) + pw_properties_set(props, PW_KEY_LINK_OUTPUT_NODE, a[0]); + if (!spa_streq(a[1], "-")) + pw_properties_set(props, PW_KEY_LINK_OUTPUT_PORT, a[1]); + if (!spa_streq(a[2], "-")) + pw_properties_set(props, PW_KEY_LINK_INPUT_NODE, a[2]); + if (!spa_streq(a[3], "-")) + pw_properties_set(props, PW_KEY_LINK_INPUT_PORT, a[3]); proxy = (struct pw_proxy*)pw_core_create_object(rd->core, "link-factory",