quirks: add MSI MPG X670E CARBON WIFI (MS-7D70) DMI anchor + loader test

Pre-existing uncommitted first-party work, surfaced by the first-party
integrity gate. Committing rather than reverting: this code exists nowhere but
this project, so a revert would destroy it outright, and it is coherent and
self-consistent -- a DMI entry for the board plus a test in toml_loader.rs that
parses the REAL 50-system.toml and asserts the entry matches while LG entries
do not.

The quirk carries no flags by design; its comment states it is a bare-metal
anchor so future board-specific quirks can be added precisely. Related to the
Ryzen 7000 / X670E work in .omo/plans/ryzen-7000-x670e-compat.md.

Not authored in this session -- committed here because it blocked every build
and the gate's guidance is to commit or revert, and reverting irreplaceable
work is the wrong call.
This commit is contained in:
2026-08-05 02:33:36 +03:00
parent 15d67086c8
commit 1cbbc66fa4
2 changed files with 51 additions and 0 deletions
@@ -925,6 +925,49 @@ mod tests {
assert_eq!(system_rules[0].flags, SystemQuirkFlags::KBD_DEACTIVATE_FIXUP);
}
#[test]
fn dmi_toml_ms_7d70_from_real_quirks_file_matches_and_lg_does_not() {
// Load the real 50-system.toml from the redbear-quirks recipe.
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../../../recipes/system/redbear-quirks/source/quirks.d/50-system.toml")
.canonicalize()
.expect("canonicalize 50-system.toml path");
let content = std::fs::read_to_string(&path).expect("read 50-system.toml");
let doc = content.parse::<toml::Value>().expect("parse 50-system.toml");
let (rules, _system_rules) = parse_both(&doc);
let ms_7d70 = rules
.iter()
.find(|r| {
r.dmi_match.sys_vendor.as_deref() == Some("Micro-Star International Co., Ltd.")
&& r.dmi_match.board_name.as_deref() == Some("MS-7D70")
})
.expect("MS-7D70 dmi_system_quirk entry present in 50-system.toml");
assert!(ms_7d70.flags.is_empty());
assert_eq!(ms_7d70.vendor, PCI_QUIRK_ANY_ID);
assert_eq!(ms_7d70.device, PCI_QUIRK_ANY_ID);
let matching_info = DmiInfo {
sys_vendor: Some("Micro-Star International Co., Ltd.".to_string()),
board_name: Some("MS-7D70".to_string()),
..DmiInfo::default()
};
assert!(
ms_7d70.dmi_match.matches(&matching_info),
"MS-7D70 entry matches the real board's DMI fields"
);
let lg_info = DmiInfo {
sys_vendor: Some("LG Electronics".to_string()),
board_name: Some("16Z90TP".to_string()),
..DmiInfo::default()
};
assert!(
!ms_7d70.dmi_match.matches(&lg_info),
"MS-7D70 entry does not match the LG 16Z90TP blob"
);
}
#[test]
fn parse_phase_defaults_to_enable_when_absent() {
let table = "phase_absent = true".parse::<toml::Value>().unwrap();
@@ -106,6 +106,14 @@ flags = ["acpi_irq1_skip_override", "kbd_deactivate_fixup"]
match.sys_vendor = "LG Electronics"
match.product_name = "17U70P"
# MSI MPG X670E CARBON WIFI (MS-7D70). Ryzen 7000 + X670E
# bare-metal anchor. No evidence-justified flags yet; this entry
# exists so future board-specific quirks can be added precisely.
[[dmi_system_quirk]]
flags = []
match.sys_vendor = "Micro-Star International Co., Ltd."
match.board_name = "MS-7D70"
# All LG Electronics: keyboard deactivate fixup (Linux atkbd.c
# matches on sys_vendor only, no product_name filter). This is
# the catch-all for older LG laptops that don't have specific