27 releases (1 stable)
| 1.0.0 | Jun 30, 2025 |
|---|---|
| 0.9.0 | Apr 18, 2025 |
| 0.8.5 | Oct 25, 2024 |
| 0.8.4 | Jun 5, 2024 |
| 0.2.0 | Jul 10, 2018 |
#90 in Hardware support
1,083 downloads per month
Used in 3 crates
450KB
10K
SLoC
dmidecode
A Rust library for parsing raw SMBIOS/DMI tables. This crate lets you read and decode system firmware information provided via /sys/firmware/dmi/tables/ on Linux, or directly from memory dumps.
# Cargo.toml
[dependencies]
dmidecode = "0.9"
Example
use dmidecode::Structure;
fn main() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Collecting DMI Information...");
// Get the SMBIOS header and DMI table from sysfs.
let buf = std::fs::read("/sys/firmware/dmi/tables/smbios_entry_point")?;
let dmi = std::fs::read("/sys/firmware/dmi/tables/DMI")?;
let entry = dmidecode::EntryPoint::search(&buf)?;
for table in entry.structures(&dmi) {
let Ok(table) = table else {
eprintln!("DMI tables contain malformed structure: {table:?}");
continue;
};
match table {
Structure::System(system) => {
// do stuff
}
Structure::BaseBoard(base_board) => {
// do stuff
}
// ...
_ => continue,
}
}
Ok(())
}
No-std support
In no_std mode, almost all of the same API is available and works the same
way. To depend on dmidecode in no_std mode, disable our default enabled
std feature in Cargo.toml.
The std feature just implements the Error trait on error types used by
dmidecode.
[dependencies]
dmidecode = { version = "0.9", default-features = false }
Rust Version Support The minimum supported Rust version is documented in
the Cargo.toml file. This may be bumped in minor releases as necessary.
License
dmidecode is released under the terms of the MIT license.
Dependencies
~340KB