fix the dmi_chassis_type function and its caller.

This commit is contained in:
Anton Arapov 2011-11-14 15:03:35 +01:00
parent 823d9ada40
commit 2775494cb0
2 changed files with 52 additions and 3 deletions

View File

@ -0,0 +1,42 @@
diff -up dmidecode-2.11/AUTHORS.chassis_fix dmidecode-2.11/AUTHORS
--- dmidecode-2.11/AUTHORS.chassis_fix 2010-11-24 10:29:09.000000000 +0100
+++ dmidecode-2.11/AUTHORS 2011-11-14 14:56:08.000000000 +0100
@@ -81,3 +81,5 @@ Murlin Wenzel
Harald Mueller-Ney
Lars Mueller
Thomas Mingarelli
+Andrey Matveyev
+Stefan Tauner
diff -up dmidecode-2.11/CHANGELOG.chassis_fix dmidecode-2.11/CHANGELOG
--- dmidecode-2.11/CHANGELOG.chassis_fix 2011-11-14 14:56:39.804855909 +0100
+++ dmidecode-2.11/CHANGELOG 2011-11-14 14:56:15.000000000 +0100
@@ -1,3 +1,8 @@
+2011-11-14 Anton Arapov <anton@redhat.com>
+
+ * dmidecode.c: Make dmi_chassis_type aware of the lock bit.
+ Patch from Stefan Tauner.
+
2011-04-20 Jean Delvare <khali@linux-fr.org>
Update to support SMBIOS specification version 2.7.1.
diff -up dmidecode-2.11/dmidecode.c.chassis_fix dmidecode-2.11/dmidecode.c
--- dmidecode-2.11/dmidecode.c.chassis_fix 2011-11-14 14:56:39.805855910 +0100
+++ dmidecode-2.11/dmidecode.c 2011-11-14 14:55:12.000000000 +0100
@@ -532,6 +532,8 @@ static const char *dmi_chassis_type(u8 c
"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_
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",

View File

@ -1,7 +1,7 @@
Summary: Tool to analyse BIOS DMI data
Name: dmidecode
Version: 2.11
Release: 4%{?dist}
Release: 5%{?dist}
Epoch: 1
Group: System Environment/Base
License: GPLv2+
@ -9,6 +9,7 @@ Source0: %{name}-%{version}.tar.bz2
URL: http://www.nongnu.org/dmidecode/
Patch0: dmidecode-2.11-type16-fix.patch
Patch1: dmidecode-2.11-smbios-271.patch
Patch2: dmidecode-2.11-chassis_fix.patch
Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: automake autoconf
ExclusiveArch: %{ix86} x86_64 ia64
@ -28,6 +29,7 @@ I/O ports (e.g. serial, parallel, USB).
%setup -q
%patch0 -p1 -b .type16_fix
%patch1 -p1 -b .smbios271
%patch2 -p1 -b .chassis_fix
%build
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
@ -51,9 +53,14 @@ rm -rf ${buildroot}
%{_mandir}/man8/*
%changelog
* Mon Nov 14 2011 Anton Arapov <anton@redhat.com> - 1:2.11-5
- Fix the wrong call of the dmi_chassis_type function call. Thus fix
an issue on the systems with the chassis lock available, application
doesn't fall out with the out of spec error anymore.
* Tue May 03 2011 Anton Arapov <anton@redhat.com> - 1:2.11-4
- update to SMBIOS 2.7.1
- fix the boundaries check in type16
- Update to SMBIOS 2.7.1
- Fix the boundaries check in type16
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:2.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild