Skip to content
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

Missing hotplug support #55

Open
ghost opened this issue May 31, 2020 · 4 comments
Open

Missing hotplug support #55

ghost opened this issue May 31, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented May 31, 2020

Hotplug support is mandatory in any modern system. But in ALSA there is no way to be notified by audio device changes.

I'm aware that as a hack, one could listen to udev notifications. But this is not appropriate, because:

  • udev is a different API, which makes this is inelegant and messy
  • it requires a dependency on udev, which may not be a workable solution even if the host OS is Linux
  • there may be devices that do not have anything to do with udev (for example network audio interfaces implemented in userspace)
  • changes in udev may not be reflected in ALSA at the same time (creating the need to avoid race conditions with timeouts or whatever)
  • it's ALSA's responsibility to provide this; I don't know any OS where you have to go to a completely different API for this
@perexg
Copy link
Member

perexg commented Jun 4, 2020

It's not as easy. The hardware based device changes can be really tracked using the /dev/snd/control* device node events, but the other "virtual" devices are mostly based on the configuration files and evaluated when the application asks for them.

We have already alsactl state management daemon, so we can probably send some notifications over DBus at least for the hardware devices.

@ghost
Copy link
Author

ghost commented Jun 4, 2020

A DBus requirement wouldn't be very welcome, to be honest. It's hard to use and uses another socket connection, which needs to be managed.

@perexg
Copy link
Member

perexg commented Jun 4, 2020

Any idea / code / patch is welcome.

@JoseTomasTocino
Copy link

What's a good workaround for this? I've been doing what the OP said for some time: checking for udev events and then waiting 6 seconds for the device to actually be available to ALSA... but it's such a hack.

@perexg perexg added the enhancement New feature or request label Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants