adapter: support custom or empty device port name prefixes
This MR adds support for setting a custom or empty port name prefix for device ports. Other ports (like monitor) are not affected.
The custom prefix can be set via the node.device-port-name-prefix
property. Passing an empty string disables the prefix completely.
Sample ALSA monitor rule for a custom prefix:
rename_2i2_input_ports = {
matches = {
{
{ "node.name", "equals", "alsa_input.usb-Focusrite_Scarlett_2i2_USB-00.analog-stereo" },
},
},
apply_properties = {
["node.device-port-name-prefix"] = "hello-world",
["node.channel-names"] = '[front1,front2]',
}
}
rename_2i2_output_ports = {
matches = {
{
{ "node.name", "equals", "alsa_output.usb-Focusrite_Scarlett_2i2_USB-00.analog-stereo" },
},
},
apply_properties = {
["node.device-port-name-prefix"] = "hello-world",
["node.channel-names"] = '[speaker_left,speaker_right]',
}
}
table.insert(alsa_monitor.rules, rename_2i2_input_ports)
table.insert(alsa_monitor.rules, rename_2i2_output_ports)
Screenshot from Helvum
Sample ALSA monitor rule for disabled prefix:
rename_2i2_input_ports = {
matches = {
{
{ "node.name", "equals", "alsa_input.usb-Focusrite_Scarlett_2i2_USB-00.analog-stereo" },
},
},
apply_properties = {
["node.device-port-name-prefix"] = "",
["node.channel-names"] = '[front1,front2]',
}
}
rename_2i2_output_ports = {
matches = {
{
{ "node.name", "equals", "alsa_output.usb-Focusrite_Scarlett_2i2_USB-00.analog-stereo" },
},
},
apply_properties = {
["node.device-port-name-prefix"] = "",
["node.channel-names"] = '[speaker_left,speaker_right]',
}
}
table.insert(alsa_monitor.rules, rename_2i2_input_ports)
table.insert(alsa_monitor.rules, rename_2i2_output_ports)
Screenshot from Helvum
Edited by szszoke