New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add port id to port name to avoid collisions #5
Conversation
This patch changes the pattern how jack port names are derived from alsa port names when using unique port names. It adds the port id after the ':' to make sure port names are really unique, even when the alsa ports are not (or too long). This fixes problems with the ploytec gm5 which has up to 5 in/out ports and quite long client/port names.
@romsom thanks for your pull request. I have some questions to be able to understand it though: Is this just a readibility fix, or does it prevent actual name collision? |
Thanks for picking up further development for a2jmidid! :) The limitation in length comes from g_max_jack_port_name_size. Later in a2j_port_create that name will be used to register a jack port with jack_port_register, which requires unique port names per client: If they are not unique further jack_port_create will fail and only one port will have been created. That happend to me with the GM5x5x5, so I added the (unique) port id at an earlier position in the name. |
Thanks for the explanation! |
This commit breaks existing sessions by changing port names. The commit will be kept out of https://github.com/LADI/a2jmidid until there is non-breaking way to achieve the same. In theory at least the existing port uniqueness feature should have fixed the issue without this commit. |
What "port uniqueness feature" is that so I can verify with my setup? How about we only include the index for clients with more than one port (inputs and outputs handled separately of course)? |
The "port uniqueness feature" is enabled when make_unique is true. It is from 2008 and you are tweaking it. A hypothetical to-be-made change-set can turn the make_unique and g_disable_port_uniqueness variables from bool to 3-state uint/enum along with extended in backward compatible way command-line and D-Bus interface. This way existing sessions will not break unless the user enables the extended uniqueness (via the new extended configuration interface), which can be done via semi-automatic upgrade process of the used a2jmidid (D-Bus or as command-line string) configuration, including changing of a2jmidid port names in session data (ladish or not). UPDATE: ladishd actually uses the a2jmidid's map_jack_port_to_alsa() D-Bus method : https://github.com/LADI/ladish/blob/stable/daemon/virtualizer.c#L616 and thus should not be affected by this. Session managers that don't use the dynamic mapping functionality will still break tho. |
I can look into the 3-state option, but maybe a clean break will motivate other session managers to use How about making the old behavior a fall-back option instead of the default? So those who have setups that rely on static port names in the old format can still make it work easily, but we don't hinder adoption of the IMO better format by hiding it behind a non-default option. Let me know what you think and what you need to be able to merge the format change. |
This patch changes the pattern how jack port names are derived from alsa
port names when using unique port names. It adds the port id after the
':' to make sure port names are really unique, even when the alsa ports
are not (or too long).
This fixes problems with the ploytec gm5 which has up to 5 in/out ports
and quite long client/port names.