I got a Lenovo Yoga 7i, there is a known issue with its audio card on the current kernels where it wont output sound through the speakers.
There is, however, a hackish solution described here where, after doing the setup, you run this script and the audio works
#!/bin/bash
sudo rtcwake -m mem -s 1
while true
do
echo -n -e '\x00' | padsp tee /dev/audio
sleep 5
done
The problem with this script is that in order to run rtcwake
, you seem to need to run it as sudo
, meaning you need to input the password making it useless as a startup script. But running the script as root
from the start means that the while loop outputs the error tee: /dev/audio: Connection refused
over and over.
How can I run this script, that only uses parts of it as sudo, on startup from any user?
What may work is to split the script: run the
rtcwake -m mem -s 1
during startup as root. Nowadays, a crontab may be the most convenient way to do that (unless you fancy writing a systemd service):To open and edit the root crontab file, and add:
You then could run the next part in another script that you autostart on user login.