Skip to content

Instantly share code, notes, and snippets.

@mariohuq
Created October 5, 2024 17:00
Show Gist options
  • Save mariohuq/ddf726c7ac8fff0e4979a4e6d570811c to your computer and use it in GitHub Desktop.
Save mariohuq/ddf726c7ac8fff0e4979a4e6d570811c to your computer and use it in GitHub Desktop.
Fix audio on ES8336 via amixer
#!/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
@mariohuq
Copy link
Author

mariohuq commented Oct 5, 2024

I just put this script to $PATH (in my case ~/.local/bin) and set up a custom keybinding F1 to run this command:

Gnome custom keybinding dialog

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment