Add geminux-imsd (VoLTE/VoWiFi/SMS), kernel XFRM, and hardware Airplane Mode (Fn+F)

This commit is contained in:
Luxferre committed 2026-11-25 08:44:27 +02:00
1 parent 92a31539e6
commit ac76431621
84 files changed
+4209 -103

No files matched your search

+18 -3
View File
@@ -20,6 +20,7 @@
#define HIT_POWER 8
#define HIT_MIXER 9
#define HIT_DATETIME 10
#define HIT_AIRPLANE 11
typedef struct {
gemui_app_t *app;
@@ -31,6 +32,7 @@ typedef struct {
pid_t vol_pid;
int pending_vol_pct;
int profile; /* 0=eco, 1=balanced, 2=performance */
bool airplane_mode;
gemui_rect_t bri_rect;
gemui_rect_t vol_rect;
int active_drag;
@@ -93,6 +95,8 @@ static void refresh_hw(ctrl_state_t *st) {
else if (strcmp(prof, "performance") == 0) st->profile = 2;
else st->profile = 1;
}
char air[16] = {0};
st->airplane_mode = (gemui_read_file_line("/run/geminux/airplane-mode", air, sizeof(air)) == 0 && air[0] == '1');
}
static void dispatch_vol_pct(ctrl_state_t *st, int pct) {
@@ -219,14 +223,17 @@ static void on_draw(gemui_app_t *app, cairo_t *cr, int w, int h, void *ud) {
snprintf(btxt, sizeof(btxt), "%d%%", (int)(bnorm * 100.0 + 0.5));
gemui_draw_slider(app, cr, st->bri_rect, "Display Backlight", bnorm, btxt, HIT_BRI, 0, false);
st->vol_rect = (gemui_rect_t){pad, 210, cw - 468, 104};
st->vol_rect = (gemui_rect_t){pad, 210, cw - 702, 104};
char vtxt[32];
snprintf(vtxt, sizeof(vtxt), "%d%%", st->vol_pct);
gemui_draw_slider(app, cr, st->vol_rect, "Master Audio Volume", st->vol_pct / 100.0, vtxt, HIT_VOL, 0, false);
gemui_draw_button(app, cr, (gemui_rect_t){pad + cw - 456, 210, 222, 104},
gemui_draw_button(app, cr, (gemui_rect_t){pad + cw - 690, 210, 222, 104},
"Audio Mixer", HIT_MIXER, 0, true, false, false);
gemui_draw_button(app, cr, (gemui_rect_t){pad + cw - 222, 210, 222, 104},
gemui_draw_button(app, cr, (gemui_rect_t){pad + cw - 456, 210, 222, 104},
"Time & Zone", HIT_DATETIME, 0, false, false, false);
gemui_draw_button(app, cr, (gemui_rect_t){pad + cw - 222, 210, 222, 104},
st->airplane_mode ? "Airplane: ON" : "Airplane: OFF",
HIT_AIRPLANE, 0, false, st->airplane_mode, false);
gemui_draw_text(cr, t, (gemui_rect_t){pad, 330, cw, 40},
"MT6797X Power Profile (A72 Big Cluster + Schedutil)",
@@ -301,6 +308,14 @@ static void on_ptr(gemui_app_t *app, int type, int x, int y, unsigned int btn, v
} else if (hit->id == HIT_DATETIME) {
const char *cmd[] = {"geminux-datetime", NULL};
gemui_spawn_detached(cmd);
} else if (hit->id == HIT_AIRPLANE) {
char aout[128] = {0};
const char *cmd[] = {"doas", "/usr/bin/geminux-power-ctl", "airplane", "toggle", NULL};
gemui_run_cmd_capture(cmd, aout, sizeof(aout));
st->airplane_mode = (strstr(aout, "airplane=on") != NULL);
gemui_show_toast(app, st->airplane_mode ? "Airplane Mode ON (All Radios Off)"
: "Airplane Mode OFF (Restoring Radios)", 2200);
gemui_request_redraw(app);
} else if (hit->id == HIT_PROF) {
static const char *pnames[3] = {"eco", "balanced", "performance"};
st->profile = hit->val;
+21 -1
View File
@@ -515,9 +515,28 @@ static int handle_media_transport(const char *action) {
return 0;
}
static int handle_airplane(void) {
char out[256] = {0};
const char *cmd[] = {"doas", "/usr/bin/geminux-power-ctl", "airplane", "toggle", NULL};
int rc = run_cmd(cmd, out, sizeof(out));
if (rc != 0) {
show_osd("airplane", 2200, -1, "Airplane Mode", "Failed to toggle radio hardware state");
return rc;
}
bool on = (strstr(out, "airplane=on") != NULL);
if (on) {
show_osd("airplane", 2400, -1, "Airplane Mode: ON",
"Wi-Fi, Bluetooth & 4G Modem Powered Off");
} else {
show_osd("airplane", 2400, -1, "Airplane Mode: OFF",
"Restoring Wi-Fi, Bluetooth & 4G Radios");
}
return 0;
}
int main(int argc, char **argv) {
if (argc < 2) {
fprintf(stderr, "Usage: %s <bri-up|bri-down|vol-up|vol-down|vol-mute|mic-mute|screenshot|screenshot-window|play-pause|prev|next|stop>\n",
fprintf(stderr, "Usage: %s <bri-up|bri-down|vol-up|vol-down|vol-mute|mic-mute|screenshot|screenshot-window|play-pause|prev|next|stop|airplane>\n",
argv[0]);
return 1;
}
@@ -531,6 +550,7 @@ int main(int argc, char **argv) {
}
if (strcmp(act, "screenshot") == 0) return handle_screenshot(false);
if (strcmp(act, "screenshot-window") == 0) return handle_screenshot(true);
if (strcmp(act, "airplane") == 0) return handle_airplane();
if (strcmp(act, "play-pause") == 0 || strcmp(act, "prev") == 0 ||
strcmp(act, "next") == 0 || strcmp(act, "stop") == 0) {
return handle_media_transport(act);
+33 -3
View File
@@ -79,12 +79,14 @@ typedef struct {
bool cellular_on;
bool cell_data_up;
bool cell_ims_on;
bool airplane_mode;
bool cell_physical_sim;
bool esim_loaded;
bool bt_on;
bool bt_svc_up;
bool hdmi_on;
int dns_mode;
char ims_state[32];
net_row_t rows[32];
esim_ui_row_t esim_profiles[16];
int esim_count;
@@ -496,10 +498,18 @@ static void refresh_cellular(net_state_t *st) {
snprintf(st->rows[r].col1, sizeof(st->rows[0].col1),
"IMS / VoLTE & VoWiFi Calling");
snprintf(st->rows[r].col2, sizeof(st->rows[0].col2), "%s",
st->cell_ims_on ? "Enabled (CEVDP=3)" : "Disabled");
if (strcmp(st->ims_state, "VoLTE") == 0) {
snprintf(st->rows[r].col2, sizeof(st->rows[0].col2), "VoLTE Registered");
} else if (strcmp(st->ims_state, "VoWiFi") == 0) {
snprintf(st->rows[r].col2, sizeof(st->rows[0].col2), "VoWiFi Registered");
} else {
snprintf(st->rows[r].col2, sizeof(st->rows[0].col2), "%s",
st->cell_ims_on ? "Enabled (Standby)" : "Disabled");
}
snprintf(st->rows[r].col3, sizeof(st->rows[0].col3), "%s",
st->cell_ims_on ? "ON" : "OFF");
(strcmp(st->ims_state, "VoLTE") == 0 || strcmp(st->ims_state, "VoWiFi") == 0)
? st->ims_state
: (st->cell_ims_on ? "ON" : "OFF"));
r++;
if (!st->esim_loaded) {
@@ -544,6 +554,11 @@ static void refresh_cellular(net_state_t *st) {
}
static void refresh_tab(net_state_t *st) {
char air[16] = {0};
st->airplane_mode = (gemui_read_file_line("/run/geminux/airplane-mode", air, sizeof(air)) == 0 && air[0] == '1');
st->ims_state[0] = '\0';
gemui_read_file_line("/run/geminux/ims-state", st->ims_state, sizeof(st->ims_state));
char prev_key[96] = {0};
if (st->tab == 0 && st->sel_row >= 0 && st->sel_row < st->num_rows) {
snprintf(prev_key, sizeof(prev_key), "%s", st->wifi_groups[st->sel_row].ssid);
@@ -583,6 +598,13 @@ static void refresh_tab(net_state_t *st) {
snprintf(st->status_text, sizeof(st->status_text),
"USB NCM Gadget: 172.16.42.1/24 | External HDMI (SiI9024)");
}
if (st->airplane_mode) {
st->wifi_on = false;
st->bt_on = false;
st->cellular_on = false;
snprintf(st->status_text, sizeof(st->status_text),
"[AIRPLANE MODE ON] All radios powered off (Fn+F or toggle radio to restore)");
}
}
static void on_worker_timer(gemui_app_t *app, void *ud);
@@ -1609,6 +1631,14 @@ static void on_ptr(gemui_app_t *app, int type, int x, int y, unsigned int btn, v
gemui_spawn_detached(acmd);
return;
} else if (hit->id == HIT_TOGGLE) {
if (st->airplane_mode && (hit->val == 0 || hit->val == 2 || hit->val == 3)) {
const char *aoff[] = {"doas", "/usr/bin/geminux-power-ctl", "airplane", "off", NULL};
gemui_run_cmd_timeout(aoff, NULL, 0, 5000);
gemui_show_toast(app, "Exiting Airplane Mode...", 2000);
refresh_tab(st);
gemui_request_redraw(app);
return;
}
if (hit->val == 0) {
const char *argv[] = {"nmcli", "radio", "wifi", st->wifi_on ? "off" : "on", NULL};
gemui_run_cmd_timeout(argv, NULL, 0, 2000);