Skip to contentSkip to conversation

ALSA utilities repository branch master updated. v1.0.26-26-ge05b903

alsa-cvslog Takashi Iwai 4 participants 14 messages Apr 9, 2013 – Apr 10, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

       via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
      from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

Takashi

#2 lore raw
Quoted 22 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 20 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

       via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
      from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

Quoted 8 lines
Quoted 1 line

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon. Eventually, we can save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs
- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)
- run multiple daemon instances per hotplug card; the question is how to detect the static card in the system (perhaps checking the PCI config?) to avoid the daemon startup for those static cards

Jaroslav

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
#3 lore raw

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

       via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
      from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Quoted 3 lines

- run multiple daemon instances per hotplug card; the question is how to detect the static card in the system (perhaps checking the PCI config?) to avoid the daemon startup for those static cards

Yeah, when thinking a PCI hotplug, it's not easy.

Takashi

#4 lore raw
Quoted 42 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

       via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
      from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 7 lines
Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Yes, it is. But it looks like the best (or at least easiest to manage) idea to solve the hotplug issues for the moment and we can optimize things later.

Quoted 4 lines
Quoted 4 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader

This variant seems most easy to implement using ConditionKernelCommandLine or ConditionPathExists (this second option may be probably better - a configuration file in /etc/alsa or so to change the state management behaviour looks good).

Quoted 17 lines
Quoted 1 line

- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Quoted 7 lines

Whether this is a better option? I dunno, honestly, too...

Quoted 3 lines

- run multiple daemon instances per hotplug card; the question is how to detect the static card in the system (perhaps checking the PCI config?) to avoid the daemon startup for those static cards

Yeah, when thinking a PCI hotplug, it's not easy.

I will add the ConditionPathExists=/etc/alsa/state-static.conf and ConditionPathExists=/etc/alsa/state-daemon.conf conditions and put back the old static config files, if no better idea is offered.

Jaroslav

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
#5 lore raw
In reply to Takashi Iwai
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

        via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
       from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#6 lore raw

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 77 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

        via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
       from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Quoted 7 lines

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Quoted 8 lines

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

Takashi

#7 lore raw
Quoted 2 lines · Takashi Iwai

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

(Some?) drivers save changed control values to the registry.

Regards,
Clemens

#8 lore raw
In reply to Takashi Iwai
Quoted 87 lines · Takashi Iwai

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 77 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

         via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
        from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Quoted 7 lines

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

