Created
September 27, 2017 02:25
-
-
Save vereist/f660bbe81002b25f4fd72b466ecb640c to your computer and use it in GitHub Desktop.
Headphone jack detection fails on Braswell / Realtek ALC5645 #318 headphone workaround script
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 | |
# User Settings | |
# < whoami > | |
username="jackiechan" | |
# < id > will return the uid to put here | |
uid="1000" | |
# Device Settings | |
# < pacmd list | grep "name: <.*>" > for sink lists | |
alsaDevice="alsa_output.platform-cht-bsw-rt5645.HiFi__hw_chtrt5650__sink" | |
# < pacmd list | grep -F "[Out]" > for output port lists | |
headphonePort="[Out] Headphones" | |
speakerPort="[Out] Speaker" | |
# Event Listener | |
event="$*" | |
case "$event" in | |
'jack/headphone HEADPHONE plug') | |
logger "jackdetect: handling $event" | |
XDG_RUNTIME_DIR=/run/user/$uid/ runuser -u $username -- pacmd set-sink-port $alsaDevice $headphonePort | |
;; | |
'jack/headphone HEADPHONE unplug') | |
logger "jackdetect: handling $event" | |
XDG_RUNTIME_DIR=/run/user/$uid/ runuser -u $username -- pacmd set-sink-port $alsaDevice $speakerPort | |
;; | |
*) | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment