diff --git a/thirdparty/asic-rs/patches/0017-luxminer-power-limit-profile-by-name.patch b/thirdparty/asic-rs/patches/0017-luxminer-power-limit-profile-by-name.patch new file mode 100644 index 00000000..9658c14a --- /dev/null +++ b/thirdparty/asic-rs/patches/0017-luxminer-power-limit-profile-by-name.patch @@ -0,0 +1,103 @@ +Subject: [PATCH 0017] luxminer v1: select power-limit profile by name, not step + +Round 17 C (found via live tuning verification). set_power_limit mapped a watts +target to a LuxOS profile and applied it with `profileset`, but keyed on the +profile's `Step` field. The top/factory profile is named "default" and its Step +is "0"; LuxOS's profileset reads the parameter "0" as empty and answers +"Missing profile parameter" (Code 400). So the setter could never select the +default profile -- and a miner nudged off default by a watts limit could not be +returned to it via the power-limit control, stranding it below its factory point. + +parse_profile_watts now keys on `Profile Name` (e.g. "480MHz", "default"), which +profileset accepts for every profile including the default. Verified live on a +LuxOS S19j Pro (10.4.1.60): set_power_limit(2700) -> 480MHz/2632W, and +set_power_limit(2900) -> default/2794W (previously errored), restoring the miner +to its factory profile. Unit test updated to key on names and to cover the +top-profile-is-"default" case. +diff --git a/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs b/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs +index 2d1331bf..a4db1e03 100644 +--- a/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs ++++ b/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs +@@ -1078,8 +1078,14 @@ impl SetFaultLight for LuxMinerV1 { + } + } + +-/// Parse a LuxOS `profiles` RPC reply into (step name, watts) pairs, keeping only +-/// profiles that report both a `Step` and a `Watts` value. ++/// Parse a LuxOS `profiles` RPC reply into (profile name, watts) pairs, keeping ++/// only profiles that report both a `Profile Name` and a `Watts` value. ++/// ++/// The identifier is the `Profile Name` (e.g. "480MHz", "default"), NOT the ++/// `Step`: `profileset` takes the name, and the default profile's step is "0", ++/// which LuxOS reads as an empty parameter ("Missing profile parameter"), so a ++/// step-keyed setter can never select the default profile and could strand a ++/// miner off its factory point. + fn parse_profile_watts(profiles: &Value) -> Vec<(String, f64)> { + profiles + .get("PROFILES") +@@ -1087,16 +1093,16 @@ fn parse_profile_watts(profiles: &Value) -> Vec<(String, f64)> { + .map(|arr| { + arr.iter() + .filter_map(|p| { +- let step = p.get("Step").and_then(Value::as_str)?.to_string(); ++ let name = p.get("Profile Name").and_then(Value::as_str)?.to_string(); + let watts = p.get("Watts").and_then(Value::as_f64)?; +- Some((step, watts)) ++ Some((name, watts)) + }) + .collect() + }) + .unwrap_or_default() + } + +-/// Choose the LuxOS profile step to satisfy a watts power limit: the highest-watt ++/// Choose the LuxOS profile name to satisfy a watts power limit: the highest-watt + /// profile that does not exceed `target_w`, or -- when the target is below every + /// profile -- the lowest-watt profile. Returns None only when there are no + /// profiles to choose from. +@@ -1315,32 +1321,34 @@ mod tests { + + #[test] + fn power_limit_profile_selection() { +- // LuxOS reports a ladder of profiles, each with a Step name and Watts. ++ // LuxOS reports a ladder of profiles, each with a Profile Name and Watts. ++ // The top profile is named "default" (its Step is "0", which profileset ++ // rejects -- so selection must key on the name, not the step). + let steps = vec![ +- ("-16".to_string(), 865.0), +- ("-4".to_string(), 2385.0), +- ("-2".to_string(), 2790.0), +- ("0".to_string(), 3100.0), ++ ("190MHz".to_string(), 865.0), ++ ("405MHz".to_string(), 2385.0), ++ ("455MHz".to_string(), 2790.0), ++ ("default".to_string(), 3100.0), + ]; + // The highest profile at or below the requested watts limit. + assert_eq!( + select_profile_at_or_below(&steps, 2500.0).as_deref(), +- Some("-4") ++ Some("405MHz") + ); + assert_eq!( + select_profile_at_or_below(&steps, 2790.0).as_deref(), +- Some("-2") ++ Some("455MHz") + ); +- // Above every profile -> the maximum profile (a limit can't exceed the +- // hardware's top profile). ++ // Above every profile -> the maximum profile, selected by NAME ("default") ++ // rather than its step "0" (which profileset would reject). + assert_eq!( + select_profile_at_or_below(&steps, 9000.0).as_deref(), +- Some("0") ++ Some("default") + ); + // Below every profile -> the minimum profile. + assert_eq!( + select_profile_at_or_below(&steps, 100.0).as_deref(), +- Some("-16") ++ Some("190MHz") + ); + // No profiles -> nothing to choose. + assert_eq!(select_profile_at_or_below(&[], 2500.0), None); diff --git a/vendor/asic-rs-firmwares-luxminer/.cargo-checksum.json b/vendor/asic-rs-firmwares-luxminer/.cargo-checksum.json index 2ab73664..daebdb42 100644 --- a/vendor/asic-rs-firmwares-luxminer/.cargo-checksum.json +++ b/vendor/asic-rs-firmwares-luxminer/.cargo-checksum.json @@ -1 +1 @@ -{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"fe8effe2bfdda5d4c390656c016729f531a2b1c60033228557659c0befdde9f2","Cargo.lock":"a2b2cb45bb8b574e4f29ffdcdb5ebafd1dd87a0e6e11b47383973a99be367784","Cargo.toml":"503efa00123f8567f5fe40bf6a93e9e453d13094df0e0e1b7e98bdacdfbd2595","Cargo.toml.orig":"1c4ba0315fb491c086fc22a5c9bafaf7288c6b1fd48679c3d03dbd9df156a8b5","src/backends/mod.rs":"548d988b877410e330a55e275f64b2adad95ca5f1a0f085fe144957c96b8906f","src/backends/v1/mod.rs":"3e57d2c72d1d48c0b86f5438202633fcd9c1ebf375bd87ffe53ea5298ae936ad","src/backends/v1/rpc.rs":"25b0b9d56fbf113d5b8c3d3bc8eb7a0d67967b1f90f6d855da0b9f6ff24ae335","src/firmware.rs":"d95345295ae5043dfc357e69ae56c564b261fdb3b19b5c0ad1765267ff05ab3f","src/lib.rs":"53f7acddeff8f7d82f80d09e0a9f91962011f9ccf2e441c4ca05cd7fc4eb292e","src/test/json/mod.rs":"24191681066d5cf6a3022ad59c1baa92b57e3ce7717bb78d6a682af9e19a38c4","src/test/json/v1/config.json":"6ca9e6217d853d4bf1e75d69159630e9c9184ede96751706b88dfb699b5d59ad","src/test/json/v1/devs.json":"8f746dc6a02953eee5ee96dcf53be8dc7880a8ffc2c6e303f0284bcf6a97f42d","src/test/json/v1/events.json":"913683ff97af3333018807e1cc6e43467ea8a55925e5964dc402616615e2a5e3","src/test/json/v1/fans.json":"f8a9a1234d651055c80f4ebb1380bbb4e6d19eb33012902c55fff1385e592447","src/test/json/v1/healthchipget_0.json":"10619460049333ca016b2beec59ecc514ed9077fb19bdf7d0ed697201f8cb96c","src/test/json/v1/healthchipget_1.json":"80927fb1480c95be7f3a4e155d63f68f97720530ff7cf5d5ade06f2a3e810bf0","src/test/json/v1/healthchipget_2.json":"1e93ee2ab472ee7af58add08b4251e3ce0ad4f986d4325abbf43fd4c9b3dd28f","src/test/json/v1/mod.rs":"5a050f07455e622e35ad79ab1c8a6daf2ea38c4198472e49c6bbfe80538a9e48","src/test/json/v1/pools.json":"0068745327e31853fec051172abb7337f18a4cf9972c51967113d63f4f31f504","src/test/json/v1/power.json":"80534bb4581de7c8b747bf33b5d629b909c6e16a531d18ecb4afd7ffad3f014f","src/test/json/v1/profiles.json":"1f00429036e270daa08f12cd2d7357135070c57acd7a899a3c0af6167fe82abb","src/test/json/v1/stats.json":"2b105f0eb927046c9d2389bde978a43e3d54d12a420dfbe400786bb2f0ae31ca","src/test/json/v1/summary.json":"aaea3378eb7040952037e2f1ef7bd5f20a1b242bf93d4ba0501c46104b0b31a0","src/test/json/v1/temps.json":"1ee781cd2be3ed6a6a07e23be930248735fb51348c160453ba10f6ef71fcb7f1","src/test/json/v1/version.json":"4beb6ca5c0ebf359cee0434fdcc4d0a1a0607436634e46be3fd951e2256595df","src/test/json/v1/voltageget_0.json":"c445fa8674c2542b2d296fbafdd3166c53008dfbd9da8095327217989d37f1da","src/test/json/v1/voltageget_1.json":"96b91c3447dd66e7f1f575ed3b99611062e8b1d516d31422b74e425c46b2f49c","src/test/json/v1/voltageget_2.json":"7d40544021b2e32401135ae333067b770d2d736ada9e60deaca8fd8f5a79a1e3","src/test/mod.rs":"ed52c3d613eabc4a0346bb38bcfdf7a94933d61e368d3c9094821edeab92f81b"},"package":"513792d93a2a21d5258d9e6ac0e6dc9e0a6365118934514b4e656792add78066"} \ No newline at end of file +{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"fe8effe2bfdda5d4c390656c016729f531a2b1c60033228557659c0befdde9f2","Cargo.lock":"a2b2cb45bb8b574e4f29ffdcdb5ebafd1dd87a0e6e11b47383973a99be367784","Cargo.toml":"503efa00123f8567f5fe40bf6a93e9e453d13094df0e0e1b7e98bdacdfbd2595","Cargo.toml.orig":"1c4ba0315fb491c086fc22a5c9bafaf7288c6b1fd48679c3d03dbd9df156a8b5","src/backends/mod.rs":"548d988b877410e330a55e275f64b2adad95ca5f1a0f085fe144957c96b8906f","src/backends/v1/mod.rs":"0c12f7714b8486372054261afd263b61f432a446cef8ae9e6cd72550a0cf4f8f","src/backends/v1/rpc.rs":"25b0b9d56fbf113d5b8c3d3bc8eb7a0d67967b1f90f6d855da0b9f6ff24ae335","src/firmware.rs":"d95345295ae5043dfc357e69ae56c564b261fdb3b19b5c0ad1765267ff05ab3f","src/lib.rs":"53f7acddeff8f7d82f80d09e0a9f91962011f9ccf2e441c4ca05cd7fc4eb292e","src/test/json/mod.rs":"24191681066d5cf6a3022ad59c1baa92b57e3ce7717bb78d6a682af9e19a38c4","src/test/json/v1/config.json":"6ca9e6217d853d4bf1e75d69159630e9c9184ede96751706b88dfb699b5d59ad","src/test/json/v1/devs.json":"8f746dc6a02953eee5ee96dcf53be8dc7880a8ffc2c6e303f0284bcf6a97f42d","src/test/json/v1/events.json":"913683ff97af3333018807e1cc6e43467ea8a55925e5964dc402616615e2a5e3","src/test/json/v1/fans.json":"f8a9a1234d651055c80f4ebb1380bbb4e6d19eb33012902c55fff1385e592447","src/test/json/v1/healthchipget_0.json":"10619460049333ca016b2beec59ecc514ed9077fb19bdf7d0ed697201f8cb96c","src/test/json/v1/healthchipget_1.json":"80927fb1480c95be7f3a4e155d63f68f97720530ff7cf5d5ade06f2a3e810bf0","src/test/json/v1/healthchipget_2.json":"1e93ee2ab472ee7af58add08b4251e3ce0ad4f986d4325abbf43fd4c9b3dd28f","src/test/json/v1/mod.rs":"5a050f07455e622e35ad79ab1c8a6daf2ea38c4198472e49c6bbfe80538a9e48","src/test/json/v1/pools.json":"0068745327e31853fec051172abb7337f18a4cf9972c51967113d63f4f31f504","src/test/json/v1/power.json":"80534bb4581de7c8b747bf33b5d629b909c6e16a531d18ecb4afd7ffad3f014f","src/test/json/v1/profiles.json":"1f00429036e270daa08f12cd2d7357135070c57acd7a899a3c0af6167fe82abb","src/test/json/v1/stats.json":"2b105f0eb927046c9d2389bde978a43e3d54d12a420dfbe400786bb2f0ae31ca","src/test/json/v1/summary.json":"aaea3378eb7040952037e2f1ef7bd5f20a1b242bf93d4ba0501c46104b0b31a0","src/test/json/v1/temps.json":"1ee781cd2be3ed6a6a07e23be930248735fb51348c160453ba10f6ef71fcb7f1","src/test/json/v1/version.json":"4beb6ca5c0ebf359cee0434fdcc4d0a1a0607436634e46be3fd951e2256595df","src/test/json/v1/voltageget_0.json":"c445fa8674c2542b2d296fbafdd3166c53008dfbd9da8095327217989d37f1da","src/test/json/v1/voltageget_1.json":"96b91c3447dd66e7f1f575ed3b99611062e8b1d516d31422b74e425c46b2f49c","src/test/json/v1/voltageget_2.json":"7d40544021b2e32401135ae333067b770d2d736ada9e60deaca8fd8f5a79a1e3","src/test/mod.rs":"ed52c3d613eabc4a0346bb38bcfdf7a94933d61e368d3c9094821edeab92f81b"},"package":"513792d93a2a21d5258d9e6ac0e6dc9e0a6365118934514b4e656792add78066"} \ No newline at end of file diff --git a/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs b/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs index 2d1331bf..a4db1e03 100644 --- a/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs +++ b/vendor/asic-rs-firmwares-luxminer/src/backends/v1/mod.rs @@ -1078,8 +1078,14 @@ impl SetFaultLight for LuxMinerV1 { } } -/// Parse a LuxOS `profiles` RPC reply into (step name, watts) pairs, keeping only -/// profiles that report both a `Step` and a `Watts` value. +/// Parse a LuxOS `profiles` RPC reply into (profile name, watts) pairs, keeping +/// only profiles that report both a `Profile Name` and a `Watts` value. +/// +/// The identifier is the `Profile Name` (e.g. "480MHz", "default"), NOT the +/// `Step`: `profileset` takes the name, and the default profile's step is "0", +/// which LuxOS reads as an empty parameter ("Missing profile parameter"), so a +/// step-keyed setter can never select the default profile and could strand a +/// miner off its factory point. fn parse_profile_watts(profiles: &Value) -> Vec<(String, f64)> { profiles .get("PROFILES") @@ -1087,16 +1093,16 @@ fn parse_profile_watts(profiles: &Value) -> Vec<(String, f64)> { .map(|arr| { arr.iter() .filter_map(|p| { - let step = p.get("Step").and_then(Value::as_str)?.to_string(); + let name = p.get("Profile Name").and_then(Value::as_str)?.to_string(); let watts = p.get("Watts").and_then(Value::as_f64)?; - Some((step, watts)) + Some((name, watts)) }) .collect() }) .unwrap_or_default() } -/// Choose the LuxOS profile step to satisfy a watts power limit: the highest-watt +/// Choose the LuxOS profile name to satisfy a watts power limit: the highest-watt /// profile that does not exceed `target_w`, or -- when the target is below every /// profile -- the lowest-watt profile. Returns None only when there are no /// profiles to choose from. @@ -1315,32 +1321,34 @@ mod tests { #[test] fn power_limit_profile_selection() { - // LuxOS reports a ladder of profiles, each with a Step name and Watts. + // LuxOS reports a ladder of profiles, each with a Profile Name and Watts. + // The top profile is named "default" (its Step is "0", which profileset + // rejects -- so selection must key on the name, not the step). let steps = vec![ - ("-16".to_string(), 865.0), - ("-4".to_string(), 2385.0), - ("-2".to_string(), 2790.0), - ("0".to_string(), 3100.0), + ("190MHz".to_string(), 865.0), + ("405MHz".to_string(), 2385.0), + ("455MHz".to_string(), 2790.0), + ("default".to_string(), 3100.0), ]; // The highest profile at or below the requested watts limit. assert_eq!( select_profile_at_or_below(&steps, 2500.0).as_deref(), - Some("-4") + Some("405MHz") ); assert_eq!( select_profile_at_or_below(&steps, 2790.0).as_deref(), - Some("-2") + Some("455MHz") ); - // Above every profile -> the maximum profile (a limit can't exceed the - // hardware's top profile). + // Above every profile -> the maximum profile, selected by NAME ("default") + // rather than its step "0" (which profileset would reject). assert_eq!( select_profile_at_or_below(&steps, 9000.0).as_deref(), - Some("0") + Some("default") ); // Below every profile -> the minimum profile. assert_eq!( select_profile_at_or_below(&steps, 100.0).as_deref(), - Some("-16") + Some("190MHz") ); // No profiles -> nothing to choose. assert_eq!(select_profile_at_or_below(&[], 2500.0), None);