Fix instant QMI call hangup, eliminate post-call dialer/callscreen popups and desktop clock flicker

This commit is contained in:
Luxferre committed 2026-11-05 09:51:53 +02:00
1 parent 1d71bc81d8
commit c9c870c3bb
27 files changed
+867 -308

No files matched your search

+2 -2
View File
@@ -28,7 +28,7 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
- Added a persistent BlueZ `NoInputNoOutput` default pairing/authorization agent (`/org/bananarchy/bt_agent`) and D-Bus `connect`/`pair` handler inside `/usr/bin/bananarchy-bt-obex` (skipping redundant pre-connect inquiry scans for known BlueZ devices and automatically recovering from stale `[LinkKey]` `br-connection-key-missing` errors) for seamless BLE HOGP (`00001812`), Classic HID (`00001124`), and A2DP/HFP bonding and reconnection, an automatic `/dev/uinput` gamepad-to-keypad bridge (`Bananarchy BT Gamepad Bridge`, excluding QWERTY keyboards) so Bluetooth/USB gamepads (`D-Pad` / `Left Stick` -> `Up`/`Down`/`Left`/`Right`, `South/A` -> `Enter`, `East/B` -> `8`, `West/X` -> `5`, `North/Y` -> `6`, `Start` -> `2`, `Select` -> `3`, `L1`/`R1` -> `Left`/`Right softkey`, `L2`/`R2` -> `*`/`0`, `Mode` -> `Escape`) control all NeoUI apps and games (`snake`, `tetris`, `scoundrel`, `gambatte`, `remedy`) out of the box, automatic `[KBD]` external keyboard detection (`isExternalKeyboardActive()`) in `fcitx5-t9`, `libneoui.so`, and DWM plugins so connecting a Bluetooth/USB QWERTY keyboard automatically bypasses T9 multi-tap and preedit popups for all keys (`0-9`, `*`, `#`, `Shift+0-9`, and letters), and automatic `XFixes` cursor display in `dwm` (`dwm_has_external_mouse()`) whenever a Bluetooth/USB mouse is connected. - Added a persistent BlueZ `NoInputNoOutput` default pairing/authorization agent (`/org/bananarchy/bt_agent`) and D-Bus `connect`/`pair` handler inside `/usr/bin/bananarchy-bt-obex` (skipping redundant pre-connect inquiry scans for known BlueZ devices and automatically recovering from stale `[LinkKey]` `br-connection-key-missing` errors) for seamless BLE HOGP (`00001812`), Classic HID (`00001124`), and A2DP/HFP bonding and reconnection, an automatic `/dev/uinput` gamepad-to-keypad bridge (`Bananarchy BT Gamepad Bridge`, excluding QWERTY keyboards) so Bluetooth/USB gamepads (`D-Pad` / `Left Stick` -> `Up`/`Down`/`Left`/`Right`, `South/A` -> `Enter`, `East/B` -> `8`, `West/X` -> `5`, `North/Y` -> `6`, `Start` -> `2`, `Select` -> `3`, `L1`/`R1` -> `Left`/`Right softkey`, `L2`/`R2` -> `*`/`0`, `Mode` -> `Escape`) control all NeoUI apps and games (`snake`, `tetris`, `scoundrel`, `gambatte`, `remedy`) out of the box, automatic `[KBD]` external keyboard detection (`isExternalKeyboardActive()`) in `fcitx5-t9`, `libneoui.so`, and DWM plugins so connecting a Bluetooth/USB QWERTY keyboard automatically bypasses T9 multi-tap and preedit popups for all keys (`0-9`, `*`, `#`, `Shift+0-9`, and letters), and automatic `XFixes` cursor display in `dwm` (`dwm_has_external_mouse()`) whenever a Bluetooth/USB mouse is connected.
- **Universal Power button (`dmenu power`) access, background call termination, lockscreen X11 grab preemption, ReMEdy `Call (green)` pause menu, JSR expansion, and 64 MB mark-and-sweep GC**: - **Universal Power button (`dmenu power`) access, background call termination, lockscreen X11 grab preemption, ReMEdy `Call (green)` pause menu, JSR expansion, and 64 MB mark-and-sweep GC**:
- Updated `dwm`, `dmenu`, `xdrawer`, `libneoui.so`, `sxmo_multikey.sh`, all standalone Xlib DWM plugins, and standalone games (`scoundrel`, `gambatte`, `remedy`) so pressing **End / Power (red)** (`XF86PowerOff`, keycode `124`) from any active window or menu immediately ends any incoming, outgoing, or active call (even when `xcallscreen` has been switched away from in the background) or opens the system **Power menu (`dmenu power`)** when no call is active, while mapped **Call (green)** (`XF86Phone` / `XF86PickupPhone`) and `500 ms` **Right softkey** hold in `remedy` open the **ReMEdy Pause Menu**. - Updated `dwm`, `dmenu`, `xdrawer`, `libneoui.so`, `sxmo_multikey.sh`, all standalone Xlib DWM plugins, and standalone games (`scoundrel`, `gambatte`, `remedy`) so pressing **End / Power (red)** (`XF86PowerOff`, keycode `124`) from any active window or menu immediately ends any incoming, outgoing, or active call (even when `xcallscreen` has been switched away from in the background) or opens the system **Power menu (`dmenu power`)** when no call is active, while mapped **Call (green)** (`XF86Phone` / `XF86PickupPhone`) and `500 ms` **Right softkey** hold in `remedy` open the **ReMEdy Pause Menu**.
- Updated `callscreen.so` (`xcallscreen`), `locker.so` (`xlocker`), `dwm` (`lock_phone_screenoff` on `SW_LID = 1`), `sxmo_hook_lock.sh`, `sxmo_modemcall.sh`, `sxmo_modemdial.sh`, and `msm-modem-uim-selection` so locking the screen or sliding the lid closed immediately hangs up any incoming, outgoing, or active cellular/VoIP call and closes `xcallscreen`, fixed DSDS QMI `call-dial` / `call-hangup all` / `dsds-daemon` state tracking so secondary-SIM calls are never orphaned when switching apps, and eliminated duplicate `xlocker` startup activations across `bananarchy-x11-session.sh`, `sxmo_hook_start.sh`, `sxmo_hook_lock.sh`, and `locker.so`. - Updated `callscreen.so` (`xcallscreen`), `dialer.so` (`xdialer`), `contacts.so` (`xcontacts`), `calllog.so` (`xcalllog`), `sms.so` (`xsms`), `locker.so` (`xlocker`), `dwm` (`lock_phone_screenoff` on `SW_LID = 1`), `sxmo_hook_lock.sh`, `sxmo_modemcall.sh`, `sxmo_modemdial.sh`, `sxmo_modemaudio.sh`, `sxmo_modem.sh`, `sxmo_modemmonitor.sh`, and `msm-modem-uim-selection` so locking the screen, sliding the lid closed, or pressing Hangup immediately sends `QMI_VOICE_END_CALL` (`0x0021`) over `AF_QIPCRTR` (`sub=1` and `sub=0`) in `< 10 ms`, aborts any in-flight `sxmo_modemdial.sh` pipeline via `/tmp/sxmo_hangup_requested`, starts Primary GW (`mmcli`) calls immediately upon creation without duplicate audio setup or background `incall_menu` jobs, guards `dialer` and `callscreen` against stale post-hangup or mid-call window popups, serializes `sxmo_modemaudio.sh` call-audio teardown (`flock` on `/tmp/sxmo_modemaudio.lock`), and prevents `callscreen` from fighting `dunst` notifications on `VisibilityNotify`, while eliminating duplicate `xlocker` and `dsds-daemon` startup instances.
- Upgraded **ReMEdy (`remedy` / `j2me`)** with a `64 MB` heap budget and mark-and-sweep garbage collector (`System.gc()` / `Runtime.gc()`, `freeSlots_` object reuse, and full heap/JAR release on MIDlet exit), synchronous `Canvas.serviceRepaints()`, `Thread.yield()` / `Thread.sleep()` background thread stepping, synthetic native static field storage (`System.out`, `System.err`, `List.SELECT_COMMAND`, `AlertType.*`, `Boolean.TRUE/FALSE`), exact `String` reference preservation in `List.getString()` and `ChoiceGroup.getString()` (for `MeBoy` / `GTA 2` GBC-to-J2ME cartridges), `java.io.InputStreamReader` / `OutputStreamWriter`, `java.lang.Float` / `Double` / `Character`, **JSR-75** (`FileSystemRegistry` / `FileConnection`), **JSR-82** (`javax.bluetooth.*`), **JSR-120** (`javax.wireless.messaging.*`), **JSR-135** (`MIDIControl`), full **Nokia `DirectGraphics`** (`drawPixels`, `getPixels`, `fillPolygon`, `drawPolygon`, `fillTriangle`, `drawTriangle`, `setARGBColor`), and automatic/configurable sub-QVGA (`128x128`, `128x160`, `176x208`, `176x220`) canvas scaling (`Asphalt 6: Adrenaline`). - Upgraded **ReMEdy (`remedy` / `j2me`)** with a `64 MB` heap budget and mark-and-sweep garbage collector (`System.gc()` / `Runtime.gc()`, `freeSlots_` object reuse, and full heap/JAR release on MIDlet exit), synchronous `Canvas.serviceRepaints()`, `Thread.yield()` / `Thread.sleep()` background thread stepping, synthetic native static field storage (`System.out`, `System.err`, `List.SELECT_COMMAND`, `AlertType.*`, `Boolean.TRUE/FALSE`), exact `String` reference preservation in `List.getString()` and `ChoiceGroup.getString()` (for `MeBoy` / `GTA 2` GBC-to-J2ME cartridges), `java.io.InputStreamReader` / `OutputStreamWriter`, `java.lang.Float` / `Double` / `Character`, **JSR-75** (`FileSystemRegistry` / `FileConnection`), **JSR-82** (`javax.bluetooth.*`), **JSR-120** (`javax.wireless.messaging.*`), **JSR-135** (`MIDIControl`), full **Nokia `DirectGraphics`** (`drawPixels`, `getPixels`, `fillPolygon`, `drawPolygon`, `fillTriangle`, `drawTriangle`, `setARGBColor`), and automatic/configurable sub-QVGA (`128x128`, `128x160`, `176x208`, `176x220`) canvas scaling (`Asphalt 6: Adrenaline`).
- **Kernel-to-userspace battery, charging, fuel-gauge, and idle power optimizations**: - **Kernel-to-userspace battery, charging, fuel-gauge, and idle power optimizations**:
- Fixed PM8909/PM8916 linear battery charger (`pm8916_lbc.ko.zst`) hardware state-machine engagement by writing `MISC_BOOT_DONE` (`0x1642 = 0x80`), overriding the internal charger comparator (`0x10d0 = 0xa5`, `0x10ee = 0x02`), stopping the USB enumeration watchdog timer (`0x134e = 0x00`, `0x104e = 0x00`), clearing `USB_SUSP` (`0x1347 = 0x00`) and `CHG_FAILED` (`0x104a = 0x80`), enabling `BAT_IF` thermistor pull-ups (`0x1248`, `0x124a`), re-arming `CHG_CTRL = 0x81` on every `usb_vbus` plug event, and setting `qcom,fast-charge-safe-current = 540 mA` (`4.375 V`) across all 5 device trees (`nokia-argon`, `nokia-beatles`, `nokia-tough`, `nokia-sparkler`, `nokia-leo`) so USB charging engages `FAST_CHG_ON` (`0x1010 = 0x20`) instead of idling at `90 mA`. - Fixed PM8909/PM8916 linear battery charger (`pm8916_lbc.ko.zst`) hardware state-machine engagement by writing `MISC_BOOT_DONE` (`0x1642 = 0x80`), overriding the internal charger comparator (`0x10d0 = 0xa5`, `0x10ee = 0x02`), stopping the USB enumeration watchdog timer (`0x134e = 0x00`, `0x104e = 0x00`), clearing `USB_SUSP` (`0x1347 = 0x00`) and `CHG_FAILED` (`0x104a = 0x80`), enabling `BAT_IF` thermistor pull-ups (`0x1248`, `0x124a`), re-arming `CHG_CTRL = 0x81` on every `usb_vbus` plug event, and setting `qcom,fast-charge-safe-current = 540 mA` (`4.375 V`) across all 5 device trees (`nokia-argon`, `nokia-beatles`, `nokia-tough`, `nokia-sparkler`, `nokia-leo`) so USB charging engages `FAST_CHG_ON` (`0x1010 = 0x20`) instead of idling at `90 mA`.
@@ -41,7 +41,7 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
- Set the DSDS `msm-modem-uim-selection` `select()` timeout to infinite (`None`, pure `AF_QIPCRTR` event-driven wait) while the screen is locked and `600s` when unlocked, added `neoui_next_timeout_ms()` to `libneoui.so`, wired GLib `GMainContext` file descriptors and `"load-failed"` / `closeWindow()` load-stop handling into `webarchy.so` (along with `NO_AT_BRIDGE=1` and `GTK_A11Y=none`), added `inotify` directory watching to `sms.so`, and eliminated idle periodic `poll()` timers across `dialer.so`, `calllog.so`, `contacts.so`, `sms.so`, `xdrawer.so`, `locker.so`, `email.so`, `irc.so`, `smallweb.so`, `tox.so`, `sip.so`, and `webarchy.so` so visible and background plugins sleep at `0%` CPU unless a transient timer (`softkey` chord, multi-tap window, or toast expiry) is active. - Set the DSDS `msm-modem-uim-selection` `select()` timeout to infinite (`None`, pure `AF_QIPCRTR` event-driven wait) while the screen is locked and `600s` when unlocked, added `neoui_next_timeout_ms()` to `libneoui.so`, wired GLib `GMainContext` file descriptors and `"load-failed"` / `closeWindow()` load-stop handling into `webarchy.so` (along with `NO_AT_BRIDGE=1` and `GTK_A11Y=none`), added `inotify` directory watching to `sms.so`, and eliminated idle periodic `poll()` timers across `dialer.so`, `calllog.so`, `contacts.so`, `sms.so`, `xdrawer.so`, `locker.so`, `email.so`, `irc.so`, `smallweb.so`, `tox.so`, `sip.so`, and `webarchy.so` so visible and background plugins sleep at `0%` CPU unless a transient timer (`softkey` chord, multi-tap window, or toast expiry) is active.
- Skipped `dwm` `drawbar()` Xorg/Glamor/SPI redraws and `sxmo_hook_statusbar.sh` process spawns whenever `bl_power != 0`, `brightness == 0`, or `/tmp/bananarchy_screen_locked` exists (with immediate bar refresh on wake/unlock), fast-exited `sxmo_hook_statusbar.sh periodics` before sourcing hooks while locked or screenoff, serialized `bananarchy-sync-dunst-theme` with `flock` without spawning duplicate unmanaged `dunst` instances under `superd` (preventing `dunst` respawn storms), disabled NetworkManager periodic connectivity polling (`[connectivity] enabled=false`), and wrapped background spawns in double-fork subshells `( ... & )` across `bananarchy-x11-session.sh`, `sxmo_modemmonitor.sh`, `sxmo_hook_start.sh`, `sxmo_hook_postwake.sh`, and `msm-modem-uim-selection` to eliminate zombie child accumulation. - Skipped `dwm` `drawbar()` Xorg/Glamor/SPI redraws and `sxmo_hook_statusbar.sh` process spawns whenever `bl_power != 0`, `brightness == 0`, or `/tmp/bananarchy_screen_locked` exists (with immediate bar refresh on wake/unlock), fast-exited `sxmo_hook_statusbar.sh periodics` before sourcing hooks while locked or screenoff, serialized `bananarchy-sync-dunst-theme` with `flock` without spawning duplicate unmanaged `dunst` instances under `superd` (preventing `dunst` respawn storms), disabled NetworkManager periodic connectivity polling (`[connectivity] enabled=false`), and wrapped background spawns in double-fork subshells `( ... & )` across `bananarchy-x11-session.sh`, `sxmo_modemmonitor.sh`, `sxmo_hook_start.sh`, `sxmo_hook_postwake.sh`, and `msm-modem-uim-selection` to eliminate zombie child accumulation.
- Fixed spontaneous screen blanking after sliding the keypad lid open and eliminated passcode entry lag in `xlocker` (`locker.so`) and `dwm` by removing queued asynchronous `sxmo_state.sh set screenoff` shell spawns from `lock_phone_screenoff()`, adding a `60 ms` `SW_LID` close debounce (`EVIOCGSW`) with instant wake on open, resetting `locker.so` inactivity timer on every unblank transition (`wasScreenBlanked`), forwarding any `dwm`-intercepted key events while locked directly to `/tmp/dwm_plugin_locker.fifo` (`KEY <keycode> <state>`), caching `locker.so` battery/notification status with a `10s` TTL, debouncing multi-digit auto-verification by `220 ms`, and adding a per-session random-salted 64-bit fast verification cache invalidated automatically on `/etc/shadow` or `/etc/bananarchy_duress.hash` changes. - Fixed spontaneous screen blanking after sliding the keypad lid open and eliminated passcode entry lag in `xlocker` (`locker.so`) and `dwm` by removing queued asynchronous `sxmo_state.sh set screenoff` shell spawns from `lock_phone_screenoff()`, adding a `60 ms` `SW_LID` close debounce (`EVIOCGSW`) with instant wake on open, resetting `locker.so` inactivity timer on every unblank transition (`wasScreenBlanked`), forwarding any `dwm`-intercepted key events while locked directly to `/tmp/dwm_plugin_locker.fifo` (`KEY <keycode> <state>`), caching `locker.so` battery/notification status with a `10s` TTL, debouncing multi-digit auto-verification by `220 ms`, and adding a per-session random-salted 64-bit fast verification cache invalidated automatically on `/etc/shadow` or `/etc/bananarchy_duress.hash` changes.
- Replaced the standalone `conky` process with native `dwm` desktop clock rendering (`m->clockwin` `ParentRelative` window at `Y = 29, H = 92`) using the exact same `Fira Code` fonts (`32pt` `%H:%M` at `Y = 43..73` and `14pt` `%a %d %b %Y` at `Y = 87..101`), white foreground, and 1px black drop shadow, eliminating the `conky` daemon, its periodic X11 wakeup timers, and all `pkill -STOP/-CONT conky` process spawns across lock/unlock, statusbar, and timezone transitions. - Replaced the standalone `conky` process with native `dwm` desktop clock rendering (`m->clockwin` `ParentRelative` window at `Y = 29, H = 92`) using the exact same `Fira Code` fonts (`32pt` `%H:%M` at `Y = 43..73` and `14pt` `%a %d %b %Y` at `Y = 87..101`), white foreground, and 1px black drop shadow, caching rendered clock/softbar state (`drawclock` and `drawsoftbar`) so statusbar updates (`xsetroot -name`) never clear or flash `m->clockwin` or `m->softwin` unless exposed or changed, and eliminating the `conky` daemon, its periodic X11 wakeup timers, and all `pkill -STOP/-CONT conky` process spawns across lock/unlock, statusbar, and timezone transitions.
- **Zero-log privacy default and Extended Logging feature setting (`engmenu.so` / `xengmenu`, `dmenu.so`, `bananarchy-engmenu-ctl`)**: - **Zero-log privacy default and Extended Logging feature setting (`engmenu.so` / `xengmenu`, `dmenu.so`, `bananarchy-engmenu-ctl`)**:
- Disabled extended system and session logging by default (`OFF`) across `sxmo_log()` / `sxmo_debug()`, `superd` (`-l /dev/null` and `/tmp/superd_state/superd/logs/*.log -> /dev/null`), `Xorg` (`-logfile /dev/null -logverbose 0`), `dwm`, `fcitx5` (`--verbose="*=0"`), `tinydm` (`tinydm-run-session`), `NetworkManager` (`level=OFF`), `ModemManager` (`--log-level=ERR --log-file=/dev/null`), and kernel `printk` (`1 4 1 1`), purging persistent log files from `~/.local/state/` and `/var/log/` so idle mode produces zero log writes. - Disabled extended system and session logging by default (`OFF`) across `sxmo_log()` / `sxmo_debug()`, `superd` (`-l /dev/null` and `/tmp/superd_state/superd/logs/*.log -> /dev/null`), `Xorg` (`-logfile /dev/null -logverbose 0`), `dwm`, `fcitx5` (`--verbose="*=0"`), `tinydm` (`tinydm-run-session`), `NetworkManager` (`level=OFF`), `ModemManager` (`--log-level=ERR --log-file=/dev/null`), and kernel `printk` (`1 4 1 1`), purging persistent log files from `~/.local/state/` and `/var/log/` so idle mode produces zero log writes.
- Added the **Extended Logging** toggle (`OFF` by default) to the **Engineering Menu (`*#0001#` / `xengmenu` -> `8: Extended Logging`)**, **Config Menu (`Config -> Extended Logging`)**, and `/usr/bin/bananarchy-engmenu-ctl logging [on|off|toggle|status]`, storing volatile diagnostic logs strictly in RAM (`/tmp/sxmo.log`, `/tmp/superd.log`, `/tmp/superd_state/superd/logs/*.log`) when enabled and purging them immediately when disabled. - Added the **Extended Logging** toggle (`OFF` by default) to the **Engineering Menu (`*#0001#` / `xengmenu` -> `8: Extended Logging`)**, **Config Menu (`Config -> Extended Logging`)**, and `/usr/bin/bananarchy-engmenu-ctl logging [on|off|toggle|status]`, storing volatile diagnostic logs strictly in RAM (`/tmp/sxmo.log`, `/tmp/superd.log`, `/tmp/superd_state/superd/logs/*.log`) when enabled and purging them immediately when disabled.
Binary file not shown.
+1 -5
View File
@@ -60,25 +60,21 @@ checkforfinishedcalls() {
if [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.discardedcall" ]; then if [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.discardedcall" ]; then
#this call was discarded #this call was discarded
STATE=discarded STATE=discarded
sxmo_notify_user.sh "Call with $CONTACT terminated"
stderr "Discarded call from $FINISHEDNUMBER" stderr "Discarded call from $FINISHEDNUMBER"
printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv" printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.pickedupcall" ]; then elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.pickedupcall" ]; then
#this call was picked up #this call was picked up
STATE=pickedup STATE=pickedup
sxmo_notify_user.sh "Call with $CONTACT terminated"
stderr "Finished call from $FINISHEDNUMBER" stderr "Finished call from $FINISHEDNUMBER"
printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv" printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.hangedupcall" ]; then elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.hangedupcall" ] || [ -f /tmp/sxmo_hangup_requested ]; then
#this call was hung up by the user #this call was hung up by the user
STATE=wehangedup STATE=wehangedup
sxmo_notify_user.sh "Call with $CONTACT terminated"
stderr "Finished call from $FINISHEDNUMBER" stderr "Finished call from $FINISHEDNUMBER"
printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv" printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.initiatedcall" ]; then elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.initiatedcall" ]; then
STATE=theyhangedup STATE=theyhangedup
#this call was hung up by the contact #this call was hung up by the contact
sxmo_notify_user.sh "Call with $CONTACT terminated"
stderr "Finished call from $FINISHEDNUMBER" stderr "Finished call from $FINISHEDNUMBER"
printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv" printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.blockedcall" ]; then elif [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${FINISHEDCALLID}.blockedcall" ]; then
+41 -23
View File
@@ -41,6 +41,8 @@ switch_bt_card_a2dp() {
} }
enable_call_audio_mode() { enable_call_audio_mode() {
exec 9>/tmp/sxmo_modemaudio.lock
flock -x 9
printf "1\n" > /tmp/sxmo_in_call 2>/dev/null || true printf "1\n" > /tmp/sxmo_in_call 2>/dev/null || true
cur_out="$(sxmo_audio.sh device get 2>/dev/null || printf "Speaker")" cur_out="$(sxmo_audio.sh device get 2>/dev/null || printf "Speaker")"
@@ -56,13 +58,15 @@ enable_call_audio_mode() {
sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true
sxmo_audio.sh device setinput Bluetooth >/dev/null 2>&1 || true sxmo_audio.sh device setinput Bluetooth >/dev/null 2>&1 || true
if command -v amixer >/dev/null 2>&1; then if command -v amixer >/dev/null 2>&1; then
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true amixer -c 0 -s >/dev/null 2>&1 <<'EOF' || true
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true cset name='INT_BT_SCO_RX Audio Mixer MultiMedia1' 0
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true cset name='MultiMedia2 Mixer INT_BT_SCO_TX' 0
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true cset name='MultiMedia2 Mixer TERT_MI2S_TX' 0
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true cset name='PRI_MI2S_RX Voice Mixer VoiceMMode1' 0
amixer -c 0 cset "name='INT_BT_SCO_RX Voice Mixer VoiceMMode1'" 1 >/dev/null 2>&1 || true cset name='VoiceMMode1 Capture Mixer TERT_MI2S_TX' 0
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX'" 1 >/dev/null 2>&1 || true cset name='INT_BT_SCO_RX Voice Mixer VoiceMMode1' 1
cset name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX' 1
EOF
fi fi
else else
if [ "$jack_plugged" = "1" ] || [ "$cur_out" = "Headphones" ]; then if [ "$jack_plugged" = "1" ] || [ "$cur_out" = "Headphones" ]; then
@@ -72,21 +76,28 @@ enable_call_audio_mode() {
fi fi
sxmo_audio.sh device set "$target_out" >/dev/null 2>&1 || true sxmo_audio.sh device set "$target_out" >/dev/null 2>&1 || true
if command -v amixer >/dev/null 2>&1; then if command -v amixer >/dev/null 2>&1; then
amixer -c 0 cset "name='INT_BT_SCO_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true amixer -c 0 -s >/dev/null 2>&1 <<'EOF' || true
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true cset name='INT_BT_SCO_RX Voice Mixer VoiceMMode1' 0
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 1 >/dev/null 2>&1 || true cset name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX' 0
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true cset name='PRI_MI2S_RX Voice Mixer VoiceMMode1' 1
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true cset name='VoiceMMode1 Capture Mixer TERT_MI2S_TX' 1
amixer -c 0 cset "name='RX1 Mute Switch'" 0 >/dev/null 2>&1 || true cset name='MultiMedia2 Mixer TERT_MI2S_TX' 0
cset name='RX1 Mute Switch' 0
EOF
fi fi
fi fi
sxmo_log "Enabled ALSA voice call audio mode ($target_out)." sxmo_log "Enabled ALSA voice call audio mode ($target_out)."
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
return 0 return 0
} }
disable_call_audio_mode() { disable_call_audio_mode() {
exec 9>/tmp/sxmo_modemaudio.lock
flock -x 9
if [ ! -e /tmp/sxmo_in_call ]; then
rm -f /tmp/sxmo_call_vol 2>/dev/null || true
return 0
fi
rm -f /tmp/sxmo_in_call /tmp/sxmo_call_vol 2>/dev/null || true rm -f /tmp/sxmo_in_call /tmp/sxmo_call_vol 2>/dev/null || true
bt_card="$(find_bt_card)" bt_card="$(find_bt_card)"
@@ -96,18 +107,26 @@ disable_call_audio_mode() {
fi fi
if command -v amixer >/dev/null 2>&1; then if command -v amixer >/dev/null 2>&1; then
amixer -c 0 cset "name='INT_BT_SCO_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true amixer -c 0 -s >/dev/null 2>&1 <<'EOF' || true
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true cset name='INT_BT_SCO_RX Voice Mixer VoiceMMode1' 0
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true cset name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX' 0
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true cset name='PRI_MI2S_RX Voice Mixer VoiceMMode1' 0
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true cset name='VoiceMMode1 Capture Mixer TERT_MI2S_TX' 0
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true cset name='INT_BT_SCO_RX Audio Mixer MultiMedia1' 0
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true cset name='MultiMedia2 Mixer INT_BT_SCO_TX' 0
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1
cset name='MultiMedia2 Mixer TERT_MI2S_TX' 1
EOF
fi fi
if [ -n "$bt_card" ]; then if [ -n "$bt_card" ]; then
target_out="Bluetooth" target_out="Bluetooth"
if [ -r /tmp/sxmo_bt_sco_keepalive.pid ]; then
read -r kpid < /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || kpid=""
rm -f /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || true
[ -n "$kpid" ] && kill -TERM "$kpid" 2>/dev/null || true
fi
pkill -TERM -f "pacat --playback --device=bluez_output" 2>/dev/null || true
switch_bt_card_a2dp "$bt_card" || true switch_bt_card_a2dp "$bt_card" || true
sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1 || true sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1 || true
sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true
@@ -122,7 +141,6 @@ disable_call_audio_mode() {
fi fi
sxmo_log "Disabled ALSA voice call audio mode ($target_out)." sxmo_log "Disabled ALSA voice call audio mode ($target_out)."
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
return 0 return 0
} }
+16 -4
View File
@@ -132,13 +132,25 @@ pickup() {
hangup() { hangup() {
CALLID="${1:-all}" CALLID="${1:-all}"
touch /tmp/sxmo_hangup_requested 2>/dev/null || true
pkill -TERM -f sxmo_modemdial.sh 2>/dev/null || true
case "$CALLID" in case "$CALLID" in
""|"-"|"all") ""|"-"|"all")
rm -f "$XDG_RUNTIME_DIR/sxmo_calls/"* /tmp/sxmo_call_ringing /tmp/sxmo_active_call 2>/dev/null || true for f in "$XDG_RUNTIME_DIR"/sxmo_calls/*.initiatedcall "$XDG_RUNTIME_DIR"/sxmo_calls/*.pickedupcall; do
mmcli -m any --voice-hangup-all >/dev/null 2>&1 || true [ -e "$f" ] || continue
base="${f%.*}"
rm -f "$f" 2>/dev/null || true
touch "${base}.hangedupcall" 2>/dev/null || true
done
rm -f "$XDG_RUNTIME_DIR"/sxmo_calls/sub1_* "$XDG_RUNTIME_DIR"/sxmo_calls/sub0_* /tmp/sxmo_call_ringing /tmp/sxmo_active_call 2>/dev/null || true
doas -n /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1 || \ doas -n /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1 || \
/usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1 || true /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1 || true
mmcli -m any --voice-hangup-all >/dev/null 2>&1 || true
for cid in $(mmcli -m any --voice-list-calls 2>/dev/null | grep -oE 'Call/[0-9]+' | cut -d/ -f2); do
mmcli -m any -o "$cid" --hangup >/dev/null 2>&1 || true
mmcli -m any --voice-delete-call="$cid" >/dev/null 2>&1 || true
done
doas -n dbus-send --system --type=signal / org.ofono.VoiceCallManager.CallRemoved >/dev/null 2>&1 || true doas -n dbus-send --system --type=signal / org.ofono.VoiceCallManager.CallRemoved >/dev/null 2>&1 || true
sxmo_hook_hangup.sh || true sxmo_hook_hangup.sh || true
return 0 return 0
@@ -176,6 +188,7 @@ hangup() {
! mmcli -m any --voice-hangup-all 2>/dev/null && \ ! mmcli -m any --voice-hangup-all 2>/dev/null && \
! doas -n /usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1 && \ ! doas -n /usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1 && \
! doas -n /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1; then ! doas -n /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1; then
mmcli -m any --voice-delete-call="$CALLID" >/dev/null 2>&1 || true
# we ignore already closed calls # we ignore already closed calls
if list_active_calls | grep -q "/$CALLID "; then if list_active_calls | grep -q "/$CALLID "; then
HANGUP_FAILED=1 HANGUP_FAILED=1
@@ -203,6 +216,7 @@ list_active_calls() {
mmcli -m any --voice-list-calls 2>/dev/null | \ mmcli -m any --voice-list-calls 2>/dev/null | \
awk '$1=$1' | \ awk '$1=$1' | \
grep -v terminated | \ grep -v terminated | \
grep -v "(unknown)" | \
grep -v "No calls were found" | while read -r line; do grep -v "No calls were found" | while read -r line; do
CALLID="$(printf "%s\n" "$line" | awk '$1=$1' | cut -d" " -f1 | xargs basename)" CALLID="$(printf "%s\n" "$line" | awk '$1=$1' | cut -d" " -f1 | xargs basename)"
if [ -e "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.mutedring" ]; then if [ -e "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.mutedring" ]; then
@@ -242,8 +256,6 @@ incall_menu() {
xcallscreen active "$CALLID" "$NUMBER" >/dev/null 2>&1 || true xcallscreen active "$CALLID" "$NUMBER" >/dev/null 2>&1 || true
;; ;;
esac esac
else
xcallscreen >/dev/null 2>&1 || true
fi fi
return 0 return 0
fi fi
+90 -59
View File
@@ -19,7 +19,13 @@ if [ "${1:-}" = "--sim" ] && [ -n "${2:-}" ]; then
fi fi
resolve_sim_state() { resolve_sim_state() {
UIM_ST="$(doas -n /usr/libexec/msm-modem-uim-selection status 2>/dev/null || /usr/libexec/msm-modem-uim-selection status 2>/dev/null || true)" UIM_ST=""
if [ -r /tmp/sxmo_sim_slots ]; then
UIM_ST="$(cat /tmp/sxmo_sim_slots 2>/dev/null || true)"
fi
if [ -z "$UIM_ST" ]; then
UIM_ST="$(doas -n /usr/libexec/msm-modem-uim-selection slots 2>/dev/null || /usr/libexec/msm-modem-uim-selection slots 2>/dev/null || true)"
fi
PRIM_SLOT="$(printf "%s\n" "$UIM_ST" | awk -F= '/^PRIMARY_GW_SLOT=/ {print $2; exit}')" PRIM_SLOT="$(printf "%s\n" "$UIM_ST" | awk -F= '/^PRIMARY_GW_SLOT=/ {print $2; exit}')"
SEC_SLOT="$(printf "%s\n" "$UIM_ST" | awk -F= '/^SECONDARY_GW_SLOT=/ {print $2; exit}')" SEC_SLOT="$(printf "%s\n" "$UIM_ST" | awk -F= '/^SECONDARY_GW_SLOT=/ {print $2; exit}')"
PREF_SLOT="$(printf "%s\n" "$UIM_ST" | awk -F= '/^PREFERRED_SLOT=/ {print $2; exit}')" PREF_SLOT="$(printf "%s\n" "$UIM_ST" | awk -F= '/^PREFERRED_SLOT=/ {print $2; exit}')"
@@ -31,24 +37,29 @@ resolve_sim_state() {
} }
dial_number() { dial_number() {
# on pinephone if you attempt to make a call while in a call, modem crashes
if sxmo_modemcall.sh list_active_calls | grep -q .; then
sxmo_notify_user.sh "Cannot make call while in a call (for now)."
return 0
fi
NUMBER="$(printf "%s" "$1" | tr -cd '+0-9*#')" NUMBER="$(printf "%s" "$1" | tr -cd '+0-9*#')"
if [ -z "$NUMBER" ]; then if [ -z "$NUMBER" ]; then
return 1 return 1
fi fi
rm -f /tmp/sxmo_hangup_requested 2>/dev/null || true
# on pinephone if you attempt to make a call while in a call, modem crashes
if [ "$(cat /tmp/sxmo_active_call 2>/dev/null)" = "1" ] && sxmo_modemcall.sh list_active_calls | grep -q .; then
sxmo_notify_user.sh "Cannot make call while in a call (for now)."
return 0
fi
resolve_sim_state resolve_sim_state
[ -f /tmp/sxmo_hangup_requested ] && return 0
TARGET_SIM="$REQ_SIM_SLOT" TARGET_SIM="$REQ_SIM_SLOT"
# If 2 SIMs are active and no SIM was chosen yet, prompt via xcallscreen # If 2 SIMs are active and no SIM was chosen yet, prompt via xcallscreen
if [ -z "$TARGET_SIM" ] && [ "$DUAL_ACTIVE" = "1" ]; then if [ -z "$TARGET_SIM" ] && [ "$DUAL_ACTIVE" = "1" ]; then
if [ -p "/tmp/dwm_plugin_callscreen.fifo" ] && command -v xcallscreen >/dev/null 2>&1; then if [ -p "/tmp/dwm_plugin_callscreen.fifo" ]; then
printf "PROMPT_SIM %s\n" "$NUMBER" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true printf "PROMPT_SIM %s\n" "$NUMBER" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true
return 0
elif command -v xcallscreen >/dev/null 2>&1; then
xcallscreen >/dev/null 2>&1 || true xcallscreen >/dev/null 2>&1 || true
return 0 return 0
fi fi
@@ -65,39 +76,32 @@ dial_number() {
xcallscreen outgoing "-" "$NUMBER" >/dev/null 2>&1 || true xcallscreen outgoing "-" "$NUMBER" >/dev/null 2>&1 || true
fi fi
if ! CALLID="$(doas -n /usr/libexec/msm-modem-uim-selection call-dial "$TARGET_SIM" "$NUMBER" 2>/dev/null || /usr/libexec/msm-modem-uim-selection call-dial "$TARGET_SIM" "$NUMBER" 2>/dev/null)"; then if ! CALLID="$(doas -n /usr/libexec/msm-modem-uim-selection call-dial "$TARGET_SIM" "$NUMBER" 2>/dev/null || /usr/libexec/msm-modem-uim-selection call-dial "$TARGET_SIM" "$NUMBER" 2>/dev/null)"; then
if command -v xcallscreen >/dev/null 2>&1; then if [ ! -f /tmp/sxmo_hangup_requested ]; then
xcallscreen ended >/dev/null 2>&1 || true if command -v xcallscreen >/dev/null 2>&1; then
xcallscreen ended >/dev/null 2>&1 || true
fi
sxmo_notify_user.sh --urgency=critical "We failed to initiate call on SIM $TARGET_SIM"
return 1
fi fi
sxmo_notify_user.sh --urgency=critical "We failed to initiate call on SIM $TARGET_SIM" return 0
return 1 fi
if [ -f /tmp/sxmo_hangup_requested ]; then
doas -n /usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1 || true
return 0
fi fi
rm -f "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.terminated" \ rm -f "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.terminated" \
"$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.hangedupcall" \ "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.hangedupcall" \
"$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.discardedcall" 2>/dev/null || true "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.discardedcall" 2>/dev/null || true
touch "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.initiatedcall" touch "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.initiatedcall"
doas -n dbus-send --system --type=signal / org.ofono.VoiceCallManager.CallAdded >/dev/null 2>&1 || true if [ -p "/tmp/dwm_plugin_callscreen.fifo" ]; then
printf "OUTGOING %s %s SIM%s\n" "$CALLID" "$NUMBER" "$TARGET_SIM" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true
fi
sxmo_hook_dial.sh || true sxmo_hook_dial.sh || true
sxmo_modemaudio.sh setup_audio || true sxmo_modemaudio.sh setup_audio || true
if [ -p "/tmp/dwm_plugin_callscreen.fifo" ]; then
if [ -f "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.active" ]; then
printf "ACTIVE %s %s SIM%s\n" "$CALLID" "$NUMBER" "$TARGET_SIM" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true
else
printf "OUTGOING %s %s SIM%s\n" "$CALLID" "$NUMBER" "$TARGET_SIM" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true
fi
elif command -v xcallscreen >/dev/null 2>&1; then
xcallscreen outgoing "$CALLID" "$NUMBER" >/dev/null 2>&1 || true
fi
sxmo_hook_statusbar.sh state & sxmo_hook_statusbar.sh state &
return 0 return 0
fi fi
mm_state="$(mmcli -m any -K 2>/dev/null | awk -F':[[:space:]]*' '{gsub(/[[:space:]]+$/, "", $1); if ($1 == "modem.generic.state") {print $2; exit}}')"
if [ "$mm_state" = "disabled" ] || [ -z "$mm_state" ]; then
mmcli -m any -e >/dev/null 2>&1 || true
mmcli -m any --3gpp-register-home >/dev/null 2>&1 || true
sleep 1
fi
sxmo_log "Attempting to dial (SIM $TARGET_SIM): $NUMBER" sxmo_log "Attempting to dial (SIM $TARGET_SIM): $NUMBER"
if [ -p "/tmp/dwm_plugin_callscreen.fifo" ]; then if [ -p "/tmp/dwm_plugin_callscreen.fifo" ]; then
printf "OUTGOING - %s SIM%s\n" "$NUMBER" "$TARGET_SIM" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true printf "OUTGOING - %s SIM%s\n" "$NUMBER" "$TARGET_SIM" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true
@@ -105,20 +109,42 @@ dial_number() {
xcallscreen outgoing "-" "$NUMBER" >/dev/null 2>&1 || true xcallscreen outgoing "-" "$NUMBER" >/dev/null 2>&1 || true
fi fi
if ! CALLID="$( CALLID="$(
mmcli -m any --voice-create-call="number=$NUMBER" 2>/dev/null | mmcli -m any --voice-create-call="number=$NUMBER" 2>/dev/null |
grep -Eo "Call/[0-9]+" | grep -Eo "Call/[0-9]+" |
grep -oE "[0-9]+" grep -oE "[0-9]+" || true
)"; then )"
if command -v xcallscreen >/dev/null 2>&1; then if [ -z "$CALLID" ]; then
xcallscreen ended >/dev/null 2>&1 || true mmcli -m any -e >/dev/null 2>&1 || true
mmcli -m any --3gpp-register-home >/dev/null 2>&1 || true
sleep 1
[ -f /tmp/sxmo_hangup_requested ] && return 0
CALLID="$(
mmcli -m any --voice-create-call="number=$NUMBER" 2>/dev/null |
grep -Eo "Call/[0-9]+" |
grep -oE "[0-9]+" || true
)"
fi
if [ -z "$CALLID" ]; then
if [ ! -f /tmp/sxmo_hangup_requested ]; then
if command -v xcallscreen >/dev/null 2>&1; then
xcallscreen ended >/dev/null 2>&1 || true
fi
sxmo_notify_user.sh --urgency=critical "We failed to initiate call"
return 1
fi fi
sxmo_notify_user.sh --urgency=critical "We failed to initiate call" return 0
return 1 fi
if [ -f /tmp/sxmo_hangup_requested ]; then
mmcli -m any -o "$CALLID" --hangup >/dev/null 2>&1 || true
mmcli -m any --voice-delete-call="$CALLID" >/dev/null 2>&1 || true
return 0
fi fi
# cleanup all dangling event files, ignore errors # cleanup all dangling event files, ignore errors
rm "$XDG_RUNTIME_DIR/sxmo_calls/$CALLID."* 2>/dev/null || true rm -f "$XDG_RUNTIME_DIR/sxmo_calls/$CALLID."* 2>/dev/null || true
touch "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.initiatedcall"
sxmo_log "Starting call with CALLID: $CALLID" sxmo_log "Starting call with CALLID: $CALLID"
if [ -p "/tmp/dwm_plugin_callscreen.fifo" ]; then if [ -p "/tmp/dwm_plugin_callscreen.fifo" ]; then
printf "OUTGOING %s %s SIM%s\n" "$CALLID" "$NUMBER" "$TARGET_SIM" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true printf "OUTGOING %s %s SIM%s\n" "$CALLID" "$NUMBER" "$TARGET_SIM" > /tmp/dwm_plugin_callscreen.fifo 2>/dev/null || true
@@ -126,30 +152,35 @@ dial_number() {
xcallscreen outgoing "$CALLID" "$NUMBER" >/dev/null 2>&1 || true xcallscreen outgoing "$CALLID" "$NUMBER" >/dev/null 2>&1 || true
fi fi
if ! mmcli -m any -o "$CALLID" --start >/dev/null 2>&1; then
rm -f "$XDG_RUNTIME_DIR/sxmo_calls/$CALLID."* 2>/dev/null || true
mmcli -m any --voice-delete-call="$CALLID" >/dev/null 2>&1 || true
if [ ! -f /tmp/sxmo_hangup_requested ]; then
if command -v xcallscreen >/dev/null 2>&1; then
xcallscreen ended >/dev/null 2>&1 || true
fi
sxmo_notify_user.sh --urgency=critical "We failed to start the call"
return 1
fi
return 0
fi
if [ -f /tmp/sxmo_hangup_requested ]; then
mmcli -m any -o "$CALLID" --hangup >/dev/null 2>&1 || true
mmcli -m any --voice-delete-call="$CALLID" >/dev/null 2>&1 || true
rm -f "$XDG_RUNTIME_DIR/sxmo_calls/$CALLID."* 2>/dev/null || true
return 0
fi
{
mkdir -p "$SXMO_LOGDIR" &&
printf "%s\tcall_start\t%s\t[SIM %s]\n" "$(date +%FT%H:%M:%S%z)" "$NUMBER" "$TARGET_SIM" >> "$SXMO_LOGDIR/modemlog.tsv"
} 2>/dev/null || true
sxmo_log "Invoking dial hook" sxmo_log "Invoking dial hook"
sxmo_hook_dial.sh sxmo_hook_dial.sh || true
sxmo_modemaudio.sh setup_audio || true
if ! sxmo_modemaudio.sh setup_audio; then
if command -v xcallscreen >/dev/null 2>&1; then
xcallscreen ended >/dev/null 2>&1 || true
fi
sxmo_notify_user.sh --urgency=critical "We failed to setup call audio"
mmcli -m any --voice-delete-call="$CALLID"
return 1
fi
if ! sxmo_modemcall.sh pickup "$CALLID"; then
if command -v xcallscreen >/dev/null 2>&1; then
xcallscreen ended >/dev/null 2>&1 || true
fi
sxmo_modemaudio.sh reset_audio
mmcli -m any --voice-delete-call="$CALLID"
return 1
fi
sxmo_hook_statusbar.sh state & sxmo_hook_statusbar.sh state &
sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incall_menu
} }
dial_ussd() { dial_ussd() {
+4 -1
View File
@@ -70,8 +70,11 @@ mainloop() {
fi fi
while : ; do while : ; do
if [ "$(cat /tmp/sxmo_dsds_active 2>/dev/null || echo 0)" = "1" ]; then if [ "$(cat /tmp/sxmo_dsds_active 2>/dev/null || echo 0)" = "1" ]; then
doas -n /usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || \ if command -v doas >/dev/null 2>&1; then
doas -n /usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || true
else
/usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || true /usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || true
fi
sleep 10 sleep 10
else else
sleep 120 sleep 120
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -74,12 +74,12 @@ detect_qmicli_modem() {
return 0 return 0
fi fi
fi fi
if timeout 3 qmicli --silent -pd qrtr://0 --uim-noop >/dev/null 2>&1; then if timeout 3 qmicli --silent -d qrtr://0 --uim-noop >/dev/null 2>&1; then
QMICLI_MODEM="timeout 4 qmicli --silent -pd qrtr://0"
return 0
elif timeout 3 qmicli --silent -d qrtr://0 --uim-noop >/dev/null 2>&1; then
QMICLI_MODEM="timeout 4 qmicli --silent -d qrtr://0" QMICLI_MODEM="timeout 4 qmicli --silent -d qrtr://0"
return 0 return 0
elif timeout 3 qmicli --silent -pd qrtr://0 --uim-noop >/dev/null 2>&1; then
QMICLI_MODEM="timeout 4 qmicli --silent -pd qrtr://0"
return 0
elif [ -e "/dev/modem" ]; then elif [ -e "/dev/modem" ]; then
if timeout 3 qmicli --silent -pd /dev/modem --uim-noop >/dev/null 2>&1; then if timeout 3 qmicli --silent -pd /dev/modem --uim-noop >/dev/null 2>&1; then
QMICLI_MODEM="timeout 4 qmicli --silent -pd /dev/modem" QMICLI_MODEM="timeout 4 qmicli --silent -pd /dev/modem"
@@ -938,7 +938,7 @@ PY
fi fi
SIM_WAIT_TIME=2 SIM_WAIT_TIME=2
provision_slot "$target" 4 provision_slot "$target" 4
pkill -f "msm-modem-uim-selection dsds-daemon" 2>/dev/null || true pkill -f "dsds-daemon" 2>/dev/null || true
if [ "${3:-}" = "--swap-gw" ]; then if [ "${3:-}" = "--swap-gw" ]; then
spawn_enable_and_register "$target" 2 spawn_enable_and_register "$target" 2
else else
@@ -1929,22 +1929,108 @@ PY
exit $? exit $?
;; ;;
slots)
python3 - "$PREFERRED_SIM_SLOT" << 'PY'
import select, socket, struct, sys
pref_slot = int(sys.argv[1]) if len(sys.argv) > 1 and sys.argv[1].isdigit() else 1
prim_slot = pref_slot
sec_slot = 0
slot1_present = 0
slot2_present = 0
AF_QIPCRTR = 42
QRTR_PORT_CTRL = 0xfffffffe
QRTR_TYPE_NEW_SERVER = 4
QRTR_TYPE_NEW_LOOKUP = 10
QMI_SERVICE_UIM = 11
try:
ls = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
node, _ = ls.getsockname()
ls.sendto(struct.pack("<IIIII", QRTR_TYPE_NEW_LOOKUP, QMI_SERVICE_UIM, 0, 0, 0), (node, QRTR_PORT_CTRL))
u_addr = None
while True:
r, _, _ = select.select([ls], [], [], 0.08)
if not r:
break
data, _ = ls.recvfrom(256)
if len(data) >= 20:
cmd, srv, inst, srv_node, srv_port = struct.unpack("<IIIII", data[:20])
if cmd == QRTR_TYPE_NEW_SERVER:
if srv == QMI_SERVICE_UIM and srv_port != 0:
u_addr = (srv_node, srv_port)
if srv == 0 and srv_node == 0 and srv_port == 0:
break
ls.close()
if u_addr:
us = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
us.sendto(struct.pack("<BHHH", 0x00, 1, 0x002F, 0), u_addr)
r, _, _ = select.select([us], [], [], 0.1)
if r:
resp, _ = us.recvfrom(2048)
pos = 7
while pos + 3 <= len(resp):
tt, tl = struct.unpack("<BH", resp[pos:pos+3])
pos += 3
val = resp[pos:pos+tl]
pos += tl
if tt == 0x10 and len(val) >= 9:
gw_pri, _, gw_sec, _ = struct.unpack("<HHHH", val[:8])
if gw_pri != 0xFFFF:
prim_slot = ((gw_pri >> 8) & 0xFF) + 1
if gw_sec != 0xFFFF:
sec_slot = ((gw_sec >> 8) & 0xFF) + 1
num_slots = val[8]
off = 9
for s in range(min(num_slots, 2)):
if off + 6 > len(val):
break
cstate = val[off]
if s == 0 and cstate == 1:
slot1_present = 1
elif s == 1 and cstate == 1:
slot2_present = 1
num_apps = val[off + 5]
off += 6
for _ in range(num_apps):
if off + 7 > len(val):
break
aid_len = val[off + 6]
if off + 14 + aid_len > len(val):
break
off += 14 + aid_len
us.close()
except Exception:
pass
dual_active = 1 if (slot1_present and slot2_present and prim_slot in (1, 2) and sec_slot in (1, 2)) else 0
out = (
f"PREFERRED_SLOT={pref_slot}\n"
f"PRIMARY_GW_SLOT={prim_slot}\n"
f"SECONDARY_GW_SLOT={sec_slot}\n"
f"SLOT1_PRESENT={slot1_present}\n"
f"SLOT2_PRESENT={slot2_present}\n"
f"DUAL_SIM_ACTIVE={dual_active}\n"
)
sys.stdout.write(out)
try:
with open("/tmp/sxmo_sim_slots", "w") as f:
f.write(out)
except Exception:
pass
PY
exit 0
;;
call-dial|call-accept|call-hangup|call-dtmf|call-list) call-dial|call-accept|call-hangup|call-dtmf|call-list)
sub_cmd="$cmd" sub_cmd="$cmd"
arg1="${2:-}" arg1="${2:-}"
arg2="${3:-}" arg2="${3:-}"
prim_slot="$PREFERRED_SIM_SLOT" prim_slot="$PREFERRED_SIM_SLOT"
sec_slot="0" sec_slot="0"
if detect_qmicli_modem; then
QMI_CARDS="$($QMICLI_MODEM --uim-get-card-status 2>/dev/null || true)"
if [ -n "$QMI_CARDS" ]; then
eval "$(parse_uim_card_status "$QMI_CARDS" "$PREFERRED_SIM_SLOT")"
prim_slot="${PRIMARY_GW_SLOT:-$PREFERRED_SIM_SLOT}"
sec_slot="${SECONDARY_GW_SLOT:-0}"
fi
fi
python3 - "$sub_cmd" "$arg1" "$arg2" "$prim_slot" "$sec_slot" << 'PY' python3 - "$sub_cmd" "$arg1" "$arg2" "$prim_slot" "$sec_slot" << 'PY'
import os, select, socket, struct, sys import os, select, socket, struct, sys, time
sub_cmd = sys.argv[1] sub_cmd = sys.argv[1]
arg1 = sys.argv[2] arg1 = sys.argv[2]
@@ -1957,27 +2043,57 @@ QRTR_PORT_CTRL = 0xfffffffe
QRTR_TYPE_NEW_SERVER = 4 QRTR_TYPE_NEW_SERVER = 4
QRTR_TYPE_NEW_LOOKUP = 10 QRTR_TYPE_NEW_LOOKUP = 10
QMI_SERVICE_VOICE = 9 QMI_SERVICE_VOICE = 9
QMI_SERVICE_UIM = 11
ls = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM) def lookup_qmi_service(srv_id):
node, _ = ls.getsockname() ls = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
ls.sendto(struct.pack("<IIIII", QRTR_TYPE_NEW_LOOKUP, QMI_SERVICE_VOICE, 0, 0, 0), (node, QRTR_PORT_CTRL)) node, _ = ls.getsockname()
v_addr = None ls.sendto(struct.pack("<IIIII", QRTR_TYPE_NEW_LOOKUP, srv_id, 0, 0, 0), (node, QRTR_PORT_CTRL))
while True: addr = None
r, _, _ = select.select([ls], [], [], 0.15) while True:
if not r: r, _, _ = select.select([ls], [], [], 0.08)
break if not r:
data, _ = ls.recvfrom(256) break
if len(data) >= 20: data, _ = ls.recvfrom(256)
cmd, srv, inst, srv_node, srv_port = struct.unpack("<IIIII", data[:20]) if len(data) >= 20:
if cmd == QRTR_TYPE_NEW_SERVER: cmd, srv, inst, srv_node, srv_port = struct.unpack("<IIIII", data[:20])
if srv == QMI_SERVICE_VOICE and srv_port != 0: if cmd == QRTR_TYPE_NEW_SERVER:
v_addr = (srv_node, srv_port) if srv == srv_id and srv_port != 0:
if srv == 0 and srv_node == 0 and srv_port == 0: addr = (srv_node, srv_port)
break if srv == 0 and srv_node == 0 and srv_port == 0:
ls.close() break
ls.close()
return addr
v_addr = lookup_qmi_service(QMI_SERVICE_VOICE)
if not v_addr: if not v_addr:
sys.exit(1) sys.exit(1)
if sub_cmd in ("call-dial", "call-list"):
u_addr = lookup_qmi_service(QMI_SERVICE_UIM)
if u_addr:
try:
us = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
us.sendto(struct.pack("<BHHH", 0x00, 1, 0x002F, 0), u_addr)
r, _, _ = select.select([us], [], [], 0.08)
if r:
resp, _ = us.recvfrom(2048)
pos = 7
while pos + 3 <= len(resp):
tt, tl = struct.unpack("<BH", resp[pos:pos+3])
pos += 3
val = resp[pos:pos+tl]
pos += tl
if tt == 0x10 and len(val) >= 8:
gw_pri, _, gw_sec, _ = struct.unpack("<HHHH", val[:8])
if gw_pri != 0xFFFF:
prim_slot = ((gw_pri >> 8) & 0xFF) + 1
if gw_sec != 0xFFFF:
sec_slot = ((gw_sec >> 8) & 0xFF) + 1
us.close()
except Exception:
pass
def parse_tlvs(resp): def parse_tlvs(resp):
res = {} res = {}
pos = 7 pos = 7
@@ -2040,7 +2156,15 @@ STATE_MAP = {
10: "setup", 10: "setup",
} }
def is_hangup_requested():
try:
return (time.time() - os.path.getmtime("/tmp/sxmo_hangup_requested")) < 3.5
except Exception:
return False
if sub_cmd == "call-dial": if sub_cmd == "call-dial":
if is_hangup_requested():
sys.exit(1)
req_slot = int(arg1) if arg1.isdigit() else prim_slot req_slot = int(arg1) if arg1.isdigit() else prim_slot
sub = 1 if (req_slot == sec_slot and sec_slot != 0) else 0 sub = 1 if (req_slot == sec_slot and sec_slot != 0) else 0
num = "".join(c for c in arg2 if c in "+0123456789*#").encode("ascii") num = "".join(c for c in arg2 if c in "+0123456789*#").encode("ascii")
@@ -2057,12 +2181,21 @@ if sub_cmd == "call-dial":
s = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM) s = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
qmi_req(s, 1, 0x0044, struct.pack("<BHB", 0x01, 1, sub)) qmi_req(s, 1, 0x0044, struct.pack("<BHB", 0x01, 1, sub))
tlvs = qmi_req(s, 2, 0x0020, struct.pack("<BH", 0x01, len(num)) + num, timeout=5.0) tlvs = qmi_req(s, 2, 0x0020, struct.pack("<BH", 0x01, len(num)) + num, timeout=5.0)
s.close()
res_tlv = tlvs.get(0x02, b"") res_tlv = tlvs.get(0x02, b"")
cid = tlvs.get(0x10, b"\x01")[0]
if is_hangup_requested():
qmi_req(s, 3, 0x0021, struct.pack("<BHB", 0x01, 1, cid), timeout=0.5)
s.close()
try:
if os.path.exists(dial_marker):
os.remove(dial_marker)
except Exception:
pass
sys.exit(1)
s.close()
if len(res_tlv) >= 4 and struct.unpack("<HH", res_tlv[:4]) == (0, 0): if len(res_tlv) >= 4 and struct.unpack("<HH", res_tlv[:4]) == (0, 0):
import subprocess import subprocess
subprocess.run(["dbus-send", "--system", "--type=signal", "/", "org.ofono.VoiceCallManager.CallAdded"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.run(["dbus-send", "--system", "--type=signal", "/", "org.ofono.VoiceCallManager.CallAdded"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
cid = tlvs.get(0x10, b"\x01")[0]
prefix = f"sub{sub}_" prefix = f"sub{sub}_"
try: try:
cid_marker = os.path.join(calls_dir, f"{prefix}{cid}.initiatedcall") cid_marker = os.path.join(calls_dir, f"{prefix}{cid}.initiatedcall")
@@ -2088,17 +2221,25 @@ elif sub_cmd in ("call-accept", "call-hangup", "call-dtmf"):
txn = 1 txn = 1
for sub in (1, 0): for sub in (1, 0):
s = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM) s = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
qmi_req(s, txn, 0x0044, struct.pack("<BHB", 0x01, 1, sub)) qmi_req(s, txn, 0x0044, struct.pack("<BHB", 0x01, 1, sub), timeout=0.4)
txn += 1 txn += 1
calls = parse_call_info(qmi_req(s, txn, 0x002F)) calls = parse_call_info(qmi_req(s, txn, 0x002F, timeout=0.5))
txn += 1 txn += 1
ended_on_sub = False
for cid, c in calls.items(): for cid, c in calls.items():
if c["state"] not in (8, 9): if c["state"] not in (8, 9):
tlvs = qmi_req(s, txn, 0x0021, struct.pack("<BHB", 0x01, 1, cid)) tlvs = qmi_req(s, txn, 0x0021, struct.pack("<BHB", 0x01, 1, cid), timeout=0.5)
txn += 1 txn += 1
ended_on_sub = True
res_tlv = tlvs.get(0x02, b"") res_tlv = tlvs.get(0x02, b"")
if len(res_tlv) >= 4 and struct.unpack("<HH", res_tlv[:4]) == (0, 0): if len(res_tlv) >= 4 and struct.unpack("<HH", res_tlv[:4]) == (0, 0):
any_ended = True any_ended = True
if not ended_on_sub:
tlvs = qmi_req(s, txn, 0x0021, struct.pack("<BHB", 0x01, 1, 1), timeout=0.3)
txn += 1
res_tlv = tlvs.get(0x02, b"")
if len(res_tlv) >= 4 and struct.unpack("<HH", res_tlv[:4]) == (0, 0):
any_ended = True
s.close() s.close()
if any_ended: if any_ended:
subprocess.run(["dbus-send", "--system", "--type=signal", "/", "org.ofono.VoiceCallManager.CallRemoved"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.run(["dbus-send", "--system", "--type=signal", "/", "org.ofono.VoiceCallManager.CallRemoved"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
@@ -2124,9 +2265,10 @@ elif sub_cmd in ("call-accept", "call-hangup", "call-dtmf"):
target_cid = int(arg1) target_cid = int(arg1)
s = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM) s = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
qmi_req(s, 1, 0x0044, struct.pack("<BHB", 0x01, 1, target_sub)) qmi_req(s, 1, 0x0044, struct.pack("<BHB", 0x01, 1, target_sub), timeout=0.4)
calls = parse_call_info(qmi_req(s, 2, 0x002F)) calls = parse_call_info(qmi_req(s, 2, 0x002F, timeout=0.5))
if target_cid == 0 or (sub_cmd == "call-hangup" and target_cid not in calls): if target_cid == 0 or (sub_cmd == "call-hangup" and target_cid not in calls):
fallback_cid = target_cid if target_cid > 0 else 1
target_cid = 0 target_cid = 0
for cid, c in calls.items(): for cid, c in calls.items():
if sub_cmd == "call-accept" and c["state"] in (2, 7): if sub_cmd == "call-accept" and c["state"] in (2, 7):
@@ -2135,6 +2277,8 @@ elif sub_cmd in ("call-accept", "call-hangup", "call-dtmf"):
elif sub_cmd != "call-accept" and c["state"] not in (8, 9): elif sub_cmd != "call-accept" and c["state"] not in (8, 9):
target_cid = cid target_cid = cid
break break
if target_cid == 0 and sub_cmd == "call-hangup":
target_cid = fallback_cid
if target_cid == 0: if target_cid == 0:
s.close() s.close()
sys.exit(1) sys.exit(1)
@@ -2175,8 +2319,18 @@ PY
;; ;;
dsds-daemon) dsds-daemon)
exec python3 - << 'PY' exec python3 - dsds-daemon << 'PY'
import datetime, os, select, socket, struct, subprocess, sys, time import datetime, fcntl, os, select, socket, struct, subprocess, sys, time
lock_fd = open("/tmp/dsds_daemon.lock", "w")
try:
fcntl.flock(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except Exception:
sys.exit(0)
try:
os.chmod("/tmp/dsds_daemon.lock", 0o666)
except Exception:
pass
try: try:
while os.waitpid(-1, os.WNOHANG)[0] > 0: while os.waitpid(-1, os.WNOHANG)[0] > 0:
@@ -2776,9 +2930,44 @@ def has_mm_call_files():
pass pass
return False return False
def sync_sub1_calls(calls, sim_slot): def is_hangup_requested():
try:
return (time.time() - os.path.getmtime("/tmp/sxmo_hangup_requested")) < 3.5
except Exception:
return False
def query_sec_slot(uim_addr, fallback=2):
if not uim_addr:
return fallback
try:
us = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
ut = qmi_req(us, uim_addr, 1, 0x002F, timeout=0.08)
us.close()
st_val = ut.get(0x10, b"")
if len(st_val) >= 8:
_, _, sec_gw_idx, _ = struct.unpack("<HHHH", st_val[:8])
if sec_gw_idx != 0xFFFF:
return ((sec_gw_idx >> 8) & 0xFF) + 1
except Exception:
pass
return fallback
def sync_sub1_calls(calls, sim_slot, vs=None, voice_addr=None):
global active_calls global active_calls
now_str = datetime.datetime.now().astimezone().isoformat(timespec="seconds") now_str = datetime.datetime.now().astimezone().isoformat(timespec="seconds")
hangup_req = is_hangup_requested()
sent_ended = False
if hangup_req:
for cid, c in list(calls.items()):
if c["state"] not in (8, 9):
if vs is not None and voice_addr is not None:
try:
qmi_req(vs, voice_addr, 55000 + (cid % 100), 0x0021, struct.pack("<BHB", 0x01, 1, cid), timeout=0.2)
except Exception:
pass
c["state"] = 9
for old_cid, old_info in list(active_calls.items()): for old_cid, old_info in list(active_calls.items()):
if old_cid not in calls: if old_cid not in calls:
if old_info.get("state") == "terminated": if old_info.get("state") == "terminated":
@@ -2794,14 +2983,14 @@ def sync_sub1_calls(calls, sim_slot):
for cid, c in list(calls.items()): for cid, c in list(calls.items()):
st = STATE_MAP.get(c["state"], "unknown") st = STATE_MAP.get(c["state"], "unknown")
if st == "setup": if st == "setup":
if c["dir"] == 1 and has_sub1_call_files(): if c["dir"] == 1 and has_sub1_call_files() and not hangup_req:
st = "dialing" st = "dialing"
else: else:
continue continue
# Skip calls that are already managed by ModemManager / sxmo_modem.sh on Primary GW # Skip calls that are already managed by ModemManager / sxmo_modem.sh on Primary GW
if cid not in active_calls: if cid not in active_calls:
if st == "terminated": if st == "terminated" or hangup_req:
continue continue
if c["dir"] == 1 and not has_sub1_call_files(): if c["dir"] == 1 and not has_sub1_call_files():
continue continue
@@ -2824,7 +3013,7 @@ def sync_sub1_calls(calls, sim_slot):
os.remove(os.path.join(CALLS_DIR, fn)) os.remove(os.path.join(CALLS_DIR, fn))
except Exception: except Exception:
pass pass
if st != "terminated": if st != "terminated" and not hangup_req:
try: try:
open(os.path.join(CALLS_DIR, f"{call_key}.{st}"), "w").close() open(os.path.join(CALLS_DIR, f"{call_key}.{st}"), "w").close()
chown_user(os.path.join(CALLS_DIR, f"{call_key}.{st}")) chown_user(os.path.join(CALLS_DIR, f"{call_key}.{st}"))
@@ -2863,7 +3052,9 @@ def sync_sub1_calls(calls, sim_slot):
stop_ringing_user() stop_ringing_user()
evt = "call_missed" if prev == "ringing-in" else "call_hangup" evt = "call_missed" if prev == "ringing-in" else "call_hangup"
append_modemlog(f"{now_str}\t{evt}\t{num}\t[SIM {sim_slot}]\n") append_modemlog(f"{now_str}\t{evt}\t{num}\t[SIM {sim_slot}]\n")
send_fifo("/tmp/dwm_plugin_callscreen.fifo", "ENDED CALL ENDED") if not hangup_req:
send_fifo("/tmp/dwm_plugin_callscreen.fifo", "ENDED CALL ENDED")
sent_ended = True
has_live = any(v["state"] in ("dialing", "ringing-out", "active", "held", "ringing-in", "waiting") for v in active_calls.values()) has_live = any(v["state"] in ("dialing", "ringing-out", "active", "held", "ringing-in", "waiting") for v in active_calls.values())
if not has_live: if not has_live:
@@ -2877,7 +3068,8 @@ def sync_sub1_calls(calls, sim_slot):
pass pass
if removed_stale: if removed_stale:
stop_ringing_user() stop_ringing_user()
send_fifo("/tmp/dwm_plugin_callscreen.fifo", "ENDED CALL ENDED") if not sent_ended and not hangup_req:
send_fifo("/tmp/dwm_plugin_callscreen.fifo", "ENDED CALL ENDED")
if audio_opened: if audio_opened:
set_q6voiced_audio(False) set_q6voiced_audio(False)
@@ -2889,16 +3081,7 @@ while True:
time.sleep(3) time.sleep(3)
continue continue
sec_slot = 2 sec_slot = query_sec_slot(uim_addr, 2)
if uim_addr:
us = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
ut = qmi_req(us, uim_addr, 1, 0x002F)
us.close()
st_val = ut.get(0x10, b"")
if len(st_val) >= 8:
_, _, sec_gw_idx, _ = struct.unpack("<HHHH", st_val[:8])
if sec_gw_idx != 0xFFFF:
sec_slot = ((sec_gw_idx >> 8) & 0xFF) + 1
ws = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM) ws = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
vs = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM) vs = socket.socket(AF_QIPCRTR, socket.SOCK_DGRAM)
@@ -2955,6 +3138,7 @@ while True:
continue continue
tlvs = parse_tlvs(pkt) tlvs = parse_tlvs(pkt)
if sock is ws and mid == 0x0001: if sock is ws and mid == 0x0001:
sec_slot = query_sec_slot(uim_addr, sec_slot)
# WMSEventReport indication # WMSEventReport indication
if 0x11 in tlvs and len(tlvs[0x11]) >= 8: if 0x11 in tlvs and len(tlvs[0x11]) >= 8:
# Transfer-route MT message: [ack_ind(1), txn_id(4), format(1), len(2), data...] # Transfer-route MT message: [ack_ind(1), txn_id(4), format(1), len(2), data...]
@@ -2980,6 +3164,7 @@ while True:
elif sock is vs and mid == 0x002E: elif sock is vs and mid == 0x002E:
# VoiceAllCallStatusIndication # VoiceAllCallStatusIndication
got_voice_ind = True got_voice_ind = True
sec_slot = query_sec_slot(uim_addr, sec_slot)
calls = parse_call_info(tlvs) calls = parse_call_info(tlvs)
if not any(c["num"] for c in calls.values()): if not any(c["num"] for c in calls.values()):
full_tlvs = qmi_req(vs, voice_addr, v_txn, 0x002F) full_tlvs = qmi_req(vs, voice_addr, v_txn, 0x002F)
@@ -2988,17 +3173,18 @@ while True:
for cid, fc in full_calls.items(): for cid, fc in full_calls.items():
if cid in calls and fc["num"]: if cid in calls and fc["num"]:
calls[cid]["num"] = fc["num"] calls[cid]["num"] = fc["num"]
sync_sub1_calls(calls, sec_slot) sync_sub1_calls(calls, sec_slot, vs, voice_addr)
if multipart_buf: if multipart_buf:
w_txn = poll_stored_sms(ws, wms_addr, w_txn, sec_slot) w_txn = poll_stored_sms(ws, wms_addr, w_txn, sec_slot)
w_txn = flush_stale_multipart(ws, wms_addr, w_txn, sec_slot) w_txn = flush_stale_multipart(ws, wms_addr, w_txn, sec_slot)
if not got_voice_ind and (active_calls or has_sub1_call_files()): if not got_voice_ind and (active_calls or has_sub1_call_files()):
sec_slot = query_sec_slot(uim_addr, sec_slot)
full_tlvs = qmi_req(vs, voice_addr, v_txn, 0x002F) full_tlvs = qmi_req(vs, voice_addr, v_txn, 0x002F)
v_txn = (v_txn % 60000) + 1 v_txn = (v_txn % 60000) + 1
if full_tlvs: if full_tlvs:
sync_sub1_calls(parse_call_info(full_tlvs), sec_slot) sync_sub1_calls(parse_call_info(full_tlvs), sec_slot, vs, voice_addr)
if not os.path.exists("/tmp/bananarchy_screen_locked") and time.time() - last_poll >= 600.0: if not os.path.exists("/tmp/bananarchy_screen_locked") and time.time() - last_poll >= 600.0:
w_txn = poll_stored_sms(ws, wms_addr, w_txn, sec_slot) w_txn = poll_stored_sms(ws, wms_addr, w_txn, sec_slot)
@@ -3,8 +3,4 @@
# This script is executed after the last call finished # This script is executed after the last call finished
if command -v xcallscreen >/dev/null 2>&1; then
xcallscreen ended >/dev/null 2>&1 || true
fi
sxmo_playerctl.sh resume_all sxmo_playerctl.sh resume_all
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -547,12 +547,12 @@ int calllog_run_main(int argc, char** argv) {
if (!selNum.empty()) { if (!selNum.empty()) {
mode = ViewMode::Log; mode = ViewMode::Log;
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
placePhoneCall(selNum);
XUngrabKeyboard(dpy, CurrentTime); XUngrabKeyboard(dpy, CurrentTime);
XUnmapWindow(dpy, win); XUnmapWindow(dpy, win);
XFlush(dpy); XFlush(dpy);
::unlink(activePidPath.c_str()); ::unlink(activePidPath.c_str());
visible = false; visible = false;
placePhoneCall(selNum);
} }
break; break;
} }
@@ -1007,8 +1007,8 @@ int calllog_run_main(int argc, char** argv) {
selected < static_cast<int>(filtered.size())) { selected < static_cast<int>(filtered.size())) {
std::string num = filtered[selected].number; std::string num = filtered[selected].number;
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
hideWindow(true);
placePhoneCall(num); placePhoneCall(num);
hideWindow(false);
} else if (filtered.empty()) { } else if (filtered.empty()) {
if (filterTab == 4) { if (filterTab == 4) {
blockList.load(); blockList.load();
+292 -40
View File
@@ -484,6 +484,7 @@ int callscreen_run_main(int argc, char** argv) {
int64_t callStartMs = 0; int64_t callStartMs = 0;
int64_t endedAtMs = 0; int64_t endedAtMs = 0;
int64_t lastHangupMs = 0;
int lastFinalDurationSec = 0; int lastFinalDurationSec = 0;
int64_t lastModemPollMs = 0; int64_t lastModemPollMs = 0;
@@ -860,7 +861,9 @@ int callscreen_run_main(int argc, char** argv) {
if (callState == CallState::Incoming) { if (callState == CallState::Incoming) {
writeIntFile("/tmp/sxmo_call_ringing", 1); writeIntFile("/tmp/sxmo_call_ringing", 1);
writeIntFile("/tmp/sxmo_active_call", 1); writeIntFile("/tmp/sxmo_active_call", 1);
} else if (callState == CallState::Outgoing || callState == CallState::Active) { } else if (callState == CallState::SelectSim ||
callState == CallState::Outgoing ||
callState == CallState::Active) {
::unlink("/tmp/sxmo_call_ringing"); ::unlink("/tmp/sxmo_call_ringing");
writeIntFile("/tmp/sxmo_active_call", 2); writeIntFile("/tmp/sxmo_active_call", 2);
} else { } else {
@@ -1422,6 +1425,7 @@ int callscreen_run_main(int argc, char** argv) {
} }
endReason = reason.empty() ? "CALL ENDED" : reason; endReason = reason.empty() ? "CALL ENDED" : reason;
callState = CallState::Ended; callState = CallState::Ended;
callId.clear();
endedAtMs = nowMs(); endedAtMs = nowMs();
dtmfMode = false; dtmfMode = false;
ringMuted = false; ringMuted = false;
@@ -1465,7 +1469,168 @@ int callscreen_run_main(int argc, char** argv) {
"sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1"); "sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1");
}; };
auto hangupQmiVoiceCallsNow = [&]() {
constexpr int kAfQipcrtr = 42;
constexpr uint32_t kQrtrPortCtrl = 0xfffffffeu;
constexpr uint32_t kQrtrTypeNewServer = 4;
constexpr uint32_t kQrtrTypeNewLookup = 10;
constexpr uint32_t kQmiServiceVoice = 9;
struct SockAddrQrtr {
unsigned short sq_family;
uint32_t sq_node;
uint32_t sq_port;
};
struct QrtrCtrlPkt {
uint32_t cmd;
uint32_t service;
uint32_t instance;
uint32_t node;
uint32_t port;
} __attribute__((packed));
int lfd = ::socket(kAfQipcrtr, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (lfd < 0) {
return;
}
SockAddrQrtr localSq {};
socklen_t sl = sizeof(localSq);
if (::getsockname(lfd, reinterpret_cast<struct sockaddr*>(&localSq), &sl) < 0) {
::close(lfd);
return;
}
SockAddrQrtr ctrlSq { kAfQipcrtr, localSq.sq_node, kQrtrPortCtrl };
QrtrCtrlPkt lookup { kQrtrTypeNewLookup, kQmiServiceVoice, 0, 0, 0 };
if (::sendto(lfd, &lookup, sizeof(lookup), 0,
reinterpret_cast<const struct sockaddr*>(&ctrlSq),
sizeof(ctrlSq)) < 0) {
::close(lfd);
return;
}
uint32_t vNode = 0, vPort = 0;
bool foundSrv = false;
for (int i = 0; i < 8; ++i) {
struct pollfd pfd { lfd, POLLIN, 0 };
if (::poll(&pfd, 1, 30) <= 0) break;
QrtrCtrlPkt pkt {};
ssize_t n = ::recv(lfd, &pkt, sizeof(pkt), 0);
if (n >= static_cast<ssize_t>(sizeof(pkt)) && pkt.cmd == kQrtrTypeNewServer) {
if (pkt.service == kQmiServiceVoice && pkt.port != 0) {
vNode = pkt.node;
vPort = pkt.port;
foundSrv = true;
break;
}
if (pkt.service == 0 && pkt.node == 0 && pkt.port == 0) break;
}
}
::close(lfd);
if (!foundSrv) {
return;
}
SockAddrQrtr vSq { kAfQipcrtr, vNode, vPort };
for (int sub : {1, 0}) {
int sfd = ::socket(kAfQipcrtr, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (sfd < 0) continue;
uint8_t bindReq[11] = {
0x00, 0x01, 0x00, 0x44, 0x00, 0x04, 0x00,
0x01, 0x01, 0x00, static_cast<uint8_t>(sub)
};
::sendto(sfd, bindReq, sizeof(bindReq), 0,
reinterpret_cast<const struct sockaddr*>(&vSq), sizeof(vSq));
struct pollfd pfd { sfd, POLLIN, 0 };
int64_t bindDeadline = nowMs() + 60;
while (nowMs() < bindDeadline) {
int waitMs = static_cast<int>(std::max<int64_t>(2, bindDeadline - nowMs()));
if (::poll(&pfd, 1, waitMs) <= 0) break;
uint8_t tmp[512];
ssize_t rlen = ::recv(sfd, tmp, sizeof(tmp), 0);
if (rlen >= 7 && tmp[0] == 0x02 && tmp[1] == 0x01 && tmp[2] == 0x00 &&
tmp[3] == 0x44 && tmp[4] == 0x00) {
break;
}
}
uint8_t infoReq[7] = { 0x00, 0x02, 0x00, 0x2F, 0x00, 0x00, 0x00 };
::sendto(sfd, infoReq, sizeof(infoReq), 0,
reinterpret_cast<const struct sockaddr*>(&vSq), sizeof(vSq));
std::vector<uint8_t> cidsToHangup;
int64_t infoDeadline = nowMs() + 80;
while (nowMs() < infoDeadline) {
int waitMs = static_cast<int>(std::max<int64_t>(2, infoDeadline - nowMs()));
if (::poll(&pfd, 1, waitMs) <= 0) break;
uint8_t buf[1024];
ssize_t rlen = ::recv(sfd, buf, sizeof(buf), 0);
if (rlen >= 7 && buf[0] == 0x02 && buf[1] == 0x02 && buf[2] == 0x00 &&
buf[3] == 0x2F && buf[4] == 0x00) {
const uint8_t* rawCi01 = nullptr;
uint16_t lenCi01 = 0;
const uint8_t* rawCi10 = nullptr;
uint16_t lenCi10 = 0;
size_t pos = 7;
while (pos + 3 <= static_cast<size_t>(rlen)) {
uint8_t tt = buf[pos];
uint16_t tl = static_cast<uint16_t>(buf[pos + 1]) |
(static_cast<uint16_t>(buf[pos + 2]) << 8);
pos += 3;
if (pos + tl > static_cast<size_t>(rlen)) break;
if (tt == 0x01) {
rawCi01 = buf + pos;
lenCi01 = tl;
} else if (tt == 0x10) {
rawCi10 = buf + pos;
lenCi10 = tl;
}
pos += tl;
}
const uint8_t* rawCi = rawCi01 ? rawCi01 : rawCi10;
uint16_t lenCi = rawCi01 ? lenCi01 : lenCi10;
if (rawCi && lenCi >= 1) {
uint8_t cnt = rawCi[0];
size_t off = 1;
for (uint8_t i = 0; i < cnt && off + 7 <= lenCi; ++i, off += 7) {
uint8_t cid = rawCi[off];
uint8_t cstate = rawCi[off + 1];
if (cstate != 8 && cstate != 9 && cid > 0) {
cidsToHangup.push_back(cid);
}
}
}
break;
}
}
if (cidsToHangup.empty()) {
cidsToHangup.push_back(1);
}
uint8_t txn = 3;
for (uint8_t cid : cidsToHangup) {
uint8_t endReq[11] = {
0x00, txn, 0x00, 0x21, 0x00, 0x04, 0x00,
0x01, 0x01, 0x00, cid
};
::sendto(sfd, endReq, sizeof(endReq), 0,
reinterpret_cast<const struct sockaddr*>(&vSq), sizeof(vSq));
int64_t endDeadline = nowMs() + 50;
while (nowMs() < endDeadline) {
int waitMs = static_cast<int>(std::max<int64_t>(2, endDeadline - nowMs()));
if (::poll(&pfd, 1, waitMs) <= 0) break;
uint8_t tmp[512];
ssize_t rlen = ::recv(sfd, tmp, sizeof(tmp), 0);
if (rlen >= 7 && tmp[0] == 0x02 && tmp[1] == txn && tmp[2] == 0x00 &&
tmp[3] == 0x21 && tmp[4] == 0x00) {
break;
}
}
++txn;
}
::close(sfd);
}
};
auto hangupCall = [&](bool closeImmediately = false) { auto hangupCall = [&](bool closeImmediately = false) {
lastHangupMs = nowMs();
writeIntFile("/tmp/sxmo_hangup_requested", 1);
std::string cid = resolveActiveModemCallId(); std::string cid = resolveActiveModemCallId();
bool wasIncoming = (callState == CallState::Incoming); bool wasIncoming = (callState == CallState::Incoming);
stopRingingJobs(); stopRingingJobs();
@@ -1473,12 +1638,34 @@ int callscreen_run_main(int argc, char** argv) {
sendPluginCommand("sip", "CALL_HANGUP " + cid); sendPluginCommand("sip", "CALL_HANGUP " + cid);
} else if (cid.rfind("tox:", 0) == 0 || activeSimSlot == 4) { } else if (cid.rfind("tox:", 0) == 0 || activeSimSlot == 4) {
sendPluginCommand("tox", "CALL_HANGUP " + cid); sendPluginCommand("tox", "CALL_HANGUP " + cid);
} else if (!cid.empty() && cid != "-" && cid != "sim" && cid != "test") {
runAsyncArgv("sxmo_modemcall.sh", "hangup", cid.c_str());
} else { } else {
runAsyncArgv("sxmo_modemcall.sh", "hangup", "all"); hangupQmiVoiceCallsNow();
sendPluginCommand("sip", "CALL_HANGUP"); std::string callsDir = getRuntimeFile("sxmo_calls");
sendPluginCommand("tox", "CALL_HANGUP"); DIR* d = ::opendir(callsDir.c_str());
if (d) {
struct dirent* ent;
while ((ent = ::readdir(d)) != nullptr) {
if (ent->d_name[0] != '.' && ent->d_name[0] != '\0') {
std::string fn(ent->d_name);
if (fn.rfind("sub", 0) == 0 ||
fn.find(".ringing-in") != std::string::npos ||
fn.find(".dialing") != std::string::npos ||
fn.find(".ringing-out") != std::string::npos ||
fn.find(".active") != std::string::npos) {
std::string fpPath = callsDir + "/" + fn;
::unlink(fpPath.c_str());
}
}
}
::closedir(d);
}
if (!cid.empty() && cid != "-" && cid != "sim" && cid != "test") {
runAsyncArgv("sxmo_modemcall.sh", "hangup", cid.c_str());
} else {
runAsyncArgv("sxmo_modemcall.sh", "hangup", "all");
sendPluginCommand("sip", "CALL_HANGUP");
sendPluginCommand("tox", "CALL_HANGUP");
}
} }
if (closeImmediately || !visible || callState == CallState::Idle || if (closeImmediately || !visible || callState == CallState::Idle ||
callState == CallState::SelectSim || callState == CallState::Ended) { callState == CallState::SelectSim || callState == CallState::Ended) {
@@ -1660,7 +1847,7 @@ int callscreen_run_main(int argc, char** argv) {
else if (cstate == 6) st = "held"; else if (cstate == 6) st = "held";
if (!st.empty() && outId.empty()) { if (!st.empty() && outId.empty()) {
outId = (sub == 1) ? ("sub1_" + std::to_string(cid)) outId = (sub == 1) ? ("sub1_" + std::to_string(cid))
: std::to_string(cid); : ("sub0_" + std::to_string(cid));
outState = st; outState = st;
outDir = (cdir == 2) ? "incoming" : "outgoing"; outDir = (cdir == 2) ? "incoming" : "outgoing";
if (rawNum && lenNum >= 1) { if (rawNum && lenNum >= 1) {
@@ -1693,13 +1880,17 @@ int callscreen_run_main(int argc, char** argv) {
if (callId == "sim" || callId == "test" || isVoipCallId(callId)) { if (callId == "sim" || callId == "test" || isVoipCallId(callId)) {
return; return;
} }
if (lastHangupMs > 0 && nowMs() - lastHangupMs < 4000 &&
::access("/tmp/sxmo_hangup_requested", F_OK) == 0) {
return;
}
std::string foundId; std::string foundId;
std::string foundDir; std::string foundDir;
std::string foundState; std::string foundState;
std::string foundNum; std::string foundNum;
bool sawTerminated = false; bool sawTerminated = false;
if (callId.rfind("sub", 0) != 0) { if (callId.rfind("sub1_", 0) != 0) {
FILE* fp = ::popen("mmcli -m any --voice-list-calls -a 2>/dev/null", "r"); FILE* fp = ::popen("mmcli -m any --voice-list-calls -a 2>/dev/null", "r");
if (fp) { if (fp) {
char line[512]; char line[512];
@@ -1891,9 +2082,9 @@ int callscreen_run_main(int argc, char** argv) {
if (line == "ENDED" || line.rfind("ENDED ", 0) == 0) { if (line == "ENDED" || line.rfind("ENDED ", 0) == 0) {
std::string reason = (line.size() > 6) ? trimStr(line.substr(6)) : "CALL ENDED"; std::string reason = (line.size() > 6) ? trimStr(line.substr(6)) : "CALL ENDED";
sipZrtpSas.clear(); sipZrtpSas.clear();
if (callState != CallState::Idle) { if (callState != CallState::Idle && callState != CallState::Ended) {
transitionToEnded(reason); transitionToEnded(reason);
} else { } else if (callState == CallState::Idle) {
hideWindow(false); hideWindow(false);
} }
return; return;
@@ -1904,13 +2095,46 @@ int callscreen_run_main(int argc, char** argv) {
std::string verb, arg1, arg2, arg3; std::string verb, arg1, arg2, arg3;
iss >> verb >> arg1 >> arg2 >> arg3; iss >> verb >> arg1 >> arg2 >> arg3;
if (verb == "PROMPT_SIM") { if (verb == "DIAL" || verb == "PROMPT_SIM") {
if (callState == CallState::Incoming || callState == CallState::Outgoing || if (callState == CallState::Incoming || callState == CallState::Outgoing ||
callState == CallState::Active) { callState == CallState::Active) {
showWindow(); showWindow();
return; return;
} }
simInfo = queryDualSimInfo(true); lastHangupMs = 0;
::unlink("/tmp/sxmo_hangup_requested");
if (!simInfo.slot1Present && !simInfo.slot2Present) {
simInfo = queryDualSimInfo(false);
}
if (verb == "DIAL" && !simInfo.dualSimActive) {
int slot = (simInfo.primaryGwSlot == 2) ? 2 : 1;
std::string simStr = std::to_string(slot);
std::string num = normalizePhone(arg1);
if (!num.empty()) {
callId.clear();
callNumber.clear();
contactName.clear();
updateCallerDetails("-", num);
activeSimSlot = slot;
callState = CallState::Outgoing;
callStartMs = nowMs();
lastModemPollMs = callStartMs;
missingModemPolls = 0;
ringMuted = false;
speakerOn = false;
btAudioOn = hasBtAudioCard();
dtmfMode = false;
dtmfSent.clear();
selectedRow = 0;
setSpeakerRoute(false, btAudioOn);
statusNotice.clear();
statusNoticeUntilMs = 0;
writeActiveStateFiles();
showWindow();
runAsyncArgv("sxmo_modemdial.sh", "--sim", simStr.c_str(), num.c_str());
}
return;
}
callId = "-"; callId = "-";
callNumber.clear(); callNumber.clear();
contactName.clear(); contactName.clear();
@@ -1920,6 +2144,11 @@ int callscreen_run_main(int argc, char** argv) {
activeSimSlot = 0; activeSimSlot = 0;
writeActiveStateFiles(); writeActiveStateFiles();
showWindow(); showWindow();
if (simInfo.slot1Operator.empty() && simInfo.slot2Operator.empty()) {
simInfo = queryDualSimInfo(true);
selectedRow = (simInfo.preferredSlot == 2) ? 1 : 0;
render();
}
return; return;
} }
@@ -1968,6 +2197,8 @@ int callscreen_run_main(int argc, char** argv) {
}; };
if (verb == "INCOMING") { if (verb == "INCOMING") {
lastHangupMs = 0;
::unlink("/tmp/sxmo_hangup_requested");
callId.clear(); callId.clear();
callNumber.clear(); callNumber.clear();
contactName.clear(); contactName.clear();
@@ -1989,31 +2220,46 @@ int callscreen_run_main(int argc, char** argv) {
writeActiveStateFiles(); writeActiveStateFiles();
showWindow(); showWindow();
} else if (verb == "OUTGOING") { } else if (verb == "OUTGOING") {
callId.clear(); if (lastHangupMs > 0 && nowMs() - lastHangupMs < 4000 &&
callNumber.clear(); ::access("/tmp/sxmo_hangup_requested", F_OK) == 0) {
contactName.clear(); return;
recordFileName.clear(); }
recordFilePath.clear(); lastHangupMs = 0;
lastRecordedSec = 0; bool alreadyOutgoing = (callState == CallState::Outgoing);
recordedClipCount = 0; if (!alreadyOutgoing) {
callId.clear();
callNumber.clear();
contactName.clear();
recordFileName.clear();
recordFilePath.clear();
lastRecordedSec = 0;
recordedClipCount = 0;
}
updateCallerDetails(arg1, arg2); updateCallerDetails(arg1, arg2);
parseSimTag(arg1, arg3); parseSimTag(arg1, arg3);
callState = CallState::Outgoing; callState = CallState::Outgoing;
callStartMs = nowMs(); if (!alreadyOutgoing) {
lastModemPollMs = callStartMs; callStartMs = nowMs();
ringMuted = false;
speakerOn = false;
btAudioOn = hasBtAudioCard();
dtmfMode = false;
dtmfSent.clear();
selectedRow = 0;
setSpeakerRoute(false, btAudioOn);
statusNotice.clear();
statusNoticeUntilMs = 0;
}
lastModemPollMs = nowMs();
missingModemPolls = 0; missingModemPolls = 0;
ringMuted = false;
speakerOn = false;
btAudioOn = hasBtAudioCard();
dtmfMode = false;
dtmfSent.clear();
selectedRow = 0;
setSpeakerRoute(false, btAudioOn);
statusNotice.clear();
statusNoticeUntilMs = 0;
writeActiveStateFiles(); writeActiveStateFiles();
showWindow(); showWindow();
} else if (verb == "ACTIVE") { } else if (verb == "ACTIVE") {
if (lastHangupMs > 0 && nowMs() - lastHangupMs < 4000 &&
::access("/tmp/sxmo_hangup_requested", F_OK) == 0) {
return;
}
lastHangupMs = 0;
bool wasActive = (callState == CallState::Active); bool wasActive = (callState == CallState::Active);
bool wasOutgoing = (callState == CallState::Outgoing); bool wasOutgoing = (callState == CallState::Outgoing);
updateCallerDetails(arg1, arg2); updateCallerDetails(arg1, arg2);
@@ -2044,7 +2290,9 @@ int callscreen_run_main(int argc, char** argv) {
if (callState == CallState::Idle || callState == CallState::Ended) { if (callState == CallState::Idle || callState == CallState::Ended) {
syncModemCalls(); syncModemCalls();
} }
showWindow(); if (callState != CallState::Idle || !arg1.empty()) {
showWindow();
}
} }
}; };
@@ -2057,6 +2305,8 @@ int callscreen_run_main(int argc, char** argv) {
if (num.empty()) { if (num.empty()) {
return; return;
} }
lastHangupMs = 0;
::unlink("/tmp/sxmo_hangup_requested");
std::string simStr = (chosenSim == 2) ? "2" : "1"; std::string simStr = (chosenSim == 2) ? "2" : "1";
handleFifoCommand("OUTGOING - " + num + " SIM" + simStr); handleFifoCommand("OUTGOING - " + num + " SIM" + simStr);
runAsyncArgv("sxmo_modemdial.sh", "--sim", simStr.c_str(), num.c_str()); runAsyncArgv("sxmo_modemdial.sh", "--sim", simStr.c_str(), num.c_str());
@@ -2120,10 +2370,6 @@ int callscreen_run_main(int argc, char** argv) {
writeActiveStateFiles(); writeActiveStateFiles();
} }
hideWindow(false); hideWindow(false);
} else {
XRaiseWindow(dpy, win);
grabPluginKeyboard(dpy, win);
render();
} }
} else if (ev.type == KeyRelease) { } else if (ev.type == KeyRelease) {
KeySym sym = XLookupKeysym(&ev.xkey, 0); KeySym sym = XLookupKeysym(&ev.xkey, 0);
@@ -2374,16 +2620,22 @@ int callscreen_run_main(int argc, char** argv) {
} }
} }
if (visible && (callState != CallState::Idle || checkRecordingAlive())) { static int64_t lastTimerRenderMs = 0;
bool hasLiveTimer = (callState == CallState::Outgoing ||
callState == CallState::Active ||
checkRecordingAlive());
if (visible && hasLiveTimer && nowMs() - lastTimerRenderMs >= 250) {
lastTimerRenderMs = nowMs();
render(); render();
} }
int timeoutMs = -1; int timeoutMs = -1;
if (visible || callState != CallState::Idle || checkRecordingAlive()) { if (softkeyDeadlineMs > 0) {
timeoutMs = static_cast<int>(std::max<int64_t>(5, softkeyDeadlineMs - nowMs()));
} else if (callState == CallState::Ended && endedAtMs > 0) {
timeoutMs = static_cast<int>(std::max<int64_t>(10, 1300 - (nowMs() - endedAtMs)));
} else if (hasLiveTimer || callState == CallState::Incoming) {
timeoutMs = 250; timeoutMs = 250;
if (softkeyDeadlineMs > 0) {
timeoutMs = static_cast<int>(std::max<int64_t>(5, softkeyDeadlineMs - nowMs()));
}
} }
struct pollfd pfds[2] {}; struct pollfd pfds[2] {};
+6 -3
View File
@@ -1046,8 +1046,8 @@ int runContactsApp(int argc, char** argv) {
switch (actIdx) { switch (actIdx) {
case 0: // Call Contact case 0: // Call Contact
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
hideWindow(true);
placePhoneCall(c.number); placePhoneCall(c.number);
hideWindow(false);
break; break;
case 1: // Send SMS case 1: // Send SMS
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
@@ -1304,8 +1304,8 @@ int runContactsApp(int argc, char** argv) {
if (selected >= 0 && selected < static_cast<int>(filtered.size())) { if (selected >= 0 && selected < static_cast<int>(filtered.size())) {
std::string target = filtered[selected].number; std::string target = filtered[selected].number;
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
hideWindow(true);
placePhoneCall(target); placePhoneCall(target);
hideWindow(false);
} }
break; break;
case XK_Return: case XK_Return:
@@ -1323,8 +1323,8 @@ int runContactsApp(int argc, char** argv) {
selected < static_cast<int>(filtered.size())) { selected < static_cast<int>(filtered.size())) {
std::string target = filtered[selected].number; std::string target = filtered[selected].number;
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
hideWindow(true);
placePhoneCall(target); placePhoneCall(target);
hideWindow(false);
} }
break; break;
} }
@@ -1769,6 +1769,9 @@ int contacts_on_idle_key(const DwmHostApi* host, KeySym keysym,
if (!host || !host->is_idle_desktop || !host->is_idle_desktop() || state != 0) { if (!host || !host->is_idle_desktop || !host->is_idle_desktop() || state != 0) {
return 0; return 0;
} }
if (isCallActiveOrRingingFast() || isAnotherPluginActive("contacts")) {
return 0;
}
if (keysym == XF86XK_Back || keysym == XF86XK_KbdLcdMenu2 || keycode == 166) { if (keysym == XF86XK_Back || keysym == XF86XK_KbdLcdMenu2 || keycode == 166) {
if (host->spawn_plugin) { if (host->spawn_plugin) {
host->spawn_plugin("contacts", nullptr); host->spawn_plugin("contacts", nullptr);
+9 -2
View File
@@ -571,6 +571,10 @@ int dialer_run_main(int argc, char** argv) {
}; };
auto showWindow = [&](const std::string& arg) { auto showWindow = [&](const std::string& arg) {
if (!visible && (isCallActiveOrRingingFast() ||
isPidFileAlive(getRuntimeFile("xcallscreen.pid")))) {
return;
}
writeIntFile(activePidPath, static_cast<int>(::getpid())); writeIntFile(activePidPath, static_cast<int>(::getpid()));
closeOtherPlugins("dialer"); closeOtherPlugins("dialer");
modal = DialerModal::Inactive; modal = DialerModal::Inactive;
@@ -939,8 +943,8 @@ int dialer_run_main(int argc, char** argv) {
case XF86XK_Send: { case XF86XK_Send: {
if (isCallActiveOrRingingFast()) { if (isCallActiveOrRingingFast()) {
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
hideWindow(false);
placePhoneCall(""); placePhoneCall("");
hideWindow(false);
break; break;
} }
std::string target = selectActiveNumber(); std::string target = selectActiveNumber();
@@ -960,8 +964,8 @@ int dialer_run_main(int argc, char** argv) {
executeUssd(target, false); executeUssd(target, false);
} else { } else {
writeSoftkeySuppress(nowMs() + 350); writeSoftkeySuppress(nowMs() + 350);
hideWindow(false);
placePhoneCall(target); placePhoneCall(target);
hideWindow(false);
} }
} }
break; break;
@@ -1085,6 +1089,9 @@ int dialer_on_idle_key(const DwmHostApi* host, KeySym keysym,
if (!host || !host->is_idle_desktop || !host->is_idle_desktop()) { if (!host || !host->is_idle_desktop || !host->is_idle_desktop()) {
return 0; return 0;
} }
if (isCallActiveOrRingingFast() || isAnotherPluginActive("dialer")) {
return 0;
}
char ch = mapDialKey(keysym, keycode, state); char ch = mapDialKey(keysym, keycode, state);
if (ch == '\0') { if (ch == '\0') {
return 0; return 0;
+7 -1
View File
@@ -1568,7 +1568,8 @@ inline DualSimInfo queryDualSimInfo(bool forceRefresh = false) {
static DualSimInfo cached; static DualSimInfo cached;
static int64_t lastQueryMs = 0; static int64_t lastQueryMs = 0;
int64_t now = nowMs(); int64_t now = nowMs();
if (!forceRefresh && lastQueryMs > 0 && (now - lastQueryMs) < 3000) { int64_t ttlMs = (cached.slot1Present || cached.slot2Present) ? 60000 : 3000;
if (!forceRefresh && lastQueryMs > 0 && (now - lastQueryMs) < ttlMs) {
return cached; return cached;
} }
@@ -1890,7 +1891,12 @@ inline void placePhoneCall(const std::string& rawNumber, int simSlot = 0) {
if (num.empty()) { if (num.empty()) {
return; return;
} }
::unlink("/tmp/sxmo_hangup_requested");
writeIntFile("/tmp/sxmo_active_call", 2);
if (simSlot == 0) { if (simSlot == 0) {
if (sendPluginCommand("callscreen", "DIAL " + num)) {
return;
}
DualSimInfo dsi = queryDualSimInfo(); DualSimInfo dsi = queryDualSimInfo();
if (dsi.dualSimActive) { if (dsi.dualSimActive) {
if (!sendPluginCommand("callscreen", "PROMPT_SIM " + num)) { if (!sendPluginCommand("callscreen", "PROMPT_SIM " + num)) {
+3 -3
View File
@@ -1137,8 +1137,8 @@ int runSmsApp(int argc, char** argv) {
? filteredThreads[selectedThread].number ? filteredThreads[selectedThread].number
: ""); : "");
if (!target.empty()) { if (!target.empty()) {
hideWindow();
placePhoneCall(target); placePhoneCall(target);
hideWindow();
} }
} else if (optId == 5) { } else if (optId == 5) {
std::string target = (prevMode == ViewMode::ThreadView) std::string target = (prevMode == ViewMode::ThreadView)
@@ -1451,12 +1451,12 @@ int runSmsApp(int argc, char** argv) {
startAsyncSendSms(composeRecipient, composeText); startAsyncSendSms(composeRecipient, composeText);
drawUI(); drawUI();
} else if (mode == ViewMode::ThreadView && !activeNumber.empty()) { } else if (mode == ViewMode::ThreadView && !activeNumber.empty()) {
hideWindow();
placePhoneCall(activeNumber); placePhoneCall(activeNumber);
hideWindow();
} else if (mode == ViewMode::Threads && !filteredThreads.empty()) { } else if (mode == ViewMode::Threads && !filteredThreads.empty()) {
std::string num = filteredThreads[selectedThread].number; std::string num = filteredThreads[selectedThread].number;
hideWindow();
placePhoneCall(num); placePhoneCall(num);
hideWindow();
} }
continue; continue;
} }
+150 -101
View File
@@ -1080,6 +1080,144 @@ dirtomon(int dir)
return m; return m;
} }
static void
drawsoftbar(Monitor *m, int force)
{
static int last_has_sel = -1;
int has_sel;
if (!m || !m->softwin || !drw || !drw->font || is_screen_off())
return;
has_sel = (m->sel != NULL);
if (!force && has_sel == last_has_sel)
return;
last_has_sel = has_sel;
XLowerWindow(dpy, m->softwin);
XClearWindow(dpy, m->softwin);
if (!has_sel) {
XftDraw *d = XftDrawCreate(dpy, m->softwin,
DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
if (d) {
unsigned int ew = 0, eh = 0;
const char *left_txt = "Menu";
const char *right_txt = "Names";
int sh_bar = 26;
drw_font_getexts(drw->font, left_txt, strlen(left_txt), &ew, &eh, False);
int ty = (sh_bar - (int)eh) / 2;
pango_layout_set_text(drw->font->layout, left_txt, strlen(left_txt));
pango_xft_render_layout(d, &scheme[SchemeSel][ColFg],
drw->font->layout, 6 * PANGO_SCALE, ty * PANGO_SCALE);
drw_font_getexts(drw->font, right_txt, strlen(right_txt), &ew, &eh, False);
ty = (sh_bar - (int)eh) / 2;
int rx = m->ww - (int)ew - 6;
pango_layout_set_text(drw->font->layout, right_txt, strlen(right_txt));
pango_xft_render_layout(d, &scheme[SchemeSel][ColFg],
drw->font->layout, rx * PANGO_SCALE, ty * PANGO_SCALE);
XftDrawDestroy(d);
}
}
}
static void
drawclock(Monitor *m, int force)
{
static XftFont *clk_font_big = NULL;
static XftFont *clk_font_small = NULL;
static XftColor clk_fg, clk_sh;
static int clk_colors_init = 0;
static char last_tzlink[256] = "";
static int last_has_sel = -1;
static char last_tbuf[32] = "";
static char last_dbuf[64] = "";
char tzlink[256], tbuf[32], dbuf[64];
ssize_t tzlen;
time_t now;
struct tm lt;
int has_sel;
if (!m || !m->clockwin || is_screen_off())
return;
has_sel = (m->sel != NULL);
if (has_sel) {
if (!force && last_has_sel == 1)
return;
last_has_sel = 1;
XLowerWindow(dpy, m->clockwin);
XClearWindow(dpy, m->clockwin);
return;
}
tzlen = readlink("/etc/localtime", tzlink, sizeof(tzlink) - 1);
if (tzlen > 0) {
tzlink[tzlen] = '\0';
if (strcmp(tzlink, last_tzlink) != 0) {
snprintf(last_tzlink, sizeof(last_tzlink), "%s", tzlink);
setenv("TZ", tzlink, 1);
tzset();
force = 1;
}
}
now = time(NULL);
localtime_r(&now, &lt);
strftime(tbuf, sizeof(tbuf), "%H:%M", &lt);
strftime(dbuf, sizeof(dbuf), "%a %d %b %Y", &lt);
if (!force && last_has_sel == 0 &&
strcmp(tbuf, last_tbuf) == 0 && strcmp(dbuf, last_dbuf) == 0)
return;
last_has_sel = 0;
snprintf(last_tbuf, sizeof(last_tbuf), "%s", tbuf);
snprintf(last_dbuf, sizeof(last_dbuf), "%s", dbuf);
if (!clk_font_big)
clk_font_big = XftFontOpenName(dpy, screen, "Fira Code:size=32:style=Regular");
if (!clk_font_small)
clk_font_small = XftFontOpenName(dpy, screen, "Fira Code:size=14:style=Regular");
if (!clk_colors_init) {
XRenderColor rfg = { 0xffff, 0xffff, 0xffff, 0xffff };
XRenderColor rsh = { 0x0000, 0x0000, 0x0000, 0xffff };
XftColorAllocValue(dpy, DefaultVisual(dpy, screen),
DefaultColormap(dpy, screen), &rfg, &clk_fg);
XftColorAllocValue(dpy, DefaultVisual(dpy, screen),
DefaultColormap(dpy, screen), &rsh, &clk_sh);
clk_colors_init = 1;
}
XLowerWindow(dpy, m->clockwin);
XClearWindow(dpy, m->clockwin);
XftDraw *cd = XftDrawCreate(dpy, m->clockwin,
DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
if (cd) {
XGlyphInfo ext;
if (clk_font_big) {
size_t tlen = strlen(tbuf);
XftTextExtentsUtf8(dpy, clk_font_big, (const FcChar8 *)tbuf, tlen, &ext);
int tx = (m->ww - ext.xOff) / 2;
int ty = 45;
XftDrawStringUtf8(cd, &clk_sh, clk_font_big, tx + 1, ty + 1,
(const FcChar8 *)tbuf, tlen);
XftDrawStringUtf8(cd, &clk_fg, clk_font_big, tx, ty,
(const FcChar8 *)tbuf, tlen);
}
if (clk_font_small) {
size_t dlen = strlen(dbuf);
XftTextExtentsUtf8(dpy, clk_font_small, (const FcChar8 *)dbuf, dlen, &ext);
int dx = (m->ww - ext.xOff) / 2;
int dy = 73;
XftDrawStringUtf8(cd, &clk_sh, clk_font_small, dx + 1, dy + 1,
(const FcChar8 *)dbuf, dlen);
XftDrawStringUtf8(cd, &clk_fg, clk_font_small, dx, dy,
(const FcChar8 *)dbuf, dlen);
}
XftDrawDestroy(cd);
}
}
void void
drawbar(Monitor *m) drawbar(Monitor *m)
{ {
@@ -1135,105 +1273,8 @@ drawbar(Monitor *m)
drw_text(drw, MAX(x, m->ww - sw), 0, sw, bh, 0, s, 0, True); drw_text(drw, MAX(x, m->ww - sw), 0, sw, bh, 0, s, 0, True);
} }
drw_map(drw, m->barwin, 0, 0, m->ww, bh); drw_map(drw, m->barwin, 0, 0, m->ww, bh);
if (m->softwin && drw && drw->font) { drawsoftbar(m, 0);
XLowerWindow(dpy, m->softwin); drawclock(m, 0);
XClearWindow(dpy, m->softwin);
if (!m->sel) {
XftDraw *d = XftDrawCreate(dpy, m->softwin,
DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
if (d) {
unsigned int ew = 0, eh = 0;
const char *left_txt = "Menu";
const char *right_txt = "Names";
int sh_bar = 26;
drw_font_getexts(drw->font, left_txt, strlen(left_txt), &ew, &eh, False);
int ty = (sh_bar - (int)eh) / 2;
pango_layout_set_text(drw->font->layout, left_txt, strlen(left_txt));
pango_xft_render_layout(d, &scheme[SchemeSel][ColFg],
drw->font->layout, 6 * PANGO_SCALE, ty * PANGO_SCALE);
drw_font_getexts(drw->font, right_txt, strlen(right_txt), &ew, &eh, False);
ty = (sh_bar - (int)eh) / 2;
int rx = m->ww - (int)ew - 6;
pango_layout_set_text(drw->font->layout, right_txt, strlen(right_txt));
pango_xft_render_layout(d, &scheme[SchemeSel][ColFg],
drw->font->layout, rx * PANGO_SCALE, ty * PANGO_SCALE);
XftDrawDestroy(d);
}
}
}
if (m->clockwin) {
XLowerWindow(dpy, m->clockwin);
XClearWindow(dpy, m->clockwin);
if (!m->sel) {
static XftFont *clk_font_big = NULL;
static XftFont *clk_font_small = NULL;
static XftColor clk_fg, clk_sh;
static int clk_colors_init = 0;
static char last_tzlink[256] = "";
char tzlink[256];
ssize_t tzlen;
if (!clk_font_big)
clk_font_big = XftFontOpenName(dpy, screen, "Fira Code:size=32:style=Regular");
if (!clk_font_small)
clk_font_small = XftFontOpenName(dpy, screen, "Fira Code:size=14:style=Regular");
if (!clk_colors_init) {
XRenderColor rfg = { 0xffff, 0xffff, 0xffff, 0xffff };
XRenderColor rsh = { 0x0000, 0x0000, 0x0000, 0xffff };
XftColorAllocValue(dpy, DefaultVisual(dpy, screen),
DefaultColormap(dpy, screen), &rfg, &clk_fg);
XftColorAllocValue(dpy, DefaultVisual(dpy, screen),
DefaultColormap(dpy, screen), &rsh, &clk_sh);
clk_colors_init = 1;
}
tzlen = readlink("/etc/localtime", tzlink, sizeof(tzlink) - 1);
if (tzlen > 0) {
tzlink[tzlen] = '\0';
if (strcmp(tzlink, last_tzlink) != 0) {
snprintf(last_tzlink, sizeof(last_tzlink), "%s", tzlink);
setenv("TZ", tzlink, 1);
tzset();
}
}
XftDraw *cd = XftDrawCreate(dpy, m->clockwin,
DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
if (cd) {
time_t now = time(NULL);
struct tm lt;
char tbuf[32], dbuf[64];
XGlyphInfo ext;
localtime_r(&now, &lt);
strftime(tbuf, sizeof(tbuf), "%H:%M", &lt);
strftime(dbuf, sizeof(dbuf), "%a %d %b %Y", &lt);
if (clk_font_big) {
size_t tlen = strlen(tbuf);
XftTextExtentsUtf8(dpy, clk_font_big, (const FcChar8 *)tbuf, tlen, &ext);
int tx = (m->ww - ext.xOff) / 2;
int ty = 45;
XftDrawStringUtf8(cd, &clk_sh, clk_font_big, tx + 1, ty + 1,
(const FcChar8 *)tbuf, tlen);
XftDrawStringUtf8(cd, &clk_fg, clk_font_big, tx, ty,
(const FcChar8 *)tbuf, tlen);
}
if (clk_font_small) {
size_t dlen = strlen(dbuf);
XftTextExtentsUtf8(dpy, clk_font_small, (const FcChar8 *)dbuf, dlen, &ext);
int dx = (m->ww - ext.xOff) / 2;
int dy = 73;
XftDrawStringUtf8(cd, &clk_sh, clk_font_small, dx + 1, dy + 1,
(const FcChar8 *)dbuf, dlen);
XftDrawStringUtf8(cd, &clk_fg, clk_font_small, dx, dy,
(const FcChar8 *)dbuf, dlen);
}
XftDrawDestroy(cd);
}
}
}
} }
void void
@@ -1270,8 +1311,14 @@ expose(XEvent *e)
Monitor *m; Monitor *m;
XExposeEvent *ev = &e->xexpose; XExposeEvent *ev = &e->xexpose;
if (ev->count == 0 && (m = wintomon(ev->window))) if (ev->count == 0 && (m = wintomon(ev->window))) {
drawbar(m); if (ev->window == m->softwin)
drawsoftbar(m, 1);
else if (ev->window == m->clockwin)
drawclock(m, 1);
else
drawbar(m);
}
} }
static void static void
@@ -4336,6 +4383,8 @@ reload_dwm_theme(void)
else else
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
} }
drawsoftbar(m, 1);
drawclock(m, 1);
} }
drawbars(); drawbars();
} }