Merge pull request #1362 from fewtarius/dev

Update the post hook to use /sys.
This commit is contained in:
fewtarius 2023-04-27 07:16:14 -04:00 committed by GitHub
commit 2f16d86a52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,23 +6,20 @@
. /etc/profile
PBDEVICE=$(amixer get "Playback Path" | awk 'BEGIN {FS="'\''"} /Item0/ {print $2}')
alsactl init
DEVICE_HEADPHONE_DEV="/sys/devices/platform/rk-headset/extcon/extcon3/state"
HEADPHONE_STATE=$(awk 'BEGIN {FS="="} /HEADPHONE/ {print $2}' ${DEVICE_HEADPHONE_DEV})
amixer -c 0 set "MUTE" "MUTE"
amixer -c 0 set "Capture MIC Path" "Main Mic"
amixer -c 0 set "Capture MIC Path" "MIC OFF"
echo ${PBDEVICE}
case ${PBDEVICE} in
HP)
case ${HEADPHONE_STATE} in
1)
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_SPK}"
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_HP}"
;;
SPK)
0)
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_HP}"
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_SPK}"
;;