2023-04-27 11:06:51 +00:00
|
|
|
#!/bin/sh
|
2023-10-23 22:44:47 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2023-10-24 16:00:57 +00:00
|
|
|
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
2023-04-27 11:06:51 +00:00
|
|
|
|
|
|
|
# Workaround for no audio on wake from sleep.
|
|
|
|
|
|
|
|
. /etc/profile
|
|
|
|
|
2023-04-27 11:10:03 +00:00
|
|
|
DEVICE_HEADPHONE_DEV="/sys/devices/platform/rk-headset/extcon/extcon3/state"
|
|
|
|
HEADPHONE_STATE=$(awk 'BEGIN {FS="="} /HEADPHONE/ {print $2}' ${DEVICE_HEADPHONE_DEV})
|
2023-04-27 11:06:51 +00:00
|
|
|
|
|
|
|
amixer -c 0 set "MUTE" "MUTE"
|
|
|
|
|
|
|
|
amixer -c 0 set "Capture MIC Path" "Main Mic"
|
|
|
|
amixer -c 0 set "Capture MIC Path" "MIC OFF"
|
|
|
|
|
2023-04-27 11:10:03 +00:00
|
|
|
case ${HEADPHONE_STATE} in
|
|
|
|
1)
|
2023-04-27 11:06:51 +00:00
|
|
|
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_SPK}"
|
|
|
|
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_HP}"
|
|
|
|
;;
|
2023-04-27 11:14:30 +00:00
|
|
|
0)
|
2023-04-27 11:06:51 +00:00
|
|
|
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_HP}"
|
|
|
|
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_SPK}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
amixer -c 0 set "MUTE" "UNMUTE"
|