🐛 Decode the whole SMBIOS memory-type table, not three values of it - #31
Merged
Conversation
The Summary reported the literal string "DRAM SDRAM" for most current laptops. Two bugs compounding. `Win32_PhysicalMemory.SMBIOSMemoryType` was decoded for DDR3, DDR4 and DDR5 only, with everything else flattened to "DRAM" — and every soldered-memory machine reports an LPDDR code, so that fallback covered most portable hardware sold today. The Summary then appended " SDRAM" to whatever it was given, turning the fallback into nonsense. `smbios_memory_type` now decodes the full DMTF table, codes 0x01 through 0x24, cross-checked against dmidecode's `dmi_memory_device_type`. That adds LPDDR through LPDDR5, HBM/HBM2/HBM3, and the older SDRAM/RDRAM/DDR/DDR2 codes. A code the table does not know reports as `Unknown (type 0x25)` rather than being flattened into a wrong name. DMTF assigns new codes as memory generations ship, and the raw number is what lets someone look one up. The suffix is now applied by `memory_type_label`, which adds " SDRAM" only to the DDR and LPDDR families — "HBM3" and "Unknown" are left alone. Six tests cover the mapping; they take the raw code rather than reading WMI, so they run on every CI leg. Verified on a DDR5 desktop, which still reports DDR5 through `sensorview info`. `memory_type_label` is marked `#[allow(dead_code)]` because only the GUI renders it — without that the headless legs fail CI's `-D warnings`. Not fixed here, but adjacent and worth a separate look: the same Memory panel infers channel count from the module count, so four DIMMs on a dual-channel board report "Quad-Channel". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The table skipped 0x08-0x0C (ROM, Flash, EEPROM, FEPROM, EPROM), so the claim that it decodes the DMTF range was not quite true — those fell to the unknown path. Added, and the doc comment now says explicitly that 0x15-0x17 are Reserved rather than memory types and are meant to fall through. A new test walks every code from 0x01 to 0x24 and asserts that only the Reserved three reach the unknown path, so the claim is checked rather than asserted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 26, 2026
Member
Author
|
The Windows and macOS checks here are red for a reason that has nothing to do with this PR: both fail at the Clippy step on Confirmed by reading the failing logs: the lint fires in Merge #32 first and these go green on a rebase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
The System Summary reported the literal string "DRAM SDRAM" as the memory type on most current laptops.
Two bugs compounding.
Win32_PhysicalMemory.SMBIOSMemoryTypewas decoded for exactly three values:Every soldered-memory machine reports an LPDDR code (
0x1B–0x1E,0x23), so that fallback covered most portable hardware sold today.summary_window.rsthen appended" SDRAM"to whatever it was handed, turning the fallback into nonsense.The fix
smbios_memory_typedecodes the full DMTF table, codes0x01–0x24, cross-checked against dmidecode'sdmi_memory_device_type. That adds:0x15–0x17are Reserved rather than memory types, so they deliberately fall through along with everything unassigned. A test walks every code from0x01to0x24and asserts that only those three reach the unknown path, so the coverage claim is checked rather than asserted.An unassigned code reports as
Unknown (type 0x25)rather than being flattened into a wrong name. DMTF assigns new codes as memory generations ship, and the raw number is what lets someone look one up.The
" SDRAM"suffix now goes throughmemory_type_label, which applies it only to the DDR and LPDDR families —HBM3andUnknownare left alone.Verification
cargo clippy --all-targets -- -D warningsclean across"",web,gui,tui,gui,web.One note for reviewers:
memory_type_labelneeds#[allow(dead_code)]because only the GUI renders it. Without that the headless legs fail on-D warnings— caught locally by running the same feature matrix CI does, not by the default build.Adjacent, deliberately not fixed here
The same Memory panel infers channel count from the module count (
summary_window.rs), so four DIMMs on a mainstream dual-channel board report "Quad-Channel", and 3/6/8/12-module HEDT and server configurations report nothing at all. Different bug, different fix — worth its own PR.🤖 Generated with Claude Code