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