[alsa-devel] snd_device_register / snd_device_disconnect
Hi All,
I would have a question regarding the behavior of snd_device_register.
Currently, the register operation will only be carried out if the state is SNDRV_DEV_BUILD. This effectively prevents device which have been disconnected via snd_device_disconnect (and thus having the state SNDRV_DEV_DISCONNECTED) to be registered again.
Is this a wanted behavior? If so, I can't seem to find a reason for this as per my testing and code reading registering a device in DISCONNECTED sate works just fine.
Thanks,
At Mon, 14 May 2012 08:23:47 +1000, Barratis wrote:
Hi All,
I would have a question regarding the behavior of snd_device_register.
Currently, the register operation will only be carried out if the state is SNDRV_DEV_BUILD. This effectively prevents device which have been disconnected via snd_device_disconnect (and thus having the state SNDRV_DEV_DISCONNECTED) to be registered again.
Is this a wanted behavior? If so, I can't seem to find a reason for this as per my testing and code reading registering a device in DISCONNECTED sate works just fine.
The disconnected device is disconnected. Why it must be registered again? In other words, the disconnected device should be freed eventually later. The disconnected state is an intermediate state, thus it's never a state ready for any use.
Takashi
Hi Takashi,
I have a virtual card with pcm which can temporarily go offline, I wanted a way to prevent the user seeing them until they come back online without having to destroy/recreate the pcm everytime. Since there was a disconnect call separate from the free, I thought this was meant to be possible.
I guess I'll simply destroy/recreate my pcms then.
Thanks for your answer.
On Tue, May 15, 2012 at 1:03 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 14 May 2012 08:23:47 +1000, Barratis wrote:
Hi All,
I would have a question regarding the behavior of snd_device_register.
Currently, the register operation will only be carried out if the state is SNDRV_DEV_BUILD. This effectively prevents device which have been disconnected via snd_device_disconnect (and thus having the state SNDRV_DEV_DISCONNECTED) to be registered again.
Is this a wanted behavior? If so, I can't seem to find a reason for this as per my testing and code reading registering a device in DISCONNECTED sate works just fine.
The disconnected device is disconnected. Why it must be registered again? In other words, the disconnected device should be freed eventually later. The disconnected state is an intermediate state, thus it's never a state ready for any use.
Takashi
At Tue, 15 May 2012 08:07:41 +1000, Barratis wrote:
Hi Takashi,
I have a virtual card with pcm which can temporarily go offline, I wanted a way to prevent the user seeing them until they come back online without having to destroy/recreate the pcm everytime. Since there was a disconnect call separate from the free, I thought this was meant to be possible.
I guess I'll simply destroy/recreate my pcms then.
Unregistering the device is a heavy task, if you think how the device registration is propagated (sysfs, udev, alsa-lib, apps...) So, freeing in the driver is just a small piece of the task in the global view.
In many cases, the driver simply refuses the open (e.g. -EAGAIN) when such a temporary restriction is applied. But if you really want to hide them, freeing and recreating PCM is the way to go, IMO.
Takashi
Thanks for your answer.
On Tue, May 15, 2012 at 1:03 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 14 May 2012 08:23:47 +1000, Barratis wrote:
Hi All,
I would have a question regarding the behavior of snd_device_register.
Currently, the register operation will only be carried out if the state is SNDRV_DEV_BUILD. This effectively prevents device which have been disconnected via snd_device_disconnect (and thus having the state SNDRV_DEV_DISCONNECTED) to be registered again.
Is this a wanted behavior? If so, I can't seem to find a reason for this as per my testing and code reading registering a device in DISCONNECTED sate works just fine.
The disconnected device is disconnected. Why it must be registered again? In other words, the disconnected device should be freed eventually later. The disconnected state is an intermediate state, thus it's never a state ready for any use.
Takashi
-- Barratis Any society that would give up a little liberty to gain a little security will deserve neither and lose both. (Benjamin Franklin)
participants (2)
-
Barratis
-
Takashi Iwai