From 1cbbc66fa4a14786bb9fafa7f47e73ff3c3884e2 Mon Sep 17 00:00:00 2001 From: vasilito Date: Wed, 5 Aug 2026 02:33:36 +0300 Subject: [PATCH] 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. --- .../source/src/quirks/toml_loader.rs | 43 +++++++++++++++++++ .../source/quirks.d/50-system.toml | 8 ++++ 2 files changed, 51 insertions(+) diff --git a/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs b/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs index 614a93b75c..08d0ad65ad 100644 --- a/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs +++ b/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs @@ -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::().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::().unwrap(); diff --git a/local/recipes/system/redbear-quirks/source/quirks.d/50-system.toml b/local/recipes/system/redbear-quirks/source/quirks.d/50-system.toml index 6c75083635..b5c4113b5d 100644 --- a/local/recipes/system/redbear-quirks/source/quirks.d/50-system.toml +++ b/local/recipes/system/redbear-quirks/source/quirks.d/50-system.toml @@ -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