Add sleep quirks mechanism.
This commit is contained in:
parent
0aaf371dae
commit
03ca265ff8
5 changed files with 62 additions and 3 deletions
|
@ -7,11 +7,21 @@ PKG_VERSION="1.2.8"
|
|||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.alsa-project.org/"
|
||||
PKG_URL="https://www.alsa-project.org/files/pub/lib/alsa-lib-${PKG_VERSION}.tar.bz2"
|
||||
PKG_DEPENDS_TARGET="toolchain alsa-ucm-conf alsa-topology-conf"
|
||||
PKG_DEPENDS_TARGET="toolchain alsa-topology-conf"
|
||||
PKG_LONGDESC="ALSA (Advanced Linux Sound Architecture) is the next generation Linux Sound API."
|
||||
PKG_TOOLCHAIN="autotools"
|
||||
PKG_BUILD_FLAGS="+pic"
|
||||
|
||||
case ${DEVICE} in
|
||||
RK356*)
|
||||
PKG_CONFIGURE_OPTS_TARGET+=" --disable-ucm"
|
||||
;;
|
||||
*)
|
||||
PKG_DEPENDS_TARGET+="alsa-ucm-conf"
|
||||
PKG_CONFIGURE_OPTS_TARGET+=" --enable-ucm"
|
||||
;;
|
||||
esac
|
||||
|
||||
if build_with_debug; then
|
||||
PKG_ALSA_DEBUG=--with-debug
|
||||
else
|
||||
|
@ -19,7 +29,6 @@ else
|
|||
fi
|
||||
|
||||
PKG_CONFIGURE_OPTS_TARGET="${PKG_ALSA_DEBUG} \
|
||||
--enable-ucm \
|
||||
--disable-dependency-tracking \
|
||||
--with-plugindir=/usr/lib/alsa \
|
||||
--disable-python"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Sleep quirks are executed before (pre) and after (post) a sleep event occurs.
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright (C) 2023-present Fewtarius
|
||||
|
||||
# Workaround for no audio on wake from sleep.
|
||||
|
||||
. /etc/profile
|
||||
|
||||
PBDEVICE=$(amixer get "Playback Path" | awk 'BEGIN {FS="'\''"} /Item0/ {print $2}')
|
||||
|
||||
alsactl init
|
||||
|
||||
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)
|
||||
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_SPK}"
|
||||
amixer -c 0 set "Playback Path" "${DEVICE_PLAYBACK_PATH_HP}"
|
||||
;;
|
||||
SPK)
|
||||
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"
|
|
@ -4,6 +4,15 @@
|
|||
|
||||
. /etc/profile
|
||||
|
||||
if [ -e "/sys/firmware/devicetree/base/model" ]
|
||||
then
|
||||
QUIRK_DEVICE=$(cat /sys/firmware/devicetree/base/model 2>/dev/null)
|
||||
else
|
||||
QUIRK_DEVICE="$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) $(cat /sys/class/dmi/id/product_name 2>/dev/null)"
|
||||
fi
|
||||
QUIRK_DEVICE="$(echo ${QUIRK_DEVICE} | sed -e "s#[/]#-#g")"
|
||||
|
||||
|
||||
headphones() {
|
||||
if [ "${DEVICE_FAKE_JACKSENSE}" == "true" ]
|
||||
then
|
||||
|
@ -85,6 +94,13 @@ modules() {
|
|||
esac
|
||||
}
|
||||
|
||||
quirks() {
|
||||
for QUIRK in /usr/lib/autostart/quirks/"${QUIRK_DEVICE}"/sleep/${1}/*
|
||||
do
|
||||
"${QUIRK}" >/dev/null 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
case $1 in
|
||||
pre)
|
||||
alsastate store
|
||||
|
@ -94,6 +110,7 @@ case $1 in
|
|||
powerstate stop
|
||||
device_powersave stop
|
||||
modules stop
|
||||
quirks pre
|
||||
touch /run/.last_sleep_time
|
||||
;;
|
||||
post)
|
||||
|
@ -118,5 +135,6 @@ case $1 in
|
|||
BRIGHTNESS=$(get_setting system.brightness)
|
||||
log $0 "Restoring brightness to ${BRIGHTNESS}."
|
||||
echo ${BRIGHTNESS} >/sys/class/backlight/$(brightness device)/brightness
|
||||
quirks post
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -6,6 +6,6 @@ PKG_VERSION=""
|
|||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.alsa-project.org/"
|
||||
PKG_URL=""
|
||||
PKG_DEPENDS_TARGET="toolchain alsa-lib alsa-utils bluez-alsa alsa-ucm-conf"
|
||||
PKG_DEPENDS_TARGET="toolchain alsa-lib alsa-utils bluez-alsa"
|
||||
PKG_SECTION="virtual"
|
||||
PKG_LONGDESC="Metapackage to install all alsa components."
|
||||
|
|
Loading…
Reference in a new issue