site  contact  subhomenews

Audio fix at bootup

November 09, 2021 — BarryK

I have fixed an old problem. Over the years, there have been reports that sound settings are lost after a reboot.

On my fast Lenovo PC, this problem does not happen; however, on the Acer Aspire 1 laptop, the problem is occurring. The laptop has an Intel Apollo Lake CPU, passively cooled, and very slow. It was very cheap, purchased early in 2019, I think for around AU$250. I posted to my blog about various issues, such as screen freezing, mouse freezing, but they got fixed -- I think was running Quirky Linux on it.

EasyOS runs fine, except as I reported yesterday, Firefox behaves very badly, with window going blank, freezing, hanging the entire desktop. So, for now, have built Easy, with only SeaMonkey. Now, about that sound problem...

/etc/init.d/10alsa runs at bootup, and loads the sound settings, so you should have same volumes as set at the last time Easy was run. The script waits for the existence of folder '/proc/asound/card0', and what I discovered is that this is not long enough.

That folder appears, but on my laptop it may be many more seconds before audio is actually ready to use.

I modified the 10alsa script to wait for existence of symlinks /sys/class/sound/card[0-9], then just in case waited 2 more seconds. Yes, that did the trick. The laptop is so slow, 10alsa has to wait 6 seconds before one or more of those symlinks appear. Incredibly slow.

EasyOS does not run "udevadm settle" in /etc/rc.d/rc.sysinit, so execution rushes ahead as fast as possible to get to the desktop. Result, we have a desktop even before audio is ready to use.

For that reason, I have fixed /root/Startup/pulseaudio and /root/Startup/pa-applet_tray to wait until audio is ready.

The pulseaudio script waits until /etc/init.d/10alsa has exited, and also waits for the 'bluetoothd' daemon to start (if there is a bluetooth hardware interface), before starting the pulseaudio daemons.

The pa-applet_tray script waits until the pulseaudio daemon is running before starting the systray volume control.

So, everything is constrained to a particular order. Working well on the laptop.

Default sound was too low, had to run AlsaMixer and boosted the volume. Played a video in Celluloid, working nicely. Rebooted, and yes, the volume level has been remembered.  

Tags: easy