Merge pull request #1676 from brooksytech/dev
Fix RK3399 Headphone Sense
This commit is contained in:
commit
09f9245256
2 changed files with 41 additions and 8 deletions
|
@ -4,12 +4,14 @@
|
|||
|
||||
cat <<EOF >/storage/.config/profile.d/001-deviceconfig
|
||||
# Device Features
|
||||
DEVICE_FAKE_JACKSENSE=false
|
||||
DEVICE_FAKE_JACKSENSE=true
|
||||
DEVICE_VOLUMECTL=true
|
||||
DEVICE_AUDIO_MIXER="DAC"
|
||||
DEVICE_PLAYBACK_PATH_SPK="SPK"
|
||||
DEVICE_PLAYBACK_PATH_HP="HP"
|
||||
DEVICE_PLAYBACK_PATH_SPK="0*"
|
||||
DEVICE_PLAYBACK_PATH_HP="1*"
|
||||
DEVICE_BRIGHTNESS="128"
|
||||
DEVICE_JACK="8"
|
||||
DEVICE_HEADPHONE_DEV="/dev/input/by-path/platform-es8316-sound-event"
|
||||
UI_SERVICE="weston.service"
|
||||
|
||||
DEVICE_TEMP_SENSOR=("/sys/devices/virtual/thermal/thermal_zone0/temp" "/sys/devices/virtual/thermal/thermal_zone1/temp")
|
||||
|
@ -22,9 +24,4 @@ DMC_FREQ="/sys/devices/platform/memory-controller/devfreq/memory-controller/"
|
|||
# Affinity
|
||||
SLOW_CORES="taskset -c 0-3"
|
||||
FAST_CORES="taskset -c 4-5"
|
||||
|
||||
# Volume Keys
|
||||
#DEVICE_KEY_VOLUMEDOWN=
|
||||
#DEVICE_KEY_VOLUMEUP=
|
||||
DEVICE_VOL_MODIFIER="BTN_TR2"
|
||||
EOF
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
|
||||
# Copyright (C) 2021-present Fewtarius
|
||||
|
||||
# Source predefined functions and variables
|
||||
. /etc/profile
|
||||
|
||||
# Switch to headphones if we have them already connected at boot
|
||||
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")
|
||||
/usr/bin/system_utils vol $(get_setting "audio.volume")
|
||||
fi
|
||||
|
||||
# Headphone sensing
|
||||
DEVICE="${DEVICE_HEADPHONE_DEV}"
|
||||
|
||||
HP_ON='*(SW_HEADPHONE_INSERT), value 0*'
|
||||
HP_OFF='*(SW_HEADPHONE_INSERT), value 1*'
|
||||
|
||||
evtest "${DEVICE}" | while read line; do
|
||||
case $line in
|
||||
(${HP_ON})
|
||||
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_HP}
|
||||
set_setting "audio.device" "headphone"
|
||||
;;
|
||||
(${HP_OFF})
|
||||
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_SPK}
|
||||
set_setting "audio.device" "speakers"
|
||||
;;
|
||||
esac
|
||||
done
|
Loading…
Reference in a new issue