Add flasher credential provisioning, LUKS2 FDE, LED fixes, and docs

This commit is contained in:
Luxferre committed 2026-11-23 08:21:37 +02:00
1 parent 2706b9a901
commit b7dca4f15f
49 files changed
+1524 -183

No files matched your search

@@ -171,6 +171,7 @@ static void handle_client(ccci_ctx_t *ctx, int cfd) {
}
int main(void) {
signal(SIGPIPE, SIG_IGN);
ccci_ctx_t ctx;
memset(&ctx, 0, sizeof(ctx));
ctx.ctl_fd = ctx.fs_fd = ctx.rpc_fd = -1;
+17 -8
View File
@@ -126,15 +126,13 @@ static int read_charging_state(void) {
char p[320], typ[32] = {0}, st[32] = {0};
snprintf(p, sizeof(p), "/sys/class/power_supply/%s/type", de->d_name);
if (read_sysfs_line(p, typ, sizeof(typ)) != 0) continue;
if (strcmp(typ, "Battery") != 0 && strcmp(typ, "USB") != 0) continue;
if (strcmp(typ, "Battery") != 0) continue;
snprintf(p, sizeof(p), "/sys/class/power_supply/%s/status", de->d_name);
if (read_sysfs_line(p, st, sizeof(st)) != 0) continue;
if (strcmp(st, "Charging") == 0) {
state = 1;
break;
} else if (strcmp(st, "Full") == 0) {
state = 2;
}
}
closedir(d);
@@ -145,9 +143,12 @@ static void sync_charging_led(int *last_state, bool force) {
int st = read_charging_state();
if (!force && *last_state == st) return;
*last_state = st;
if (st == 1) apply_strip_rgb(32, 16, 0, false);
else if (st == 2) apply_strip_rgb(0, 32, 0, false);
else apply_strip_rgb(0, 0, 0, true);
if (st == 1) {
apply_strip_rgb(0, 0, 0, false);
write_single_cover_led(6, 128, 12, 0);
} else {
apply_strip_rgb(0, 0, 0, true);
}
}
static void disarm_timer(int tmr_fd) {
@@ -158,6 +159,7 @@ static void disarm_timer(int tmr_fd) {
}
int main(void) {
signal(SIGPIPE, SIG_IGN);
mkdir("/run/geminux", 0755);
sigset_t mask;
@@ -205,6 +207,7 @@ int main(void) {
}
int last_chg_state = -1;
bool manual_override = false;
sync_charging_led(&last_chg_state, true);
struct epoll_event events[8];
@@ -231,18 +234,23 @@ int main(void) {
int idx = 0, rr = 0, gg = 0, bb = 0, ms = 0;
if (strcmp(cmd, "off") == 0) {
disarm_timer(tmr_fd);
manual_override = true;
apply_strip_rgb(0, 0, 0, true);
} else if (strcmp(cmd, "auto") == 0) {
disarm_timer(tmr_fd);
manual_override = false;
sync_charging_led(&last_chg_state, true);
} else if (sscanf(cmd, "rgb %d %d %d", &rr, &gg, &bb) == 3) {
disarm_timer(tmr_fd);
manual_override = true;
apply_strip_rgb(rr, gg, bb, false);
} else if (sscanf(cmd, "led %d %d %d %d", &idx, &rr, &gg, &bb) == 4) {
if (idx >= 1 && idx <= 6) {
manual_override = true;
write_single_cover_led(idx, rr, gg, bb);
}
} else if (sscanf(cmd, "pulse %d %d %d %d", &rr, &gg, &bb, &ms) == 4) {
manual_override = false;
apply_strip_rgb(rr, gg, bb, false);
if (ms > 0 && tmr_fd >= 0) {
struct itimerspec its;
@@ -255,12 +263,13 @@ int main(void) {
}
}
}
dprintf(cfd, "OK\n");
send(cfd, "OK\n", 3, MSG_NOSIGNAL);
close(cfd);
}
} else if (fd == tmr_fd) {
uint64_t exp = 0;
while (read(tmr_fd, &exp, sizeof(exp)) > 0) {}
manual_override = false;
sync_charging_led(&last_chg_state, true);
} else if (fd == uev_fd) {
char ubuf[1024];
@@ -271,7 +280,7 @@ int main(void) {
ps_event = true;
}
}
if (ps_event) {
if (ps_event && !manual_override) {
sync_charging_led(&last_chg_state, false);
}
}
+1
View File
@@ -206,6 +206,7 @@ static int bind_modem_socket(modem_ctx_t *ctx) {
}
int main(void) {
signal(SIGPIPE, SIG_IGN);
modem_ctx_t ctx;
memset(&ctx, 0, sizeof(ctx));
ctx.srv_fd = -1;
+3 -1
View File
@@ -193,7 +193,8 @@ static void lock_x11_session(void) {
if (access("/tmp/.X11-unix/X0", F_OK) != 0) return;
if (is_lock_running()) return;
struct passwd *pw = getpwnam("user");
struct passwd *pw = getpwuid(10000);
if (!pw) pw = getpwnam("user");
if (!pw) return;
int pfd[2];
@@ -373,6 +374,7 @@ static int setup_uevent_socket(void) {
}
int main(void) {
signal(SIGPIPE, SIG_IGN);
powerd_ctx_t ctx;
memset(&ctx, 0, sizeof(ctx));
ctx.saved_brightness = 128;