diff --git a/devices/common-msm8909/70-nokia-argon-keypad.rules b/devices/common-msm8909/70-nokia-argon-keypad.rules index f85a430..722b96e 100644 --- a/devices/common-msm8909/70-nokia-argon-keypad.rules +++ b/devices/common-msm8909/70-nokia-argon-keypad.rules @@ -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" diff --git a/overlay/rootfs/etc/conf.d/modemmanager b/overlay/rootfs/etc/conf.d/modemmanager new file mode 100644 index 0000000..f742ccc --- /dev/null +++ b/overlay/rootfs/etc/conf.d/modemmanager @@ -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" diff --git a/overlay/rootfs/etc/udev/rules.d/70-nokia-argon-keypad.rules b/overlay/rootfs/etc/udev/rules.d/70-nokia-argon-keypad.rules index f85a430..722b96e 100644 --- a/overlay/rootfs/etc/udev/rules.d/70-nokia-argon-keypad.rules +++ b/overlay/rootfs/etc/udev/rules.d/70-nokia-argon-keypad.rules @@ -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" diff --git a/overlay/rootfs/usr/bin/dwm b/overlay/rootfs/usr/bin/dwm index d5fb326..fbc60c0 100755 Binary files a/overlay/rootfs/usr/bin/dwm and b/overlay/rootfs/usr/bin/dwm differ diff --git a/overlay/rootfs/usr/lib/dwm/plugins/modem.so b/overlay/rootfs/usr/lib/dwm/plugins/modem.so index dbec846..b6c2ad7 100755 Binary files a/overlay/rootfs/usr/lib/dwm/plugins/modem.so and b/overlay/rootfs/usr/lib/dwm/plugins/modem.so differ diff --git a/overlay/rootfs/usr/lib/dwm/plugins/networks.so b/overlay/rootfs/usr/lib/dwm/plugins/networks.so index 12706ad..67546b4 100755 Binary files a/overlay/rootfs/usr/lib/dwm/plugins/networks.so and b/overlay/rootfs/usr/lib/dwm/plugins/networks.so differ diff --git a/overlay/rootfs/usr/lib/dwm/plugins/ringtones.so b/overlay/rootfs/usr/lib/dwm/plugins/ringtones.so index 2154985..2a2db22 100755 Binary files a/overlay/rootfs/usr/lib/dwm/plugins/ringtones.so and b/overlay/rootfs/usr/lib/dwm/plugins/ringtones.so differ diff --git a/overlay/rootfs/usr/lib/dwm/plugins/wallpapers.so b/overlay/rootfs/usr/lib/dwm/plugins/wallpapers.so index efd9e7f..eaf7aed 100755 Binary files a/overlay/rootfs/usr/lib/dwm/plugins/wallpapers.so and b/overlay/rootfs/usr/lib/dwm/plugins/wallpapers.so differ diff --git a/overlay/rootfs/usr/libexec/msm-modem-uim-selection b/overlay/rootfs/usr/libexec/msm-modem-uim-selection index a4e4037..17dd0cd 100755 --- a/overlay/rootfs/usr/libexec/msm-modem-uim-selection +++ b/overlay/rootfs/usr/libexec/msm-modem-uim-selection @@ -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 diff --git a/overlay/rootfs/usr/share/dbus-1/system-services/org.freedesktop.ModemManager1.service b/overlay/rootfs/usr/share/dbus-1/system-services/org.freedesktop.ModemManager1.service new file mode 100644 index 0000000..e7445af --- /dev/null +++ b/overlay/rootfs/usr/share/dbus-1/system-services/org.freedesktop.ModemManager1.service @@ -0,0 +1,5 @@ +[D-BUS Service] +Name=org.freedesktop.ModemManager1 +Exec=/usr/sbin/ModemManager --debug +User=root +SystemdService=dbus-org.freedesktop.ModemManager1.service diff --git a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh index dbc147e..d346411 100755 --- a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh +++ b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh @@ -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 diff --git a/prebuilt/sxmo-x11/usr/bin/dwm b/prebuilt/sxmo-x11/usr/bin/dwm index d5fb326..fbc60c0 100755 Binary files a/prebuilt/sxmo-x11/usr/bin/dwm and b/prebuilt/sxmo-x11/usr/bin/dwm differ diff --git a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/modem.so b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/modem.so index dbec846..b6c2ad7 100755 Binary files a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/modem.so and b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/modem.so differ diff --git a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so index 12706ad..67546b4 100755 Binary files a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so and b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so differ diff --git a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/ringtones.so b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/ringtones.so index 2154985..2a2db22 100755 Binary files a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/ringtones.so and b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/ringtones.so differ diff --git a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/wallpapers.so b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/wallpapers.so index efd9e7f..eaf7aed 100755 Binary files a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/wallpapers.so and b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/wallpapers.so differ diff --git a/src/dwm-plugins/modem_plugin.cpp b/src/dwm-plugins/modem_plugin.cpp index e576921..11e3cb1 100644 --- a/src/dwm-plugins/modem_plugin.cpp +++ b/src/dwm-plugins/modem_plugin.cpp @@ -1110,6 +1110,19 @@ int runModemApp(int argc, char** argv) { auto hideWindow = [&]() { 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); XUnmapWindow(dpy, win); XFlush(dpy); diff --git a/src/dwm-plugins/networks_plugin.cpp b/src/dwm-plugins/networks_plugin.cpp index 0e46aaa..0891792 100644 --- a/src/dwm-plugins/networks_plugin.cpp +++ b/src/dwm-plugins/networks_plugin.cpp @@ -952,6 +952,19 @@ int runNetworksApp(int argc, char** argv) { auto hideWindow = [&]() { 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); XUnmapWindow(dpy, win); XFlush(dpy); diff --git a/src/dwm-plugins/ringtones_plugin.cpp b/src/dwm-plugins/ringtones_plugin.cpp index 35dbfcf..0ac76b5 100644 --- a/src/dwm-plugins/ringtones_plugin.cpp +++ b/src/dwm-plugins/ringtones_plugin.cpp @@ -585,18 +585,44 @@ int runRingtonesApp(int argc, char** argv) { } } writeIntFile(activePidPath, static_cast(::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; initialSoftkeysReleased = (querySoftkeysDown(dpy) == 0); softkeyPending = 0; - XMapRaised(dpy, win); - XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime); render(); }; auto hideWindow = [&]() { stopPreview(); 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; softkeyPending = 0; XUnmapWindow(dpy, win); @@ -636,9 +662,15 @@ int runRingtonesApp(int argc, char** argv) { ((settings.vibrateStrength - 1 + 3 + delta) % 3) + 1; saveRingSettings(settings); } else if (settingsRow == 4) { - runAsyncCmd("sxmo_vibrate 600 " + - std::to_string(settings.vibrateStrength) + - " >/dev/null 2>&1"); + int mag = (settings.vibrateStrength == 1) + ? 20000 + : (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..."); } }; diff --git a/src/dwm-plugins/wallpapers_plugin.cpp b/src/dwm-plugins/wallpapers_plugin.cpp index c8836b8..116d384 100644 --- a/src/dwm-plugins/wallpapers_plugin.cpp +++ b/src/dwm-plugins/wallpapers_plugin.cpp @@ -490,17 +490,43 @@ int runWallpapersApp(int argc, char** argv) { } updatePreviewCache(); writeIntFile(activePidPath, static_cast(::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; initialSoftkeysReleased = (querySoftkeysDown(dpy) == 0); softkeyPending = 0; - XMapRaised(dpy, win); - XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime); render(); }; auto hideWindow = [&]() { 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; fullscreenPreview = false; softkeyPending = 0; diff --git a/src/sxmo-dwm/dwm.c b/src/sxmo-dwm/dwm.c index 54e5f5a..9070564 100644 --- a/src/sxmo-dwm/dwm.c +++ b/src/sxmo-dwm/dwm.c @@ -1873,6 +1873,8 @@ flush_pending_softkey(void) softkey_deadline_ms = 0; XUngrabKeyboard(dpy, CurrentTime); XFlush(dpy); + if (dwm_now_ms() < read_softkey_suppress()) + return; if (pending == SOFTKEY_LEFT) { if (is_plugin_loaded("dmenu")) { host_spawn_plugin("dmenu", "sys");