#!/bin/sh # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) # Workaround for no audio on wake from sleep. . /etc/profile 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" 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}" ;; 0) 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"