Extend vendored asic-rs to scan more per-firmware telemetry (round 19 #10 follow-up, tier 1 sub-batch A). All new values ride on existing DataFields (Psu/Hashboards/BestShare) and commands already fetched, so no new core DataField plumbing and no extra network round-trips. Patch 0023. Vendored (asic-rs): - PsuInfo gains `serial`. Braiins v26_04 parse_psu corrected to read model_name + fw_version (it used the numeric type code as the model and dropped the fw version) and to capture serial_number. ePIC / WhatsMiner v1/v2 report no serial. - BoardData gains `chip_type` (e.g. "BM1370") + `hashboard_model` (e.g. "A3HB70601"); Braiins miner/hw/hashboards populates both. - best_share (all-time) wired for Antminer v2020 and WhatsMiner v1/v2 from the already-fetched summary "Best Share" (those backends had the empty default). - refresh-checksums --all; existing braiins/antminer/whatsminer fixture tests pass. GUI: - MinerRow gains chip_type, hashboard_model, psu_serial; populated in to_row. - New columns: Chip, HB model, PSU serial. Best share now populates for Antminer and WhatsMiner (column already existed). Feasibility analysis (5-agent, all firmwares) recorded in memory; further tiers (fan %, rolling hashrate averages, difficulty/shares, temp thresholds, WhatsMiner V3 / VNish PSU serial) follow. Confirmed genuinely-unavailable: fan max RPM, WhatsMiner/LuxOS real logs, chip type on Antminer/LuxOS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Djv3oncM4LxTS5tb61Ako6
162 lines
6.0 KiB
Rust
162 lines
6.0 KiB
Rust
use std::fmt::Display;
|
|
|
|
use measurements::{Frequency, Temperature, Voltage};
|
|
#[cfg(feature = "python")]
|
|
use pyo3::pyclass;
|
|
use serde::{Deserialize, Serialize};
|
|
use ts_rs::TS;
|
|
|
|
use super::{
|
|
hashrate::HashRate,
|
|
serialize::{serialize_frequency, serialize_temperature, serialize_voltage},
|
|
};
|
|
|
|
#[cfg_attr(feature = "python", pyclass(from_py_object, module = "asic_rs"))]
|
|
#[cfg_attr(feature = "python", asic_rs_pydantic::py_pydantic_model(getters))]
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default, TS)]
|
|
/// Per-chip telemetry for a hashboard.
|
|
pub struct ChipData {
|
|
/// The position of the chip on the board, indexed from 0
|
|
pub position: u16,
|
|
/// The current hashrate of the chip
|
|
pub hashrate: Option<HashRate>,
|
|
/// The current chip temperature
|
|
#[serde(serialize_with = "serialize_temperature")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub temperature: Option<Temperature>,
|
|
/// The voltage set point for this chip
|
|
#[serde(serialize_with = "serialize_voltage")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub voltage: Option<Voltage>,
|
|
/// The frequency set point for this chip
|
|
#[serde(serialize_with = "serialize_frequency")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub frequency: Option<Frequency>,
|
|
/// Whether this chip is tuned and optimizations have completed
|
|
pub tuned: Option<bool>,
|
|
/// Whether this chip is working and actively mining
|
|
pub working: Option<bool>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "python", pyclass(from_py_object, module = "asic_rs"))]
|
|
#[cfg_attr(feature = "python", asic_rs_pydantic::py_pydantic_model(getters))]
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default, TS)]
|
|
/// Per-hashboard telemetry for a miner.
|
|
pub struct BoardData {
|
|
/// The board position in the miner, indexed from 0
|
|
pub position: u8,
|
|
/// The current hashrate of the board
|
|
pub hashrate: Option<HashRate>,
|
|
/// The expected or factory hashrate of the board
|
|
pub expected_hashrate: Option<HashRate>,
|
|
/// The board temperature, also sometimes called PCB temperature
|
|
#[serde(serialize_with = "serialize_temperature")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub board_temperature: Option<Temperature>,
|
|
/// The temperature of the coolest / first-in-chain chip on the board
|
|
#[serde(serialize_with = "serialize_temperature")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub inlet_chip_temperature: Option<Temperature>,
|
|
/// The temperature of the hottest / last-in-chain chip on the board
|
|
#[serde(serialize_with = "serialize_temperature")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub outlet_chip_temperature: Option<Temperature>,
|
|
/// The expected number of chips on this board
|
|
pub expected_chips: Option<u16>,
|
|
/// The number of working chips on this board
|
|
pub working_chips: Option<u16>,
|
|
/// The serial number of this board
|
|
pub serial_number: Option<String>,
|
|
/// Chip level information for this board
|
|
/// May be empty, most machines do not provide this level of in depth information
|
|
pub chips: Vec<ChipData>,
|
|
/// The average voltage or voltage set point of this board
|
|
#[serde(serialize_with = "serialize_voltage")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub voltage: Option<Voltage>,
|
|
/// The average frequency or frequency set point of this board
|
|
#[serde(serialize_with = "serialize_frequency")]
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional, type = "number")]
|
|
pub frequency: Option<Frequency>,
|
|
/// Whether this board has been tuned and optimizations have completed
|
|
pub tuned: Option<bool>,
|
|
/// Whether this board is enabled and actively mining
|
|
pub active: Option<bool>,
|
|
/// The ASIC chip type/model on this board (e.g. "BM1370"), when reported.
|
|
/// Not exposed by Antminer/LuxOS (their network API reports only the control
|
|
/// board type).
|
|
pub chip_type: Option<String>,
|
|
/// The hashboard model / part identifier (e.g. "A3HB70601"), when reported.
|
|
pub hashboard_model: Option<String>,
|
|
}
|
|
|
|
impl BoardData {
|
|
/// Create a new board at the given position with the specified expected chip count.
|
|
/// All other fields are left at their defaults.
|
|
pub fn new(position: u8, expected_chips: Option<u16>) -> Self {
|
|
Self {
|
|
position,
|
|
expected_chips,
|
|
..Default::default()
|
|
}
|
|
}
|
|
|
|
/// Create a new board with tuned and active state pre-set.
|
|
pub fn with_state(
|
|
position: u8,
|
|
expected_chips: Option<u16>,
|
|
tuned: Option<bool>,
|
|
active: Option<bool>,
|
|
) -> Self {
|
|
Self {
|
|
position,
|
|
expected_chips,
|
|
tuned,
|
|
active,
|
|
..Default::default()
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, TS)]
|
|
#[cfg_attr(
|
|
feature = "python",
|
|
pyclass(from_py_object, get_all, module = "asic_rs")
|
|
)]
|
|
#[cfg_attr(feature = "python", asic_rs_pydantic::py_pydantic_model)]
|
|
/// Control board identity reported by a miner.
|
|
pub struct MinerControlBoard {
|
|
/// Whether the control board name is a known board identifier.
|
|
pub known: bool,
|
|
/// Control board name or raw unknown identifier.
|
|
pub name: String,
|
|
}
|
|
impl MinerControlBoard {
|
|
/// Create an unknown control board identity from a raw name.
|
|
pub fn unknown(name: String) -> Self {
|
|
Self { known: false, name }
|
|
}
|
|
/// Create a known control board identity.
|
|
pub fn known(name: String) -> Self {
|
|
Self { known: true, name }
|
|
}
|
|
}
|
|
|
|
impl Display for MinerControlBoard {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
if self.known {
|
|
write!(f, "{}", self.name)
|
|
} else {
|
|
write!(f, "Unknown: {}", self.name)
|
|
}
|
|
}
|
|
}
|