Quoted 5 lines

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Is it possible to add a uevent that synchronously fires just before the device file is removed? Then the mixer state could be read. (The mixer state must be completely stored in kernel, of course, since you can't read it from unplugged hardware.)

Quoted 2 lines

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Btw, one could also fire udev events on mixer changes (possibly delayed by a few seconds to avoid a uevent storm). Then at least the daemon would not be running constantly. As a minor benefit, this would also protect against settings getting lost on sudden power outages.

Quoted 11 lines
Quoted 8 lines

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

Windows and Mac OS? I think they record it, but not sure. Slightly related, I believe they're both system level (as is alsactl), where as PulseAudio saves volume per user.

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#9 lore raw

At Wed, 10 Apr 2013 08:32:20 +0200,

Quoted 89 lines · David Henningsson
Quoted 87 lines · Takashi Iwai

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 84 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

         via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
        from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

Quoted 8 lines
Quoted 5 lines

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Is it possible to add a uevent that synchronously fires just before the device file is removed?

Well, it's difficult to know beforehand when the device is removed :)

Quoted 11 lines

Then the mixer state could be read. (The mixer
state must be completely stored in kernel, of course, since you can't read it from unplugged hardware.)

Quoted 2 lines

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Btw, one could also fire udev events on mixer changes (possibly delayed by a few seconds to avoid a uevent storm). Then at least the daemon would not be running constantly. As a minor benefit, this would also protect against settings getting lost on sudden power outages.

There is no udev event per mixer value change.
If it were, it's a too overload.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

Quoted 6 lines
Quoted 2 lines

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

Windows and Mac OS? I think they record it, but not sure. Slightly related, I believe they're both system level (as is alsactl), where as PulseAudio saves volume per user.

Does PA record the volume of USB device properly, too?

Takashi

#10 lore raw
Quoted 97 lines · Takashi Iwai

At Wed, 10 Apr 2013 08:32:20 +0200,

Quoted 95 lines · David Henningsson
Quoted 92 lines · Takashi Iwai

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 77 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

          via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
         from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Quoted 7 lines

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Quoted 4 lines
Quoted 2 lines

Is it possible to add a uevent that synchronously fires just before the device file is removed?

Well, it's difficult to know beforehand when the device is removed :)

1. Kernel detects device has been plugged in.
2. Kernel sets up mixer and reads all mixer values from the device.
3. Kernel notifies userspace about the new device.
4. Userspace might set volume on the device, too.

(later)
5. Kernel detects device has been removed.
6. Kernel fires a udev event and waits for it to finish.
7. Userspace reads mixer state and saves it.
8. Kernel removes the device file.

Quoted 7 lines
Quoted 7 lines

Then the mixer state could be read. (The mixer
state must be completely stored in kernel, of course, since you can't read it from unplugged hardware.)

Quoted 2 lines

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Quoted 7 lines
Quoted 4 lines

Btw, one could also fire udev events on mixer changes (possibly delayed by a few seconds to avoid a uevent storm). Then at least the daemon would not be running constantly. As a minor benefit, this would also protect against settings getting lost on sudden power outages.

There is no udev event per mixer value change.
If it were, it's a too overload.

I meant we could introduce one. We would also delay it, so in case of many changes in a row, we would only fire one uevent for all changes.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

Windows and Mac OS? I think they record it, but not sure. Slightly related, I believe they're both system level (as is alsactl), where as PulseAudio saves volume per user.

Does PA record the volume of USB device properly, too?

Yes. If the volume is changed from PA, that volume is also written to disk (after five seconds). So it writes on change, not on unplug.

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#11 lore raw

At Wed, 10 Apr 2013 09:11:50 +0200,

Quoted 109 lines · David Henningsson
Quoted 97 lines · Takashi Iwai

At Wed, 10 Apr 2013 08:32:20 +0200,

Quoted 95 lines · David Henningsson
Quoted 92 lines · Takashi Iwai

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 77 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

          via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
         from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Quoted 7 lines

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Quoted 4 lines
Quoted 2 lines

Is it possible to add a uevent that synchronously fires just before the device file is removed?

Well, it's difficult to know beforehand when the device is removed :)

1. Kernel detects device has been plugged in.
2. Kernel sets up mixer and reads all mixer values from the device.
3. Kernel notifies userspace about the new device.
4. Userspace might set volume on the device, too.

Quoted 5 lines

(later)
5. Kernel detects device has been removed.
6. Kernel fires a udev event and waits for it to finish.
7. Userspace reads mixer state and saves it.
8. Kernel removes the device file.

It doesn't work reliably. Not only that it would need a large change in kernel, you don't know when the kernel may remove device files. Waiting until a user-space read finishes? It might not happen forever. And the driver still keeps the card slot for that period.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Then the mixer state could be read. (The mixer
state must be completely stored in kernel, of course, since you can't read it from unplugged hardware.)

Quoted 2 lines

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Btw, one could also fire udev events on mixer changes (possibly delayed by a few seconds to avoid a uevent storm). Then at least the daemon would not be running constantly. As a minor benefit, this would also protect against settings getting lost on sudden power outages.

Quoted 5 lines
Quoted 2 lines

There is no udev event per mixer value change.
If it were, it's a too overload.

I meant we could introduce one. We would also delay it, so in case of many changes in a row, we would only fire one uevent for all changes.

But udev event is costly. I don't think it's so appropriate.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Windows and Mac OS? I think they record it, but not sure. Slightly related, I believe they're both system level (as is alsactl), where as PulseAudio saves volume per user.

Does PA record the volume of USB device properly, too?

Yes. If the volume is changed from PA, that volume is also written to disk (after five seconds). So it writes on change, not on unplug.

OK, good to know.

thanks,

Takashi

#12 lore raw

Just to follow-up. I put back the static systemd configuration files to the alsa-utils package and made them conditional by checking the existence of the daemon mode swich file (by default, it is the file /etc/alsa/state-daemon.conf). The udev restore rule also handles this condition.

The nice thing is that the other unit configurations depending on the alsa-restore.service (After= rules) do not need to be updated.

Jaroslav

Quoted 172 lines · Takashi Iwai

At Wed, 10 Apr 2013 09:11:50 +0200,

Quoted 109 lines · David Henningsson
Quoted 97 lines · Takashi Iwai

At Wed, 10 Apr 2013 08:32:20 +0200,

Quoted 95 lines · David Henningsson
Quoted 92 lines · Takashi Iwai

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 77 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

          via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
         from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Quoted 7 lines

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Quoted 4 lines
Quoted 2 lines

Is it possible to add a uevent that synchronously fires just before the device file is removed?

Well, it's difficult to know beforehand when the device is removed :)

1. Kernel detects device has been plugged in.
2. Kernel sets up mixer and reads all mixer values from the device.
3. Kernel notifies userspace about the new device.
4. Userspace might set volume on the device, too.

Quoted 5 lines

(later)
5. Kernel detects device has been removed.
6. Kernel fires a udev event and waits for it to finish.
7. Userspace reads mixer state and saves it.
8. Kernel removes the device file.

It doesn't work reliably. Not only that it would need a large change in kernel, you don't know when the kernel may remove device files. Waiting until a user-space read finishes? It might not happen forever. And the driver still keeps the card slot for that period.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Then the mixer state could be read. (The mixer
state must be completely stored in kernel, of course, since you can't read it from unplugged hardware.)

Quoted 2 lines

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Btw, one could also fire udev events on mixer changes (possibly delayed by a few seconds to avoid a uevent storm). Then at least the daemon would not be running constantly. As a minor benefit, this would also protect against settings getting lost on sudden power outages.

Quoted 5 lines
Quoted 2 lines

There is no udev event per mixer value change.
If it were, it's a too overload.

I meant we could introduce one. We would also delay it, so in case of many changes in a row, we would only fire one uevent for all changes.

But udev event is costly. I don't think it's so appropriate.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Windows and Mac OS? I think they record it, but not sure. Slightly related, I believe they're both system level (as is alsactl), where as PulseAudio saves volume per user.

Does PA record the volume of USB device properly, too?

Yes. If the volume is changed from PA, that volume is also written to disk (after five seconds). So it writes on change, not on unplug.

OK, good to know.

thanks,

Takashi

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
#13 lore raw

At Wed, 10 Apr 2013 11:20:34 +0200,

Quoted 9 lines · Jaroslav Kysela

Just to follow-up. I put back the static systemd configuration files to the alsa-utils package and made them conditional by checking the existence of the daemon mode swich file (by default, it is the file /etc/alsa/state-daemon.conf). The udev restore rule also handles this condition.

The nice thing is that the other unit configurations depending on the alsa-restore.service (After= rules) do not need to be updated.

Sounds good. Thanks for caring this!

Takashi

Quoted 183 lines

Jaroslav

Quoted 172 lines · Takashi Iwai

At Wed, 10 Apr 2013 09:11:50 +0200,

Quoted 109 lines · David Henningsson
Quoted 97 lines · Takashi Iwai

At Wed, 10 Apr 2013 08:32:20 +0200,

Quoted 95 lines · David Henningsson
Quoted 92 lines · Takashi Iwai

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 77 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

          via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
         from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Quoted 7 lines

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Quoted 4 lines
Quoted 2 lines

Is it possible to add a uevent that synchronously fires just before the device file is removed?

Well, it's difficult to know beforehand when the device is removed :)

1. Kernel detects device has been plugged in.
2. Kernel sets up mixer and reads all mixer values from the device.
3. Kernel notifies userspace about the new device.
4. Userspace might set volume on the device, too.

Quoted 5 lines

(later)
5. Kernel detects device has been removed.
6. Kernel fires a udev event and waits for it to finish.
7. Userspace reads mixer state and saves it.
8. Kernel removes the device file.

It doesn't work reliably. Not only that it would need a large change in kernel, you don't know when the kernel may remove device files. Waiting until a user-space read finishes? It might not happen forever. And the driver still keeps the card slot for that period.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Then the mixer state could be read. (The mixer
state must be completely stored in kernel, of course, since you can't read it from unplugged hardware.)

Quoted 2 lines

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Btw, one could also fire udev events on mixer changes (possibly delayed by a few seconds to avoid a uevent storm). Then at least the daemon would not be running constantly. As a minor benefit, this would also protect against settings getting lost on sudden power outages.

Quoted 5 lines
Quoted 2 lines

There is no udev event per mixer value change.
If it were, it's a too overload.

I meant we could introduce one. We would also delay it, so in case of many changes in a row, we would only fire one uevent for all changes.

But udev event is costly. I don't think it's so appropriate.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines

FWIW; another option is never to save it unless explicitly requested by the user. There is definitely a use case where you want to avoid any sound on bootup, e g if you often boot up your computer in a student class - regardless of what it was when you turned it off earlier you want silence on boot.

(And now we haven't even touched PulseAudio's own save/restore volume stuff...)

I wonder what about other OS. Is the mixer status of a USB device recorded and resumed after reboot at hotplug?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Windows and Mac OS? I think they record it, but not sure. Slightly related, I believe they're both system level (as is alsactl), where as PulseAudio saves volume per user.

Does PA record the volume of USB device properly, too?

Yes. If the volume is changed from PA, that volume is also written to disk (after five seconds). So it writes on change, not on unplug.

OK, good to know.

thanks,

Takashi

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
#14 lore raw
In reply to David Henningsson
Quoted 94 lines · David Henningsson
Quoted 87 lines · Takashi Iwai

At Tue, 09 Apr 2013 22:07:03 +0200,

Quoted 77 lines · David Henningsson
Quoted 67 lines · Takashi Iwai

At Tue, 09 Apr 2013 17:52:23 +0200,

Quoted 29 lines · Jaroslav Kysela
Quoted 27 lines · Takashi Iwai

At Mon, 8 Apr 2013 14:51:54 +0200 (CEST),

Quoted 13 lines · GIT server

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ALSA utilities repository".

The branch, master has been updated

         via  e05b903b1fb16e967d838edac408304cd4470fee (commit)
        from  46cb355d4ff41c8065b02644b0534ab42d16cb72 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

Quoted 8 lines

- Log ----------------------------------------------------------------- commit e05b903b1fb16e967d838edac408304cd4470fee

Author: Jaroslav Kysela <[email protected]>
Date:   Mon Apr 8 14:49:31 2013 +0200

alsactl: move systemd config to the daemon mode

I'm not thrilled by the silent default behavior change like this. This will affect all systems using systemd from now on.

Quoted 8 lines
Quoted 3 lines

I understand the reason behind it, but I wonder whether it's an overkill. Yet another daemon, unconditionally no matter whether hotplug or not? Hmm...

The question is, how we can detect the hotplug scheme. Almost all systems have USB today and laptops have PCI express card slots, so.... Fedora has the systemd configs in the alsa-utils package. A removal of this package is sufficient do disable the daemon.

Yes, but then this would break the formerly working environment, too.

Quoted 3 lines

Eventually, we can
save the state periodically using cron (without the changes tracking), but my measurement is that the alsactl daemon eats approx. 150kb of memory.

I'm not concerned about alsactl memory footprint so much. But having another daemon unconditionally just to save/restore the mixer status is a question.

Quoted 5 lines

Some other quick ideas:

- make the static/hotplug schemes depending on an environment variable passed through the bootloader
- another two packages on top of alsa-utils with two configs

Manageable, but maybe will become a bit messy...

Quoted 2 lines

- save the last state inside the driver and offer it to the userspace upon the card removal (seems overkill)

This won't be that bad, I think. But, accessing the information after removal is the problem, after all. The device and proc files are removed at disconnection, so user-space can't access it. Otherwise the normal "alsactl store" should have worked. So this can't be a card-basis interface.

Quoted 5 lines

A possible w/a would be that we can keep some stable ctl lists and provide it as a (one-time) death message from a global proc or a sysfs file, for example. Then we don't need periodical sync.

Whether this is a better option? I dunno, honestly, too...

Coming from a non-systemd world...

Quoted 7 lines

Is the problem you're trying to solve that mixer state is not saved on hot-unplug; and if so, is this not working for non-systemd installations either then? Or is it systemd that causes this problem?

I was expecting that when you unplug something, some kind of synchronous udev event was fired, which could read the current mixer state and save it, before it all goes away. But perhaps this was too optimistic...

Quoted 5 lines

This was the implementation, so far, and known to be broken. alsactl was triggered by udev. But, in the case of hotplug, when it's unplugged, there is no more device file. Thus you can't get the mixer status _after_ the unplug. And, of course, the udev event is triggered at the disconnection, that is, it's performed after the unplug.

Quoted 4 lines

Is it possible to add a uevent that synchronously fires just before the device file is removed? Then the mixer state could be read. (The mixer state must be completely stored in kernel, of course, since you can't read it from unplugged hardware.)

I'm not sure, if moving every logic to the kernel is a good idea.

Quoted 7 lines
Quoted 2 lines

Jaroslav's change is to start alsactl as a system daemon by systemd, and let it keeping all mixer states in background.

Btw, one could also fire udev events on mixer changes (possibly delayed by a few seconds to avoid a uevent storm). Then at least the daemon would not be running constantly. As a minor benefit, this would also protect against settings getting lost on sudden power outages.

I think that the daemon solution is a better idea. The consumed resources are negligible and the daemon is woken in very long periods (by default 150 seconds or a ctl event). Also, the consumed resources for new tasks are higher than if all logic is in a daemon.

Jaroslav

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.