dwm-plugins: fix vibration test, AT debug channel, and Close softkey leak

This commit is contained in:
Luxferre
2026-10-24 21:11:57 +03:00
parent f394d2b135
commit 5646f03ebe
21 changed files with 160 additions and 54 deletions
+4
View File
@@ -0,0 +1,4 @@
# /etc/conf.d/modemmanager: config file for modemmanager
# Enable quick suspend/resume hooks and debug mode (allows mmcli --command AT queries)
modemmanager_opts="--test-quick-suspend-resume --debug"
@@ -1,3 +1,4 @@
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="keypad", ENV{ID_INPUT_KEYBOARD}="1"
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="gpio-keys", ENV{ID_INPUT_KEYBOARD}="1"
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="pm8941_resin", ENV{ID_INPUT_KEYBOARD}="1"
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="pm8xxx*vib*", SYMLINK+="input/by-path/platform-vibrator-event"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -504,57 +504,50 @@ case "$cmd" in
echo "ERROR: Empty AT command"
exit 1
fi
run_at_dev() {
dev="$1"
[ -c "$dev" ] || return 1
out="$(timeout 2 awk -v dev="$dev" -v cmd="$at_cmd" '
BEGIN {
sys = "stty -F " dev " raw -echo 115200 min 0 time 2 2>/dev/null"
system(sys)
printf "%s\r\n", cmd > dev
close(dev)
}
' 2>/dev/null || true)"
return 0
}
resp=""
for candidate in "$port" wwan0at1 wwan0at0; do
for candidate in "$port" /dev/wwan0at1 /dev/wwan0at0; do
case "$candidate" in
wwan0at0|wwan0at1)
dev="/dev/$candidate"
if [ -c "$dev" ]; then
resp="$(timeout 2 sh -c '
dev="$1"
cmd="$2"
stty -F "$dev" raw -echo 115200 min 0 time 2 2>/dev/null || true
exec 3<>"$dev"
dd bs=256 count=4 status=none <&3 >/dev/null 2>&1 || true
printf "%s\r\n" "$cmd" >&3
lines=""
i=0
while [ "$i" -lt 8 ]; do
chunk="$(dd bs=512 count=1 status=none <&3 2>/dev/null | tr -d "\r" || true)"
if [ -n "$chunk" ]; then
lines="${lines}${chunk}"
case "$lines" in
*OK*|*ERROR*)
break
;;
esac
fi
i=$((i + 1))
done
exec 3>&-
printf "%s\n" "$lines"
' _ "$dev" "$at_cmd" 2>/dev/null | sed '/^[[:space:]]*$/d' || true)"
if [ -n "$resp" ]; then
printf "%s\n" "$resp"
exit 0
fi
fi
;;
/dev/wwan0at0|/dev/wwan0at1)
dev="$candidate"
;;
*)
dev=""
;;
esac
[ "$port" != "auto" ] && [ "$candidate" = "$port" ] && break
if [ -n "$dev" ] && [ -c "$dev" ]; then
resp="$(timeout 2 sh -c '
dev="$1"
cmd="$2"
tmpf="/tmp/at_resp_$$.txt"
rm -f "$tmpf"
cat "$dev" > "$tmpf" 2>/dev/null &
rpid=$!
sleep 0.04
printf "%s\r\n" "$cmd" > "$dev" 2>/dev/null || true
i=0
while [ "$i" -lt 12 ]; do
if grep -qE "(^|[[:space:]])(OK|ERROR|\+CME ERROR|\+CMS ERROR)([[:space:]]|$)" "$tmpf" 2>/dev/null; then
break
fi
sleep 0.08
i=$((i + 1))
done
kill "$rpid" 2>/dev/null || true
wait "$rpid" 2>/dev/null || true
tr -d "\r" < "$tmpf" 2>/dev/null || true
rm -f "$tmpf"
' _ "$dev" "$at_cmd" 2>/dev/null | sed '/^[[:space:]]*$/d' || true)"
if [ -n "$resp" ]; then
printf "%s\n" "$resp"
exit 0
fi
fi
if [ "$port" != "auto" ] && [ "$candidate" = "$port" ]; then
break
fi
done
mm_out="$(mmcli -m any --command="$at_cmd" 2>&1 || true)"
if [ -n "$mm_out" ]; then
@@ -0,0 +1,5 @@
[D-BUS Service]
Name=org.freedesktop.ModemManager1
Exec=/usr/sbin/ModemManager --debug
User=root
SystemdService=dbus-org.freedesktop.ModemManager1.service
@@ -11,11 +11,27 @@
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
if [ -z "${SXMO_VIBRATE_DEV:-}" ] && [ ! -e /dev/input/by-path/platform-vibrator-event ]; then
for vdev in /dev/input/by-path/*vibrator*-event; do
if [ -e "$vdev" ]; then
export SXMO_VIBRATE_DEV="$vdev"
break
fi
done
fi
if [ -f "$XDG_CONFIG_HOME/sxmo/ringsettings" ]; then
# shellcheck disable=SC1091
. "$XDG_CONFIG_HOME/sxmo/ringsettings"
fi
# pm8xxx-vib shifts FF_RUMBLE strong_magnitude right by 8 bits (valid 256..65535)
case "${SXMO_VIBRATE_STRENGTH:-}" in
1) SXMO_VIBRATE_STRENGTH=20000 ;;
2|"") SXMO_VIBRATE_STRENGTH=40000 ;;
3) SXMO_VIBRATE_STRENGTH=65535 ;;
esac
if [ -f "$XDG_CONFIG_HOME/sxmo/ringtone" ]; then
custom_ring="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/ringtone" 2>/dev/null)"
if [ -n "$custom_ring" ] && [ -f "$custom_ring" ]; then