You are not logged in.
Pages: 1
I have a bash script with a bunch of "hda-verb" commands to fix the audio on my laptop and I need it to run on startup. And the first thing I thought of was to add it as a systemd service.
The script works does work. However, only certain commands are applied.
In the script, I need to set "SET_CONNECT_SEL", 'SET_AMP_GAIN_MUTE" and "SET_PIN_WIDGET_CONTROL" in order to get the audio working correctly.
Settings that do get set:
- SET_CONNECT_SEL
- SET_AMP_GAIN_MUTE
Settings that do NOT get set:
- SET_PIN_WIDGET_CONTROL
It does, however, get set when I manually run "sudo ./audio-fix.sh" after I log in. But it will unset itself after a few minutes.
What am I doing wrong?
audio-fix.sh
#!/usr/bin/env bash
# Wait for sound card to appear.
until [ -e /dev/snd/hwC1D0 ]; do
sleep 1
done
hda-verb /dev/snd/hwC1D0 0x17 SET_CONNECT_SEL 0x00
hda-verb /dev/snd/hwC1D0 0x17 SET_AMP_GAIN_MUTE 0xb02f
hda-verb /dev/snd/hwC1D0 0x1b SET_CONNECT_SEL 0x00
hda-verb /dev/snd/hwC1D0 0x1b SET_AMP_GAIN_MUTE 0xb02f
hda-verb /dev/snd/hwC1D0 0x1e SET_PIN_WIDGET_CONTROL 0x40
hda-verb /dev/snd/hwC1D0 0x17 SET_PIN_WIDGET_CONTROL 0x40
hda-verb /dev/snd/hwC1D0 0x1b SET_PIN_WIDGET_CONTROL 0x40audio-fix.service
[Unit]
Description=Fix for speakers for Yoga Slim 7 Gen 10
After=sound.target
Requires=sound.target
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 5
ExecStart=/home/pox/.config/yoga-fix/audio-fix.sh
RemainAfterExit=true
[Install]
WantedBy=multi-user.targetLast edited by Poxinator (2025-04-17 04:28:48)
Offline
Update
I have found a fix. The problem was that power saving mode for audio was on and resetting everything whenever it gets woken up to play audio.
To turn off power saving mode, add a .conf file in /etc/modprobe.d with this:
options snd_hda_intel powers-save=0Run "mkinitcpio -P" and reboot.
Offline
Pages: 1