style: rustfmt the A113D GUI install + headless bench driver
cargo fmt -p alkane-gui; no logic change. This branch's CI never ran before (its verify was skipped), so the formatting was never enforced. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
This commit is contained in:
@@ -53,9 +53,7 @@ fn drive(label: &str, handle: StockHandle) -> bool {
|
||||
fn ssh_banner(host: &str) -> Option<String> {
|
||||
let addr: std::net::SocketAddr = format!("{host}:22").parse().ok()?;
|
||||
let mut stream = TcpStream::connect_timeout(&addr, Duration::from_secs(5)).ok()?;
|
||||
stream
|
||||
.set_read_timeout(Some(Duration::from_secs(5)))
|
||||
.ok()?;
|
||||
stream.set_read_timeout(Some(Duration::from_secs(5))).ok()?;
|
||||
let mut buf = [0u8; 256];
|
||||
let n = stream.read(&mut buf).ok()?;
|
||||
if n == 0 {
|
||||
@@ -129,7 +127,10 @@ fn mac_of(host: &str) -> Option<String> {
|
||||
let _ = Command::new("ping")
|
||||
.args(["-c", "1", "-W", "1", host])
|
||||
.output();
|
||||
let out = Command::new("ip").args(["neigh", "show", host]).output().ok()?;
|
||||
let out = Command::new("ip")
|
||||
.args(["neigh", "show", host])
|
||||
.output()
|
||||
.ok()?;
|
||||
let s = String::from_utf8_lossy(&out.stdout);
|
||||
let mut it = s.split_whitespace();
|
||||
while let Some(t) = it.next() {
|
||||
@@ -183,7 +184,12 @@ fn ip_for_mac(mac: &str) -> Option<String> {
|
||||
/// Poll until the board (located by MAC, so a changed DHCP lease is followed)
|
||||
/// reaches the wanted stock-ness, or `timeout` elapses. Returns the board's
|
||||
/// current IP, a description, and whether the target state was reached.
|
||||
fn wait_for(mac: Option<&str>, fallback: &str, want_stock: bool, timeout: Duration) -> (String, String, bool) {
|
||||
fn wait_for(
|
||||
mac: Option<&str>,
|
||||
fallback: &str,
|
||||
want_stock: bool,
|
||||
timeout: Duration,
|
||||
) -> (String, String, bool) {
|
||||
let deadline = Instant::now() + timeout;
|
||||
let mut ip = fallback.to_string();
|
||||
let mut swept = Instant::now() - Duration::from_secs(60);
|
||||
@@ -255,7 +261,8 @@ pub fn run(spec: &str) -> i32 {
|
||||
let mac = mac_of(&host);
|
||||
println!(
|
||||
"board MAC: {}",
|
||||
mac.as_deref().unwrap_or("unknown (will use the fixed host)")
|
||||
mac.as_deref()
|
||||
.unwrap_or("unknown (will use the fixed host)")
|
||||
);
|
||||
|
||||
let boot_timeout = Duration::from_secs(300);
|
||||
@@ -286,7 +293,10 @@ pub fn run(spec: &str) -> i32 {
|
||||
boot_timeout.as_secs()
|
||||
);
|
||||
let (alkane_ip, desc, ok) = wait_for(mac.as_deref(), &host, false, boot_timeout);
|
||||
println!(" {desc} => {}", if ok { "ALKANE" } else { "NOT ALKANE (fail)" });
|
||||
println!(
|
||||
" {desc} => {}",
|
||||
if ok { "ALKANE" } else { "NOT ALKANE (fail)" }
|
||||
);
|
||||
all_ok = all_ok && ok;
|
||||
|
||||
// 3. restore (alkane -> stock) flag-flip at the board's CURRENT address
|
||||
@@ -303,7 +313,10 @@ pub fn run(spec: &str) -> i32 {
|
||||
boot_timeout.as_secs()
|
||||
);
|
||||
let (_stock_ip, desc, ok) = wait_for(mac.as_deref(), &host, true, boot_timeout);
|
||||
println!(" {desc} => {}", if ok { "STOCK" } else { "NOT STOCK (fail)" });
|
||||
println!(
|
||||
" {desc} => {}",
|
||||
if ok { "STOCK" } else { "NOT STOCK (fail)" }
|
||||
);
|
||||
all_ok = all_ok && ok;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@ use crate::scan::fake_scan_enabled;
|
||||
/// `SUPPORTED`). Only these are offered as install targets.
|
||||
pub const SUPPORTED_BOARDS: &[(&str, &str)] = &[
|
||||
("zynq-7010", "Antminer S17 (Xilinx Zynq-7010 control board)"),
|
||||
("a113d", "Antminer S19j Pro (Amlogic A113D/AXG control board)"),
|
||||
(
|
||||
"a113d",
|
||||
"Antminer S19j Pro (Amlogic A113D/AXG control board)",
|
||||
),
|
||||
];
|
||||
|
||||
/// The default install board when the user has not chosen another.
|
||||
|
||||
Reference in New Issue
Block a user