diff options
author | aarapov <aarapov> | 2011-11-14 13:28:26 +0000 |
---|---|---|
committer | aarapov <aarapov> | 2011-11-14 13:28:26 +0000 |
commit | 4c17fb19a4d8f239d0c4a7175529b79d028fad80 (patch) | |
tree | 6143516c03dd1322ba3dd156cd5c1e23aa785224 | |
parent | 208dc2cb51ffbe6ca049e37c0e201c101bd7959c (diff) | |
download | dmidecode-4c17fb19a4d8f239d0c4a7175529b79d028fad80.tar.gz |
Make dmi_chassis_type aware of the lock bit (Closes: #33978).
.
Previously all bits of the parameter passed to dmi_chassis_type were
used to derive the chassis type although the 7th bit indicates a
lock and only bits 6:0 encode the chassis type (7.4 System Enclosure
or Chassis (Type 3), offset 05h). This is ok as long as the input is
masked as it was done in dmi_decode, but it was forgotten in
dmi_table_string, resulting in wrong output if there is a lock
present:
.
dmidecode -s chassis-type
<OUT OF SPEC>
.
although the normal output is correct:
.
[...]
Handle 0x0003, DMI type 3, 17 bytes
Chassis Information
Manufacturer: Chassis Manufacture
Type: Desktop
Lock: Present
[...]
.
dump (the 5th byte (83) is the interesting one):
.
dmidecode -t chassis -u
SMBIOS 2.3 present.
.
Handle 0x0003, DMI type 3, 17 bytes
Header and Data:
03 11 03 00 01 83 02 03 04 03 03 03 03 01 00 00
00
.
Tested with current CVS code on a "Laptop" without a lock (by me)
and on the "Desktop" board dumped above (by Florian Zumbiehl, thanks!).
Patch from Stefan Tauner
-rw-r--r-- | dmidecode.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/dmidecode.c b/dmidecode.c index f7b23c1..a702e5b 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -532,6 +532,8 @@ static const char *dmi_chassis_type(u8 code) "Blade Enclosing" /* 0x1D */ }; + code &= 0x7F; /* bits 6:0 are chassis type, 7th bit is the lock bit */ + if (code >= 0x01 && code <= 0x1D) return type[code - 0x01]; return out_of_spec; @@ -3237,7 +3239,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver) printf("\tManufacturer: %s\n", dmi_string(h, data[0x04])); printf("\tType: %s\n", - dmi_chassis_type(data[0x05] & 0x7F)); + dmi_chassis_type(data[0x05])); printf("\tLock: %s\n", dmi_chassis_lock(data[0x05] >> 7)); printf("\tVersion: %s\n", |