Created
January 29, 2019 07:15
-
-
Save nerevar009/c1298dd51602ab4dbf7c21db7f021fe8 to your computer and use it in GitHub Desktop.
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/sh | |
# | |
# /etc/acpi/jack.sh | |
# | |
event="$*" | |
headphones_in() { | |
#pacmd set-sink-port "alsa_output.platform-cht-bsw-rt5645.HiFi__hw_chtrt5650__sink" "[Out] Headphones" | |
#/usr/bin/amixer -c 0 cset name='Speaker Channel Switch' off | |
#/usr/bin/amixer -c 0 cset name='Headphone Channel Switch' on | |
echo 1 > /var/log/headphones_plugged | |
} | |
headphones_out() { | |
#pacmd set-sink-port "alsa_output.platform-cht-bsw-rt5645.HiFi__hw_chtrt5650__sink" "[Out] Speaker" | |
#/usr/bin/amixer -c 0 cset name='Headphone Channel Switch' off | |
#/usr/bin/amixer -c 0 cset name='Speaker Channel Switch' on | |
echo 0 > /var/log/headphones_plugged | |
} | |
case "$event" in | |
'') ;; | |
'jack/headphone HEADPHONE plug') | |
logger "jackdetect: handling $event" | |
headphones_in | |
;; | |
'jack/headphone HEADPHONE unplug') | |
logger "jackdetect: handling $event" | |
headphones_out | |
;; | |
*) logger "jackdetect: ignoring $event" ;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment