Enable MT6797 Wi-Fi/BT, PipeWire audio GUI, cursor autohide, and dev tools
- Add MT6797 CONSYS Wi-Fi/BT factory-firmware patch (0005), native EAPOL TX, 5 GHz NO_IR/regulatory-notifier fixes, TKIP/CCMP admission, initramfs regdb, and geminux-wifi-nvram - Order OpenRC polkit startup before NetworkManager/ModemManager and harden geminux-net with non-blocking scans, mesh SSID grouping, password masking toggle, and BT A2DP/HFP/LE/HID support - Add geminux-audio PipeWire/WirePlumber/UCM2 playback & recording control GUI alongside st and dmenu XFixes cursor autohide - Preinstall requested CLI/dev tools (bash, coreutils, build-base, git, nmtui, perl/SSL, curl-dev, janet, jpm, etc.) and set bash as system-wide default shell
This commit is contained in:
1 parent
ba7b86e570
commit
6aea73cbeb
92 files changed
+5524
-198
No files matched your search
+79
-12
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <locale.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
@@ -303,6 +304,8 @@ static void gemui_ensure_backbuf(gemui_app_t *app) {
|
||||
|
||||
gemui_app_t *gemui_create(const char *res_name, const char *title,
|
||||
int w, int h, bool fullscreen_override) {
|
||||
setlocale(LC_CTYPE, "");
|
||||
XSetLocaleModifiers("");
|
||||
gemui_init_sigpipe();
|
||||
Display *dpy = XOpenDisplay(NULL);
|
||||
if (!dpy) {
|
||||
@@ -550,6 +553,12 @@ static void gemui_render_frame(gemui_app_t *app) {
|
||||
app->need_redraw = false;
|
||||
}
|
||||
|
||||
void gemui_flush_draw(gemui_app_t *app) {
|
||||
if (!app) return;
|
||||
app->need_redraw = true;
|
||||
gemui_render_frame(app);
|
||||
}
|
||||
|
||||
static void gemui_handle_x_events(gemui_app_t *app) {
|
||||
while (XPending(app->dpy) > 0 && app->running) {
|
||||
XEvent ev;
|
||||
@@ -925,6 +934,7 @@ void gemui_draw_input(gemui_app_t *app, cairo_t *cr, gemui_rect_t r,
|
||||
size_t len = strlen(text);
|
||||
if (len > 48) len = 48;
|
||||
for (size_t i = 0; i < len; i++) display[i] = '*';
|
||||
if (focused && len + 1 < sizeof(display)) display[len++] = '_';
|
||||
display[len] = '\0';
|
||||
} else {
|
||||
snprintf(display, sizeof(display), "%s%s", text, focused ? "_" : "");
|
||||
@@ -1005,7 +1015,7 @@ int gemui_read_file_line(const char *path, char *buf, size_t sz) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gemui_run_cmd_capture(const char *const argv[], char *out, size_t out_sz) {
|
||||
int gemui_run_cmd_timeout(const char *const argv[], char *out, size_t out_sz, int timeout_ms) {
|
||||
if (!argv || !argv[0]) return -1;
|
||||
int pfd[2];
|
||||
if (pipe(pfd) < 0) return -1;
|
||||
@@ -1016,33 +1026,90 @@ int gemui_run_cmd_capture(const char *const argv[], char *out, size_t out_sz) {
|
||||
return -1;
|
||||
}
|
||||
if (pid == 0) {
|
||||
setpgid(0, 0);
|
||||
int devnull = open("/dev/null", O_RDONLY);
|
||||
if (devnull >= 0) {
|
||||
dup2(devnull, STDIN_FILENO);
|
||||
if (devnull > 2) close(devnull);
|
||||
} else {
|
||||
close(STDIN_FILENO);
|
||||
}
|
||||
close(pfd[0]);
|
||||
dup2(pfd[1], STDOUT_FILENO);
|
||||
dup2(pfd[1], STDERR_FILENO);
|
||||
close(pfd[1]);
|
||||
if (pfd[1] > 2) close(pfd[1]);
|
||||
execvp(argv[0], (char *const *)argv);
|
||||
_exit(127);
|
||||
}
|
||||
close(pfd[1]);
|
||||
int fl = fcntl(pfd[0], F_GETFL, 0);
|
||||
if (fl >= 0) fcntl(pfd[0], F_SETFL, fl | O_NONBLOCK);
|
||||
|
||||
size_t off = 0;
|
||||
char tmp[256];
|
||||
while (1) {
|
||||
ssize_t n = read(pfd[0], tmp, sizeof(tmp));
|
||||
if (n <= 0) break;
|
||||
if (out && off + 1 < out_sz) {
|
||||
size_t cp = (size_t)n;
|
||||
if (cp > out_sz - 1 - off) cp = out_sz - 1 - off;
|
||||
memcpy(out + off, tmp, cp);
|
||||
off += cp;
|
||||
char tmp[512];
|
||||
uint64_t deadline = (timeout_ms > 0) ? (gemui_now_ms() + (uint64_t)timeout_ms) : UINT64_MAX;
|
||||
bool timed_out = false;
|
||||
bool eof = false;
|
||||
|
||||
while (!eof) {
|
||||
int wait_ms = -1;
|
||||
if (timeout_ms > 0) {
|
||||
uint64_t now = gemui_now_ms();
|
||||
if (now >= deadline) {
|
||||
timed_out = true;
|
||||
break;
|
||||
}
|
||||
uint64_t rem = deadline - now;
|
||||
wait_ms = rem > 60000ULL ? 60000 : (int)rem;
|
||||
}
|
||||
struct pollfd pf = { .fd = pfd[0], .events = POLLIN | POLLHUP };
|
||||
int pr = poll(&pf, 1, wait_ms);
|
||||
if (pr < 0) {
|
||||
if (errno == EINTR) continue;
|
||||
break;
|
||||
}
|
||||
if (pr == 0) {
|
||||
timed_out = true;
|
||||
break;
|
||||
}
|
||||
while (1) {
|
||||
ssize_t n = read(pfd[0], tmp, sizeof(tmp));
|
||||
if (n > 0) {
|
||||
if (out && off + 1 < out_sz) {
|
||||
size_t cp = (size_t)n;
|
||||
if (cp > out_sz - 1 - off) cp = out_sz - 1 - off;
|
||||
memcpy(out + off, tmp, cp);
|
||||
off += cp;
|
||||
}
|
||||
} else if (n == 0) {
|
||||
eof = true;
|
||||
break;
|
||||
} else {
|
||||
if (errno == EINTR) continue;
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) break;
|
||||
eof = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (out && out_sz > 0) out[off] = '\0';
|
||||
close(pfd[0]);
|
||||
if (timed_out) {
|
||||
kill(-pid, SIGKILL);
|
||||
kill(pid, SIGKILL);
|
||||
}
|
||||
int status = 0;
|
||||
if (waitpid(pid, &status, 0) < 0) return -1;
|
||||
while (waitpid(pid, &status, 0) < 0) {
|
||||
if (errno != EINTR) return timed_out ? 124 : -1;
|
||||
}
|
||||
if (timed_out) return 124;
|
||||
return WIFEXITED(status) ? WEXITSTATUS(status) : 1;
|
||||
}
|
||||
|
||||
int gemui_run_cmd_capture(const char *const argv[], char *out, size_t out_sz) {
|
||||
return gemui_run_cmd_timeout(argv, out, out_sz, 2500);
|
||||
}
|
||||
|
||||
int gemui_spawn_detached(const char *const argv[]) {
|
||||
if (!argv || !argv[0]) return -1;
|
||||
pid_t pid = fork();
|
||||
|
||||
Reference in new issue
Block a user