Fix 2720 closed-flip call wakeups/preservation, live timezone sync, and Power menu
- Default CPU_RPM_SLEEP=0, CPU_L2_SLEEP=0, and MODEM_DRX_MODE=0 across bananarchy-power-policy.conf, bananarchy-power-policy.sh, bananarchy-display-power-sync, and kernel patch 0010 so closed-flip incoming calls wake APSS promptly via smd-edge without AT port contention. - Serialize sxmo_modem.sh incoming/finished call checks, expire stale /tmp/sxmo_hangup_requested flags, re-verify live ModemManager call state before ringing/raising callscreen, guard idle/flip-open HANGUP_CLOSE paths in locker.so, callscreen.so, bananarchy-idle-lock.sh, and bananarchy-lid, preserve calls on flip-open (UNGRAB/RAISE), and add closed-flip cover call controls (bananarchy-cover-idle, bananarchy-cover-event.sh, bananarchy-volume-keys). - Propagate live network/manual timezone updates across statusbar, locker.so, bananarchy-cover-idle, bananarchy-dsds, callscreen.so, and bananarchy-run-aligned without reboot (scripts/test-time-timezone-sync.py), remove non-functional Logout from the Power menu, ignore post-call sxmo_calls markers, add scripts/build-dwm-plugins.sh, and update a1114 (carbonara) hashes and docs.
This commit is contained in:
1 parent
786480a08f
commit
8b466ef8ae
110 files changed
+2728
-285
No files matched your search
@@ -22,7 +22,9 @@
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <strings.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
@@ -295,6 +297,12 @@ static const struct glyph font[] = {
|
||||
{':', {0x00, 0x36, 0x36, 0x00, 0x00}}, {'-', {0x08, 0x08, 0x08, 0x08, 0x08}},
|
||||
{'.', {0x00, 0x60, 0x60, 0x00, 0x00}}, {'/', {0x20, 0x10, 0x08, 0x04, 0x02}},
|
||||
{'%', {0x23, 0x13, 0x08, 0x64, 0x62}}, {'|', {0x00, 0x00, 0x7f, 0x00, 0x00}},
|
||||
{'+', {0x08, 0x08, 0x3e, 0x08, 0x08}}, {'(', {0x00, 0x1c, 0x22, 0x41, 0x00}},
|
||||
{')', {0x00, 0x41, 0x22, 0x1c, 0x00}}, {'*', {0x14, 0x08, 0x3e, 0x08, 0x14}},
|
||||
{'#', {0x14, 0x7f, 0x14, 0x7f, 0x14}}, {',', {0x00, 0x50, 0x30, 0x00, 0x00}},
|
||||
{'!', {0x00, 0x00, 0x5f, 0x00, 0x00}}, {'?', {0x02, 0x01, 0x51, 0x09, 0x06}},
|
||||
{'_', {0x40, 0x40, 0x40, 0x40, 0x40}}, {'[', {0x00, 0x7f, 0x41, 0x41, 0x00}},
|
||||
{']', {0x00, 0x41, 0x41, 0x7f, 0x00}}, {'\'', {0x00, 0x05, 0x03, 0x00, 0x00}},
|
||||
{' ', {0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
};
|
||||
|
||||
@@ -422,6 +430,91 @@ static void frame_text_centered(struct frame *fb, const char *text, int y,
|
||||
frame_text(fb, text, x, y, scale, color);
|
||||
}
|
||||
|
||||
/* Transliterate basic Cyrillic UTF-8 and sanitize caller labels to 5x7 ASCII. */
|
||||
static void sanitize_cover_text(const char *src, char *dst, size_t dstlen)
|
||||
{
|
||||
static const char *const cyr_map[32] = {
|
||||
"A", "B", "V", "G", "D", "E", "ZH", "Z",
|
||||
"I", "Y", "K", "L", "M", "N", "O", "P",
|
||||
"R", "S", "T", "U", "F", "KH", "TS", "CH",
|
||||
"SH", "SHCH", "", "Y", "", "E", "YU", "YA"
|
||||
};
|
||||
const unsigned char *p = (const unsigned char *)(src ? src : "");
|
||||
size_t out = 0;
|
||||
if(!dst || dstlen == 0)
|
||||
return;
|
||||
while(*p && out + 1 < dstlen) {
|
||||
unsigned char b = *p;
|
||||
if(b < 0x80) {
|
||||
char ch = (b >= 0x20 && b < 0x7f) ? (char)toupper(b) : ' ';
|
||||
if(ch == ' ' && (out == 0 || dst[out - 1] == ' ')) {
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
dst[out++] = ch;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
if((b == 0xd0 || b == 0xd1 || b == 0xd2) && p[1] >= 0x80 && p[1] <= 0xbf) {
|
||||
unsigned char b2 = p[1];
|
||||
const char *rep = NULL;
|
||||
if(b == 0xd0 && b2 == 0x81)
|
||||
rep = "YO";
|
||||
else if(b == 0xd1 && b2 == 0x91)
|
||||
rep = "YO";
|
||||
else if((b == 0xd0 && b2 == 0x84) || (b == 0xd1 && b2 == 0x94))
|
||||
rep = "YE";
|
||||
else if((b == 0xd0 && b2 == 0x86) || (b == 0xd1 && b2 == 0x96))
|
||||
rep = "I";
|
||||
else if((b == 0xd0 && b2 == 0x87) || (b == 0xd1 && b2 == 0x97))
|
||||
rep = "YI";
|
||||
else if(b == 0xd2 && (b2 == 0x90 || b2 == 0x91))
|
||||
rep = "G";
|
||||
else if(b == 0xd0 && b2 >= 0x90 && b2 <= 0xbf)
|
||||
rep = cyr_map[(b2 - 0x90) % 32];
|
||||
else if(b == 0xd1 && b2 >= 0x80 && b2 <= 0x8f)
|
||||
rep = cyr_map[(b2 - 0x80 + 16) % 32];
|
||||
if(rep) {
|
||||
while(*rep && out + 1 < dstlen)
|
||||
dst[out++] = *rep++;
|
||||
}
|
||||
p += 2;
|
||||
continue;
|
||||
}
|
||||
p++;
|
||||
while((*p & 0xc0) == 0x80)
|
||||
p++;
|
||||
}
|
||||
while(out > 0 && dst[out - 1] == ' ')
|
||||
out--;
|
||||
dst[out] = '\0';
|
||||
}
|
||||
|
||||
static void draw_fit_centered(struct frame *fb, const char *text, int y,
|
||||
int pref_scale, uint32_t color)
|
||||
{
|
||||
char buf[64];
|
||||
int max_chars;
|
||||
int scale = pref_scale;
|
||||
size_t len;
|
||||
if(!text || !*text)
|
||||
return;
|
||||
sanitize_cover_text(text, buf, sizeof(buf));
|
||||
if(!buf[0])
|
||||
return;
|
||||
len = strlen(buf);
|
||||
max_chars = ((int)fb->width - 8) / (6 * scale);
|
||||
if(max_chars < 1)
|
||||
max_chars = 1;
|
||||
if((int)len > max_chars && scale > 1) {
|
||||
scale = 1;
|
||||
max_chars = ((int)fb->width - 8) / 6;
|
||||
}
|
||||
if((int)len > max_chars)
|
||||
buf[max_chars] = '\0';
|
||||
frame_text_centered(fb, buf, y, scale, color);
|
||||
}
|
||||
|
||||
static int read_uint_file(const char *path, unsigned int *value)
|
||||
{
|
||||
FILE *handle = fopen(path, "r");
|
||||
@@ -505,6 +598,9 @@ struct state {
|
||||
char lid[16];
|
||||
char backend[16];
|
||||
char call[64];
|
||||
char call_num[64];
|
||||
char call_name[64];
|
||||
char call_sim[16];
|
||||
char message[128];
|
||||
char network[96];
|
||||
int enabled;
|
||||
@@ -520,6 +616,12 @@ struct state {
|
||||
int backlight_level;
|
||||
};
|
||||
|
||||
static int cover_hold_awake(const struct state *state)
|
||||
{
|
||||
return strcmp(state->call, "incoming") == 0 ||
|
||||
strcmp(state->call, "muted") == 0;
|
||||
}
|
||||
|
||||
/* A lit cover needs a lit framebuffer, a lit backlight and an unblanked fbdev;
|
||||
* everything else is "fully off". TEST modes are diagnostic overrides. */
|
||||
static int cover_is_lit(const struct state *state)
|
||||
@@ -557,10 +659,12 @@ static void render_frame(struct frame *fb, const struct state *state)
|
||||
char clock[16];
|
||||
char date[32];
|
||||
char battery[32];
|
||||
time_t now = time(NULL);
|
||||
time_t now;
|
||||
struct tm tm;
|
||||
unsigned int width = fb->width;
|
||||
unsigned int height = fb->height;
|
||||
ba_refresh_tz();
|
||||
now = time(NULL);
|
||||
localtime_r(&now, &tm);
|
||||
strftime(clock, sizeof(clock), "%H:%M", &tm);
|
||||
strftime(date, sizeof(date), "%d.%m.%Y", &tm);
|
||||
@@ -578,6 +682,42 @@ static void render_frame(struct frame *fb, const struct state *state)
|
||||
rgb888(245, 245, 245));
|
||||
} else if(!cover_is_lit(state)) {
|
||||
frame_rect(fb, 0, 0, (int)width, (int)height, rgb888(0, 0, 0));
|
||||
} else if(cover_hold_awake(state)) {
|
||||
int muted = strcmp(state->call, "muted") == 0;
|
||||
char subhdr[48];
|
||||
char name_san[64];
|
||||
char num_san[64];
|
||||
uint32_t accent = muted ? rgb888(250, 210, 60) : rgb888(80, 220, 120);
|
||||
frame_rect(fb, 0, 0, (int)width, (int)height, rgb888(8, 12, 26));
|
||||
frame_rect(fb, 0, 0, (int)width, 4, accent);
|
||||
frame_text_centered(fb, muted ? "RING MUTED" : "INCOMING CALL",
|
||||
18, 2, accent);
|
||||
if(state->call_sim[0])
|
||||
snprintf(subhdr, sizeof(subhdr), "%s %s", state->call_sim, clock);
|
||||
else
|
||||
snprintf(subhdr, sizeof(subhdr), "%s", clock);
|
||||
frame_text_centered(fb, subhdr, 44, 1, rgb888(140, 180, 240));
|
||||
sanitize_cover_text(state->call_name, name_san, sizeof(name_san));
|
||||
sanitize_cover_text(state->call_num, num_san, sizeof(num_san));
|
||||
if(name_san[0] && num_san[0] && strcmp(name_san, num_san) != 0) {
|
||||
draw_fit_centered(fb, name_san, 78, 2, rgb888(245, 248, 255));
|
||||
draw_fit_centered(fb, num_san, 112, 2, rgb888(160, 210, 250));
|
||||
} else if(name_san[0]) {
|
||||
draw_fit_centered(fb, name_san, 96, 2, rgb888(245, 248, 255));
|
||||
} else {
|
||||
if(!num_san[0])
|
||||
safe_copy(num_san, sizeof(num_san), "UNKNOWN");
|
||||
draw_fit_centered(fb, num_san, 96, 2, rgb888(245, 248, 255));
|
||||
}
|
||||
if(state->battery >= 0) {
|
||||
snprintf(battery, sizeof(battery), "BAT %d%%", state->battery);
|
||||
frame_text_centered(fb, battery, (int)height - 52, 1,
|
||||
rgb888(250, 210, 60));
|
||||
}
|
||||
frame_text_centered(fb, muted ? "RINGER MUTED" : "VOL: MUTE RING",
|
||||
(int)height - 34, 1, rgb888(250, 210, 60));
|
||||
frame_text_centered(fb, "PWR: HANG UP",
|
||||
(int)height - 18, 1, rgb888(255, 110, 110));
|
||||
} else {
|
||||
int clock_scale = width >= 220 ? 5 : 3;
|
||||
int clock_h = 7 * clock_scale;
|
||||
@@ -2210,6 +2350,21 @@ static int test_value(const char *mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void spawn_cover_event(const char *action, const char *arg)
|
||||
{
|
||||
const char *cmd = getenv("BANANARCHY_COVER_EVENT_CMD");
|
||||
const char *bin = (cmd && *cmd) ? cmd : "/usr/bin/bananarchy-cover-event.sh";
|
||||
char *const argv_with_arg[] = {
|
||||
(char *)bin, (char *)action, (char *)arg, NULL
|
||||
};
|
||||
char *const argv_no_arg[] = {
|
||||
(char *)bin, (char *)action, NULL
|
||||
};
|
||||
if(!action || !*action)
|
||||
return;
|
||||
spawn_async_cmd((arg && *arg) ? argv_with_arg : argv_no_arg);
|
||||
}
|
||||
|
||||
/* A closed flip lights the outer panel only. Status updates (NETWORK,
|
||||
* BATTERY) refresh an already visible cover but never wake it; real events
|
||||
* (BUTTON, WAKE, CALL, NOTIFY, SMS) do. */
|
||||
@@ -2281,6 +2436,7 @@ static void handle_command(char *buffer, struct state *state,
|
||||
}
|
||||
} else if(strcmp(command, "BUTTON") == 0 ||
|
||||
strcmp(command, "WAKE") == 0) {
|
||||
char *sub = strtok_r(NULL, " \t\r\n", &save);
|
||||
/* Trusted external side button, or a main-panel wake request that the
|
||||
* closed-lid gate forwarded to the cover display. Ignore WAKE (never
|
||||
* BUTTON) during the 450 ms close-settle window so dwm's spurious
|
||||
@@ -2289,6 +2445,29 @@ static void handle_command(char *buffer, struct state *state,
|
||||
state->closed_since_ms > 0 &&
|
||||
now_ms() - state->closed_since_ms < 450)
|
||||
return;
|
||||
if(strcmp(command, "BUTTON") == 0 && sub &&
|
||||
strcmp(state->lid, "closed") == 0 && cover_hold_awake(state)) {
|
||||
upper_string(sub);
|
||||
if(strcmp(sub, "VOLUP") == 0 || strcmp(sub, "VOLDOWN") == 0) {
|
||||
if(strcmp(state->call, "incoming") == 0) {
|
||||
safe_copy(state->call, sizeof(state->call), "muted");
|
||||
spawn_cover_event("mute-ring", state->call_num);
|
||||
}
|
||||
cover_wake(state, redraw);
|
||||
*redraw = 1;
|
||||
return;
|
||||
}
|
||||
if(strcmp(sub, "POWER") == 0) {
|
||||
safe_copy(state->call, sizeof(state->call), "none");
|
||||
state->call_num[0] = '\0';
|
||||
state->call_name[0] = '\0';
|
||||
state->call_sim[0] = '\0';
|
||||
spawn_cover_event("hangup-call", "");
|
||||
cover_wake(state, redraw);
|
||||
*redraw = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
cover_wake(state, redraw);
|
||||
} else if(strcmp(command, "NETWORK") == 0) {
|
||||
char *rest = save;
|
||||
@@ -2308,12 +2487,107 @@ static void handle_command(char *buffer, struct state *state,
|
||||
if(state->visible)
|
||||
*redraw = 1;
|
||||
} else if(strcmp(command, "CALL") == 0) {
|
||||
char *value = strtok_r(NULL, " \t\r\n", &save);
|
||||
if(value) {
|
||||
safe_copy(state->call, sizeof(state->call), value);
|
||||
lower_string(state->call);
|
||||
if(strcmp(state->call, "none") != 0)
|
||||
char *rest = save;
|
||||
char status[64] = "";
|
||||
char num[64] = "";
|
||||
char name[64] = "";
|
||||
char sim[16] = "";
|
||||
while(rest && (*rest == ' ' || *rest == '\t'))
|
||||
rest++;
|
||||
if(rest && *rest) {
|
||||
trim(rest);
|
||||
if(strchr(rest, '|')) {
|
||||
char *parts[4] = { NULL, NULL, NULL, NULL };
|
||||
int idx = 0;
|
||||
char *p = rest;
|
||||
parts[idx++] = p;
|
||||
while((p = strchr(p, '|')) != NULL && idx < 4) {
|
||||
*p++ = '\0';
|
||||
parts[idx++] = p;
|
||||
}
|
||||
if(parts[0]) safe_copy(status, sizeof(status), parts[0]);
|
||||
if(parts[1]) safe_copy(num, sizeof(num), parts[1]);
|
||||
if(parts[2]) safe_copy(name, sizeof(name), parts[2]);
|
||||
if(parts[3]) safe_copy(sim, sizeof(sim), parts[3]);
|
||||
} else {
|
||||
char *t0 = strtok_r(rest, " \t\r\n", &save);
|
||||
char *t1 = t0 ? strtok_r(NULL, " \t\r\n", &save) : NULL;
|
||||
char *t2 = t1 ? strtok_r(NULL, " \t\r\n", &save) : NULL;
|
||||
char *t3 = t2 ? strtok_r(NULL, " \t\r\n", &save) : NULL;
|
||||
if(t0) safe_copy(status, sizeof(status), t0);
|
||||
if(t1) safe_copy(num, sizeof(num), t1);
|
||||
if(t2) safe_copy(name, sizeof(name), t2);
|
||||
if(t3) safe_copy(sim, sizeof(sim), t3);
|
||||
}
|
||||
trim(status);
|
||||
lower_string(status);
|
||||
trim(num);
|
||||
trim(name);
|
||||
trim(sim);
|
||||
if(strcmp(num, "-") == 0) num[0] = '\0';
|
||||
if(strcmp(name, "-") == 0) name[0] = '\0';
|
||||
if(strcmp(sim, "-") == 0) sim[0] = '\0';
|
||||
if(strcmp(status, "none") == 0) {
|
||||
safe_copy(state->call, sizeof(state->call), "none");
|
||||
state->call_num[0] = '\0';
|
||||
state->call_name[0] = '\0';
|
||||
state->call_sim[0] = '\0';
|
||||
state->last_input_ms = now_ms();
|
||||
if(state->visible)
|
||||
*redraw = 1;
|
||||
} else if(strcmp(status, "muted") == 0) {
|
||||
if(strcmp(state->call, "incoming") != 0 &&
|
||||
strcmp(state->call, "muted") != 0)
|
||||
return;
|
||||
safe_copy(state->call, sizeof(state->call), "muted");
|
||||
if(num[0]) safe_copy(state->call_num, sizeof(state->call_num), num);
|
||||
if(name[0]) safe_copy(state->call_name, sizeof(state->call_name), name);
|
||||
if(sim[0]) safe_copy(state->call_sim, sizeof(state->call_sim), sim);
|
||||
cover_wake(state, redraw);
|
||||
*redraw = 1;
|
||||
} else if(strcmp(status, "incoming") == 0) {
|
||||
if(num[0] && strcmp(state->call_num, num) != 0) {
|
||||
safe_copy(state->call_num, sizeof(state->call_num), num);
|
||||
state->call_name[0] = '\0';
|
||||
}
|
||||
if(name[0])
|
||||
safe_copy(state->call_name, sizeof(state->call_name), name);
|
||||
if(sim[0])
|
||||
safe_copy(state->call_sim, sizeof(state->call_sim), sim);
|
||||
safe_copy(state->call, sizeof(state->call), "incoming");
|
||||
cover_wake(state, redraw);
|
||||
*redraw = 1;
|
||||
} else if(strcmp(status, "missed") == 0) {
|
||||
const char *who = name[0] ? name :
|
||||
(num[0] ? num :
|
||||
(state->call_name[0] ? state->call_name :
|
||||
state->call_num));
|
||||
if(who && *who) {
|
||||
char clean_who[64];
|
||||
sanitize_cover_text(who, clean_who, sizeof(clean_who));
|
||||
if(clean_who[0])
|
||||
snprintf(state->message, sizeof(state->message),
|
||||
"MISSED: %s", clean_who);
|
||||
else
|
||||
snprintf(state->message, sizeof(state->message), "MISSED CALL");
|
||||
} else {
|
||||
snprintf(state->message, sizeof(state->message), "MISSED CALL");
|
||||
}
|
||||
safe_copy(state->call, sizeof(state->call), "missed");
|
||||
state->call_num[0] = '\0';
|
||||
state->call_name[0] = '\0';
|
||||
state->call_sim[0] = '\0';
|
||||
cover_wake(state, redraw);
|
||||
*redraw = 1;
|
||||
} else if(strcmp(status, "active") == 0) {
|
||||
safe_copy(state->call, sizeof(state->call), "active");
|
||||
state->last_input_ms = now_ms();
|
||||
if(state->visible)
|
||||
*redraw = 1;
|
||||
} else if(status[0]) {
|
||||
safe_copy(state->call, sizeof(state->call), status);
|
||||
cover_wake(state, redraw);
|
||||
}
|
||||
}
|
||||
} else if(strcmp(command, "SMS") == 0) {
|
||||
char *value = strtok_r(NULL, " \t\r\n", &save);
|
||||
@@ -2438,6 +2712,7 @@ static void handle_command(char *buffer, struct state *state,
|
||||
} else if(strcmp(command, "REFRESH") == 0 ||
|
||||
strcmp(command, "RELOAD_THEME") == 0 ||
|
||||
strcmp(command, "STATUS") == 0) {
|
||||
ba_refresh_tz();
|
||||
refresh_blank_timeout(state);
|
||||
if(state->visible && strcmp(command, "STATUS") != 0)
|
||||
*redraw = 1;
|
||||
@@ -2480,6 +2755,24 @@ static void reply_for(char *buffer, const struct state *state,
|
||||
}
|
||||
}
|
||||
|
||||
static volatile sig_atomic_t g_stop_requested = 0;
|
||||
|
||||
static void handle_stop_signal(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_stop_requested = 1;
|
||||
}
|
||||
|
||||
static void install_stop_handlers(void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = handle_stop_signal;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *lock_path = getenv("BANANARCHY_COVER_LOCK");
|
||||
@@ -2501,6 +2794,7 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
(void)lock_fd;
|
||||
install_reaper();
|
||||
install_stop_handlers();
|
||||
if(argc > 2 && strcmp(argv[1], "--config") == 0)
|
||||
config = argv[2];
|
||||
memset(&state, 0, sizeof(state));
|
||||
@@ -2532,7 +2826,7 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
chmod(socket_path, 0660);
|
||||
chown(socket_path, 0, SESSION_GID);
|
||||
while(1) {
|
||||
while(!g_stop_requested) {
|
||||
struct pollfd pfds[2];
|
||||
nfds_t nfds = 1;
|
||||
char buffer[512];
|
||||
@@ -2542,6 +2836,7 @@ int main(int argc, char **argv)
|
||||
socklen_t peer_len = sizeof(peer);
|
||||
ssize_t nread;
|
||||
long long now = now_ms();
|
||||
int pr;
|
||||
/* With the cover off there is no timer at all: poll blocks until IPC. */
|
||||
int timeout_ms = -1;
|
||||
if(state.visible) {
|
||||
@@ -2551,7 +2846,9 @@ int main(int argc, char **argv)
|
||||
refresh_blank_timeout(&state);
|
||||
if(next < 1)
|
||||
next = 1;
|
||||
if(state.blank_ms > 0) {
|
||||
if(cover_hold_awake(&state)) {
|
||||
state.last_input_ms = now;
|
||||
} else if(state.blank_ms > 0) {
|
||||
long long remaining = state.blank_ms - (now - state.last_input_ms);
|
||||
if(remaining <= 0) {
|
||||
state.visible = 0;
|
||||
@@ -2580,7 +2877,9 @@ int main(int argc, char **argv)
|
||||
long long interval = strcmp(hw.backend, "kernel") == 0 ?
|
||||
KERNEL_REDRAW_MS : CLOCK_REDRAW_MS;
|
||||
long long next = interval;
|
||||
if(state.blank_ms > 0) {
|
||||
if(cover_hold_awake(&state)) {
|
||||
state.last_input_ms = now;
|
||||
} else if(state.blank_ms > 0) {
|
||||
long long remaining = state.blank_ms - (now - state.last_input_ms);
|
||||
if(remaining < 1)
|
||||
remaining = 1;
|
||||
@@ -2603,7 +2902,15 @@ int main(int argc, char **argv)
|
||||
pfds[1].revents = 0;
|
||||
nfds = 2;
|
||||
}
|
||||
if(poll(pfds, nfds, timeout_ms) == 0 && pending_until > now &&
|
||||
pr = poll(pfds, nfds, timeout_ms);
|
||||
if(pr < 0) {
|
||||
if(errno == EINTR && g_stop_requested)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
if(g_stop_requested)
|
||||
break;
|
||||
if(pr == 0 && pending_until > now &&
|
||||
strcmp(state.backend, "pending") == 0) {
|
||||
redraw = 1;
|
||||
}
|
||||
@@ -2624,14 +2931,20 @@ int main(int argc, char **argv)
|
||||
sendto(server, reply, strlen(reply), 0,
|
||||
(struct sockaddr *)&peer, peer_len);
|
||||
if(strncasecmp(original, "QUIT", 4) == 0) {
|
||||
set_backlight(&state, 0);
|
||||
cover_hw_shutdown(&hw);
|
||||
close(server);
|
||||
unlink(socket_path);
|
||||
return 0;
|
||||
g_stop_requested = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
state.visible = 0;
|
||||
state.test = 0;
|
||||
set_backlight(&state, 0);
|
||||
if(strcmp(state.lid, "closed") == 0 &&
|
||||
(hw.kernel_lit > 0 || hw.mux_claimed))
|
||||
cover_draw(&hw, fb_path, &state);
|
||||
cover_hw_shutdown(&hw);
|
||||
close(server);
|
||||
unlink(socket_path);
|
||||
return 0;
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <pwd.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#if defined(__has_include) && __has_include(<linux/qrtr.h>)
|
||||
#include <linux/qrtr.h>
|
||||
#else
|
||||
@@ -98,10 +99,12 @@ static BA_UNUSED void sleep_ms(int ms)
|
||||
|
||||
static void format_now_iso(char *out, size_t len)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now;
|
||||
struct tm tm_now;
|
||||
char base[32];
|
||||
char tz[16];
|
||||
ba_refresh_tz();
|
||||
now = time(NULL);
|
||||
localtime_r(&now, &tm_now);
|
||||
strftime(base, sizeof(base), "%Y-%m-%dT%H:%M:%S", &tm_now);
|
||||
strftime(tz, sizeof(tz), "%z", &tm_now);
|
||||
@@ -1453,6 +1456,42 @@ static int parse_call_info(const uint8_t *pkt, size_t pkt_len,
|
||||
return count;
|
||||
}
|
||||
|
||||
static int is_live_call_entry(const char *cdir, const char *name)
|
||||
{
|
||||
const char *dot;
|
||||
const char *ext;
|
||||
size_t i;
|
||||
static const char *const live_exts[] = {
|
||||
"pickedupcall", "initiatedcall", "ringing-in", "dialing",
|
||||
"ringing-out", "active", "held", "waiting",
|
||||
};
|
||||
static const char *const term_exts[] = {
|
||||
"discardedcall", "hangedupcall", "terminated", "blockedcall",
|
||||
};
|
||||
|
||||
if(!name || name[0] == '\0' || name[0] == '.')
|
||||
return 0;
|
||||
dot = strrchr(name, '.');
|
||||
if(!dot || dot == name || dot[1] == '\0')
|
||||
return 0;
|
||||
ext = dot + 1;
|
||||
for(i = 0; i < sizeof(live_exts) / sizeof(live_exts[0]); i++) {
|
||||
if(strcmp(ext, live_exts[i]) == 0)
|
||||
return 1;
|
||||
}
|
||||
if(strcmp(ext, "monitoredcall") == 0) {
|
||||
char p[PATH_MAX];
|
||||
int blen = (int)(dot - name);
|
||||
for(i = 0; i < sizeof(term_exts) / sizeof(term_exts[0]); i++) {
|
||||
int n = snprintf(p, sizeof(p), "%s/%.*s.%s", cdir, blen, name, term_exts[i]);
|
||||
if(n > 0 && (size_t)n < sizeof(p) && access(p, F_OK) == 0)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int has_sub1_call_files(void)
|
||||
{
|
||||
DIR *dir = opendir(CALLS_DIR);
|
||||
@@ -1460,7 +1499,8 @@ static int has_sub1_call_files(void)
|
||||
if(!dir)
|
||||
return 0;
|
||||
while((de = readdir(dir)) != NULL) {
|
||||
if(strncmp(de->d_name, "sub1_", 5) == 0) {
|
||||
if(strncmp(de->d_name, "sub1_", 5) == 0 &&
|
||||
is_live_call_entry(CALLS_DIR, de->d_name)) {
|
||||
closedir(dir);
|
||||
return 1;
|
||||
}
|
||||
@@ -1476,7 +1516,8 @@ static int has_mm_call_files(void)
|
||||
if(!dir)
|
||||
return 0;
|
||||
while((de = readdir(dir)) != NULL) {
|
||||
if(isdigit((unsigned char)de->d_name[0])) {
|
||||
if(isdigit((unsigned char)de->d_name[0]) &&
|
||||
is_live_call_entry(CALLS_DIR, de->d_name)) {
|
||||
closedir(dir);
|
||||
return 1;
|
||||
}
|
||||
@@ -1586,6 +1627,42 @@ static void cleanup_call_files_for_key(const char *call_key, int all_for_key)
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
static void send_cover_call_event(const char *status, const char *num, int sim_slot)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
char clean[96];
|
||||
char msg[192];
|
||||
size_t i = 0;
|
||||
int fd;
|
||||
int n;
|
||||
if(is_non_flip_profile() || !status || !*status)
|
||||
return;
|
||||
if(num) {
|
||||
for(; num[i] && i + 1 < sizeof(clean); i++) {
|
||||
char c = num[i];
|
||||
clean[i] = (c == '|' || c == '\n' || c == '\r' || c == '\t') ? ' ' : c;
|
||||
}
|
||||
}
|
||||
clean[i] = '\0';
|
||||
fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
|
||||
if(fd < 0)
|
||||
return;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", "/run/bananarchy/cover.sock");
|
||||
if(sim_slot == 1 || sim_slot == 2) {
|
||||
n = snprintf(msg, sizeof(msg), "CALL %s|%s||SIM%d\n", status, clean, sim_slot);
|
||||
} else {
|
||||
n = snprintf(msg, sizeof(msg), "CALL %s|%s||\n", status, clean);
|
||||
}
|
||||
if(n > 0) {
|
||||
size_t len = (size_t)n < sizeof(msg) ? (size_t)n : sizeof(msg) - 1;
|
||||
(void)sendto(fd, msg, len, MSG_DONTWAIT | MSG_NOSIGNAL,
|
||||
(const struct sockaddr *)&addr, sizeof(addr));
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static void sync_sub1_calls(struct voice_call *calls, int n_calls, int sim_slot,
|
||||
int vs, const struct sockaddr_qrtr *voice_addr)
|
||||
{
|
||||
@@ -1719,6 +1796,7 @@ static void sync_sub1_calls(struct voice_call *calls, int n_calls, int sim_slot,
|
||||
snprintf(fifo_msg, sizeof(fifo_msg), "INCOMING %s %s SIM%d",
|
||||
call_key, num, sim_slot);
|
||||
send_fifo_line("/tmp/dwm_plugin_callscreen.fifo", fifo_msg);
|
||||
send_cover_call_event("incoming", num, sim_slot);
|
||||
snprintf(ring_cmd, sizeof(ring_cmd),
|
||||
"sxmo_jobs.sh start --group ringing sxmo_hook_ring.sh '%s'",
|
||||
num);
|
||||
@@ -1746,6 +1824,7 @@ static void sync_sub1_calls(struct voice_call *calls, int n_calls, int sim_slot,
|
||||
snprintf(fifo_msg, sizeof(fifo_msg), "ACTIVE %s %s SIM%d",
|
||||
call_key, num, sim_slot);
|
||||
send_fifo_line("/tmp/dwm_plugin_callscreen.fifo", fifo_msg);
|
||||
send_cover_call_event("active", num, sim_slot);
|
||||
} else if(strcmp(st, "terminated") == 0) {
|
||||
char log_line[256];
|
||||
const char *evt = (strcmp(prev, "ringing-in") == 0) ?
|
||||
@@ -1754,6 +1833,8 @@ static void sync_sub1_calls(struct voice_call *calls, int n_calls, int sim_slot,
|
||||
snprintf(log_line, sizeof(log_line), "%s\t%s\t%s\t[SIM %d]\n",
|
||||
now_str, evt, num, sim_slot);
|
||||
append_modemlog(log_line);
|
||||
send_cover_call_event(strcmp(prev, "ringing-in") == 0 ? "missed" : "none",
|
||||
num, sim_slot);
|
||||
if(!hangup_req)
|
||||
send_fifo_line("/tmp/dwm_plugin_callscreen.fifo", "ENDED CALL ENDED");
|
||||
sent_ended = 1;
|
||||
@@ -1789,6 +1870,7 @@ static void sync_sub1_calls(struct voice_call *calls, int n_calls, int sim_slot,
|
||||
}
|
||||
if(removed_stale) {
|
||||
stop_ringing_user();
|
||||
send_cover_call_event("none", "", 0);
|
||||
if(!sent_ended && !hangup_req)
|
||||
send_fifo_line("/tmp/dwm_plugin_callscreen.fifo", "ENDED CALL ENDED");
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#define LID_STATE_FILE "/run/bananarchy/lid-state"
|
||||
#define LID_GENERATION_FILE "/run/bananarchy/lid-generation"
|
||||
#define LOCK_FLAG "/tmp/bananarchy_screen_locked"
|
||||
#define IDLE_LOCK_PIDFILE "/tmp/bananarchy_idle_lock.pid"
|
||||
#define LOCKER_FIFO "/tmp/dwm_plugin_locker.fifo"
|
||||
#define CALLSCREEN_FIFO "/tmp/dwm_plugin_callscreen.fifo"
|
||||
#define SXMO_STATE_FILE "/run/user/10000/sxmo.state"
|
||||
#define BRIGHTNESS "/sys/class/backlight/backlight/brightness"
|
||||
#define BL_POWER "/sys/class/backlight/backlight/bl_power"
|
||||
@@ -177,6 +179,15 @@ static void locker_send(const char *payload)
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static void callscreen_send(const char *payload)
|
||||
{
|
||||
int fd = open(CALLSCREEN_FIFO, O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
if(fd < 0)
|
||||
return;
|
||||
(void)write(fd, payload, strlen(payload));
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static const char *sxmo_state_path(void)
|
||||
{
|
||||
const char *path = getenv("SXMO_STATE");
|
||||
@@ -247,6 +258,14 @@ static void enforce_closed_dark(void)
|
||||
run_dpms("off");
|
||||
}
|
||||
|
||||
static void cancel_idle_lock_timer(void)
|
||||
{
|
||||
int pid = read_int_file(IDLE_LOCK_PIDFILE, -1);
|
||||
if(pid > 1)
|
||||
kill((pid_t)pid, SIGTERM);
|
||||
unlink(IDLE_LOCK_PIDFILE);
|
||||
}
|
||||
|
||||
/* Everything user-visible happens synchronously here: no shell, no fork and
|
||||
* no scheduler wait before the main panel is dark and the screen is locked.
|
||||
* The Sxmo state hooks are spawned afterwards and only repeat these writes. */
|
||||
@@ -254,6 +273,7 @@ static void on_transition(int closed)
|
||||
{
|
||||
const char *state = sxmo_state_path();
|
||||
char generation[32];
|
||||
cancel_idle_lock_timer();
|
||||
lid_generation++;
|
||||
snprintf(generation, sizeof(generation), "%lu", lid_generation);
|
||||
write_session_file(LID_GENERATION_FILE, generation);
|
||||
@@ -301,6 +321,10 @@ static void on_transition(int closed)
|
||||
run_dpms("reinit");
|
||||
locker_send("LOCK\n");
|
||||
run_sxmo_state("lock", "open");
|
||||
if(access("/tmp/sxmo_call_ringing", F_OK) == 0 ||
|
||||
access("/tmp/sxmo_active_call", F_OK) == 0) {
|
||||
callscreen_send("RAISE\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
static volatile sig_atomic_t stop_requested = 0;
|
||||
static volatile sig_atomic_t realign_requested = 0;
|
||||
static volatile pid_t active_child = -1;
|
||||
|
||||
static void handle_stop(int sig)
|
||||
@@ -24,6 +25,12 @@ static void handle_stop(int sig)
|
||||
kill(child, SIGTERM);
|
||||
}
|
||||
|
||||
static void handle_realign(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
realign_requested = 1;
|
||||
}
|
||||
|
||||
static void aligned_sleep(long interval)
|
||||
{
|
||||
struct timespec now;
|
||||
@@ -47,9 +54,14 @@ static void aligned_sleep(long interval)
|
||||
req.tv_nsec = (long)rem_ns;
|
||||
}
|
||||
|
||||
realign_requested = 0;
|
||||
while(!stop_requested) {
|
||||
if(nanosleep(&req, &req) == 0)
|
||||
break;
|
||||
if(realign_requested) {
|
||||
realign_requested = 0;
|
||||
break;
|
||||
}
|
||||
if(errno != EINTR)
|
||||
break;
|
||||
}
|
||||
@@ -78,6 +90,8 @@ int main(int argc, char **argv)
|
||||
sa.sa_flags = 0;
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sa.sa_handler = handle_realign;
|
||||
sigaction(SIGUSR1, &sa, NULL);
|
||||
|
||||
while(!stop_requested) {
|
||||
pid_t pid = fork();
|
||||
@@ -89,6 +103,7 @@ int main(int argc, char **argv)
|
||||
sa.sa_flags = 0;
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGUSR1, &sa, NULL);
|
||||
execvp(argv[2], &argv[2]);
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
@@ -71,12 +71,14 @@ static int lid_is_closed(void)
|
||||
}
|
||||
|
||||
/* While the flip is closed the external side keys are cover-display wake
|
||||
* buttons, not volume controls. The cover daemon is a 0%-CPU datagram
|
||||
* server; a failed send just means it is not running on this target. */
|
||||
static void cover_button(void)
|
||||
* or incoming-call action buttons, not volume controls. The cover daemon is
|
||||
* a 0%-CPU datagram server; a failed send just means it is not running on this
|
||||
* target. */
|
||||
static void cover_button(const char *cmd)
|
||||
{
|
||||
const char *client_path = client_socket_path();
|
||||
const char *remote_path = cover_socket_path();
|
||||
const char *payload = (cmd && *cmd) ? cmd : "BUTTON\n";
|
||||
int fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
struct sockaddr_un local;
|
||||
struct sockaddr_un remote;
|
||||
@@ -95,7 +97,7 @@ static void cover_button(void)
|
||||
memset(&remote, 0, sizeof(remote));
|
||||
remote.sun_family = AF_UNIX;
|
||||
snprintf(remote.sun_path, sizeof(remote.sun_path), "%s", remote_path);
|
||||
sendto(fd, "BUTTON\n", 7, 0, (struct sockaddr *)&remote, sizeof(remote));
|
||||
sendto(fd, payload, strlen(payload), 0, (struct sockaddr *)&remote, sizeof(remote));
|
||||
close(fd);
|
||||
unlink(client_path);
|
||||
}
|
||||
@@ -134,7 +136,12 @@ static void read_ready(struct watch_list *list, struct pollfd *fds, int nfds)
|
||||
ev.code != KEY_POWER && ev.code != KEY_CAMERA)
|
||||
continue;
|
||||
if(lid_is_closed()) {
|
||||
cover_button();
|
||||
if(ev.code == KEY_VOLUMEUP)
|
||||
cover_button("BUTTON VOLUP\n");
|
||||
else if(ev.code == KEY_VOLUMEDOWN)
|
||||
cover_button("BUTTON VOLDOWN\n");
|
||||
else
|
||||
cover_button("BUTTON POWER\n");
|
||||
continue;
|
||||
}
|
||||
if(ev.code == KEY_VOLUMEUP)
|
||||
|
||||
@@ -349,4 +349,110 @@ static BA_UNUSED pid_t spawn_async_cmd(char *const argv[])
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
/* Force musl/glibc to reload timezone rules when /etc/localtime or /etc/timezone changes. */
|
||||
static BA_UNUSED void ba_refresh_tz(void)
|
||||
{
|
||||
const char *lt_env = getenv("BANANARCHY_TZ_LOCALTIME");
|
||||
const char *tf_env = getenv("BANANARCHY_TZ_FILE");
|
||||
const char *lt_path = (lt_env && *lt_env) ? lt_env : "/etc/localtime";
|
||||
const char *tf_path = (tf_env && *tf_env) ? tf_env : "/etc/timezone";
|
||||
struct stat st;
|
||||
struct stat lst;
|
||||
struct stat tf_st;
|
||||
char linkbuf[512];
|
||||
char tf_buf[128];
|
||||
ssize_t linklen;
|
||||
int have_lt;
|
||||
int have_lst;
|
||||
int have_tf;
|
||||
int tf_is_tzif = 0;
|
||||
char sig[1024];
|
||||
static char last_sig[1024];
|
||||
static int tz_toggle = 0;
|
||||
|
||||
memset(&st, 0, sizeof(st));
|
||||
memset(&lst, 0, sizeof(lst));
|
||||
memset(&tf_st, 0, sizeof(tf_st));
|
||||
linkbuf[0] = '\0';
|
||||
tf_buf[0] = '\0';
|
||||
|
||||
have_lt = (stat(lt_path, &st) == 0);
|
||||
have_lst = (lstat(lt_path, &lst) == 0);
|
||||
linklen = readlink(lt_path, linkbuf, sizeof(linkbuf) - 1);
|
||||
if (linklen >= 0) {
|
||||
linkbuf[linklen] = '\0';
|
||||
} else {
|
||||
linkbuf[0] = '\0';
|
||||
}
|
||||
|
||||
have_tf = (stat(tf_path, &tf_st) == 0);
|
||||
if (have_tf) {
|
||||
int fd = open(tf_path, O_RDONLY | O_CLOEXEC);
|
||||
if (fd >= 0) {
|
||||
ssize_t n = read(fd, tf_buf, sizeof(tf_buf) - 1);
|
||||
close(fd);
|
||||
if (n >= 4 && memcmp(tf_buf, "TZif", 4) == 0) {
|
||||
tf_is_tzif = 1;
|
||||
tf_buf[0] = '\0';
|
||||
} else if (n > 0) {
|
||||
size_t len = (size_t)n;
|
||||
tf_buf[len] = '\0';
|
||||
while (len > 0 && (tf_buf[len - 1] == '\n' || tf_buf[len - 1] == '\r' ||
|
||||
tf_buf[len - 1] == ' ' || tf_buf[len - 1] == '\t')) {
|
||||
tf_buf[--len] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Avoid clearing cached timezone if setup-timezone is mid-rm/ln. */
|
||||
if (!have_lt && !have_tf && last_sig[0] != '\0')
|
||||
return;
|
||||
|
||||
snprintf(sig, sizeof(sig),
|
||||
"%d|%d|%s|%llu|%lld|%ld|%llu|%llu|%lld|%ld|%llu|%d|%d|%s|%lld|%ld|%llu",
|
||||
have_lt, have_lst, linkbuf,
|
||||
(unsigned long long)st.st_ino, (long long)st.st_mtime,
|
||||
(long)st.st_mtim.tv_nsec, (unsigned long long)st.st_size,
|
||||
(unsigned long long)lst.st_ino, (long long)lst.st_mtime,
|
||||
(long)lst.st_mtim.tv_nsec,
|
||||
(unsigned long long)tf_st.st_size, have_tf, tf_is_tzif, tf_buf,
|
||||
(long long)tf_st.st_mtime, (long)tf_st.st_mtim.tv_nsec,
|
||||
(unsigned long long)tf_st.st_ino);
|
||||
|
||||
if (strcmp(sig, last_sig) == 0)
|
||||
return;
|
||||
snprintf(last_sig, sizeof(last_sig), "%s", sig);
|
||||
|
||||
tz_toggle ^= 1;
|
||||
if ((!lt_env || !*lt_env) && tf_env && *tf_env && have_tf) {
|
||||
char tz_val[600];
|
||||
if (tf_is_tzif) {
|
||||
if (tf_path[0] == '/') {
|
||||
snprintf(tz_val, sizeof(tz_val), "%s%s", tz_toggle ? ":" : ":/.", tf_path);
|
||||
} else {
|
||||
snprintf(tz_val, sizeof(tz_val), "%s%s", tz_toggle ? ":" : ":./", tf_path);
|
||||
}
|
||||
setenv("TZ", tz_val, 1);
|
||||
} else if (tf_buf[0]) {
|
||||
setenv("TZ", tf_buf, 1);
|
||||
}
|
||||
tzset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (have_lt) {
|
||||
char tz_val[600];
|
||||
if (lt_path[0] == '/') {
|
||||
snprintf(tz_val, sizeof(tz_val), "%s%s", tz_toggle ? ":" : ":/.", lt_path);
|
||||
} else {
|
||||
snprintf(tz_val, sizeof(tz_val), "%s%s", tz_toggle ? ":" : ":./", lt_path);
|
||||
}
|
||||
setenv("TZ", tz_val, 1);
|
||||
} else if (tf_buf[0]) {
|
||||
setenv("TZ", tf_buf, 1);
|
||||
}
|
||||
tzset();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -27,7 +27,9 @@
|
||||
#include <poll.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
@@ -300,26 +302,83 @@ void finalizeWavHeader(const std::string& path) {
|
||||
::close(fd);
|
||||
}
|
||||
|
||||
void wakeDisplayHardware(Display* dpy) {
|
||||
bool isFlipDevice() {
|
||||
int profFd = ::open("/usr/share/bananarchy/lid-profile", O_RDONLY | O_CLOEXEC);
|
||||
bool isFlip = false;
|
||||
if (profFd >= 0) {
|
||||
char profBuf[16] {};
|
||||
ssize_t pn = ::read(profFd, profBuf, sizeof(profBuf) - 1);
|
||||
::close(profFd);
|
||||
isFlip = (pn >= 4 && std::strncmp(profBuf, "flip", 4) == 0 &&
|
||||
(profBuf[4] == '\0' || profBuf[4] == '\n' || profBuf[4] == '\r'));
|
||||
if (profFd < 0) {
|
||||
return false;
|
||||
}
|
||||
int lidFd = isFlip ? ::open("/run/bananarchy/lid-state", O_RDONLY | O_CLOEXEC) : -1;
|
||||
if (lidFd >= 0) {
|
||||
char lidBuf[32] {};
|
||||
ssize_t n = ::read(lidFd, lidBuf, sizeof(lidBuf) - 1);
|
||||
::close(lidFd);
|
||||
if (n >= 6 && std::strncmp(lidBuf, "closed", 6) == 0) {
|
||||
runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake");
|
||||
return;
|
||||
char profBuf[16] {};
|
||||
ssize_t pn = ::read(profFd, profBuf, sizeof(profBuf) - 1);
|
||||
::close(profFd);
|
||||
return (pn >= 4 && std::strncmp(profBuf, "flip", 4) == 0 &&
|
||||
(profBuf[4] == '\0' || profBuf[4] == '\n' || profBuf[4] == '\r'));
|
||||
}
|
||||
|
||||
bool isFlipClosed() {
|
||||
if (!isFlipDevice()) {
|
||||
return false;
|
||||
}
|
||||
int lidFd = ::open("/run/bananarchy/lid-state", O_RDONLY | O_CLOEXEC);
|
||||
if (lidFd < 0) {
|
||||
return false;
|
||||
}
|
||||
char lidBuf[32] {};
|
||||
ssize_t n = ::read(lidFd, lidBuf, sizeof(lidBuf) - 1);
|
||||
::close(lidFd);
|
||||
return (n >= 6 && std::strncmp(lidBuf, "closed", 6) == 0);
|
||||
}
|
||||
|
||||
std::string sanitizeCoverField(const std::string& raw) {
|
||||
std::string out;
|
||||
out.reserve(raw.size());
|
||||
for (char c : raw) {
|
||||
if (c == '|' || c == '\n' || c == '\r' || c == '\t') {
|
||||
out.push_back(' ');
|
||||
} else {
|
||||
out.push_back(c);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
void notifyCoverCall(const char* status, const std::string& number,
|
||||
const std::string& name, int simSlot) {
|
||||
if (!isFlipDevice() || !status || !*status) {
|
||||
return;
|
||||
}
|
||||
int fd = ::socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
|
||||
if (fd < 0) {
|
||||
return;
|
||||
}
|
||||
struct sockaddr_un addr {};
|
||||
addr.sun_family = AF_UNIX;
|
||||
std::snprintf(addr.sun_path, sizeof(addr.sun_path), "%s",
|
||||
"/run/bananarchy/cover.sock");
|
||||
std::string safeNum = sanitizeCoverField(number);
|
||||
std::string safeName = sanitizeCoverField(name);
|
||||
char simBuf[16] {};
|
||||
if (simSlot == 1 || simSlot == 2) {
|
||||
std::snprintf(simBuf, sizeof(simBuf), "SIM%d", simSlot);
|
||||
}
|
||||
char msg[384];
|
||||
int len = std::snprintf(msg, sizeof(msg), "CALL %s|%s|%s|%s\n",
|
||||
status, safeNum.c_str(), safeName.c_str(), simBuf);
|
||||
if (len > 0) {
|
||||
size_t sendLen = static_cast<size_t>(len) < sizeof(msg)
|
||||
? static_cast<size_t>(len)
|
||||
: sizeof(msg) - 1;
|
||||
(void)::sendto(fd, msg, sendLen, MSG_DONTWAIT | MSG_NOSIGNAL,
|
||||
reinterpret_cast<const struct sockaddr*>(&addr),
|
||||
sizeof(addr));
|
||||
}
|
||||
::close(fd);
|
||||
}
|
||||
|
||||
void wakeDisplayHardware(Display* dpy) {
|
||||
if (isFlipClosed()) {
|
||||
runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake");
|
||||
return;
|
||||
}
|
||||
int saved = readIntFile("/tmp/sxmo_saved_brightness", -1);
|
||||
if (saved <= 1) {
|
||||
saved = readIntFile("/sys/class/backlight/backlight/max_brightness", 14);
|
||||
@@ -504,6 +563,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
int64_t callStartMs = 0;
|
||||
int64_t endedAtMs = 0;
|
||||
int64_t lastHangupMs = 0;
|
||||
std::string lastRejectedCallId;
|
||||
int lastFinalDurationSec = 0;
|
||||
int64_t lastModemPollMs = 0;
|
||||
|
||||
@@ -796,6 +856,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
return true;
|
||||
}
|
||||
std::string dir = getRecordingsDir();
|
||||
refreshLocalTimezone();
|
||||
time_t nowSec = ::time(nullptr);
|
||||
struct tm tmNow {};
|
||||
localtime_r(&nowSec, &tmNow);
|
||||
@@ -1289,8 +1350,13 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
|
||||
auto showWindow = [&]() {
|
||||
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
||||
closeOtherPlugins("callscreen");
|
||||
closeOtherPlugins("callscreen", "locker");
|
||||
if (isFlipClosed()) {
|
||||
runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake");
|
||||
return;
|
||||
}
|
||||
wakeDisplayHardware(dpy);
|
||||
sendPluginCommand("locker", "UNGRAB");
|
||||
theme.checkAndReload(dpy, screen, visual, cmap, layoutMain, layoutSmall,
|
||||
layoutIcon, layoutNum, win);
|
||||
reloadContactsIfNeeded();
|
||||
@@ -1351,6 +1417,9 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
if (d) {
|
||||
struct dirent* ent;
|
||||
while ((ent = ::readdir(d)) != nullptr) {
|
||||
if (!isLiveSxmoCallFile(callsDir, ent->d_name)) {
|
||||
continue;
|
||||
}
|
||||
std::string name = ent->d_name;
|
||||
size_t dot = name.find('.');
|
||||
if (dot != std::string::npos && dot > 0) {
|
||||
@@ -1381,10 +1450,9 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
auto stopRingingJobs = [&]() {
|
||||
::unlink("/tmp/sxmo_call_ringing");
|
||||
runAsyncCmd("sxmo_jobs.sh stop ringing >/dev/null 2>&1; "
|
||||
"pkill -TERM -f sxmo_hook_ring.sh >/dev/null 2>&1; "
|
||||
"pkill -TERM -f 'pw-play.*ring' >/dev/null 2>&1; "
|
||||
"pkill -TERM -f 'mpv.*ring' >/dev/null 2>&1; "
|
||||
"pkill -TERM -x sxmo_vibrate >/dev/null 2>&1");
|
||||
"killall -q -TERM bananarchy-melody pw-play mpv sxmo_vibrate >/dev/null 2>&1; "
|
||||
"pids=\"$(pgrep -f '[s]xmo_hook_ring\\.sh|[p]w-play.*ring|[m]pv.*ring' 2>/dev/null)\"; "
|
||||
"[ -n \"$pids\" ] && kill -TERM $pids >/dev/null 2>&1 || true");
|
||||
};
|
||||
|
||||
auto acceptIncomingCall = [&]() {
|
||||
@@ -1400,6 +1468,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
selectedRow = 0;
|
||||
writeActiveStateFiles();
|
||||
stopRingingJobs();
|
||||
notifyCoverCall("active", callNumber, contactName, activeSimSlot);
|
||||
setSpeakerRoute(false, hasBtAudioCard());
|
||||
render();
|
||||
|
||||
@@ -1418,6 +1487,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
}
|
||||
ringMuted = true;
|
||||
stopRingingJobs();
|
||||
notifyCoverCall("muted", callNumber, contactName, activeSimSlot);
|
||||
std::string cid = resolveActiveModemCallId();
|
||||
if (cid.rfind("sip:", 0) == 0) {
|
||||
sendPluginCommand("sip", "CALL_MUTE_RING " + cid);
|
||||
@@ -1432,6 +1502,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
};
|
||||
|
||||
auto transitionToEnded = [&](const std::string& reason) {
|
||||
bool wasIncoming = (callState == CallState::Incoming);
|
||||
stopRecording();
|
||||
if (micMuted) {
|
||||
setMicMuted(false);
|
||||
@@ -1450,13 +1521,13 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
ringMuted = false;
|
||||
writeActiveStateFiles();
|
||||
stopRingingJobs();
|
||||
if (wasIncoming && endReason == "CALL ENDED") {
|
||||
notifyCoverCall("missed", callNumber, contactName, activeSimSlot);
|
||||
} else {
|
||||
notifyCoverCall("none", "", "", 0);
|
||||
}
|
||||
btAudioOn = false;
|
||||
runAsyncCmd("sxmo_jobs.sh stop ringing >/dev/null 2>&1; "
|
||||
"pkill -TERM -f sxmo_hook_ring.sh >/dev/null 2>&1; "
|
||||
"pkill -TERM -f 'pw-play.*ring' >/dev/null 2>&1; "
|
||||
"pkill -TERM -f 'mpv.*ring' >/dev/null 2>&1; "
|
||||
"pkill -TERM -x sxmo_vibrate >/dev/null 2>&1; "
|
||||
"sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1");
|
||||
runAsyncCmd("sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1");
|
||||
render();
|
||||
};
|
||||
|
||||
@@ -1468,6 +1539,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
setMicMuted(false);
|
||||
}
|
||||
stopRingingJobs();
|
||||
notifyCoverCall("none", "", "", 0);
|
||||
btAudioOn = false;
|
||||
dtmfMode = false;
|
||||
ringMuted = false;
|
||||
@@ -1480,12 +1552,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
missingModemPolls = 0;
|
||||
writeActiveStateFiles();
|
||||
hideWindow(false);
|
||||
runAsyncCmd("sxmo_jobs.sh stop ringing >/dev/null 2>&1; "
|
||||
"pkill -TERM -f sxmo_hook_ring.sh >/dev/null 2>&1; "
|
||||
"pkill -TERM -f 'pw-play.*ring' >/dev/null 2>&1; "
|
||||
"pkill -TERM -f 'mpv.*ring' >/dev/null 2>&1; "
|
||||
"pkill -TERM -x sxmo_vibrate >/dev/null 2>&1; "
|
||||
"sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1");
|
||||
runAsyncCmd("sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1");
|
||||
};
|
||||
|
||||
auto hangupQmiVoiceCallsNow = [&]() {
|
||||
@@ -1575,6 +1642,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
::sendto(sfd, infoReq, sizeof(infoReq), 0,
|
||||
reinterpret_cast<const struct sockaddr*>(&vSq), sizeof(vSq));
|
||||
std::vector<uint8_t> cidsToHangup;
|
||||
bool gotCallInfo = false;
|
||||
int64_t infoDeadline = nowMs() + 80;
|
||||
while (nowMs() < infoDeadline) {
|
||||
int waitMs = static_cast<int>(std::max<int64_t>(2, infoDeadline - nowMs()));
|
||||
@@ -1583,6 +1651,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
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) {
|
||||
gotCallInfo = true;
|
||||
const uint8_t* rawCi01 = nullptr;
|
||||
uint16_t lenCi01 = 0;
|
||||
const uint8_t* rawCi10 = nullptr;
|
||||
@@ -1619,7 +1688,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cidsToHangup.empty()) {
|
||||
if (!gotCallInfo && cidsToHangup.empty()) {
|
||||
cidsToHangup.push_back(1);
|
||||
}
|
||||
uint8_t txn = 3;
|
||||
@@ -1651,6 +1720,11 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
lastHangupMs = nowMs();
|
||||
writeIntFile("/tmp/sxmo_hangup_requested", 1);
|
||||
std::string cid = resolveActiveModemCallId();
|
||||
if (!cid.empty() && cid != "-" && cid != "sim" && cid != "test") {
|
||||
lastRejectedCallId = cid;
|
||||
} else {
|
||||
lastRejectedCallId.clear();
|
||||
}
|
||||
bool wasIncoming = (callState == CallState::Incoming);
|
||||
stopRingingJobs();
|
||||
if (cid.rfind("sip:", 0) == 0 || activeSimSlot == 3) {
|
||||
@@ -1670,7 +1744,9 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
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) {
|
||||
fn.find(".active") != std::string::npos ||
|
||||
fn.find(".held") != std::string::npos ||
|
||||
fn.find(".waiting") != std::string::npos) {
|
||||
std::string fpPath = callsDir + "/" + fn;
|
||||
::unlink(fpPath.c_str());
|
||||
}
|
||||
@@ -1993,6 +2069,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
ringMuted = false;
|
||||
writeActiveStateFiles();
|
||||
stopRingingJobs();
|
||||
notifyCoverCall("active", callNumber, contactName, activeSimSlot);
|
||||
setSpeakerRoute(speakerOn, btAudioOn);
|
||||
render();
|
||||
} else if (foundState == "ringing-in" && callState == CallState::Idle) {
|
||||
@@ -2000,6 +2077,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
callStartMs = nowMs();
|
||||
selectedRow = 0;
|
||||
writeActiveStateFiles();
|
||||
notifyCoverCall("incoming", callNumber, contactName, activeSimSlot);
|
||||
render();
|
||||
} else if ((foundState == "dialing" || foundState == "ringing-out") &&
|
||||
callState == CallState::Idle) {
|
||||
@@ -2028,7 +2106,9 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
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) {
|
||||
fn.find(".active") != std::string::npos ||
|
||||
fn.find(".held") != std::string::npos ||
|
||||
fn.find(".waiting") != std::string::npos) {
|
||||
std::string fpPath = callsDir + "/" + fn;
|
||||
::unlink(fpPath.c_str());
|
||||
}
|
||||
@@ -2071,6 +2151,10 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
return;
|
||||
}
|
||||
if (line == "HANGUP_CLOSE" || line.rfind("HANGUP_CLOSE ", 0) == 0) {
|
||||
if (callState == CallState::Idle && !isCallActiveOrRingingFast()) {
|
||||
hideWindow(false);
|
||||
return;
|
||||
}
|
||||
hangupCall(true);
|
||||
return;
|
||||
}
|
||||
@@ -2216,7 +2300,25 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
};
|
||||
|
||||
if (verb == "INCOMING") {
|
||||
if (lastHangupMs > 0 && nowMs() - lastHangupMs < 4000 &&
|
||||
::access("/tmp/sxmo_hangup_requested", F_OK) == 0 &&
|
||||
!arg1.empty() && arg1 != "-" && arg1 == lastRejectedCallId) {
|
||||
return;
|
||||
}
|
||||
if (callState == CallState::Incoming &&
|
||||
!arg1.empty() && arg1 != "-" && callId == arg1) {
|
||||
updateCallerDetails(arg1, arg2);
|
||||
if (!arg3.empty() || activeSimSlot == 0) {
|
||||
parseSimTag(arg1, arg3);
|
||||
}
|
||||
writeActiveStateFiles();
|
||||
notifyCoverCall(ringMuted ? "muted" : "incoming",
|
||||
callNumber, contactName, activeSimSlot);
|
||||
showWindow();
|
||||
return;
|
||||
}
|
||||
lastHangupMs = 0;
|
||||
lastRejectedCallId.clear();
|
||||
::unlink("/tmp/sxmo_hangup_requested");
|
||||
callId.clear();
|
||||
callNumber.clear();
|
||||
@@ -2229,7 +2331,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
parseSimTag(arg1, arg3);
|
||||
callState = CallState::Incoming;
|
||||
callStartMs = nowMs();
|
||||
lastModemPollMs = callStartMs;
|
||||
lastModemPollMs = callStartMs - 1100;
|
||||
missingModemPolls = 0;
|
||||
ringMuted = false;
|
||||
speakerOn = false;
|
||||
@@ -2237,6 +2339,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
dtmfSent.clear();
|
||||
selectedRow = 0;
|
||||
writeActiveStateFiles();
|
||||
notifyCoverCall("incoming", callNumber, contactName, activeSimSlot);
|
||||
showWindow();
|
||||
} else if (verb == "OUTGOING") {
|
||||
if (lastHangupMs > 0 && nowMs() - lastHangupMs < 4000 &&
|
||||
@@ -2301,6 +2404,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
statusNotice.clear();
|
||||
statusNoticeUntilMs = 0;
|
||||
writeActiveStateFiles();
|
||||
notifyCoverCall("active", callNumber, contactName, activeSimSlot);
|
||||
showWindow();
|
||||
} else if (verb == "OPEN") {
|
||||
if (!arg1.empty()) {
|
||||
@@ -2312,6 +2416,22 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
if (callState != CallState::Idle || !arg1.empty()) {
|
||||
showWindow();
|
||||
}
|
||||
} else if (verb == "RAISE") {
|
||||
if (!isFlipClosed() &&
|
||||
(callState == CallState::Incoming || callState == CallState::Active ||
|
||||
callState == CallState::Outgoing)) {
|
||||
if (nowMs() - lastModemPollMs >= 250) {
|
||||
lastModemPollMs = nowMs();
|
||||
syncModemCalls();
|
||||
if (callState == CallState::Incoming && missingModemPolls > 0) {
|
||||
syncModemCalls();
|
||||
}
|
||||
}
|
||||
if (callState == CallState::Incoming || callState == CallState::Active ||
|
||||
callState == CallState::Outgoing) {
|
||||
showWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2379,6 +2499,17 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
}
|
||||
} else if (ev.type == VisibilityNotify &&
|
||||
ev.xvisibility.state != VisibilityUnobscured) {
|
||||
if (isFlipClosed()) {
|
||||
continue;
|
||||
}
|
||||
if (callState == CallState::Incoming ||
|
||||
callState == CallState::Outgoing ||
|
||||
callState == CallState::Active) {
|
||||
XMapRaised(dpy, win);
|
||||
grabPluginKeyboard(dpy, win);
|
||||
render();
|
||||
continue;
|
||||
}
|
||||
if (isAnotherPluginActive("callscreen")) {
|
||||
if (callState == CallState::SelectSim || callState == CallState::Ended) {
|
||||
callState = CallState::Idle;
|
||||
@@ -2400,6 +2531,9 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
} else if (ev.type == KeyPress) {
|
||||
if (isFlipClosed()) {
|
||||
continue;
|
||||
}
|
||||
KeySym sym = XLookupKeysym(&ev.xkey, 0);
|
||||
unsigned int kc = ev.xkey.keycode;
|
||||
bool isLeftSoft = (sym == XK_Menu || sym == XF86XK_KbdLcdMenu1 || kc == 135);
|
||||
|
||||
@@ -624,8 +624,8 @@ int locker_run_main(int argc, char** argv) {
|
||||
}
|
||||
};
|
||||
|
||||
auto closeOtherOverlays = [&]() {
|
||||
closeOtherPlugins("locker");
|
||||
auto closeOtherOverlays = [&](bool keepCallScreen = false) {
|
||||
closeOtherPlugins("locker", keepCallScreen ? "callscreen" : nullptr);
|
||||
sendPluginCommand("dmenu", "CLOSE");
|
||||
sendPluginCommand("xdrawer", "CLOSE");
|
||||
::unlink("/tmp/dwm_plugin_dmenu.active");
|
||||
@@ -676,6 +676,7 @@ int locker_run_main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
// Current time and date
|
||||
refreshLocalTimezone();
|
||||
std::time_t t = std::time(nullptr);
|
||||
struct tm tmNow {};
|
||||
localtime_r(&t, &tmNow);
|
||||
@@ -813,16 +814,23 @@ int locker_run_main(int argc, char** argv) {
|
||||
|
||||
auto lockPhone = [&](bool blankDisplay) {
|
||||
bool alreadyVisible = visible;
|
||||
bool alreadyClosedBlanked =
|
||||
blankDisplay && isLidClosed() && alreadyVisible && wasScreenBlanked;
|
||||
bool hadActiveCall = isCallActiveOrRingingFast() || isCallScreenVisible();
|
||||
bool keepCall = (!blankDisplay || alreadyClosedBlanked) && hadActiveCall;
|
||||
writeSmallFileStr(kLockFlagPath, "1\n");
|
||||
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
||||
sendPluginCommand("callscreen", "HANGUP_CLOSE");
|
||||
if (hadActiveCall) {
|
||||
::unlink("/tmp/sxmo_call_ringing");
|
||||
::unlink("/tmp/sxmo_active_call");
|
||||
runAsyncArgv("sxmo_modemcall.sh", "hangup", "all");
|
||||
if (blankDisplay && !alreadyClosedBlanked) {
|
||||
if (hadActiveCall) {
|
||||
sendPluginCommand("callscreen", "HANGUP_CLOSE");
|
||||
::unlink("/tmp/sxmo_call_ringing");
|
||||
::unlink("/tmp/sxmo_active_call");
|
||||
runAsyncArgv("sxmo_modemcall.sh", "hangup", "all");
|
||||
} else if (isCallScreenVisible()) {
|
||||
sendPluginCommand("callscreen", "CLOSE");
|
||||
}
|
||||
}
|
||||
closeOtherOverlays();
|
||||
closeOtherOverlays(keepCall);
|
||||
verifier.refreshIfNeeded();
|
||||
int64_t now = nowMs();
|
||||
lastActivityMs = now;
|
||||
@@ -840,7 +848,16 @@ int locker_run_main(int argc, char** argv) {
|
||||
XSync(dpy, False);
|
||||
visible = true;
|
||||
}
|
||||
grabLockerInput();
|
||||
if (keepCall && !isLidClosed()) {
|
||||
if (grabHeld) {
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
XSync(dpy, False);
|
||||
grabHeld = false;
|
||||
}
|
||||
} else {
|
||||
grabLockerInput();
|
||||
}
|
||||
if (blankDisplay || isLidClosed()) {
|
||||
setSxmoStateFile("screenoff");
|
||||
blankScreenBacklight();
|
||||
@@ -851,6 +868,9 @@ int locker_run_main(int argc, char** argv) {
|
||||
wasScreenBlanked = false;
|
||||
refreshStatusCache(true);
|
||||
render();
|
||||
if (keepCall) {
|
||||
sendPluginCommand("callscreen", "RAISE");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1064,12 +1084,13 @@ int locker_run_main(int argc, char** argv) {
|
||||
continue;
|
||||
}
|
||||
if (::access(kLockFlagPath, F_OK) == 0 || visible) {
|
||||
bool keepCall = isCallActiveOrRingingFast() || isCallScreenVisible();
|
||||
if (!visible) {
|
||||
lockPhone(false);
|
||||
} else {
|
||||
bool wasBlank = wasScreenBlanked || isScreenBlanked();
|
||||
if (wasBlank) {
|
||||
closeOtherOverlays();
|
||||
closeOtherOverlays(keepCall);
|
||||
}
|
||||
setSxmoStateFile("lock");
|
||||
wakeScreenBacklight();
|
||||
@@ -1078,14 +1099,42 @@ int locker_run_main(int argc, char** argv) {
|
||||
if (wasBlank) {
|
||||
refreshStatusCache(true);
|
||||
}
|
||||
if (!grabHeld) {
|
||||
if (keepCall) {
|
||||
if (grabHeld) {
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
XSync(dpy, False);
|
||||
grabHeld = false;
|
||||
}
|
||||
} else if (!grabHeld) {
|
||||
grabLockerInput();
|
||||
}
|
||||
render();
|
||||
if (keepCall) {
|
||||
sendPluginCommand("callscreen", "RAISE");
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (cmd == "REFRESH_TIME") {
|
||||
refreshLocalTimezone();
|
||||
lastRenderedMin = -1;
|
||||
if (visible && !isScreenBlanked() && !isLidClosed() && !isCallScreenVisible()) {
|
||||
render();
|
||||
XFlush(dpy);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (cmd == "UNGRAB") {
|
||||
if (grabHeld) {
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
XSync(dpy, False);
|
||||
grabHeld = false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (cmd.rfind("KEY ", 0) == 0) {
|
||||
unsigned int kc = 0;
|
||||
unsigned int st = 0;
|
||||
@@ -1204,10 +1253,11 @@ int locker_run_main(int argc, char** argv) {
|
||||
|
||||
if (visible && !isScreenBlanked()) {
|
||||
int64_t now = nowMs();
|
||||
if (lastActivityMs <= 0) {
|
||||
bool callActive = isCallScreenVisible() || isCallActiveOrRingingFast();
|
||||
if (lastActivityMs <= 0 || callActive) {
|
||||
lastActivityMs = now;
|
||||
}
|
||||
if (now - lastActivityMs >= kLockerIdleBlankMs) {
|
||||
if (!callActive && now - lastActivityMs >= kLockerIdleBlankMs) {
|
||||
passcode.clear();
|
||||
statusMsg.clear();
|
||||
statusIsError = false;
|
||||
@@ -1216,9 +1266,17 @@ int locker_run_main(int argc, char** argv) {
|
||||
blankScreenBacklight();
|
||||
wasScreenBlanked = true;
|
||||
} else {
|
||||
if (!isCallScreenVisible() && !grabHeld) {
|
||||
if (callActive) {
|
||||
if (grabHeld) {
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
XSync(dpy, False);
|
||||
grabHeld = false;
|
||||
}
|
||||
} else if (!grabHeld) {
|
||||
grabLockerInput();
|
||||
}
|
||||
refreshLocalTimezone();
|
||||
std::time_t t = std::time(nullptr);
|
||||
struct tm tmNow {};
|
||||
localtime_r(&t, &tmNow);
|
||||
|
||||
@@ -269,6 +269,40 @@ inline bool isCallRingingFast() {
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool isLiveSxmoCallFile(const std::string& callsDir, const char* name) {
|
||||
if (!name || name[0] == '\0' || name[0] == '.') {
|
||||
return false;
|
||||
}
|
||||
const char* dot = std::strrchr(name, '.');
|
||||
if (!dot || dot == name || dot[1] == '\0') {
|
||||
return false;
|
||||
}
|
||||
const char* ext = dot + 1;
|
||||
static const char* const kLiveExts[] = {
|
||||
"pickedupcall", "initiatedcall", "ringing-in", "dialing",
|
||||
"ringing-out", "active", "held", "waiting",
|
||||
};
|
||||
for (const char* live : kLiveExts) {
|
||||
if (std::strcmp(ext, live) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (std::strcmp(ext, "monitoredcall") == 0) {
|
||||
std::string base(name, static_cast<size_t>(dot - name));
|
||||
static const char* const kTermExts[] = {
|
||||
"discardedcall", "hangedupcall", "terminated", "blockedcall",
|
||||
};
|
||||
for (const char* term : kTermExts) {
|
||||
std::string p = callsDir + "/" + base + "." + term;
|
||||
if (::access(p.c_str(), F_OK) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool isCallActiveOrRingingFast() {
|
||||
if (isCallRingingFast()) {
|
||||
return true;
|
||||
@@ -284,7 +318,7 @@ inline bool isCallActiveOrRingingFast() {
|
||||
bool found = false;
|
||||
struct dirent* ent;
|
||||
while ((ent = ::readdir(d)) != nullptr) {
|
||||
if (ent->d_name[0] != '.' && ent->d_name[0] != '\0') {
|
||||
if (isLiveSxmoCallFile(callsDir, ent->d_name)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -1914,7 +1948,109 @@ inline void placePhoneCall(const std::string& rawNumber, int simSlot = 0) {
|
||||
runAsyncArgv("sxmo_modemdial.sh", "--sim", simStr.c_str(), num.c_str());
|
||||
}
|
||||
|
||||
inline void closeOtherPlugins(const char* selfPluginName) {
|
||||
/* Force musl/glibc to reload timezone rules when /etc/localtime or /etc/timezone changes. */
|
||||
inline void refreshLocalTimezone() {
|
||||
const char* ltEnv = ::getenv("BANANARCHY_TZ_LOCALTIME");
|
||||
const char* tfEnv = ::getenv("BANANARCHY_TZ_FILE");
|
||||
const char* ltPath = (ltEnv && *ltEnv) ? ltEnv : "/etc/localtime";
|
||||
const char* tfPath = (tfEnv && *tfEnv) ? tfEnv : "/etc/timezone";
|
||||
struct stat st {};
|
||||
struct stat lst {};
|
||||
struct stat tfSt {};
|
||||
char linkBuf[512];
|
||||
char tfBuf[128];
|
||||
linkBuf[0] = '\0';
|
||||
tfBuf[0] = '\0';
|
||||
|
||||
bool haveLt = (::stat(ltPath, &st) == 0);
|
||||
bool haveLst = (::lstat(ltPath, &lst) == 0);
|
||||
ssize_t linkLen = ::readlink(ltPath, linkBuf, sizeof(linkBuf) - 1);
|
||||
if (linkLen >= 0) {
|
||||
linkBuf[linkLen] = '\0';
|
||||
} else {
|
||||
linkBuf[0] = '\0';
|
||||
}
|
||||
|
||||
bool haveTf = (::stat(tfPath, &tfSt) == 0);
|
||||
bool tfIsTzif = false;
|
||||
if (haveTf) {
|
||||
int fd = ::open(tfPath, O_RDONLY | O_CLOEXEC);
|
||||
if (fd >= 0) {
|
||||
ssize_t n = ::read(fd, tfBuf, sizeof(tfBuf) - 1);
|
||||
::close(fd);
|
||||
if (n >= 4 && std::memcmp(tfBuf, "TZif", 4) == 0) {
|
||||
tfIsTzif = true;
|
||||
tfBuf[0] = '\0';
|
||||
} else if (n > 0) {
|
||||
size_t len = static_cast<size_t>(n);
|
||||
tfBuf[len] = '\0';
|
||||
while (len > 0 && (tfBuf[len - 1] == '\n' || tfBuf[len - 1] == '\r' ||
|
||||
tfBuf[len - 1] == ' ' || tfBuf[len - 1] == '\t')) {
|
||||
tfBuf[--len] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char lastSig[1024] = {};
|
||||
static int tzToggle = 0;
|
||||
if (!haveLt && !haveTf && lastSig[0] != '\0') {
|
||||
return;
|
||||
}
|
||||
|
||||
char sig[1024];
|
||||
std::snprintf(
|
||||
sig, sizeof(sig),
|
||||
"%d|%d|%s|%llu|%lld|%ld|%llu|%llu|%lld|%ld|%llu|%d|%d|%s|%lld|%ld|%llu",
|
||||
haveLt ? 1 : 0, haveLst ? 1 : 0, linkBuf,
|
||||
static_cast<unsigned long long>(st.st_ino),
|
||||
static_cast<long long>(st.st_mtime),
|
||||
static_cast<long>(st.st_mtim.tv_nsec),
|
||||
static_cast<unsigned long long>(st.st_size),
|
||||
static_cast<unsigned long long>(lst.st_ino),
|
||||
static_cast<long long>(lst.st_mtime),
|
||||
static_cast<long>(lst.st_mtim.tv_nsec),
|
||||
static_cast<unsigned long long>(tfSt.st_size),
|
||||
haveTf ? 1 : 0, tfIsTzif ? 1 : 0, tfBuf,
|
||||
static_cast<long long>(tfSt.st_mtime),
|
||||
static_cast<long>(tfSt.st_mtim.tv_nsec),
|
||||
static_cast<unsigned long long>(tfSt.st_ino));
|
||||
if (std::strcmp(sig, lastSig) == 0) {
|
||||
return;
|
||||
}
|
||||
std::snprintf(lastSig, sizeof(lastSig), "%s", sig);
|
||||
|
||||
tzToggle ^= 1;
|
||||
if ((!ltEnv || !*ltEnv) && tfEnv && *tfEnv && haveTf) {
|
||||
char tzVal[600];
|
||||
if (tfIsTzif) {
|
||||
std::snprintf(tzVal, sizeof(tzVal), "%s%s",
|
||||
tfPath[0] == '/' ? (tzToggle ? ":" : ":/.")
|
||||
: (tzToggle ? ":" : ":./"),
|
||||
tfPath);
|
||||
::setenv("TZ", tzVal, 1);
|
||||
} else if (tfBuf[0]) {
|
||||
::setenv("TZ", tfBuf, 1);
|
||||
}
|
||||
::tzset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (haveLt) {
|
||||
char tzVal[600];
|
||||
std::snprintf(tzVal, sizeof(tzVal), "%s%s",
|
||||
ltPath[0] == '/' ? (tzToggle ? ":" : ":/.")
|
||||
: (tzToggle ? ":" : ":./"),
|
||||
ltPath);
|
||||
::setenv("TZ", tzVal, 1);
|
||||
} else if (tfBuf[0]) {
|
||||
::setenv("TZ", tfBuf, 1);
|
||||
}
|
||||
::tzset();
|
||||
}
|
||||
|
||||
inline void closeOtherPlugins(const char* selfPluginName,
|
||||
const char* keepPluginName = nullptr) {
|
||||
struct PluginRef {
|
||||
const char* pidFile;
|
||||
const char* name;
|
||||
@@ -1946,7 +2082,8 @@ inline void closeOtherPlugins(const char* selfPluginName) {
|
||||
{"xprivacy.pid", "privacy"},
|
||||
};
|
||||
for (const auto& p : kAllPlugins) {
|
||||
if (selfPluginName && std::strcmp(p.name, selfPluginName) == 0) {
|
||||
if ((selfPluginName && std::strcmp(p.name, selfPluginName) == 0) ||
|
||||
(keepPluginName && std::strcmp(p.name, keepPluginName) == 0)) {
|
||||
continue;
|
||||
}
|
||||
if (isPidFileAlive(getRuntimeFile(p.pidFile))) {
|
||||
@@ -1954,6 +2091,7 @@ inline void closeOtherPlugins(const char* selfPluginName) {
|
||||
}
|
||||
}
|
||||
if ((!selfPluginName || std::strcmp(selfPluginName, "dmenu") != 0) &&
|
||||
(!keepPluginName || std::strcmp(keepPluginName, "dmenu") != 0) &&
|
||||
::access("/tmp/dwm_plugin_dmenu.active", F_OK) == 0) {
|
||||
sendPluginCommand("dmenu", "CLOSE");
|
||||
}
|
||||
@@ -2802,6 +2940,7 @@ inline std::string sendModemUssd(const std::string& input,
|
||||
ContactBook::ensureParentDir(logPath);
|
||||
std::ofstream logOut(logPath, std::ios::app);
|
||||
if (logOut.is_open()) {
|
||||
refreshLocalTimezone();
|
||||
std::time_t now = std::time(nullptr);
|
||||
struct tm tmNow {};
|
||||
localtime_r(&now, &tmNow);
|
||||
|
||||
+37
-2
@@ -155,6 +155,40 @@ bool sendPluginFifoMsg(const char* name, const std::string& cmdLine) {
|
||||
return w == static_cast<ssize_t>(msg.size());
|
||||
}
|
||||
|
||||
bool isLiveSxmoCallFileNeoui(const std::string& callsDir, const char* name) {
|
||||
if (!name || name[0] == '\0' || name[0] == '.') {
|
||||
return false;
|
||||
}
|
||||
const char* dot = std::strrchr(name, '.');
|
||||
if (!dot || dot == name || dot[1] == '\0') {
|
||||
return false;
|
||||
}
|
||||
const char* ext = dot + 1;
|
||||
static const char* const kLiveExts[] = {
|
||||
"pickedupcall", "initiatedcall", "ringing-in", "dialing",
|
||||
"ringing-out", "active", "held", "waiting",
|
||||
};
|
||||
for (const char* live : kLiveExts) {
|
||||
if (std::strcmp(ext, live) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (std::strcmp(ext, "monitoredcall") == 0) {
|
||||
std::string base(name, static_cast<size_t>(dot - name));
|
||||
static const char* const kTermExts[] = {
|
||||
"discardedcall", "hangedupcall", "terminated", "blockedcall",
|
||||
};
|
||||
for (const char* term : kTermExts) {
|
||||
std::string p = callsDir + "/" + base + "." + term;
|
||||
if (::access(p.c_str(), F_OK) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isCallActiveOrRingingInNeoui() {
|
||||
if (::access("/tmp/sxmo_call_ringing", F_OK) == 0 ||
|
||||
::access("/tmp/sxmo_active_call", F_OK) == 0) {
|
||||
@@ -165,11 +199,12 @@ bool isCallActiveOrRingingInNeoui() {
|
||||
if (::access((base + "/sxmo_jobs/ringing").c_str(), F_OK) == 0) {
|
||||
return true;
|
||||
}
|
||||
DIR* d = ::opendir((base + "/sxmo_calls").c_str());
|
||||
std::string callsDir = base + "/sxmo_calls";
|
||||
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') {
|
||||
if (isLiveSxmoCallFileNeoui(callsDir, ent->d_name)) {
|
||||
::closedir(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
+40
-9
@@ -2241,6 +2241,39 @@ count_notifications(void)
|
||||
return n;
|
||||
}
|
||||
|
||||
static int
|
||||
is_live_sxmo_call_file(const char *cdir, const char *name)
|
||||
{
|
||||
if (!name || name[0] == '\0' || name[0] == '.')
|
||||
return 0;
|
||||
const char *dot = strrchr(name, '.');
|
||||
if (!dot || dot == name || dot[1] == '\0')
|
||||
return 0;
|
||||
const char *ext = dot + 1;
|
||||
static const char *const live_exts[] = {
|
||||
"pickedupcall", "initiatedcall", "ringing-in", "dialing",
|
||||
"ringing-out", "active", "held", "waiting",
|
||||
};
|
||||
for (size_t i = 0; i < sizeof(live_exts) / sizeof(live_exts[0]); i++) {
|
||||
if (strcmp(ext, live_exts[i]) == 0)
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(ext, "monitoredcall") == 0) {
|
||||
static const char *const term_exts[] = {
|
||||
"discardedcall", "hangedupcall", "terminated", "blockedcall",
|
||||
};
|
||||
char p[512];
|
||||
int blen = (int)(dot - name);
|
||||
for (size_t i = 0; i < sizeof(term_exts) / sizeof(term_exts[0]); i++) {
|
||||
int n = snprintf(p, sizeof(p), "%s/%.*s.%s", cdir, blen, name, term_exts[i]);
|
||||
if (n > 0 && (size_t)n < sizeof(p) && access(p, F_OK) == 0)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
has_tracked_calls(void)
|
||||
{
|
||||
@@ -2256,7 +2289,7 @@ has_tracked_calls(void)
|
||||
struct dirent *ent;
|
||||
int found = 0;
|
||||
while ((ent = readdir(d)) != NULL) {
|
||||
if (ent->d_name[0] != '.') {
|
||||
if (is_live_sxmo_call_file(cdir, ent->d_name)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
@@ -2569,9 +2602,13 @@ populate_timezone_menu(void)
|
||||
qsort(tz_list, tz_count, sizeof(char *), cmp_cstr_ptr);
|
||||
|
||||
for (size_t i = 0; i < tz_count; i++) {
|
||||
char cmd[512];
|
||||
char cmd[768];
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"doas -n setup-timezone -z '%s' >/dev/null 2>&1; sxmo_hook_statusbar.sh time",
|
||||
"doas -n setup-timezone -z '%s' >/dev/null 2>&1; "
|
||||
"sxmo_hook_statusbar.sh time >/dev/null 2>&1; "
|
||||
"[ -p /tmp/dwm_plugin_locker.fifo ] && timeout 1 printf 'REFRESH_TIME\\n' > /tmp/dwm_plugin_locker.fifo 2>/dev/null || true; "
|
||||
"bananarchy-coverctl REFRESH >/dev/null 2>&1 || true; "
|
||||
"killall -q -USR1 bananarchy-run-aligned >/dev/null 2>&1 || true",
|
||||
tz_list[i]);
|
||||
add_menu_item(tz_list[i], cmd, 0);
|
||||
free(tz_list[i]);
|
||||
@@ -3080,8 +3117,6 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
add_menu_item(label, "@plugin:locker:screenoff", 0);
|
||||
snprintf(label, sizeof(label), "%s Lock (Screen off)", ICON_LCK);
|
||||
add_menu_item(label, "@plugin:locker:screenoff", 0);
|
||||
snprintf(label, sizeof(label), "%s Logout", ICON_OUT);
|
||||
add_menu_item(label, "@menu:confirm_logout", 1);
|
||||
snprintf(label, sizeof(label), "%s Reboot", ICON_RLD);
|
||||
add_menu_item(label, "@menu:confirm_reboot", 1);
|
||||
snprintf(label, sizeof(label), "%s Reboot to loader", ICON_RLD);
|
||||
@@ -3092,10 +3127,6 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
add_menu_item(label, "@menu:sys", 1);
|
||||
snprintf(label, sizeof(label), "%s Close Menu", ICON_CLS);
|
||||
add_menu_item(label, "@close", 0);
|
||||
} else if (strcmp(menu_name, "confirm_logout") == 0) {
|
||||
reset_session_defaults(1, "Confirm Logout");
|
||||
add_menu_item("Yes", "sxmo_power.sh logout", 0);
|
||||
add_menu_item("No", "@menu:power", 1);
|
||||
} else if (strcmp(menu_name, "confirm_reboot") == 0) {
|
||||
reset_session_defaults(1, "Confirm Reboot");
|
||||
add_menu_item("Yes", "sxmo_power.sh reboot", 0);
|
||||
|
||||
+35
-1
@@ -81,6 +81,40 @@ std::string getRuntimeFile(const char* name) {
|
||||
return base + "/" + name;
|
||||
}
|
||||
|
||||
bool isLiveSxmoCallFileXdrawer(const std::string& cdir, const char* name) {
|
||||
if (!name || name[0] == '\0' || name[0] == '.') {
|
||||
return false;
|
||||
}
|
||||
const char* dot = std::strrchr(name, '.');
|
||||
if (!dot || dot == name || dot[1] == '\0') {
|
||||
return false;
|
||||
}
|
||||
const char* ext = dot + 1;
|
||||
static const char* const kLiveExts[] = {
|
||||
"pickedupcall", "initiatedcall", "ringing-in", "dialing",
|
||||
"ringing-out", "active", "held", "waiting",
|
||||
};
|
||||
for (const char* live : kLiveExts) {
|
||||
if (std::strcmp(ext, live) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (std::strcmp(ext, "monitoredcall") == 0) {
|
||||
std::string base(name, static_cast<size_t>(dot - name));
|
||||
static const char* const kTermExts[] = {
|
||||
"discardedcall", "hangedupcall", "terminated", "blockedcall",
|
||||
};
|
||||
for (const char* term : kTermExts) {
|
||||
std::string p = cdir + "/" + base + "." + term;
|
||||
if (::access(p.c_str(), F_OK) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int readIntFile(const std::string& path, int fallback = -1) {
|
||||
int fd = ::open(path.c_str(), O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
@@ -1253,7 +1287,7 @@ static int xdrawer_run_main(int argc, char** argv) {
|
||||
if (d) {
|
||||
struct dirent* ent;
|
||||
while ((ent = ::readdir(d)) != nullptr) {
|
||||
if (ent->d_name[0] != '.' && ent->d_name[0] != '\0') {
|
||||
if (isLiveSxmoCallFileXdrawer(cdir, ent->d_name)) {
|
||||
callActive = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user