diff --git a/crates/alkane-gui/src/alkane_detect.rs b/crates/alkane-gui/src/alkane_detect.rs index 268f04c9..594216ce 100644 --- a/crates/alkane-gui/src/alkane_detect.rs +++ b/crates/alkane-gui/src/alkane_detect.rs @@ -143,12 +143,23 @@ pub fn is_alkane(row: &MinerRow) -> bool { } /// The alkane-os board family the row's control board is, when it can be told: -/// what an Alkane board reports, or for a stock Antminer the Zynq-7010 (S17/T17 -/// era, "XIL (C49)") control board. +/// what an Alkane board reports, the stock Antminer Zynq-7010 (S17/T17 era, +/// "XIL (C49)") control board, or the stock Amlogic A113D ("AML (C76)") control +/// board. pub fn board_family(row: &MinerRow) -> Option { if let Some(board) = &row.alkane_board { return (!board.is_empty()).then(|| board.clone()); } + // A stock A113D (Amlogic AXG) control board -- the "a113d" install target + // (board_labels maps a113d -> "AML (C76)"). Decided on the control-board + // code, not the brand: asic-rs has no make for the Antminer BHB42XXX and + // reports its brand as "Unknown" (model "Unknown: ANTMINER BHB42XXX"), so + // the generic brand guard below would otherwise reject it. The "AML" code is + // only ever derived for an Amlogic Antminer control board, so this is + // specific on its own. + if row.cpu == "AML" && row.board_code == "C76" { + return Some("a113d".to_string()); + } if !row.brand.to_ascii_lowercase().contains("antminer") { return None; } @@ -243,7 +254,10 @@ mod tests { assert!(install_supported(&s17)); assert!(!is_alkane(&s17)); assert!(!install_supported(&stock("XIL", "C55"))); // S19-era Zynq - assert!(!install_supported(&stock("AML", "C76"))); + // The Amlogic A113D control board is the "a113d" install target. + assert!(install_supported(&stock("AML", "C76"))); + assert_eq!(board_family(&stock("AML", "C76")).as_deref(), Some("a113d")); + assert!(!install_supported(&stock("AML", "CBE"))); // 140mm S19k/S21-class, not a target assert!(!install_supported(&stock("", ""))); let whatsminer = MinerRow { brand: "WhatsMiner".into(), @@ -274,7 +288,9 @@ mod tests { assert!(!install_supported(&other("S19"))); assert!(!install_supported(&other("S17+"))); assert!(!install_supported(&other(""))); - // A reported control board overrides the model. + // A reported control board overrides the model: an "S17" model on an + // Amlogic A113D control board resolves to a113d (the control board), + // not zynq (the model). let s17_on_aml = MinerRow { brand: "Antminer".into(), model: "S17".into(), @@ -282,7 +298,26 @@ mod tests { board_code: "C76".into(), ..Default::default() }; - assert!(!install_supported(&s17_on_aml)); + assert_eq!(board_family(&s17_on_aml).as_deref(), Some("a113d")); + } + + #[test] + fn a_stock_a113d_bhb42xxx_is_an_install_target_despite_unknown_brand() { + // Exactly as the live scan reports the bench A113D at 10.255.1.18: + // asic-rs cannot pin a make, so brand is "Unknown" and the model is + // "Unknown: ANTMINER BHB42XXX", but the control board classifies as + // "AML (C76)". Install must still be offered. + let bhb = MinerRow { + brand: "Unknown".into(), + model: "Unknown: ANTMINER BHB42XXX".into(), + firmware: "Stock".into(), + cpu: "AML".into(), + board_code: "C76".into(), + ..Default::default() + }; + assert_eq!(board_family(&bhb).as_deref(), Some("a113d")); + assert!(install_supported(&bhb)); + assert!(!is_alkane(&bhb)); } /// Live check against a real board: