Deprecate system_utils.

This commit is contained in:
fewtarius 2023-08-06 21:17:45 +00:00
parent 981f28f417
commit 2b16257b81
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
3 changed files with 10 additions and 46 deletions

View file

@ -18,7 +18,6 @@ makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin
cp ${PKG_DIR}/sources/scripts/fancontrol ${INSTALL}/usr/bin
cp ${PKG_DIR}/sources/scripts/headphone_sense ${INSTALL}/usr/bin
cp ${PKG_DIR}/sources/scripts/system_utils ${INSTALL}/usr/bin
cp ${PKG_DIR}/sources/scripts/volume_sense ${INSTALL}/usr/bin
cp ${PKG_DIR}/sources/scripts/bluetooth_sense ${INSTALL}/usr/bin
cp ${PKG_DIR}/sources/scripts/ledcontrol ${INSTALL}/usr/bin

View file

@ -11,10 +11,17 @@
GPIO=$(cat /sys/class/gpio/gpio${DEVICE_JACK}/value)
[[ "$GPIO" == "0" ]] && set_setting "audio.device" "headphone" || set_setting "audio.device" "speakers"
if [ -e "/storage/.config/system/configs/system.cfg" ]; then
/usr/bin/system_utils setaudio $(get_setting "audio.device")
STARTUP_DEVICE=$(get_setting "audio.device")
case "${2}" in
"headphone")
amixer -M cset name='Playback Path' ${DEVICE_PLAYBACK_PATH_HP}
;;
"auto"|"speakers"|*)
amixer -M cset name='Playback Path' ${DEVICE_PLAYBACK_PATH_SPK}
;;
esac
/usr/bin/volume $(get_setting "audio.volume")
fi
# Headphone sensing
DEVICE="${DEVICE_HEADPHONE_DEV}"

View file

@ -1,42 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2020-present Fewtarius
# Source predefined functions and variables
. /etc/profile
if [ "${1}" == "toggleaudio" ];then
# Toggle audio output
CURRENTAUDIO=$(get_setting "audio.device")
case "${CURRENTAUDIO}" in
"headphone")
echo "setting speakers"
amixer -M cset name='Playback Path' ${DEVICE_PLAYBACK_PATH_SPK}
set_setting "audio.device" "speakers"
;;
"auto"|"speakers"|*)
echo "setting headphones"
amixer -M cset name='Playback Path' ${DEVICE_PLAYBACK_PATH_HP}
set_setting "audio.device" "headphone"
;;
esac
fi
if [ "${1}" == "setaudio" ];then
# Set audio output second parameter is either headphones or speakers
case "${2}" in
"headphone")
echo "setting headphones"
amixer -M cset name='Playback Path' ${DEVICE_PLAYBACK_PATH_HP}
set_setting "audio.device" "headphone"
;;
"auto"|"speakers"|*)
echo "setting speakers"
amixer -M cset name='Playback Path' ${DEVICE_PLAYBACK_PATH_SPK}
set_setting "audio.device" "speakers"
;;
esac
fi