From 2b16257b81d29a9180fa8d8809b72dfcc96a3550 Mon Sep 17 00:00:00 2001 From: fewtarius Date: Sun, 6 Aug 2023 21:17:45 +0000 Subject: [PATCH] Deprecate system_utils. --- packages/sysutils/system-utils/package.mk | 1 - .../sources/scripts/headphone_sense | 13 ++++-- .../system-utils/sources/scripts/system_utils | 42 ------------------- 3 files changed, 10 insertions(+), 46 deletions(-) delete mode 100755 packages/sysutils/system-utils/sources/scripts/system_utils diff --git a/packages/sysutils/system-utils/package.mk b/packages/sysutils/system-utils/package.mk index 1cef829ff..34883c4dd 100644 --- a/packages/sysutils/system-utils/package.mk +++ b/packages/sysutils/system-utils/package.mk @@ -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 diff --git a/packages/sysutils/system-utils/sources/scripts/headphone_sense b/packages/sysutils/system-utils/sources/scripts/headphone_sense index c8f5f6d80..1ada18abc 100755 --- a/packages/sysutils/system-utils/sources/scripts/headphone_sense +++ b/packages/sysutils/system-utils/sources/scripts/headphone_sense @@ -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}" diff --git a/packages/sysutils/system-utils/sources/scripts/system_utils b/packages/sysutils/system-utils/sources/scripts/system_utils deleted file mode 100755 index d43e1aae9..000000000 --- a/packages/sysutils/system-utils/sources/scripts/system_utils +++ /dev/null @@ -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 -