Device Profile: Make vibration strength configurable

Fixes vibration on OnePlus 6

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This commit is contained in:
Zach DeCook
2023-07-29 10:56:22 -04:00
committed by Willow Barraco
parent 228b936f08
commit 3a70be4fd7
8 changed files with 12 additions and 9 deletions

View File

@@ -8,9 +8,9 @@
#if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
# VIBS=5
# VIBI=0
# while [ $VIBI -lt $VIBS ]; do
# sxmo_vibrate 400 &
# while [ "$VIBI" -lt "$VIBS" ]; do
# sxmo_vibrate 400 "${SXMO_VIBRATE_STRENGTH:-1}" &
# sleep 0.5
# VIBI=$(echo $VIBI+1 | bc)
# VIBI="$(echo "$VIBI+1" | bc)"
# done
#fi

View File

@@ -14,7 +14,7 @@
if sxmo_modemcall.sh list_active_calls \
| grep -v ringing-in \
| grep -q .; then
sxmo_vibrate 1500
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
exit
fi
@@ -39,7 +39,7 @@ if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ ! -f "$XDG_CONFIG_HOME"/sxmo/.n
echo "$MPVID" > "$XDG_RUNTIME_DIR/sxmo.ring.pid"
# vibrate while mpv is running
while kill -0 $MPVID; do
sxmo_vibrate 1500
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
sleep 0.5
done
@@ -59,7 +59,7 @@ elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.n
elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
smxo_log "VIBRATE ONLY"
for _ in $(seq 5); do
sxmo_vibrate 1500
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
sleep 0.5
done &
echo "$!" > "$XDG_RUNTIME_DIR/sxmo.ring.pid"

View File

@@ -24,7 +24,7 @@ if ! sxmo_modemcall.sh list_active_calls | grep -q active; then
fi
if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
sxmo_vibrate 500
sxmo_vibrate 500 "${SXMO_VIBRATE_STRENGTH:-1}"
fi
fi

View File

@@ -22,7 +22,7 @@ timerrun() {
while : ;
do notify-send "Done with $*";
sxmo_vibrate 1000
sxmo_vibrate 1000 "${SXMO_VIBRATE_STRENGTH:-1}"
sleep 0.5
done
}

View File

@@ -96,3 +96,4 @@ SXMO_RTW_SCAN_INTERVAL | Does the wifi kernel module offer a rtw_scan_interval_t
SXMO_SYS_FILES | String of files for sxmo_setpermissions.sh to make +rw (see sxmo_setpermissions.sh)
SXMO_VIBRATE_DEV | Path to vibration device (see sxmo_vibrate.c and clickclack.c) [default: /dev/input/by-path/platform-vibrator-event]
SXMO_VIBRATE_STRENGTH | Strength parameter to pass to sxmo_vibrate [default: 1]

View File

@@ -7,4 +7,5 @@ export SXMO_POWER_BUTTON="0:0:pm8941_pwrkey"
export SXMO_MONITOR="DSI-1"
export SXMO_DISABLE_LEDS="1"
export SXMO_VIBRATE_DEV="/dev/input/by-path/platform-c440000.spmi-platform-c440000.spmi:pmic@3:haptics@c000-event"
export SXMO_VIBRATE_STRENGTH="5000"
export SXMO_SWAY_SCALE="3"

View File

@@ -7,4 +7,5 @@ export SXMO_VOLUME_BUTTON="1:1:Volume_keys"
export SXMO_POWER_BUTTON="0:0:pm8941_pwrkey"
export SXMO_MONITOR="DSI-1"
export SXMO_VIBRATE_DEV="/dev/input/by-path/platform-c440000.spmi-platform-c440000.spmi:pmic@3:haptics@c000-event"
export SXMO_VIBRATE_STRENGTH="5000"
export SXMO_SWAY_SCALE="3"

View File

@@ -95,7 +95,7 @@ checkforfinishedcalls() {
# If it was the last call
if ! sxmo_modemcall.sh list_active_calls | grep -q .; then
# Cleanup
sxmo_vibrate 1000 &
sxmo_vibrate 1000 "${SXMO_VIBRATE_STRENGTH:-1}" &
sxmo_daemons.sh stop incall_menu
sxmo_daemons.sh stop proximity_lock