[systemd-devel] alsa-restore.service seems to be too early

Colin Guthrie gmane at colin.guthr.ie
Mon Sep 3 02:48:58 PDT 2012


[ Please don't drop the list from the CC ]


'Twas brillig, and Вечный Студент at 03/09/12 10:33 did gyre and gimble:
> 03.09.2012, 13:05, "Colin Guthrie" <gmane at colin.guthr.ie>:
>> Yes this unit is just a part of a two part solution here. See the
>> commit where it was introduced for an explanation:
>> 
>> http://git.alsa-project.org/?p=alsa-utils.git;a=commitdiff;h=de7c3eff0e371ce155403bbcdcf81ee79266fa0f
>>
>>
>> So the udev rule is the other part of the puzzle that should deal with
>> restoration during hotplug events.
>> 
>> You should have the file
>> [/usr]/lib/udev/rules.d/90-alsa-restore.rules
> 
> Thanks for the tip! In fact I have the rule file installed:
> 
> ~ $ cat /usr/lib/udev/rules.d/90-alsa-restore.rules ACTION=="add",
> SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="card*", \ 
> RUN+="/usr/sbin/alsactl restore $attr{number}"
> 
> But the thing isn't done. I guess the issue is driver-specific.

Then you should probably try and debug this further - e.g. by rmmod'ing
the module and inserting it and trying to work out why it's not run. You
can always replace the rule with one that runs a script instead that
writes debugging info or similar.

In theory the control device should appear last to udev (something which
we had to fight with a few years back with PulseAudio). When the control
device appears it should be all ready. The only complication that I can
think of is that there might be some kind of firmware loading issue that
means that the control device appears before the device can really be used.

If you do replace it with a script, try introducing a sleep in it to
give the firmware time to load - this isn't a solution of course, but it
might help work out if it's a timing thing and that, in turn, might
highlight where the real solution lies.

> I think at my case some kind of - in initscripts terms - rc.local must
> be used - a service with 'After=all' :) Is there a tool presenting in
> some (pseudo)graphics form a graph with Before/After deps of active
> units? I need to find that After=all...

No there is no such concept. It's broken by design anyway so you should
not follow this path for a solution to this problem - it needs to be
fixed properly such that things happen in a proper async friendly manner
and don't rely on theoretical moments in time when everything is "ready"
(which don't really exist anyway - even if such solutions do work 99% of
the time, they are still technically wrong!)

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list