Created
October 5, 2024 17:00
-
-
Save mariohuq/ddf726c7ac8fff0e4979a4e6d570811c to your computer and use it in GitHub Desktop.
Fix audio on ES8336 via amixer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fix audio on ES8336 via amixer | |
command='amixer --quiet --card 0' | |
loud_command='amixer --card 0' | |
# got these values from `amixer controls` | |
speaker=numid=29,iface=MIXER,name='Speaker Switch' | |
headphone=numid=30,iface=MIXER,name='Headphone Switch' | |
if # want speakers === speakers is unmute | |
# `amixer -c 0 sget 'Speaker',0` has 'on' in its output | |
$loud_command cget "$speaker" | grep --quiet --fixed-strings 'values=on' | |
then | |
# enable speakers | |
$command cset "$speaker" off | |
$command cset "$headphone" on | |
else | |
# enable headphones | |
$command cset "$speaker" on | |
$command cset "$headphone" off | |
fi | |
# if $loud_command cget "$speaker" | grep --quiet --fixed-strings 'values=on'; then echo speakers; else echo headphones; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just put this script to
$PATH
(in my case~/.local/bin
) and set up a custom keybinding F1 to run this command:Now I don't have that problem on my intel chuwi laptop.
Problem was: when I connect headphones to 3.5 jack, I got audio on both my speakers and headphones, but when I pull headphones off audio resets completely