diff --git a/crates/alkane-gui/src/fixtures.rs b/crates/alkane-gui/src/fixtures.rs index 16094fc8..b3e5d726 100644 --- a/crates/alkane-gui/src/fixtures.rs +++ b/crates/alkane-gui/src/fixtures.rs @@ -14,9 +14,14 @@ use crate::model::{is_slow, MinerRow}; /// One fixture board, pre-transform. `expected` of 0.0 means "band unknown". +/// `make`/`model_id`/`board` mirror what asic-rs actually reports (compact +/// identifiers + a bare control-board name) so the fixtures exercise the real +/// crate::naming transform, not pre-cleaned strings. struct Board { ip: &'static str, - model: &'static str, + make: &'static str, + model_id: &'static str, + board: &'static str, firmware: &'static str, hashrate: f64, expected: f64, @@ -51,13 +56,21 @@ impl Board { // upgrade path (S17/S19/S21 family); WhatsMiner boards in this fleet // don't advertise it, so both true and false show up and the // firmware menu item is testable. - let firmware_flash = self.model == "Antminer S17" - || self.model.starts_with("Antminer S19") - || self.model.starts_with("Antminer S21"); + let firmware_flash = self.make.eq_ignore_ascii_case("antminer") + && (self.model_id == "S17" + || self.model_id.starts_with("S19") + || self.model_id.starts_with("S21")); + // Derive the display identity through the same path the live scan uses. + let brand = crate::naming::brand(self.make); + let model = crate::naming::clean_model(self.make, self.model_id); + let submodel = crate::naming::submodel(self.make, self.model_id); + let control_board = crate::naming::control_board_code(self.make, self.board, &model); MinerRow { ip: self.ip.to_string(), selected: false, - model: self.model.to_string(), + model, + brand, + submodel, firmware: self.firmware.to_string(), hashrate_ths: self.hashrate, expected_ths: self.expected, @@ -107,22 +120,12 @@ impl Board { firmware_flash, }, // Demo values for the round-8/9 columns (synthetic, so the columns - // show variety offline). + // show variety offline). control_board is derived above via naming. algorithm: "SHA256".to_string(), - control_board: if self.model.contains("S17") { - "Xilinx".to_string() - } else if self.model.contains("S19j") || self.model.contains("S19k") { - "AMLogic".to_string() - } else if self.model.contains("S19") { - "BeagleBone Black".to_string() - } else if self.model.contains("S21") { - "CVITek".to_string() - } else { - String::new() - }, - pic_present: if self.model.contains("S21") { + control_board, + pic_present: if self.model_id.contains("S21") { Some(false) // noPIC example - } else if self.model.starts_with("Antminer") { + } else if self.make.eq_ignore_ascii_case("antminer") { Some(true) } else { None // WhatsMiner: unknown over the network @@ -130,7 +133,7 @@ impl Board { // Access: idle/view-only units (no worker) shown locked; the rest // unlocked. (Live rows infer this from control capabilities.) write_locked: Some(self.worker.is_empty()), - errors: if self.model.contains("S21 Pro") { + errors: if self.model_id == "S21Pro" { vec![ "[Warning] hashrate 70% below expected".to_string(), "[Warning] chip temperature high (HashBoard 2)".to_string(), @@ -153,33 +156,33 @@ impl Board { /// total hashrate = 685.0 TH/s, total power = 21300 W. pub fn bench_fleet() -> Vec { let boards = [ - Board { ip: "10.255.1.112", model: "Antminer S17", firmware: "Stock", + Board { ip: "10.255.1.112", make: "Antminer", model_id: "S17", board: "Xilinx", firmware: "Stock", hashrate: 0.0, expected: 0.0, power: 0.0, temp: 0.0, fan: 0.0, worker: "", mining: false, paused: false }, - Board { ip: "10.255.1.166", model: "Antminer S19", firmware: "[removed] 1.2", + Board { ip: "10.255.1.166", make: "Antminer", model_id: "S19", board: "BeagleBoneBlack", firmware: "[removed] 1.2", hashrate: 95.0, expected: 96.0, power: 3250.0, temp: 65.0, fan: 4200.0, worker: "blueflare.s19", mining: true, paused: false }, - Board { ip: "10.255.1.152", model: "Antminer S19j Pro", firmware: "[removed] 1.2", + Board { ip: "10.255.1.152", make: "Antminer", model_id: "S19jPro", board: "AMLogic", firmware: "[removed] 1.2", hashrate: 100.0, expected: 104.0, power: 3100.0, temp: 62.0, fan: 3900.0, worker: "blueflare.s19jpro", mining: true, paused: false }, - Board { ip: "10.255.1.167", model: "Antminer S19k Pro", firmware: "[removed] 1.2", + Board { ip: "10.255.1.167", make: "Antminer", model_id: "S19KPro", board: "AMLogic", firmware: "[removed] 1.2", hashrate: 120.0, expected: 128.0, power: 3300.0, temp: 68.0, fan: 4500.0, worker: "blueflare.s19kpro", mining: true, paused: false }, - Board { ip: "10.255.1.149", model: "Antminer S21 Pro", firmware: "Stock", + Board { ip: "10.255.1.149", make: "Antminer", model_id: "S21Pro", board: "CVITek", firmware: "Stock", hashrate: 60.0, expected: 200.0, power: 1500.0, temp: 55.0, fan: 3000.0, worker: "blueflare.s21pro", mining: true, paused: false }, // slow: 60/200 = 30% - Board { ip: "10.255.1.126", model: "WhatsMiner M30S", firmware: "WMOS H3", + Board { ip: "10.255.1.126", make: "Whatsminer", model_id: "M30SVE40", board: "H3", firmware: "WMOS H3", hashrate: 92.0, expected: 96.0, power: 3400.0, temp: 70.0, fan: 4800.0, worker: "blueflare.h3", mining: true, paused: false }, - Board { ip: "10.255.1.131", model: "WhatsMiner M30S+", firmware: "WMOS H616", + Board { ip: "10.255.1.131", make: "Whatsminer", model_id: "M30SPlusVE40", board: "H616", firmware: "WMOS H616", hashrate: 100.0, expected: 100.0, power: 3450.0, temp: 71.0, fan: 4900.0, worker: "blueflare.h616", mining: true, paused: false }, - Board { ip: "10.255.1.148", model: "WhatsMiner M50", firmware: "WMOS CB4", + Board { ip: "10.255.1.148", make: "Whatsminer", model_id: "M50VH50", board: "H6", firmware: "WMOS CB4", hashrate: 118.0, expected: 122.0, power: 3300.0, temp: 66.0, fan: 4600.0, worker: "blueflare.m50", mining: true, paused: false }, // Rebucketed from idle/not-hashing to paused so the "paused" // status/KPI bucket is exercisable in the fake-scan/offline demo. - Board { ip: "10.255.1.115", model: "Antminer S19", firmware: "WardenOS dev", + Board { ip: "10.255.1.115", make: "Antminer", model_id: "S19", board: "BeagleBoneBlack", firmware: "WardenOS dev", hashrate: 0.0, expected: 0.0, power: 0.0, temp: 0.0, fan: 0.0, worker: "", mining: false, paused: true }, ]; diff --git a/crates/alkane-gui/src/main.rs b/crates/alkane-gui/src/main.rs index 097d9cb4..e0ecef69 100644 --- a/crates/alkane-gui/src/main.rs +++ b/crates/alkane-gui/src/main.rs @@ -5,6 +5,7 @@ mod access_probe; mod credentials; mod fixtures; mod model; +mod naming; mod pic_probe; mod presets; mod scan; diff --git a/crates/alkane-gui/src/model.rs b/crates/alkane-gui/src/model.rs index ad1c682d..12840edb 100644 --- a/crates/alkane-gui/src/model.rs +++ b/crates/alkane-gui/src/model.rs @@ -237,6 +237,12 @@ pub struct MinerRow { pub caps: MinerCaps, // identity pub model: String, + /// Manufacturer brand ("Antminer", "WhatsMiner", ...), its own column so the + /// Model column can carry just the cleaned model name. + pub brand: String, + /// Model sub-variant: WhatsMiner's version block ("VE40"); blank for Antminer + /// (its hashboard type is not reported over the network by asic-rs). + pub submodel: String, pub mac: String, pub hostname: String, pub serial: String, @@ -357,6 +363,8 @@ pub enum Column { Firmware, Worker, Model, + Brand, + Submodel, Status, Efficiency, FluidTemp, @@ -392,7 +400,7 @@ pub enum Column { /// Every column, in registry order. Ip first, then the default-visible set /// (UI-SPEC order), then all remaining metrics. -pub const ALL_COLUMNS: [Column; 39] = [ +pub const ALL_COLUMNS: [Column; 41] = [ Column::Ip, Column::Hashrate, Column::Power, @@ -401,6 +409,8 @@ pub const ALL_COLUMNS: [Column; 39] = [ Column::Firmware, Column::Worker, Column::Model, + Column::Brand, + Column::Submodel, Column::Status, Column::Efficiency, Column::FluidTemp, @@ -457,6 +467,8 @@ impl Column { Column::Firmware => "Firmware", Column::Worker => "Pool worker", Column::Model => "Model", + Column::Brand => "Brand", + Column::Submodel => "Submodel", Column::Status => "Status", Column::Efficiency => "Efficiency (J/TH)", Column::FluidTemp => "Fluid temp", @@ -501,6 +513,8 @@ impl Column { Column::Firmware => 160, Column::Worker => 150, Column::Model => 150, + Column::Brand => 100, + Column::Submodel => 100, Column::Status => 95, Column::Efficiency => 120, Column::FanCount | Column::TotalChips | Column::Hashboards => 70, @@ -645,6 +659,8 @@ impl Column { Column::Worker => r.worker.clone(), Column::PoolUrl => r.pool_url.clone(), Column::Model => r.model.clone(), + Column::Brand => r.brand.clone(), + Column::Submodel => r.submodel.clone(), Column::Mac => r.mac.clone(), Column::Hostname => r.hostname.clone(), Column::Serial => r.serial.clone(), diff --git a/crates/alkane-gui/src/naming.rs b/crates/alkane-gui/src/naming.rs new file mode 100644 index 00000000..e2ff24e6 --- /dev/null +++ b/crates/alkane-gui/src/naming.rs @@ -0,0 +1,302 @@ +//! Display-layer device-naming cleanup (round-9 item #11). +//! +//! asic-rs hands us compact Rust-identifier model strings and bare control-board +//! names, not human-facing labels: +//! - `device_info.make` = "Antminer" / "Whatsminer" (note the casing) +//! - `device_info.model` = the model enum's variant identifier verbatim, e.g. +//! "S19KPro", "S19jPro", "M30SPlusVE40", "M30SPlusPlusVE40" -- no spaces, +//! "+" rendered "Plus", "++" rendered "PlusPlus", the WhatsMiner version +//! block ("VE40") baked in. +//! - `control_board_version` = a bare board name ("Xilinx", "CVITek", +//! "AMLogic", "BeagleBoneBlack"; WhatsMiner "H3"/"H6"/"H6OS"/"H616"). +//! +//! This module turns those into the Brand / Model / Submodel / control-board +//! short code the table shows. It is a pure string transform -- no asic-rs edit +//! -- so it stays a build-on-top layer over the vendored crate. +//! +//! Known limitations (asic-rs does not expose the data): +//! - Antminer has no hashboard-type/submodel over the network, so Submodel is +//! blank for Antminer (only WhatsMiner's version block is recoverable). +//! - asic-rs reports only "AMLogic" (not the 120mm C76 vs 140mm CBE board) and +//! only "Xilinx" (not C49 vs C55); we disambiguate by model family as a +//! best-effort heuristic documented at `control_board_code`. + +/// Human brand from asic-rs `device_info.make`. +pub fn brand(make: &str) -> String { + match make.trim().to_ascii_lowercase().as_str() { + "antminer" => "Antminer".to_string(), + "whatsminer" => "WhatsMiner".to_string(), + "" => String::new(), + other => { + // Title-case an unknown make so the Brand column still reads well. + let mut c = other.chars(); + match c.next() { + Some(f) => f.to_ascii_uppercase().to_string() + c.as_str(), + None => String::new(), + } + } + } +} + +fn is_whatsminer(make: &str) -> bool { + make.trim().eq_ignore_ascii_case("whatsminer") +} + +fn is_antminer(make: &str) -> bool { + make.trim().eq_ignore_ascii_case("antminer") +} + +/// The human model name for the Model column: brand dropped (it has its own +/// column), family-letter suffix lowercased, word suffixes spaced, "+"/"++" for +/// Plus/PlusPlus, and (WhatsMiner) the trailing version block moved to Submodel. +pub fn clean_model(make: &str, model_id: &str) -> String { + let id = model_id.trim(); + if id.is_empty() { + return String::new(); + } + if is_whatsminer(make) { + clean_whatsminer(id).0 + } else if is_antminer(make) { + clean_antminer(id) + } else { + id.to_string() + } +} + +/// The Submodel column value. WhatsMiner: the version block ("VE40"). Antminer: +/// empty -- the hashboard type is not reported over the network by asic-rs. +pub fn submodel(make: &str, model_id: &str) -> String { + if is_whatsminer(make) { + clean_whatsminer(model_id.trim()).1 + } else { + String::new() + } +} + +/// Split a WhatsMiner identifier into (clean model, version submodel). The +/// version block is the trailing run beginning at the first 'V' (WhatsMiner +/// tiers never contain a 'V', so the first 'V' always starts the version). The +/// prefix's Plus/PlusPlus become +/++. +fn clean_whatsminer(id: &str) -> (String, String) { + let (prefix, version) = match id.find('V') { + Some(i) => (&id[..i], id[i..].to_string()), + None => (id, String::new()), + }; + let model = prefix.replace("PlusPlus", "++").replace("Plus", "+"); + (model, version) +} + +/// Known Antminer word-suffixes, longest-first so "PlusPlus" wins over "Plus" +/// and "NoPIC" is matched whole. Each maps to its spaced display form. +const ANT_SUFFIXES: &[(&str, &str)] = &[ + ("PlusPlus", "++"), + ("Plus", "+"), + ("NoPIC", " NoPIC"), + ("Hydro", " Hydro"), + ("Pro", " Pro"), + ("XP", " XP"), +]; + +/// Clean an Antminer identifier, e.g. "S19KPro" -> "S19k Pro", "S21eXPHydro" -> +/// "S21e XP Hydro", "L3PlusPlus" -> "L3++". Unknown/odd inputs pass through. +fn clean_antminer(id: &str) -> String { + let bytes = id.as_bytes(); + // Base = leading letters then digits ("S19", "KS5", "L3", "Z15"). Without a + // letter+digit base (e.g. an Unknown passthrough), return the id unchanged. + let mut i = 0; + while i < bytes.len() && bytes[i].is_ascii_alphabetic() { + i += 1; + } + let letters_end = i; + while i < bytes.len() && bytes[i].is_ascii_digit() { + i += 1; + } + if letters_end == 0 || i == letters_end { + return id.to_string(); + } + let mut out = String::from(&id[..i]); + let mut rest = &id[i..]; + + // An optional single family letter directly after the digits (j/i/a/e/K/L), + // recognised as "not the start of a known suffix". Lowercase it, keep it + // attached to the base (no space): "S19K" -> "S19k". + if let Some(first) = rest.chars().next() { + let starts_suffix = ANT_SUFFIXES.iter().any(|(s, _)| rest.starts_with(s)); + if first.is_ascii_alphabetic() && !starts_suffix { + out.push(first.to_ascii_lowercase()); + rest = &rest[first.len_utf8()..]; + } + } + + // Remaining suffix words, matched greedily against the known set. + while !rest.is_empty() { + match ANT_SUFFIXES.iter().find(|(s, _)| rest.starts_with(s)) { + Some((s, disp)) => { + out.push_str(disp); + rest = &rest[s.len()..]; + } + None => { + // Unknown trailing token: emit it space-separated and stop. + out.push(' '); + out.push_str(rest); + break; + } + } + } + out +} + +/// Normalise a raw control-board name for matching: drop spaces/punctuation and +/// uppercase, so "BeagleBone Black", "BeagleBoneBlack" and "BBB" all collapse. +fn compact_upper(s: &str) -> String { + s.chars().filter(|c| c.is_ascii_alphanumeric()).flat_map(|c| c.to_uppercase()).collect() +} + +/// The control-board short code for the Control-board column, e.g. +/// "BeagleBoneBlack" -> "BBB (C77)", "Xilinx" on an S17 -> "XIL (C49)". +/// +/// asic-rs reports only the board FAMILY ("AMLogic"/"Xilinx"), never the exact +/// Bitmain board number, so where a family spans two boards we disambiguate by +/// model era/class (best-effort, since the network data can't distinguish them): +/// - Xilinx: S17/T17-era -> C49, otherwise (S19-era) -> C55. +/// - AMLogic: XP-class / S19k (140mm fans) -> CBE, otherwise (120mm) -> C76. +/// `clean_model` is the already-cleaned model name (used for the era/class test). +pub fn control_board_code(make: &str, board_name: &str, clean_model: &str) -> String { + let raw = board_name.trim(); + if raw.is_empty() { + return String::new(); + } + // asic-rs renders an unrecognised board as "Unknown: "; pass that + // through so the operator still sees what came back. + if raw.starts_with("Unknown") { + return raw.to_string(); + } + let key = compact_upper(raw); + + if is_whatsminer(make) { + return match key.as_str() { + "H3" => "H3 (CB2)", + "H6" => "H6 (CB4)", + "H6OS" => "H6os (CB4)", + "H616" => "H616 (CB6)", + _ => raw, + } + .to_string(); + } + + // Antminer (and any make that reports these families). + match key.as_str() { + "BEAGLEBONEBLACK" | "BBB" | "BB" | "BEAGLEBONE" => "BBB (C77)".to_string(), + "CVITEK" | "CVI" => "CVI (C88)".to_string(), + "XILINX" | "XIL" => { + if is_s17_era(clean_model) { + "XIL (C49)".to_string() + } else { + "XIL (C55)".to_string() + } + } + "AMLOGIC" | "AML" => { + if is_aml_140mm(clean_model) { + "AML (CBE)".to_string() + } else { + "AML (C76)".to_string() + } + } + _ => raw.to_string(), + } +} + +/// S17/T17-era models use the Xilinx C49 control board. +fn is_s17_era(clean_model: &str) -> bool { + let m = clean_model.trim_start(); + m.starts_with("S17") || m.starts_with("T17") +} + +/// Best-effort: the 140mm-fan AMLogic board (CBE) is used on the XP-class and +/// the S19k Pro; everything else AMLogic is the 120mm C76. asic-rs cannot tell +/// these apart, so this is a model-family heuristic, not a hardware read. +fn is_aml_140mm(clean_model: &str) -> bool { + let m = clean_model; + m.contains("XP") || m.starts_with("S19k") +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn brand_normalises_case() { + assert_eq!(brand("Antminer"), "Antminer"); + assert_eq!(brand("Whatsminer"), "WhatsMiner"); + assert_eq!(brand("whatsminer"), "WhatsMiner"); + assert_eq!(brand(""), ""); + assert_eq!(brand("avalonminer"), "Avalonminer"); + } + + #[test] + fn antminer_model_cleanup() { + // The headline example from the spec. + assert_eq!(clean_model("Antminer", "S19KPro"), "S19k Pro"); + assert_eq!(clean_model("Antminer", "S19jPro"), "S19j Pro"); + assert_eq!(clean_model("Antminer", "S21Pro"), "S21 Pro"); + assert_eq!(clean_model("Antminer", "S19"), "S19"); + assert_eq!(clean_model("Antminer", "S19XP"), "S19 XP"); + assert_eq!(clean_model("Antminer", "S19jXP"), "S19j XP"); + assert_eq!(clean_model("Antminer", "S19Plus"), "S19+"); + assert_eq!(clean_model("Antminer", "S19ProPlus"), "S19 Pro+"); + assert_eq!(clean_model("Antminer", "S19jProPlus"), "S19j Pro+"); + assert_eq!(clean_model("Antminer", "S19ProPlusHydro"), "S19 Pro+ Hydro"); + assert_eq!(clean_model("Antminer", "S19jNoPIC"), "S19j NoPIC"); + assert_eq!(clean_model("Antminer", "S21PlusPlus"), "S21++"); + assert_eq!(clean_model("Antminer", "S21eXPHydro"), "S21e XP Hydro"); + assert_eq!(clean_model("Antminer", "L3PlusPlus"), "L3++"); + assert_eq!(clean_model("Antminer", "KS5Pro"), "KS5 Pro"); + assert_eq!(clean_model("Antminer", "Z15Pro"), "Z15 Pro"); + assert_eq!(clean_model("Antminer", "S9i"), "S9i"); + assert_eq!(clean_model("Antminer", "S17e"), "S17e"); + assert_eq!(clean_model("Antminer", "S19a"), "S19a"); + assert_eq!(clean_model("Antminer", "S19aPro"), "S19a Pro"); + } + + #[test] + fn whatsminer_model_and_submodel() { + assert_eq!(clean_model("Whatsminer", "M30SPlusVE40"), "M30S+"); + assert_eq!(submodel("Whatsminer", "M30SPlusVE40"), "VE40"); + assert_eq!(clean_model("Whatsminer", "M30SPlusPlusVE40"), "M30S++"); + assert_eq!(submodel("Whatsminer", "M30SPlusPlusVE40"), "VE40"); + assert_eq!(clean_model("Whatsminer", "M30SVE40"), "M30S"); + assert_eq!(submodel("Whatsminer", "M30SVE40"), "VE40"); + assert_eq!(clean_model("Whatsminer", "M20S"), "M20S"); + assert_eq!(submodel("Whatsminer", "M20S"), ""); + assert_eq!(clean_model("Whatsminer", "M50S++VK30"), "M50S++"); + assert_eq!(submodel("Whatsminer", "M50S++VK30"), "VK30"); + } + + #[test] + fn antminer_has_no_submodel() { + assert_eq!(submodel("Antminer", "S19KPro"), ""); + } + + #[test] + fn control_board_short_codes() { + // Antminer families (board name as asic-rs renders the enum variant). + assert_eq!(control_board_code("Antminer", "BeagleBoneBlack", "S19"), "BBB (C77)"); + // Also accept the spaced form some layers produce. + assert_eq!(control_board_code("Antminer", "BeagleBone Black", "S19"), "BBB (C77)"); + assert_eq!(control_board_code("Antminer", "CVITek", "S21 Pro"), "CVI (C88)"); + assert_eq!(control_board_code("Antminer", "Xilinx", "S17 Pro"), "XIL (C49)"); + assert_eq!(control_board_code("Antminer", "Xilinx", "T17"), "XIL (C49)"); + assert_eq!(control_board_code("Antminer", "Xilinx", "S19 Pro"), "XIL (C55)"); + assert_eq!(control_board_code("Antminer", "AMLogic", "S19j Pro"), "AML (C76)"); + assert_eq!(control_board_code("Antminer", "AMLogic", "S19k Pro"), "AML (CBE)"); + assert_eq!(control_board_code("Antminer", "AMLogic", "S19 XP"), "AML (CBE)"); + // WhatsMiner families. + assert_eq!(control_board_code("Whatsminer", "H3", "M30S"), "H3 (CB2)"); + assert_eq!(control_board_code("Whatsminer", "H6", "M50"), "H6 (CB4)"); + assert_eq!(control_board_code("Whatsminer", "H6OS", "M50"), "H6os (CB4)"); + assert_eq!(control_board_code("Whatsminer", "H616", "M30S+"), "H616 (CB6)"); + // Unknown / blank pass through. + assert_eq!(control_board_code("Antminer", "Unknown: FOO", "S19"), "Unknown: FOO"); + assert_eq!(control_board_code("Antminer", "", "S19"), ""); + } +} diff --git a/crates/alkane-gui/src/scan.rs b/crates/alkane-gui/src/scan.rs index 68bb9152..5c4f6ab0 100644 --- a/crates/alkane-gui/src/scan.rs +++ b/crates/alkane-gui/src/scan.rs @@ -482,11 +482,19 @@ async fn to_row(miner: &dyn Miner) -> MinerRow { (fw, Some(v)) => format!("{fw}{v}"), (fw, None) => fw.clone(), }; - let model = if data.device_info.make.is_empty() { - data.device_info.model.clone() - } else { - format!("{} {}", data.device_info.make, data.device_info.model) - }; + // Split asic-rs's compact make/model identifiers into the human-facing + // Brand / Model / Submodel the table shows (see crate::naming). asic-rs hands + // us "Antminer"/"S19KPro"; we render brand "Antminer", model "S19k Pro". + let make = data.device_info.make.clone(); + let model_id = data.device_info.model.clone(); + let brand = crate::naming::brand(&make); + let model = crate::naming::clean_model(&make, &model_id); + let submodel = crate::naming::submodel(&make, &model_id); + let control_board = crate::naming::control_board_code( + &make, + &data.control_board_version.as_ref().map(|c| c.to_string()).unwrap_or_default(), + &model, + ); let fluid_temp_c = data.fluid_temperature.as_ref().map(|t| t.as_celsius()).unwrap_or(0.0); let outlet_temp_c = data .outlet_fluid_temperature @@ -531,12 +539,14 @@ async fn to_row(miner: &dyn Miner) -> MinerRow { write_locked, errors, model, + brand, + submodel, mac: data.mac.map(|m| m.to_string()).unwrap_or_default(), hostname: data.hostname.clone().unwrap_or_default(), serial: data.serial_number.clone().unwrap_or_default(), firmware, api_version: data.api_version.clone().unwrap_or_default(), - control_board: data.control_board_version.as_ref().map(|c| c.to_string()).unwrap_or_default(), + control_board, hashrate_ths, expected_ths, efficiency: data.efficiency.unwrap_or(0.0), diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index 9cbab318..33f47c25 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -2742,6 +2742,36 @@ impl App { } else { check("WardenOS-dev (.115) present", false, "row not found".into()); } + + // 4b. Device-naming cleanup (#11): the cleaned Model, split Brand/ + // Submodel, and control-board short code, read straight from the row + // (these columns are hidden by default, so not in the store above). + // (ip, brand, model, submodel, control-board code). + let name_cases = [ + ("10.255.1.167", "Antminer", "S19k Pro", "", "AML (CBE)"), + ("10.255.1.112", "Antminer", "S17", "", "XIL (C49)"), + ("10.255.1.152", "Antminer", "S19j Pro", "", "AML (C76)"), + ("10.255.1.149", "Antminer", "S21 Pro", "", "CVI (C88)"), + ("10.255.1.166", "Antminer", "S19", "", "BBB (C77)"), + ("10.255.1.131", "WhatsMiner", "M30S+", "VE40", "H616 (CB6)"), + ("10.255.1.126", "WhatsMiner", "M30S", "VE40", "H3 (CB2)"), + ("10.255.1.148", "WhatsMiner", "M50", "VH50", "H6 (CB4)"), + ]; + for (ip, brand, model, sub, board) in name_cases { + match self.rows.iter().find(|r| r.ip == ip) { + Some(r) => { + check(&format!("{ip} brand == \"{brand}\""), r.brand == brand, + format!("got \"{}\"", r.brand)); + check(&format!("{ip} model == \"{model}\""), r.model == model, + format!("got \"{}\"", r.model)); + check(&format!("{ip} submodel == \"{sub}\""), r.submodel == sub, + format!("got \"{}\"", r.submodel)); + check(&format!("{ip} control board == \"{board}\""), r.control_board == board, + format!("got \"{}\"", r.control_board)); + } + None => check(&format!("{ip} present"), false, "row not found".into()), + } + } check("IP is the first column", ip_col == Some(0), format!("ip col index = {ip_col:?}")); // default view is IP-ascending -- compare against the model's own