Monorepo for Aesthetic.Computer aesthetic.computer

wifi: unblock rfkill before interface probe (HP 14 G7 AX201 fix)

The existing rfkill unblock ran AFTER detect_iface succeeded — no help
when the radio is blocked at boot, because mac80211 then refuses to
register an interface at all and detect_iface returns nothing.

Happens on HP Chromebook 14 G7 (and other Jasper Lake Chromebooks with
Intel AX201): coreboot / ACPI leaves the radio RF_KILL blocked on cold
boot, so iwlwifi probes successfully but wlp* never appears. ac-native
logged "no wifi hardware" even though the driver was loaded + firmware
was present.

Run `rfkill unblock all` right before `iw dev` probing. If rfkill isn't
installed in the initramfs, fall back to walking /sys/class/rfkill/*
and writing '0' to each node's `soft` file by hand.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+23
+23
fedac/native/src/wifi.c
··· 8 8 #include <sys/stat.h> 9 9 #include <fcntl.h> 10 10 #include <errno.h> 11 + #include <dirent.h> 11 12 #include <time.h> 12 13 #include <stdarg.h> 13 14 ··· 48 49 } 49 50 50 51 static int detect_iface(char *out, int out_len) { 52 + // Chromebooks (esp. HP 14 G7 / Jasper Lake w/ Intel AX201) often boot 53 + // with WiFi rfkill-blocked at the ACPI / coreboot level — the iwlwifi 54 + // driver loads but mac80211 refuses to register an interface, so 55 + // `iw dev` returns nothing. Unblock unconditionally before we look 56 + // for an interface; it's a no-op on hardware that wasn't blocked. 57 + if (system("rfkill unblock all >/dev/null 2>&1") != 0) { 58 + // rfkill binary not available — fall back to writing the soft 59 + // flag on every rfkill node we can find. 60 + DIR *rd = opendir("/sys/class/rfkill"); 61 + if (rd) { 62 + struct dirent *ent; 63 + while ((ent = readdir(rd)) != NULL) { 64 + if (ent->d_name[0] == '.') continue; 65 + char path[256]; 66 + snprintf(path, sizeof(path), "/sys/class/rfkill/%s/soft", ent->d_name); 67 + FILE *f = fopen(path, "w"); 68 + if (f) { fputs("0\n", f); fclose(f); } 69 + } 70 + closedir(rd); 71 + } 72 + } 73 + 51 74 FILE *fp = popen("iw dev 2>/dev/null | grep Interface | head -1 | awk '{print $2}'", "r"); 52 75 if (fp) { 53 76 char buf[32] = "";