dwm-plugins: fix vibration test, AT debug channel, and Close softkey leak
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="keypad", ENV{ID_INPUT_KEYBOARD}="1"
|
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}=="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}=="pm8941_resin", ENV{ID_INPUT_KEYBOARD}="1"
|
||||||
|
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="pm8xxx*vib*", SYMLINK+="input/by-path/platform-vibrator-event"
|
||||||
|
|||||||
@@ -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}=="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}=="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}=="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"
|
echo "ERROR: Empty AT command"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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=""
|
resp=""
|
||||||
for candidate in "$port" wwan0at1 wwan0at0; do
|
for candidate in "$port" /dev/wwan0at1 /dev/wwan0at0; do
|
||||||
case "$candidate" in
|
case "$candidate" in
|
||||||
wwan0at0|wwan0at1)
|
wwan0at0|wwan0at1)
|
||||||
dev="/dev/$candidate"
|
dev="/dev/$candidate"
|
||||||
if [ -c "$dev" ]; then
|
;;
|
||||||
resp="$(timeout 2 sh -c '
|
/dev/wwan0at0|/dev/wwan0at1)
|
||||||
dev="$1"
|
dev="$candidate"
|
||||||
cmd="$2"
|
;;
|
||||||
stty -F "$dev" raw -echo 115200 min 0 time 2 2>/dev/null || true
|
*)
|
||||||
exec 3<>"$dev"
|
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
|
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
done
|
||||||
mm_out="$(mmcli -m any --command="$at_cmd" 2>&1 || true)"
|
mm_out="$(mmcli -m any --command="$at_cmd" 2>&1 || true)"
|
||||||
if [ -n "$mm_out" ]; then
|
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
|
# shellcheck source=scripts/core/sxmo_common.sh
|
||||||
. 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
|
if [ -f "$XDG_CONFIG_HOME/sxmo/ringsettings" ]; then
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. "$XDG_CONFIG_HOME/sxmo/ringsettings"
|
. "$XDG_CONFIG_HOME/sxmo/ringsettings"
|
||||||
fi
|
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
|
if [ -f "$XDG_CONFIG_HOME/sxmo/ringtone" ]; then
|
||||||
custom_ring="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/ringtone" 2>/dev/null)"
|
custom_ring="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/ringtone" 2>/dev/null)"
|
||||||
if [ -n "$custom_ring" ] && [ -f "$custom_ring" ]; then
|
if [ -n "$custom_ring" ] && [ -f "$custom_ring" ]; then
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1110,6 +1110,19 @@ int runModemApp(int argc, char** argv) {
|
|||||||
|
|
||||||
auto hideWindow = [&]() {
|
auto hideWindow = [&]() {
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
int xfdLocal = ConnectionNumber(dpy);
|
||||||
|
int64_t drainDeadline = nowMs() + 180;
|
||||||
|
while (nowMs() < drainDeadline && querySoftkeysDown(dpy) != 0) {
|
||||||
|
while (XPending(dpy) > 0) {
|
||||||
|
XEvent ev;
|
||||||
|
XNextEvent(dpy, &ev);
|
||||||
|
}
|
||||||
|
struct pollfd pfd {};
|
||||||
|
pfd.fd = xfdLocal;
|
||||||
|
pfd.events = POLLIN;
|
||||||
|
::poll(&pfd, 1, 10);
|
||||||
|
}
|
||||||
|
writeSoftkeySuppress(nowMs() + 450);
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
XUnmapWindow(dpy, win);
|
XUnmapWindow(dpy, win);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|||||||
@@ -952,6 +952,19 @@ int runNetworksApp(int argc, char** argv) {
|
|||||||
|
|
||||||
auto hideWindow = [&]() {
|
auto hideWindow = [&]() {
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
int xfdLocal = ConnectionNumber(dpy);
|
||||||
|
int64_t drainDeadline = nowMs() + 180;
|
||||||
|
while (nowMs() < drainDeadline && querySoftkeysDown(dpy) != 0) {
|
||||||
|
while (XPending(dpy) > 0) {
|
||||||
|
XEvent ev;
|
||||||
|
XNextEvent(dpy, &ev);
|
||||||
|
}
|
||||||
|
struct pollfd pfd {};
|
||||||
|
pfd.fd = xfdLocal;
|
||||||
|
pfd.events = POLLIN;
|
||||||
|
::poll(&pfd, 1, 10);
|
||||||
|
}
|
||||||
|
writeSoftkeySuppress(nowMs() + 450);
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
XUnmapWindow(dpy, win);
|
XUnmapWindow(dpy, win);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|||||||
@@ -585,18 +585,44 @@ int runRingtonesApp(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
||||||
visible = true;
|
if (!visible) {
|
||||||
|
visible = true;
|
||||||
|
XMapRaised(dpy, win);
|
||||||
|
XSync(dpy, False);
|
||||||
|
} else {
|
||||||
|
XRaiseWindow(dpy, win);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 20; ++i) {
|
||||||
|
if (XGrabKeyboard(dpy, win, True, GrabModeAsync, GrabModeAsync,
|
||||||
|
CurrentTime) == GrabSuccess) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
usleep(2000);
|
||||||
|
}
|
||||||
|
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
|
||||||
startupIgnoreUntilMs = nowMs() + 180;
|
startupIgnoreUntilMs = nowMs() + 180;
|
||||||
initialSoftkeysReleased = (querySoftkeysDown(dpy) == 0);
|
initialSoftkeysReleased = (querySoftkeysDown(dpy) == 0);
|
||||||
softkeyPending = 0;
|
softkeyPending = 0;
|
||||||
XMapRaised(dpy, win);
|
|
||||||
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
|
|
||||||
render();
|
render();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto hideWindow = [&]() {
|
auto hideWindow = [&]() {
|
||||||
stopPreview();
|
stopPreview();
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
int xfdLocal = ConnectionNumber(dpy);
|
||||||
|
int64_t drainDeadline = nowMs() + 180;
|
||||||
|
while (nowMs() < drainDeadline && querySoftkeysDown(dpy) != 0) {
|
||||||
|
while (XPending(dpy) > 0) {
|
||||||
|
XEvent ev;
|
||||||
|
XNextEvent(dpy, &ev);
|
||||||
|
}
|
||||||
|
struct pollfd pfd {};
|
||||||
|
pfd.fd = xfdLocal;
|
||||||
|
pfd.events = POLLIN;
|
||||||
|
::poll(&pfd, 1, 10);
|
||||||
|
}
|
||||||
|
writeSoftkeySuppress(nowMs() + 450);
|
||||||
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
visible = false;
|
visible = false;
|
||||||
softkeyPending = 0;
|
softkeyPending = 0;
|
||||||
XUnmapWindow(dpy, win);
|
XUnmapWindow(dpy, win);
|
||||||
@@ -636,9 +662,15 @@ int runRingtonesApp(int argc, char** argv) {
|
|||||||
((settings.vibrateStrength - 1 + 3 + delta) % 3) + 1;
|
((settings.vibrateStrength - 1 + 3 + delta) % 3) + 1;
|
||||||
saveRingSettings(settings);
|
saveRingSettings(settings);
|
||||||
} else if (settingsRow == 4) {
|
} else if (settingsRow == 4) {
|
||||||
runAsyncCmd("sxmo_vibrate 600 " +
|
int mag = (settings.vibrateStrength == 1)
|
||||||
std::to_string(settings.vibrateStrength) +
|
? 20000
|
||||||
" >/dev/null 2>&1");
|
: (settings.vibrateStrength == 3 ? 65535 : 40000);
|
||||||
|
runAsyncCmd(
|
||||||
|
"for d in /dev/input/by-path/platform-vibrator-event "
|
||||||
|
"/dev/input/by-path/*vibrator*-event; do "
|
||||||
|
"[ -e \"$d\" ] && export SXMO_VIBRATE_DEV=\"$d\" && break; done; "
|
||||||
|
"sxmo_vibrate 600 " +
|
||||||
|
std::to_string(mag) + " >/dev/null 2>&1");
|
||||||
setBanner("Testing vibration...");
|
setBanner("Testing vibration...");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -490,17 +490,43 @@ int runWallpapersApp(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
updatePreviewCache();
|
updatePreviewCache();
|
||||||
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
||||||
visible = true;
|
if (!visible) {
|
||||||
|
visible = true;
|
||||||
|
XMapRaised(dpy, win);
|
||||||
|
XSync(dpy, False);
|
||||||
|
} else {
|
||||||
|
XRaiseWindow(dpy, win);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 20; ++i) {
|
||||||
|
if (XGrabKeyboard(dpy, win, True, GrabModeAsync, GrabModeAsync,
|
||||||
|
CurrentTime) == GrabSuccess) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
usleep(2000);
|
||||||
|
}
|
||||||
|
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
|
||||||
startupIgnoreUntilMs = nowMs() + 180;
|
startupIgnoreUntilMs = nowMs() + 180;
|
||||||
initialSoftkeysReleased = (querySoftkeysDown(dpy) == 0);
|
initialSoftkeysReleased = (querySoftkeysDown(dpy) == 0);
|
||||||
softkeyPending = 0;
|
softkeyPending = 0;
|
||||||
XMapRaised(dpy, win);
|
|
||||||
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
|
|
||||||
render();
|
render();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto hideWindow = [&]() {
|
auto hideWindow = [&]() {
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
int xfdLocal = ConnectionNumber(dpy);
|
||||||
|
int64_t drainDeadline = nowMs() + 180;
|
||||||
|
while (nowMs() < drainDeadline && querySoftkeysDown(dpy) != 0) {
|
||||||
|
while (XPending(dpy) > 0) {
|
||||||
|
XEvent ev;
|
||||||
|
XNextEvent(dpy, &ev);
|
||||||
|
}
|
||||||
|
struct pollfd pfd {};
|
||||||
|
pfd.fd = xfdLocal;
|
||||||
|
pfd.events = POLLIN;
|
||||||
|
::poll(&pfd, 1, 10);
|
||||||
|
}
|
||||||
|
writeSoftkeySuppress(nowMs() + 450);
|
||||||
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
visible = false;
|
visible = false;
|
||||||
fullscreenPreview = false;
|
fullscreenPreview = false;
|
||||||
softkeyPending = 0;
|
softkeyPending = 0;
|
||||||
|
|||||||
@@ -1873,6 +1873,8 @@ flush_pending_softkey(void)
|
|||||||
softkey_deadline_ms = 0;
|
softkey_deadline_ms = 0;
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
if (dwm_now_ms() < read_softkey_suppress())
|
||||||
|
return;
|
||||||
if (pending == SOFTKEY_LEFT) {
|
if (pending == SOFTKEY_LEFT) {
|
||||||
if (is_plugin_loaded("dmenu")) {
|
if (is_plugin_loaded("dmenu")) {
|
||||||
host_spawn_plugin("dmenu", "sys");
|
host_spawn_plugin("dmenu", "sys");
|
||||||
|
|||||||
Reference in New Issue
Block a user