feat(boot): say "Wi-Fi: press W to choose a network" on the boot menu and in the log when a Wi-Fi chip Stambha starts has no network, where the menu showed no Wi-Fi line at all and testers missed the key

With a Wi-Fi chip the driver starts and no --wifi or saved network, the
startup menu's bottom line was empty, so nothing said that Wi-Fi needs a
network chosen with W. wifi_page::status_line now always gives the line
(CHOOSE for that case), and the menu logs hint_line's "CHOICE Wi-Fi: no
network is set up; press W in this menu to choose one, or Wi-Fi stays off".
The HOST and GUEST NETWORK lines for an adapter left off say the same in
place of "no --wifi network".
This commit is contained in:
Garvit Surana committed 2026-11-24 12:16:21 +00:00
1 parent afa70f9809
commit a95ddeb980
5 files changed
+56 -21

No files matched your search

+18 -5
View File
@@ -28,16 +28,29 @@ const CARD: usize = 244;
/// The startup menu's Wi-Fi line: the network this boot joins first, the
/// one the page chose (`prefer`) or else stela.cfg's `--wifi` one
/// (`configured`), and the key that changes it. With no `--wifi` the boot
/// joins nothing, and saved networks (`saved`) can still be managed. `None`
/// when this boot has neither. No password reaches it.
pub fn status_line(configured: Option<&str>, prefer: Option<&str>, saved: bool) -> Option<String> {
/// joins nothing, and saved networks (`saved`) can still be managed. With
/// neither, the line says how to choose one: Wi-Fi works only once a
/// network is chosen, and testers missed the key. No password reaches it.
pub fn status_line(configured: Option<&str>, prefer: Option<&str>, saved: bool) -> String {
let network = match (configured, prefer) {
(Some(_), Some(prefer)) => prefer,
(Some(configured), None) => configured,
(None, _) if saved => "not set up",
(None, _) => return None,
(None, _) => return String::from(CHOOSE),
};
Some(format!("Wi-Fi: {network} \u{b7} press W to change"))
format!("Wi-Fi: {network} \u{b7} press W to change")
}
/// The startup menu's Wi-Fi line when no network is set up.
pub const CHOOSE: &str = "Wi-Fi: press W to choose a network";
/// The boot log's line for a menu that offers Wi-Fi with no network set up
/// (`configured` none and nothing `saved`): the hint the menu shows.
pub fn hint_line(configured: Option<&str>, saved: bool) -> Option<&'static str> {
(configured.is_none() && !saved).then_some(
"CHOICE Wi-Fi: no network is set up; press W in this menu to choose one, or Wi-Fi \
stays off\n",
)
}
/// One network the page lists.
+27 -10
View File
@@ -71,27 +71,44 @@ fn has_text(scene: &Scene, wanted: &str) -> bool {
#[test]
fn the_status_line_names_the_network_this_boot_joins_first() {
assert_eq!(
status_line(Some("home"), None, false).as_deref(),
Some("Wi-Fi: home \u{b7} press W to change")
status_line(Some("home"), None, false),
"Wi-Fi: home \u{b7} press W to change"
);
assert_eq!(
status_line(Some("home"), Some("cafe"), true).as_deref(),
Some("Wi-Fi: cafe \u{b7} press W to change")
status_line(Some("home"), Some("cafe"), true),
"Wi-Fi: cafe \u{b7} press W to change"
);
}
#[test]
fn the_status_line_shows_not_set_up_only_with_saved_networks() {
assert_eq!(
status_line(None, None, true).as_deref(),
Some("Wi-Fi: not set up \u{b7} press W to change")
status_line(None, None, true),
"Wi-Fi: not set up \u{b7} press W to change"
);
// A preference without `--wifi` joins nothing, as `with_prefer` adds none.
assert_eq!(
status_line(None, Some("cafe"), true).as_deref(),
Some("Wi-Fi: not set up \u{b7} press W to change")
status_line(None, Some("cafe"), true),
"Wi-Fi: not set up \u{b7} press W to change"
);
assert_eq!(status_line(None, None, false), None);
}
/// Testers with a Wi-Fi chip the driver starts missed that a network is
/// chosen with W: with none set up the menu and the log both say so.
#[test]
fn with_no_network_set_up_the_line_and_the_log_say_to_press_w() {
assert_eq!(
status_line(None, None, false),
"Wi-Fi: press W to choose a network"
);
let hint = hint_line(None, false).unwrap();
assert_eq!(
hint,
"CHOICE Wi-Fi: no network is set up; press W in this menu to choose one, or Wi-Fi \
stays off\n"
);
assert_eq!(hint_line(Some("home"), false), None);
assert_eq!(hint_line(None, true), None);
}
// The rows.
@@ -560,7 +577,7 @@ fn no_other_screen_draws_the_password() {
};
assert_eq!(save.password, b"password");
assert!(!has_text(&page.scene(SCREEN), "password"));
let status = status_line(Some("home"), Some("cafe"), true).unwrap_or_default();
let status = status_line(Some("home"), Some("cafe"), true);
assert!(!status.contains("password"));
}
@@ -177,7 +177,7 @@ fn main_menu() -> Painter {
painter.text(left + 20, y + 8, name, 1, rgb(Tone::Text));
y += 36;
}
let line = status_line(Some("GarvitRoom_5G"), None, true).unwrap_or_default();
let line = status_line(Some("GarvitRoom_5G"), None, true);
painter.centred(640, 720 - 24, &line, rgb(Tone::Dim));
painter.centred(640, 720 - 56, "macOS Tahoe in 5", rgb(Tone::Dim));
painter
+8 -4
View File
@@ -500,13 +500,12 @@ impl<'a> Menu<'a> {
}
// The network this boot joins first and the Wi-Fi page's key, on
// the bottom line.
if self.wifi_offered
&& let Some(line) = wifi_page::status_line(
if self.wifi_offered {
let line = wifi_page::status_line(
self.wifi.as_deref(),
self.wifi_prefer.as_deref(),
self.wifi_saved,
)
{
);
canvas.text_centred(width / 2, height.saturating_sub(24), &line, 1, ui::DIM);
}
let (status, colour) = match (self.notice, self.countdown, self.held) {
@@ -640,6 +639,11 @@ fn asked() -> bool {
fn menu(volume: &mut FileSystem, choices: &Choices, mut menu: Menu<'_>) -> Option<Chosen> {
menu.wifi_saved = crate::wifi_menu::saved(volume);
menu.wifi_offered = crate::wifi_menu::offered();
if menu.wifi_offered
&& let Some(hint) = wifi_page::hint_line(menu.wifi.as_deref(), menu.wifi_saved)
{
output::arguments(format_args!("{hint}"));
}
loop {
let index = match menu.run()? {
Pick::Item(index) => index,
+2 -1
View File
@@ -1042,7 +1042,8 @@ const XHCI_DIED_AGAIN: &str = "xHCI: the controller stopped answering again afte
its devices are out of reach for this boot";
/// Why a Wi-Fi adapter is left alone.
const NO_WIFI_NETWORK: &str = "Wi-Fi adapter stays off: no --wifi network";
const NO_WIFI_NETWORK: &str =
"Wi-Fi adapter stays off: no network is chosen (press W at the boot menu to choose one)";
/// Said when an RTL8852CE's MAC was found powered on.
const RTW89_WAS_ON: &str =