From d7200d96d5b90bcd0013c84ec1b053acbcca86c9 Mon Sep 17 00:00:00 2001 From: nima Date: Tue, 31 Mar 2009 11:42:38 +0000 Subject: Reverting recent (pointless) change. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@180 abc39116-655e-4be6-ad55-d661dc543056 --- Makefile | 97 + README | 1 + debian/changelog | 60 + debian/compat | 1 + debian/control | 35 + debian/copyright | 56 + debian/python-dmidecode-dbg.docs | 2 + debian/python-dmidecode.docs | 2 + debian/rules | 70 + debian/upstream.changelog | 952 +++++++ debian/watch | 2 + doc/AUTHORS | 15 + doc/AUTHORS.upstream | 70 + doc/LICENSE | 621 +++++ doc/README.types | 55 + doc/README.upstream | 116 + doc/changelog | 1009 +++++++ doc/dmidump.py | 54 + examples/dmidump.py | 18 + examples/test.py | 112 + man/biosdecode.8 | 83 + man/dmidecode.8 | 236 ++ man/ownership.8 | 37 + man/vpddecode.8 | 74 + python-dmidecode.spec | 44 + src/config.h | 25 + src/dmidecode.c | 4785 ++++++++++++++++++++++++++++++++ src/dmidecode.h | 45 + src/dmidecodemodule.c | 305 ++ src/dmidecodemodule.h | 63 + src/dmihelper.c | 115 + src/dmihelper.h | 114 + src/dmioem.c | 128 + src/dmioem.h | 25 + src/setup-dbg.py | 25 + src/setup.py | 25 + src/types.h | 62 + src/util.c | 205 ++ src/util.h | 29 + src/version.h | 1 + trunk/Makefile | 97 - trunk/README | 1 - trunk/debian/changelog | 60 - trunk/debian/compat | 1 - trunk/debian/control | 35 - trunk/debian/copyright | 56 - trunk/debian/python-dmidecode-dbg.docs | 2 - trunk/debian/python-dmidecode.docs | 2 - trunk/debian/rules | 70 - trunk/debian/upstream.changelog | 952 ------- trunk/debian/watch | 2 - trunk/doc/AUTHORS | 15 - trunk/doc/AUTHORS.upstream | 70 - trunk/doc/LICENSE | 621 ----- trunk/doc/README.types | 55 - trunk/doc/README.upstream | 116 - trunk/doc/changelog | 1009 ------- trunk/doc/dmidump.py | 54 - trunk/examples/dmidump.py | 18 - trunk/examples/test.py | 112 - trunk/man/biosdecode.8 | 83 - trunk/man/dmidecode.8 | 236 -- trunk/man/ownership.8 | 37 - trunk/man/vpddecode.8 | 74 - trunk/python-dmidecode.spec | 44 - trunk/src/config.h | 25 - trunk/src/dmidecode.c | 4785 -------------------------------- trunk/src/dmidecode.h | 45 - trunk/src/dmidecodemodule.c | 305 -- trunk/src/dmidecodemodule.h | 63 - trunk/src/dmihelper.c | 115 - trunk/src/dmihelper.h | 114 - trunk/src/dmioem.c | 128 - trunk/src/dmioem.h | 25 - trunk/src/setup-dbg.py | 25 - trunk/src/setup.py | 25 - trunk/src/types.h | 62 - trunk/src/util.c | 205 -- trunk/src/util.h | 29 - trunk/src/version.h | 1 - 80 files changed, 9774 insertions(+), 9774 deletions(-) create mode 100644 Makefile create mode 100644 README create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/python-dmidecode-dbg.docs create mode 100644 debian/python-dmidecode.docs create mode 100755 debian/rules create mode 100644 debian/upstream.changelog create mode 100644 debian/watch create mode 100644 doc/AUTHORS create mode 100644 doc/AUTHORS.upstream create mode 100644 doc/LICENSE create mode 100644 doc/README.types create mode 100644 doc/README.upstream create mode 100644 doc/changelog create mode 100755 doc/dmidump.py create mode 100755 examples/dmidump.py create mode 100755 examples/test.py create mode 100644 man/biosdecode.8 create mode 100644 man/dmidecode.8 create mode 100644 man/ownership.8 create mode 100644 man/vpddecode.8 create mode 100644 python-dmidecode.spec create mode 100644 src/config.h create mode 100644 src/dmidecode.c create mode 100644 src/dmidecode.h create mode 100644 src/dmidecodemodule.c create mode 100644 src/dmidecodemodule.h create mode 100644 src/dmihelper.c create mode 100644 src/dmihelper.h create mode 100644 src/dmioem.c create mode 100644 src/dmioem.h create mode 100644 src/setup-dbg.py create mode 100644 src/setup.py create mode 100644 src/types.h create mode 100644 src/util.c create mode 100644 src/util.h create mode 100644 src/version.h delete mode 100644 trunk/Makefile delete mode 100644 trunk/README delete mode 100644 trunk/debian/changelog delete mode 100644 trunk/debian/compat delete mode 100644 trunk/debian/control delete mode 100644 trunk/debian/copyright delete mode 100644 trunk/debian/python-dmidecode-dbg.docs delete mode 100644 trunk/debian/python-dmidecode.docs delete mode 100755 trunk/debian/rules delete mode 100644 trunk/debian/upstream.changelog delete mode 100644 trunk/debian/watch delete mode 100644 trunk/doc/AUTHORS delete mode 100644 trunk/doc/AUTHORS.upstream delete mode 100644 trunk/doc/LICENSE delete mode 100644 trunk/doc/README.types delete mode 100644 trunk/doc/README.upstream delete mode 100644 trunk/doc/changelog delete mode 100755 trunk/doc/dmidump.py delete mode 100755 trunk/examples/dmidump.py delete mode 100755 trunk/examples/test.py delete mode 100644 trunk/man/biosdecode.8 delete mode 100644 trunk/man/dmidecode.8 delete mode 100644 trunk/man/ownership.8 delete mode 100644 trunk/man/vpddecode.8 delete mode 100644 trunk/python-dmidecode.spec delete mode 100644 trunk/src/config.h delete mode 100644 trunk/src/dmidecode.c delete mode 100644 trunk/src/dmidecode.h delete mode 100644 trunk/src/dmidecodemodule.c delete mode 100644 trunk/src/dmidecodemodule.h delete mode 100644 trunk/src/dmihelper.c delete mode 100644 trunk/src/dmihelper.h delete mode 100644 trunk/src/dmioem.c delete mode 100644 trunk/src/dmioem.h delete mode 100644 trunk/src/setup-dbg.py delete mode 100644 trunk/src/setup.py delete mode 100644 trunk/src/types.h delete mode 100644 trunk/src/util.c delete mode 100644 trunk/src/util.h delete mode 100644 trunk/src/version.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8e69bb5 --- /dev/null +++ b/Makefile @@ -0,0 +1,97 @@ +#. +#. DMI Decode Python Extension Module +#. +#. (C) 2008 Nima Talebi +#. +#. Licensed under the GNU Public License v3 +#. + +VERSION := 2.10 +PY := $(shell python -V 2>&1 |sed -e 's/.\(ython\) \(2\.[0-9]\)\..*/p\1\2/') +PY_VER := $(subst python,,$(PY)) +PACKAGE := python-dmidecode +SRCSRV := /var/www/nima/sites/src.autonomy.net.au/pub + +CC := gcc +RM := rm -f +SRC_D := src +OBJ_D := lib +CFLAGS = -g -D_XOPEN_SOURCE=600 +CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align +CFLAGS += -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual +CFLAGS += -pthread -fno-strict-aliasing -DNDEBUG -fPIC +CFLAGS += -I/usr/include/$(PY) +CFLAGS += -O3 +#CFLAGS += -DNDEBUG +#CFLAGS += -DBIGENDIAN +#CFLAGS += -DALIGNMENT_WORKAROUND +#LDFLAGS = -lefence +LDFLAGS = +SOFLAGS = -pthread -shared -L/home/nima/dev-room/projects/dmidecode -lutil +SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecode.so + +#. Search +vpath %.o $(OBJ_D) +vpath %.c $(SRC_D) +vpath %.h $(SRC_D) +vpath % $(OBJ_D) + + +############################################################################### +build: $(PY)-dmidecode.so +$(PY)-dmidecode.so: $(SO) + cp $< $@ + +build: $(SO) +$(SO): + $(PY) src/setup.py build + +install: + $(PY) src/setup.py install + +uninstall: + $(PY) src/setup.py uninstall + +clean : + dh_clean + $(PY) src/setup.py clean + -$(RM) *.so lib/*.o core + -rm -rf build .dpkg + +tarball: + rm -rf $(PACKAGE)-$(VERSION) + mkdir $(PACKAGE)-$(VERSION) + cp -r contrib doc examples lib Makefile man README src $(PACKAGE)-$(VERSION) + tar -czvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) + +rpm: tarball + rm -rf rpm + mkdir -p rpm/{BUILD,RPMS,SRPMS,SPECS,SOURCES} + cp contrib/$(PACKAGE).spec rpm/SPECS + cp $(PACKAGE)-$(VERSION).tar.gz rpm/SOURCES + rpmbuild -ba --define "_topdir $(shell pwd)/rpm" rpm/SPECS/$(PACKAGE).spec + +############################################################################### +libdmidecode.so: dmihelper.o util.o dmioem.o dmidecode.o dmidecodemodule.o + $(CC) $(LDFLAGS) $(SOFLAGS) $^ -o $@ + +$(OBJ_D)/dmidecodemodule.o: dmidecodemodule.c + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/dmidecode.o: dmidecode.c version.h types.h util.h config.h dmidecode.h dmioem.h + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/dmihelper.o: dmihelper.c dmihelper.h + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/util.o: util.c types.h util.h config.h + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/dmioem.o: dmioem.c types.h dmidecode.h dmioem.h + $(CC) $(CFLAGS) -c -o $@ $< + + + +############################################################################### +.PHONY: install clean uninstall build dupload +.PHONY: srcsrv binary source orig.tar.gz all diff --git a/README b/README new file mode 100644 index 0000000..089a6f3 --- /dev/null +++ b/README @@ -0,0 +1 @@ +Please visit http://projects.autonomy.net.au/dmidecode/ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..940a149 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,60 @@ +python-dmidecode (2.10.5-1) unstable; urgency=low + + * Upstream (cleanup) release. + + -- Nima Talebi Mon, 09 Mar 2009 10:29:52 +1100 + +python-dmidecode (2.10.4-1) unstable; urgency=low + + * Upstream release - purely to do with rpm packaging. + * Added upstream changelog. + + -- Nima Talebi Mon, 09 Mar 2009 00:45:19 +1100 + +python-dmidecode (2.10.3-1) unstable; urgency=low + + * Upstream release - separate setup.py for debug and non-debug versions of + python-dmidecode (Closes: #516358). + + -- Nima Talebi Mon, 23 Feb 2009 00:34:11 +1100 + +python-dmidecode (2.10.2-1) unstable; urgency=low + + * Upstream release. + * Added upstream changelog. + * Added hopepage to the control file. + * Change (C) to © in the copyright. + * Changed generic (GPL) license to specific (GPL-3). + + -- Nima Talebi Fri, 13 Feb 2009 06:36:30 -0800 + +python-dmidecode (2.10.1-3) unstable; urgency=low + + * Updated copyright file. + + -- Nima Talebi Wed, 14 Jan 2009 13:24:58 -0800 + +python-dmidecode (2.10.1-2) unstable; urgency=low + + * Fixed watchfile. + + -- Nima Talebi Mon, 12 Jan 2009 23:43:17 -0800 + +python-dmidecode (2.10.1-1) unstable; urgency=low + + * The separation between the upstream and the debian files is now complete. + + -- Nima Talebi Mon, 12 Jan 2009 00:19:29 -0800 + +python-dmidecode (2.10-2) unstable; urgency=low + + * Conform the the latest Lintian rules. + + -- Nima Talebi Sun, 11 Jan 2009 15:04:58 -0800 + +python-dmidecode (2.10-1) unstable; urgency=low + + * Initial release (Closes: #509169) + + -- Nima Talebi Fri, 19 Dec 2008 14:04:16 +0900 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..17740f3 --- /dev/null +++ b/debian/control @@ -0,0 +1,35 @@ +Source: python-dmidecode +XS-Python-Version: >= 2.3 +Section: python +Priority: optional +Homepage: http://projects.autonomy.net.au/dmidecode +Maintainer: Nima Talebi +Build-Depends: debhelper (>= 7), python-all-dev (>= 2.3.5-11), python-central (>= 0.6), python-all-dbg +Standards-Version: 3.8.0 + +Package: python-dmidecode +XB-Python-Version: ${python:Versions} +Architecture: any +Provides: ${python:Provides} +Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends} +Description: Python extension module for dmidecode + DMI (the desktop management interface) provides a standardized description of + a computer's hardware, including characteristics such as BIOS serial number + and hardware connectors. + . + This package provides an interface to the DMI data available from the BIOS. + It is intended to be used as a back-end tool by other hardware detection + programs implemented in Python. + +Package: python-dmidecode-dbg +Architecture: any +Priority: extra +Depends: python-dmidecode (= ${binary:Version}), python-dbg, ${shlibs:Depends}, ${misc:Depends} +Provides: ${python:Provides} +XB-Python-Version: ${python:Versions} +Description: Python extension module for dmidecode (debug) + DMI (the desktop management interface) provides a standardized description of + a computer's hardware, including characteristics such as BIOS serial number + and hardware connectors. + . + This package contains the extension built for the Python debug interpreter. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..2515d56 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,56 @@ +DMIDecode Python Extension Module shadows the DMIDecode utility +=============================================================== + + +DMIDecode Python Extension Module +================================= + +This package was authored and debianized by Nima Talebi on +Wed, 17 Dec 2008 19:52:44 +0900. + +It was downloaded from http://projects.autonomy.net.au/dmidecode/ + +Upstream Author: Nima Talebi + +The Debian packaging is © 2008, Nima Talebi and is licensed +under the GPL, see `/usr/share/common-licenses/GPL-3'. + +License: + GPLv3 - The python-dmidecode packages is available under the terms of + the GNU General Public license version 3. On Debian systems, the complete + text of the GNU General Public License can be found in + `/usr/share/common-licenses/GPL-3'. + + +DMIDecode +========= + +Original Author: Alan Cox + +Developer & Maintainer: Jean Delvare + +License: GNU GPLv2 + + +Copyrights +========== + © 2000-2002 Alan Cox + © 2000-2008 Jean Delvare + © 2007-2009Nima Talebi + +License: + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +// vim: ft=asciidoc diff --git a/debian/python-dmidecode-dbg.docs b/debian/python-dmidecode-dbg.docs new file mode 100644 index 0000000..5ac33e9 --- /dev/null +++ b/debian/python-dmidecode-dbg.docs @@ -0,0 +1,2 @@ +README +doc/changelog diff --git a/debian/python-dmidecode.docs b/debian/python-dmidecode.docs new file mode 100644 index 0000000..5ac33e9 --- /dev/null +++ b/debian/python-dmidecode.docs @@ -0,0 +1,2 @@ +README +doc/changelog diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..5e4d832 --- /dev/null +++ b/debian/rules @@ -0,0 +1,70 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=0 +PACKAGE = $(shell dh_listpackages) +PYVERS = $(shell pyversions -vr) + +################################################################################ +#. Build +build: build-stamp +build-stamp: $(PYVERS:%=build-ext-%) $(PYVERS:%=build-dbg-ext-%) + dh_testdir + touch $@ +build-ext-%: + python$* src/setup.py build + touch $@ +build-dbg-ext-%: + python$*-dbg src/setup-dbg.py build + touch $@ + +################################################################################ +#. Install +install: install-stamp + dh_testdir + dh_testroot + dh_installdirs + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install + dh_pycentral + dh_installman +install-stamp: build-stamp $(PYVERS:%=install-ext-%) $(PYVERS:%=install-dbg-ext-%) +install-ext-%: + python$* src/setup.py install --root $(CURDIR)/debian/python-dmidecode + touch $@ +install-dbg-ext-%: + python$*-dbg src/setup-dbg.py install --root $(CURDIR)/debian/python-dmidecode-dbg + #find $(CURDIR)/debian/python-dmidecode-dbg/usr/lib/python$*/ ! -type d ! -name '*_d\.so' -delete + #find $(CURDIR)/debian/python-dmidecode-dbg/usr/lib/python$*/ -depth -empty -delete + touch $@ + +################################################################################ +#. Binary +binary: binary-indep binary-arch +binary-indep: +binary-arch: build install + dh_testdir + dh_testroot + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + + +################################################################################ +#. Clean +clean: + dh_testdir + dh_testroot + $(MAKE) -f Makefile clean + test $(CL_AGE) -le $(CACHE_AGE) || dh_clean + dh_clean build-stamp install-stamp \ + $(PYVERS:%=install-ext-%) $(PYVERS:%=build-ext-%) \ + $(PYVERS:%=install-dbg-ext-%) $(PYVERS:%=build-dbg-ext-%) + +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/upstream.changelog b/debian/upstream.changelog new file mode 100644 index 0000000..e0f0ddc --- /dev/null +++ b/debian/upstream.changelog @@ -0,0 +1,952 @@ +------------------------------------------------------------------------ +r166 | nima | 2008-12-22 15:02:00 -0800 (Mon, 22 Dec 2008) | 2 lines + +Source file name change. + +------------------------------------------------------------------------ +r165 | nima | 2008-12-22 15:01:22 -0800 (Mon, 22 Dec 2008) | 2 lines + +A more complete dmidecode example. + +------------------------------------------------------------------------ +r164 | nima | 2008-12-22 14:40:51 -0800 (Mon, 22 Dec 2008) | 2 lines + +Applied the nice changes suggested by Piotr Ożarowsk. + +------------------------------------------------------------------------ +r163 | nima | 2008-12-22 05:37:43 -0800 (Mon, 22 Dec 2008) | 6 lines + +Cleaned up the fix for type(127). + +Added the second type of stuffed bios (upstream). + +Integrated dmidecode the binary into the test case for a more objective result. + +------------------------------------------------------------------------ +r162 | nima | 2008-12-22 01:06:43 -0800 (Mon, 22 Dec 2008) | 2 lines + +Fixed the type(127) problem (at least on this machine) - again. + +------------------------------------------------------------------------ +r161 | nima | 2008-12-21 04:52:51 -0800 (Sun, 21 Dec 2008) | 4 lines + +Removed unnecessay manpage. + +Spell my own name correctly. + +------------------------------------------------------------------------ +r160 | nima | 2008-12-21 03:31:36 -0800 (Sun, 21 Dec 2008) | 2 lines + +Added an upload into src.autonomy.net.au after source build. + +------------------------------------------------------------------------ +r159 | nima | 2008-12-21 03:27:52 -0800 (Sun, 21 Dec 2008) | 2 lines + +Fixed sample. + +------------------------------------------------------------------------ +r158 | nima | 2008-12-21 02:22:06 -0800 (Sun, 21 Dec 2008) | 6 lines + +Cleanup copyright. + +Cleanup debian/rules. + +Adding test.py to examples. + +------------------------------------------------------------------------ +r157 | nima | 2008-12-21 02:04:03 -0800 (Sun, 21 Dec 2008) | 2 lines + +Remove README.Debian - no point. + +------------------------------------------------------------------------ +r156 | nima | 2008-12-20 23:57:49 -0800 (Sat, 20 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r155 | nima | 2008-12-20 23:53:54 -0800 (Sat, 20 Dec 2008) | 3 lines + +Handle cases where user does not have appropriate permission to access the +memory file or device. + +------------------------------------------------------------------------ +r154 | nima | 2008-12-20 21:44:04 -0800 (Sat, 20 Dec 2008) | 2 lines + +Names. + +------------------------------------------------------------------------ +r153 | nima | 2008-12-20 21:43:06 -0800 (Sat, 20 Dec 2008) | 2 lines + +Better naming. + +------------------------------------------------------------------------ +r152 | nima | 2008-12-20 20:41:39 -0800 (Sat, 20 Dec 2008) | 4 lines + +Upped debhelper build-required version from 5 to 7. + +Final cleanups. + +------------------------------------------------------------------------ +r151 | nima | 2008-12-20 18:55:19 -0800 (Sat, 20 Dec 2008) | 2 lines + +Cleaned up and Lintian-approved. + +------------------------------------------------------------------------ +r150 | nima | 2008-12-20 18:48:05 -0800 (Sat, 20 Dec 2008) | 2 lines + +Email address fixed. + +------------------------------------------------------------------------ +r149 | nima | 2008-12-20 18:39:16 -0800 (Sat, 20 Dec 2008) | 2 lines + +Sigh. + +------------------------------------------------------------------------ +r148 | nima | 2008-12-20 18:38:35 -0800 (Sat, 20 Dec 2008) | 2 lines + +Changing to svn-buildpackage. + +------------------------------------------------------------------------ +r147 | nima | 2008-12-20 18:22:20 -0800 (Sat, 20 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r146 | nima | 2008-12-20 18:07:56 -0800 (Sat, 20 Dec 2008) | 2 lines + +Source generation. + +------------------------------------------------------------------------ +r145 | nima | 2008-12-20 17:41:57 -0800 (Sat, 20 Dec 2008) | 6 lines + +Fixed watchfile now that I've created a src (orig.tar.gz) repository. + +Added more copyright/lisencing information. + +More debianizing. + +------------------------------------------------------------------------ +r144 | nima | 2008-12-20 09:00:56 -0800 (Sat, 20 Dec 2008) | 2 lines + +Required for dh_installdocs. + +------------------------------------------------------------------------ +r143 | nima | 2008-12-20 08:54:32 -0800 (Sat, 20 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r142 | nima | 2008-12-20 08:52:15 -0800 (Sat, 20 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r141 | nima | 2008-12-20 08:49:40 -0800 (Sat, 20 Dec 2008) | 2 lines + +Removed out-of-place README. + +------------------------------------------------------------------------ +r140 | nima | 2008-12-20 08:47:18 -0800 (Sat, 20 Dec 2008) | 2 lines + +Hide private data from subversion. + +------------------------------------------------------------------------ +r139 | nima | 2008-12-20 08:46:37 -0800 (Sat, 20 Dec 2008) | 2 lines + +Remove private memory dumps. + +------------------------------------------------------------------------ +r138 | nima | 2008-12-20 08:45:39 -0800 (Sat, 20 Dec 2008) | 4 lines + +Added missing info to copyright file. + +Source creation target. + +------------------------------------------------------------------------ +r137 | nima | 2008-12-20 08:26:43 -0800 (Sat, 20 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r136 | nima | 2008-12-20 07:49:18 -0800 (Sat, 20 Dec 2008) | 4 lines + +Handle cases where user asks for invalid types. + +Updated test cases to test for this too. + +------------------------------------------------------------------------ +r135 | nima | 2008-12-20 07:32:30 -0800 (Sat, 20 Dec 2008) | 6 lines + +Version information now set once during init(). + +Bettered test cases. + +Case 127 magically fixed. + +------------------------------------------------------------------------ +r134 | nima | 2008-12-19 17:46:42 -0800 (Fri, 19 Dec 2008) | 2 lines + +Debian specific target. + +------------------------------------------------------------------------ +r133 | nima | 2008-12-19 17:44:55 -0800 (Fri, 19 Dec 2008) | 8 lines + +Removed "detected" from appearing in every single function call. TODO: An ivar +should be implemented to return this string, so further cleanup is still +required; as it stands, there is no access to this information anymore! + +Updated test case. + +Further general cleanup. + +------------------------------------------------------------------------ +r132 | nima | 2008-12-19 15:55:53 -0800 (Fri, 19 Dec 2008) | 4 lines + +Further testing shows that the segfault does not occur when the device is +/dev/mem, but does so for all images (where requested type is 127), suggesting +that the problem could be with the image or surrounding processes. + +------------------------------------------------------------------------ +r131 | nima | 2008-12-19 15:46:46 -0800 (Fri, 19 Dec 2008) | 2 lines + +Oops - fixed. + +------------------------------------------------------------------------ +r130 | nima | 2008-12-19 15:45:55 -0800 (Fri, 19 Dec 2008) | 3 lines + +Test case is close to complete, type 127 results in a segfault - (test case +is serving its purpose). + +------------------------------------------------------------------------ +r129 | nima | 2008-12-19 15:29:50 -0800 (Fri, 19 Dec 2008) | 3 lines + +Adding an image from parallel's desktop running Debian lenny, and another for +a physical server also running Debian. Both are intel 32 bit. + +------------------------------------------------------------------------ +r128 | nima | 2008-12-19 15:27:10 -0800 (Fri, 19 Dec 2008) | 4 lines + +More work on test case. + +Updated setup.py to reflect new version. + +------------------------------------------------------------------------ +r127 | nima | 2008-12-19 05:49:19 -0800 (Fri, 19 Dec 2008) | 2 lines + +More testing and fixes. + +------------------------------------------------------------------------ +r126 | nima | 2008-12-19 05:42:10 -0800 (Fri, 19 Dec 2008) | 2 lines + +Improved test case. + +------------------------------------------------------------------------ +r125 | nima | 2008-12-19 05:32:35 -0800 (Fri, 19 Dec 2008) | 2 lines + +Removed a printf() comment. + +------------------------------------------------------------------------ +r124 | nima | 2008-12-19 05:21:24 -0800 (Fri, 19 Dec 2008) | 6 lines + +Check that the path given with set_dev() is writeable. + +Don't crash when writing to a read-only file, return False instead. + +Missing an INCREF in get_dev() fixed. + +------------------------------------------------------------------------ +r123 | nima | 2008-12-19 03:56:39 -0800 (Fri, 19 Dec 2008) | 2 lines + +Test for write permission prior to write attempts. + +------------------------------------------------------------------------ +r122 | nima | 2008-12-19 01:02:52 -0800 (Fri, 19 Dec 2008) | 2 lines + +Fixed watch file. + +------------------------------------------------------------------------ +r121 | nima | 2008-12-18 21:05:38 -0800 (Thu, 18 Dec 2008) | 4 lines + +Received ITP auto-ack: #509169. + +More debianizing cleanup. + +------------------------------------------------------------------------ +r120 | nima | 2008-12-18 20:13:24 -0800 (Thu, 18 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r119 | nima | 2008-12-18 20:07:06 -0800 (Thu, 18 Dec 2008) | 3 lines + +Further work in enforcing the Debian policy in package based on advice from +`POX' and the documentation. + +------------------------------------------------------------------------ +r118 | nima | 2008-12-18 18:23:32 -0800 (Thu, 18 Dec 2008) | 2 lines + +Removed junk and doing more debianizing - WIP. + +------------------------------------------------------------------------ +r117 | nima | 2008-12-18 05:49:57 -0800 (Thu, 18 Dec 2008) | 2 lines + +Updated. + +------------------------------------------------------------------------ +r116 | nima | 2008-12-18 05:48:52 -0800 (Thu, 18 Dec 2008) | 6 lines + +The dmidecode.type() call not takes ints, not strings. + +Adding an example directory. + +Adding test case. + +------------------------------------------------------------------------ +r115 | nima | 2008-12-18 05:45:37 -0800 (Thu, 18 Dec 2008) | 4 lines + +The dmidecode.type() call not takes ints, not strings. + +Adding an example directory. + +------------------------------------------------------------------------ +r114 | nima | 2008-12-17 17:12:50 -0800 (Wed, 17 Dec 2008) | 5 lines + +More upstream changes implemented, see CHANGELOG by Jean Delvare from the +period 2008-02-16 to 2008-11-23. + +These changes have been made, but not yet fully tested. + +------------------------------------------------------------------------ +r113 | nima | 2008-12-17 05:26:57 -0800 (Wed, 17 Dec 2008) | 5 lines + +Claim to support revision 32 of Intel AP-485 (CPUID). No relevant change since +revision 31. + +Update reference to AMD CPUID document. + +------------------------------------------------------------------------ +r112 | nima | 2008-12-17 05:11:35 -0800 (Wed, 17 Dec 2008) | 2 lines + +Handle chassis information records of size 19 (DMI type 3). + +------------------------------------------------------------------------ +r111 | nima | 2008-12-17 05:00:12 -0800 (Wed, 17 Dec 2008) | 2 lines + +And the debian subfolder itself... + +------------------------------------------------------------------------ +r110 | nima | 2008-12-17 04:59:32 -0800 (Wed, 17 Dec 2008) | 2 lines + +Debianizing dmidecode. + +------------------------------------------------------------------------ +r109 | nima | 2008-12-16 23:30:04 -0800 (Tue, 16 Dec 2008) | 2 lines + +Adding spec file written by Joel Heenan. + +------------------------------------------------------------------------ +r108 | nima | 2008-12-16 23:20:56 -0800 (Tue, 16 Dec 2008) | 2 lines + +Cleaning up source area, ready for debianizing, and rpm after that. + +------------------------------------------------------------------------ +r107 | nima | 2008-10-31 07:45:34 -0700 (Fri, 31 Oct 2008) | 2 lines + +Changed default target of Makefile back to `setup.py' method of installation. + +------------------------------------------------------------------------ +r106 | nima | 2008-10-31 07:41:02 -0700 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r105 | nima | 2008-10-31 07:33:03 -0700 (Fri, 31 Oct 2008) | 3 lines + +This commit closes #2 reported by Justin Cook, the ticket will remain open +until Justin confirms this however. + +------------------------------------------------------------------------ +r104 | nima | 2008-10-31 07:07:22 -0700 (Fri, 31 Oct 2008) | 6 lines + +Implemented reading a dump to - this concludes syncing to the upstream release. + +Next, exceptions should be thrown in certain places, more error checking in the +python side of things, and also in relation to setting and unsetting of the +alternate memory file. + +------------------------------------------------------------------------ +r103 | nima | 2008-10-31 06:42:35 -0700 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r102 | nima | 2008-10-31 06:38:24 -0700 (Fri, 31 Oct 2008) | 3 lines + +Fixed dump. The `offset' problem was not really an offset problem - it was a +silly typo. + +------------------------------------------------------------------------ +r101 | nima | 2008-10-31 06:24:04 -0700 (Fri, 31 Oct 2008) | 2 lines + +Missed two lines. + +------------------------------------------------------------------------ +r100 | nima | 2008-10-31 06:19:50 -0700 (Fri, 31 Oct 2008) | 3 lines + +Dump-to-file is almost working, there seems to be a 4-byte misalignment in the +produced file though for now - needs to be fixed. + +------------------------------------------------------------------------ +r99 | nima | 2008-10-31 04:43:15 -0700 (Fri, 31 Oct 2008) | 2 lines + +Removed junk comments. + +------------------------------------------------------------------------ +r98 | nima | 2008-10-31 04:21:24 -0700 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r97 | nima | 2008-10-31 04:15:19 -0700 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r96 | nima | 2008-10-31 03:24:41 -0700 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r95 | nima | 2008-10-31 02:05:23 -0700 (Fri, 31 Oct 2008) | 6 lines + +Integration of required `dmiopt.h' bits. +Removed QUIETness code. +Other cleanups. +Added get/set methods for changinf the default /dev/mem device. + + +------------------------------------------------------------------------ +r94 | nima | 2008-10-31 02:02:21 -0700 (Fri, 31 Oct 2008) | 2 lines + +Removed traces of `_' and integrating required bits from dmiopt.h. + +------------------------------------------------------------------------ +r93 | nima | 2008-10-31 02:01:41 -0700 (Fri, 31 Oct 2008) | 2 lines + +Removed traces of `_'. + +------------------------------------------------------------------------ +r92 | nima | 2008-10-31 02:00:26 -0700 (Fri, 31 Oct 2008) | 2 lines + +Integrating the required bits from dmiopt into dmihelper. + +------------------------------------------------------------------------ +r91 | nima | 2008-10-31 01:39:12 -0700 (Fri, 31 Oct 2008) | 4 lines + +Removed `_' buffer. +Removed use of `FLAGS_QUIET' as it makes no sense for a module. +Removed the `submain()' function. + +------------------------------------------------------------------------ +r90 | nima | 2008-10-31 01:30:00 -0700 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r89 | nima | 2008-10-31 01:29:06 -0700 (Fri, 31 Oct 2008) | 2 lines + +Removed dependency on dmiopt. + +------------------------------------------------------------------------ +r88 | nima | 2008-10-31 01:28:33 -0700 (Fri, 31 Oct 2008) | 2 lines + +Removed verbose printout. + +------------------------------------------------------------------------ +r87 | nima | 2008-10-30 03:14:24 -0700 (Thu, 30 Oct 2008) | 2 lines + +Removed final traces of the `_' buffer. + +------------------------------------------------------------------------ +r86 | nima | 2008-10-29 19:11:56 -0700 (Wed, 29 Oct 2008) | 2 lines + +Implementing (incomplete) upstream changes. + +------------------------------------------------------------------------ +r85 | nima | 2008-10-29 00:15:35 -0700 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r84 | nima | 2008-10-29 00:13:49 -0700 (Wed, 29 Oct 2008) | 5 lines + +Adding man pages from upstream. Sooner or later, these will be removed, as will +all other work that's simply replicating the demidecode binary. All this +package should provide is the python module, and some py-module-specific man +pages. + +------------------------------------------------------------------------ +r83 | nima | 2008-10-29 00:10:24 -0700 (Wed, 29 Oct 2008) | 4 lines + +Recoded the new work from upstream into these (main) files. The options to +dump the memory image onto file, and read back from it has not yet been +worked in, but the underlying work has been completed. + +------------------------------------------------------------------------ +r82 | nima | 2008-10-29 00:09:10 -0700 (Wed, 29 Oct 2008) | 3 lines + +Tested new dmidecode python module with this example file. A real test case +will be implemented sometime in future. + +------------------------------------------------------------------------ +r81 | nima | 2008-10-29 00:07:56 -0700 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r80 | nima | 2008-10-29 00:07:13 -0700 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r79 | nima | 2008-10-29 00:06:47 -0700 (Wed, 29 Oct 2008) | 2 lines + +Using dmihelper now. + +------------------------------------------------------------------------ +r78 | nima | 2008-10-29 00:05:58 -0700 (Wed, 29 Oct 2008) | 2 lines + +Upstream. + +------------------------------------------------------------------------ +r77 | nima | 2008-10-29 00:04:19 -0700 (Wed, 29 Oct 2008) | 2 lines + +Upstream. + +------------------------------------------------------------------------ +r76 | nima | 2008-10-29 00:04:03 -0700 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r75 | nima | 2008-10-28 23:36:23 -0700 (Tue, 28 Oct 2008) | 2 lines + +Renamed to a more appropriate name. + +------------------------------------------------------------------------ +r74 | nima | 2008-10-28 23:35:21 -0700 (Tue, 28 Oct 2008) | 3 lines + +Committing new dmidecode helper functions, and next, renaming it to a +meaningful name. + +------------------------------------------------------------------------ +r73 | nima | 2008-10-28 23:27:31 -0700 (Tue, 28 Oct 2008) | 3 lines + +Synced to the latest from upstream, with a light modification required for the +module. + +------------------------------------------------------------------------ +r72 | nima | 2008-10-18 02:34:09 -0700 (Sat, 18 Oct 2008) | 5 lines + +Python does not have unsigned integers, hence %u and %lu in printf style +strings are taken to be literal strings, not space-holders. All occurences +of '%u' (78) have been amended to '%i', there was no '%lu'. + + +------------------------------------------------------------------------ +r71 | nima | 2008-10-18 02:28:46 -0700 (Sat, 18 Oct 2008) | 4 lines + +Fixed bug reported by by Justin Cook, where dmidecode.type() would segfault. +It turned out to be some code that was forgotten about during the conversion, or +at least very incomplete and wrong. + +------------------------------------------------------------------------ +r70 | nima | 2008-10-16 08:52:48 -0700 (Thu, 16 Oct 2008) | 2 lines + +Remove efence. + +------------------------------------------------------------------------ +r69 | nima | 2008-09-04 20:08:02 -0700 (Thu, 04 Sep 2008) | 2 lines + +Fixed a bug that crashed dmidecode.slot(). + +------------------------------------------------------------------------ +r68 | nima | 2008-09-03 23:09:55 -0700 (Wed, 03 Sep 2008) | 5 lines + +Cleaning up of the dmidecode module, mostly conversion of things that can be +Python `None's or `Int's but were `String'. + +Replaced a meaningless int dictionary key to `data'. + +------------------------------------------------------------------------ +r67 | nima | 2008-09-03 19:26:09 -0700 (Wed, 03 Sep 2008) | 3 lines + +Work on CPU details - seemed to been a bug with appending to a string rather +than rewriting it. + +------------------------------------------------------------------------ +r66 | nima | 2008-08-08 07:15:47 -0700 (Fri, 08 Aug 2008) | 4 lines + +Replaced `%X' with `%x'. + +Logic cleanup - Put the `Handle' info back into the dictionary. + +------------------------------------------------------------------------ +r65 | nima | 2008-08-08 00:57:44 -0700 (Fri, 08 Aug 2008) | 2 lines + +Anoher bug fix, this time in baseboard. + +------------------------------------------------------------------------ +r64 | nima | 2008-08-08 00:27:36 -0700 (Fri, 08 Aug 2008) | 3 lines + +Fixed many major bugs (all of which were expected based on the way we mass +converted all the `case' blocks. + +------------------------------------------------------------------------ +r63 | nima | 2008-08-07 05:32:39 -0700 (Thu, 07 Aug 2008) | 2 lines + +Cleaned up a little. + +------------------------------------------------------------------------ +r62 | nima | 2008-08-06 18:34:15 -0700 (Wed, 06 Aug 2008) | 2 lines + +Fixed some conversion bits missed during last night. + +------------------------------------------------------------------------ +r61 | nima | 2008-08-06 06:32:37 -0700 (Wed, 06 Aug 2008) | 2 lines + +Updated authors file with developers of the dmidecode python module. + +------------------------------------------------------------------------ +r60 | nima | 2008-08-06 06:27:26 -0700 (Wed, 06 Aug 2008) | 2 lines + +Changed to GNU GPL v3 License. + +------------------------------------------------------------------------ +r59 | nima | 2008-08-06 05:59:03 -0700 (Wed, 06 Aug 2008) | 2 lines + +Removed `sudo'. + +------------------------------------------------------------------------ +r58 | nima | 2008-08-06 05:52:46 -0700 (Wed, 06 Aug 2008) | 4 lines + +Completed `case 126', thought to have been completed in previous commit. + +Some housekeeping elsewhere. + +------------------------------------------------------------------------ +r57 | nima | 2008-08-06 01:51:05 -0700 (Wed, 06 Aug 2008) | 4 lines + +Completed all conversions! Only problem now is of course finding all the memory +leaks and introduced logic errors which (confirmed) do exists - use valgrind and +see. + +------------------------------------------------------------------------ +r56 | vwhitteron | 2008-08-06 01:29:18 -0700 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 34' through `Case 39' +------------------------------------------------------------------------ +r55 | nima | 2008-08-06 01:12:43 -0700 (Wed, 06 Aug 2008) | 2 lines + +Almost there! + +------------------------------------------------------------------------ +r54 | vwhitteron | 2008-08-06 00:49:23 -0700 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 29' and `Case 32' +------------------------------------------------------------------------ +r53 | nima | 2008-08-06 00:42:34 -0700 (Wed, 06 Aug 2008) | 2 lines + +Converted `case 30'. + +------------------------------------------------------------------------ +r52 | vwhitteron | 2008-08-06 00:40:42 -0700 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 26', `Case 27' and `Case 28' +------------------------------------------------------------------------ +r51 | nima | 2008-08-06 00:30:41 -0700 (Wed, 06 Aug 2008) | 3 lines + +Added `PyObject *data;' to all remaining functions which will generate a warning +as to indicate these need to be converted. + +------------------------------------------------------------------------ +r50 | nima | 2008-08-06 00:27:30 -0700 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `csae 28'. + +------------------------------------------------------------------------ +r49 | nima | 2008-08-06 00:23:35 -0700 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `case 27', and fixed error in last commit for `case 26'. + +------------------------------------------------------------------------ +r48 | nima | 2008-08-06 00:19:27 -0700 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `case 26'. + +------------------------------------------------------------------------ +r47 | vwhitteron | 2008-08-06 00:09:11 -0700 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 23', `Case 24', `Case24' and `Case 25' +------------------------------------------------------------------------ +r46 | nima | 2008-08-06 00:07:20 -0700 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `case 25'. + +------------------------------------------------------------------------ +r45 | nima | 2008-08-06 00:00:41 -0700 (Wed, 06 Aug 2008) | 2 lines + +Converted function for `case 24'. + +------------------------------------------------------------------------ +r44 | nima | 2008-08-05 23:59:35 -0700 (Tue, 05 Aug 2008) | 2 lines + +More fixes on recent commits (by me), and more conversions on functions. + +------------------------------------------------------------------------ +r43 | vwhitteron | 2008-08-05 23:57:13 -0700 (Tue, 05 Aug 2008) | 1 line + +Completed `Case 22' +------------------------------------------------------------------------ +r42 | nima | 2008-08-05 23:53:24 -0700 (Tue, 05 Aug 2008) | 2 lines + +Oops. Fixed stupidity on last commit. + +------------------------------------------------------------------------ +r41 | nima | 2008-08-05 23:52:01 -0700 (Tue, 05 Aug 2008) | 2 lines + +Completed functions called by `case 21' and `case 22'. + +------------------------------------------------------------------------ +r40 | nima | 2008-08-05 23:42:54 -0700 (Tue, 05 Aug 2008) | 3 lines + +Completed `case 21' functions. +Cleanup. + +------------------------------------------------------------------------ +r39 | vwhitteron | 2008-08-05 23:39:53 -0700 (Tue, 05 Aug 2008) | 2 lines + +Completed `case 19' and `case 20'. + +------------------------------------------------------------------------ +r38 | nima | 2008-08-05 23:17:21 -0700 (Tue, 05 Aug 2008) | 2 lines + +Started on `case 19'. + +------------------------------------------------------------------------ +r37 | nima | 2008-08-05 22:43:05 -0700 (Tue, 05 Aug 2008) | 2 lines + +Completed `case 18' and `case 19'. + +------------------------------------------------------------------------ +r36 | nima | 2008-08-05 22:06:03 -0700 (Tue, 05 Aug 2008) | 2 lines + +Added `case 16' and `case 17'. + +------------------------------------------------------------------------ +r35 | nima | 2008-08-05 21:26:45 -0700 (Tue, 05 Aug 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r34 | nima | 2008-08-05 21:05:06 -0700 (Tue, 05 Aug 2008) | 2 lines + +Converted `case 5', `case 6', and `case 7'. + +------------------------------------------------------------------------ +r33 | nima | 2008-08-01 00:59:51 -0700 (Fri, 01 Aug 2008) | 2 lines + +Default case set to return python's `None'. + +------------------------------------------------------------------------ +r32 | nima | 2008-08-01 00:58:24 -0700 (Fri, 01 Aug 2008) | 2 lines + +Completed `case 15'. + +------------------------------------------------------------------------ +r31 | nima | 2008-07-28 21:33:59 -0700 (Mon, 28 Jul 2008) | 2 lines + +Completed `case 9' and case `8'. + +------------------------------------------------------------------------ +r30 | nima | 2008-07-28 18:31:21 -0700 (Mon, 28 Jul 2008) | 2 lines + +Completed `case 11'. + +------------------------------------------------------------------------ +r29 | nima | 2008-07-28 18:28:04 -0700 (Mon, 28 Jul 2008) | 2 lines + +Completed `case 12' and `case 14'. + +------------------------------------------------------------------------ +r28 | nima | 2008-07-28 17:29:05 -0700 (Mon, 28 Jul 2008) | 6 lines + +Bug fix (removed unnecessary breakr). + +Changed %i back to %u for now, even though it does not work with Python. +Better to do the change globally - later. + + +------------------------------------------------------------------------ +r27 | nima | 2008-07-28 03:14:38 -0700 (Mon, 28 Jul 2008) | 2 lines + +Try and determine python version dynamically. + +------------------------------------------------------------------------ +r26 | nima | 2008-07-27 05:15:51 -0700 (Sun, 27 Jul 2008) | 2 lines + +Completed `case 4', which was thought to have been completed falsely before. + +------------------------------------------------------------------------ +r25 | nima | 2008-07-26 02:15:53 -0700 (Sat, 26 Jul 2008) | 6 lines + +Completed cases 1, 4, and 13. Also altered the main PyDict object such that +each case has a value of a list to which items are appended. Without this, +each object of the same type would overwrite the previous, for example, 8 +processors would result in one single cpu with data pertaining to the last +cpu (7). + +------------------------------------------------------------------------ +r24 | nima | 2008-07-25 16:35:30 -0700 (Fri, 25 Jul 2008) | 2 lines + +Completed `case 0'. + +------------------------------------------------------------------------ +r23 | root | 2008-07-25 06:17:24 -0700 (Fri, 25 Jul 2008) | 2 lines + +Added `case 3'. + +------------------------------------------------------------------------ +r22 | root | 2008-07-25 05:51:02 -0700 (Fri, 25 Jul 2008) | 2 lines + +No new moves, cleanup on last commit and better test file template. + +------------------------------------------------------------------------ +r21 | root | 2008-07-25 05:27:26 -0700 (Fri, 25 Jul 2008) | 8 lines + +Next phase is to start converting all pure C functions returning `char *' and +such to new Pythonized functions returning `PyObject *', to save from having +to `PyString_FromString()' and similar, and more importantly, some functions +return a long string that could better be represented by a PyDict, PyList etc. + +This is the first commit of many more to come, converting a `case XX:' at a +time, making sure that each commit can actually compile and run. + +------------------------------------------------------------------------ +r20 | root | 2008-07-24 18:13:13 -0700 (Thu, 24 Jul 2008) | 2 lines + +Cleanup (DECREF). + +------------------------------------------------------------------------ +r19 | root | 2008-07-24 18:12:46 -0700 (Thu, 24 Jul 2008) | 2 lines + +Add in electric fence for now. + +------------------------------------------------------------------------ +r18 | root | 2008-07-24 18:11:39 -0700 (Thu, 24 Jul 2008) | 5 lines + +This was the culprit causing the `Abort' crash, valgrind showed that this file +is where the error lied. Stephen Darragh discovered this, and the fix has been +to use vsnprintf() and not vsprintf(), which should have been the case to begin +with really. + +------------------------------------------------------------------------ +r17 | root | 2008-07-24 17:46:00 -0700 (Thu, 24 Jul 2008) | 2 lines + +Cleaner to not vsprintf() at all if `format' is NULL. + +------------------------------------------------------------------------ +r16 | root | 2008-07-24 17:45:11 -0700 (Thu, 24 Jul 2008) | 2 lines + + The `biosdecode' is a program, nothing to do with the module, removed. + +------------------------------------------------------------------------ +r15 | nima | 2008-07-24 07:36:16 -0700 (Thu, 24 Jul 2008) | 2 lines + +Added my small role in AUTHORS so nobody bugs others for my code. + +------------------------------------------------------------------------ +r14 | nima | 2008-07-24 07:17:16 -0700 (Thu, 24 Jul 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r13 | nima | 2008-07-24 05:02:12 -0700 (Thu, 24 Jul 2008) | 2 lines + +Some cleaning, crash in interactive mode on dmidecode.bios() still not fixed. + +------------------------------------------------------------------------ +r12 | nima | 2008-07-24 03:48:01 -0700 (Thu, 24 Jul 2008) | 3 lines + +Now that code has been converted, work has started on "bios", and at the point +of proof-of-concept. + +------------------------------------------------------------------------ +r11 | nima | 2008-07-04 08:24:22 -0700 (Fri, 04 Jul 2008) | 3 lines + +Removing printf() statements, instead adding to Python dictionary object, +untested. + +------------------------------------------------------------------------ +r10 | nima | 2008-07-03 08:59:08 -0700 (Thu, 03 Jul 2008) | 6 lines + +Major changes have been implemented, alas, untested, in hope to move towards +a new version of dmi decode where rather than having data just printed to +screen in functions, data is passed around, and some data structure is +constructed, which is then used to construct the Python list/dicitonary +objects. + +------------------------------------------------------------------------ +r9 | nima | 2008-07-02 00:02:05 -0700 (Wed, 02 Jul 2008) | 4 lines + +WIP - Adding h->type value to catsprintf (as int major), later will add minor +too, and finally will replace the buffer with a linked list of structs, which +will be added to the python dictionary/list. + +------------------------------------------------------------------------ +r8 | nima | 2008-07-01 21:53:48 -0700 (Tue, 01 Jul 2008) | 3 lines + +Now the `Handle' hex codes are the key values in the python dictionaries +returned. + +------------------------------------------------------------------------ +r7 | nima | 2008-07-01 16:14:17 -0700 (Tue, 01 Jul 2008) | 2 lines + +Brought main() back into the python module and fixed malloc/free problems. + +------------------------------------------------------------------------ +r6 | nima | 2008-07-01 00:05:57 -0700 (Tue, 01 Jul 2008) | 2 lines + +Removed junk comments. + +------------------------------------------------------------------------ +r5 | nima | 2008-06-30 23:11:21 -0700 (Mon, 30 Jun 2008) | 2 lines + +Update for file renames. + +------------------------------------------------------------------------ +r4 | nima | 2008-06-30 23:04:02 -0700 (Mon, 30 Jun 2008) | 2 lines + +Better named. + +------------------------------------------------------------------------ +r3 | nima | 2008-06-30 23:01:21 -0700 (Mon, 30 Jun 2008) | 5 lines + +Project progressing along excellently. The python module is now functional and +has as many methods as the --type option takes. + +Next is to expand and harness the code around the `--string' option. + +------------------------------------------------------------------------ +r2 | nima | 2008-06-30 07:14:46 -0700 (Mon, 30 Jun 2008) | 4 lines + +Split out the module header into its own file. + +Cleaned up Makefile a little. + +------------------------------------------------------------------------ +r1 | nima | 2008-06-30 05:08:58 -0700 (Mon, 30 Jun 2008) | 2 lines + +First commit to SVN. + +------------------------------------------------------------------------ diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..2018f4f --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://src.autonomy.net.au/python-dmidecode/python-dmidecode-(.*).tar.gz diff --git a/doc/AUTHORS b/doc/AUTHORS new file mode 100644 index 0000000..05475b7 --- /dev/null +++ b/doc/AUTHORS @@ -0,0 +1,15 @@ +DEVELOPER AND MAINTAINER OF PYTHON MODULE (http://projects.autonomy.net.au/dmidecode) +Nima Talebi + +DEVELOPER AND MAINTAINER OF DMIDECODE (Please see http://www.nongnu.org/dmidecode) +Jean Delvare + +ORIGINAL AUTHOR +Alan Cox + +MANY THANKS TO (IN CHRONOLOGICAL ORDER) +Jean Delvare +Stephen Darragh +Joel Heenan +Vaughan Whitteron +Justin Cook diff --git a/doc/AUTHORS.upstream b/doc/AUTHORS.upstream new file mode 100644 index 0000000..1ad50db --- /dev/null +++ b/doc/AUTHORS.upstream @@ -0,0 +1,70 @@ +DEVELOPER AND MAINTAINER +Jean Delvare + +ORIGINAL AUTHOR +Alan Cox + +CODE CONTRIBUTORS (IN CHRONOLOGICAL ORDER) +Matt Domsch +Arjan van de Ven +Mark D. Studebaker +Larry Lile +Dave Johnson +Petter Reinholdtsen +Roberto Nibali +John Cagle +Jens Elkner + +MANY THANKS TO (IN CHRONOLOGICAL ORDER) +Werner Heuser +Alexandre Duret-Lutz +Xavier Roche +Pamela Huntley +Gael Stephan +Sebastian Henschel +Richard Sharpe +David Wilson +Glen Foster +Chad Smith +Joshua Goldenhar +Luc Van de Velde +Mario Lang +Hugues Lepesant +Sergey Leonovich +Mike Cooper +Marc Rieffel +Jeff Moyer +Josef Moellers +Zing Zing Shishak +Rafael Avila de Espindola +Roger Koot +Martin Pool +Doug Brenner +Alex Williamson +Durval Menezes +Raphael Raimbault +Raul Nunez de Arenas Coronado +Francois Revol +Dominik Klein +Erwan Velu +Don Howard +Frans Pop +Tomek Mateja +Myke Olson +Torsten Seemann +Garry Belka +Klaus Muth +Antoine Fuselier +Matthew Garrett +Landry Breuil +Luke Suchocki +Attila Nagy +Alex Iribarren +Sebastien Douche +William Lallemand +Olivier Guerrier +Pascal Terjan +Stuart Hayes +Sofian Brabez +Vincent Pelletier +Andreas Gruenbacher diff --git a/doc/LICENSE b/doc/LICENSE new file mode 100644 index 0000000..94a0453 --- /dev/null +++ b/doc/LICENSE @@ -0,0 +1,621 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS diff --git a/doc/README.types b/doc/README.types new file mode 100644 index 0000000..5d65a3a --- /dev/null +++ b/doc/README.types @@ -0,0 +1,55 @@ + Type Information + ---------------------------------------- + 0 BIOS + 1 System + 2 Base Board + 3 Chassis + 4 Processor + 5 Memory Controller + 6 Memory Module + 7 Cache + 8 Port Connector + 9 System Slots + 10 On Board Devices + 11 OEM Strings + 12 System Configuration Options + 13 BIOS Language + 14 Group Associations + 15 System Event Log + 16 Physical Memory Array + 17 Memory Device + 18 32-bit Memory Error + 19 Memory Array Mapped Address + 20 Memory Device Mapped Address + 21 Built-in Pointing Device + 22 Portable Battery + 23 System Reset + 24 Hardware Security + 25 System Power Controls + 26 Voltage Probe + 27 Cooling Device + 28 Temperature Probe + 29 Electrical Current Probe + 30 Out-of-band Remote Access + 31 Boot Integrity Services + 32 System Boot + 33 64-bit Memory Error + 34 Management Device + 35 Management Device Component + 36 Management Device Threshold Data + 37 Memory Channel + 38 IPMI Device + 39 Power Supply + + + Keyword Types + ------------------------------ + bios 0, 13 + system 1, 12, 15, 23, 32 + baseboard 2, 10 + chassis 3 + processor 4 + memory 5, 6, 16, 17 + cache 7 + connector 8 + slot 9 diff --git a/doc/README.upstream b/doc/README.upstream new file mode 100644 index 0000000..391a5cb --- /dev/null +++ b/doc/README.upstream @@ -0,0 +1,116 @@ +** INTRODUCTION ** + +Dmidecode reports information about your system's hardware as described in +your system BIOS according to the SMBIOS/DMI standard. This information +typically includes system manufacturer, model name, serial number, BIOS +version, asset tag as well as a lot of other details of varying level of +interest and reliability depending on the manufacturer. This will often +include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, +ISA) and memory module slots, and the list of I/O ports (e.g. serial, +parallel, USB). + +DMI data can be used to enable or disable specific portions of kernel code +depending on the specific hardware. Thus, one use of dmidecode is for kernel +developers to detect system "signatures" and add them to the kernel source +code when needed. + +Beware that DMI data have proven to be too unreliable to be blindly trusted. +Dmidecode does not scan your hardware, it only reports what the BIOS told it +to. + + +** INSTALLATION ** + +The home web page for dmidecode is hosted on Savannah: + http://www.nongnu.org/dmidecode/ +You will find the latest version (including CVS) there, as well as fresh news +and other interesting material, such as a list of related projects and +articles. + +This program was first written for Linux, and has since been reported to work +on FreeBSD, NetBSD, OpenBSD, BeOS, Cygwin and Solaris as well. + +There's no configure script, so simply run "make" to build dmidecode, and +"make install" to install it. You also can use "make uninstall" to remove +all the files you installed. By default, files are installed in /usr/local +but you can change this behavior by editing the Makefile file and setting +prefix to wherever you want. You may change the C compiler and the +compilation flags as well. + +Optionally, you can run "make strip" prior to "make install" if you want +smaller binaries. However, be aware that this will prevent any further +attempt to debug the programs. + +Two parameters can be set in the Makefile file to make dmidecode work on +non-i386 systems. They should be used if your system uses the big endian +byte ordering (Motorola) or doesn't support unaligned memory accesses, +respectively. For example, compiling for a SPARC processor would require +both (but I am not aware of SPARC-based systems implementing SMBIOS). +Compiling for an IA64 processor requires the memory alignment workaround, +and it is enabled automatically. + + +** DOCUMENTATION ** + +Each tool has a manual page, found in the "man" subdirectory. Manual pages +are installed by "make install". See these manual pages for command line +interface details and tool specific information. + +For an history of the changes made to dmidecode, see the CHANGELOG file. + +If you need help, your best chances are to visit the web page (see the +INSTALLATION section above) or to get in touch with the developers directly. +Have a look at the AUTHORS file and contact one of the maintainers. + +If you want to help with the development of dmidecode, please consider +joining the dmidecode-devel discussion list: + http://lists.nongnu.org/mailman/listinfo/dmidecode-devel + + +** COMMON PROBLEMS ** + +IA-64 + +Non-Linux systems are not yet supported. + +MMAP + +Note that mmap() is now used by default wherever possible, since this seems +to solve a number of problems. This default behavior can be changed in +config.h. Just to make sure this is clear, mmap() is not used for performance +reasons but to increase the number of systems on which dmidecode can be +successfully run. + +CYGWIN + +Dmidecode was reported to work under Cygwin. It seems that /dev/mem doesn't +work properly before version 1.5.10 though, so you will need to use at least +this version. + + +** MISCELLANEOUS TOOLS ** + +Three other tools come along with dmidecode: biosdecode, ownership and +vpddecode. These tools are only useful on systems with a BIOS, so they +are not built on IA-64 by default. + +BIOSDECODE + +This one prints all BIOS related information it can find in /dev/mem. +It used to be part of dmidecode itself, but as dmidecode was growing, +we felt that the non-DMI part had to be moved to a separate tool. + +OWNERSHIP + +This tool was written on a request by Luc Van de Velde for use with Novell +tools in his company. It retrieves the "ownership tag" that can be set on +most Compaq computers. Since it uses the same mechanisms dmidecode and +biosdecode use, and could be of some use for other people as well, we +decided to make it part of the project. + +VPDDECODE + +This tool prints the contents of the "vital product data" structure as +found in most IBM and Lenovo computers. It used to have a lookup table +for the machine name, but it was unreliable and hard to maintain so it +was ultimately dropped. It has a command line interface. diff --git a/doc/changelog b/doc/changelog new file mode 100644 index 0000000..476de63 --- /dev/null +++ b/doc/changelog @@ -0,0 +1,1009 @@ +------------------------------------------------------------------------ +r177 | nima | 2009-03-09 00:49:21 +1100 (Mon, 09 Mar 2009) | 2 lines + +Releasing v2.10.4. + +------------------------------------------------------------------------ +r176 | nima | 2009-03-08 22:32:42 +1100 (Sun, 08 Mar 2009) | 2 lines + +Adding spec file supplied by Clark Williams . + +------------------------------------------------------------------------ +r175 | nima | 2009-03-08 22:31:31 +1100 (Sun, 08 Mar 2009) | 3 lines + +Applied patch submitted by Clark Williams . + + +------------------------------------------------------------------------ +r174 | nima | 2009-02-23 00:34:24 +1100 (Mon, 23 Feb 2009) | 2 lines + +Fixed bug reported by Ralf Treinen. + +------------------------------------------------------------------------ +r173 | nima | 2009-02-14 01:39:23 +1100 (Sat, 14 Feb 2009) | 2 lines + +Removing spec file from upstream. + +------------------------------------------------------------------------ +r172 | nima | 2009-02-14 01:36:16 +1100 (Sat, 14 Feb 2009) | 2 lines + +Upped sub-version. + +------------------------------------------------------------------------ +r171 | nima | 2009-02-14 01:32:06 +1100 (Sat, 14 Feb 2009) | 2 lines + +Small changes - final touches for 2.10.1. + +------------------------------------------------------------------------ +r170 | nima | 2009-02-14 01:30:37 +1100 (Sat, 14 Feb 2009) | 3 lines + +Versioning now chagned to reflect the version of the upstream (dmidecode) +version with which python-dmidecode is in sync with. + +------------------------------------------------------------------------ +r169 | nima | 2009-01-13 23:48:28 +1100 (Tue, 13 Jan 2009) | 2 lines + +Fixed watch file. + +------------------------------------------------------------------------ +r168 | nima | 2009-01-13 00:06:34 +1100 (Tue, 13 Jan 2009) | 2 lines + +Debian changes completely separated from upstream. + +------------------------------------------------------------------------ +r167 | nima | 2009-01-13 00:04:52 +1100 (Tue, 13 Jan 2009) | 2 lines + +Removed Debian-specific targets from the makefile. + +------------------------------------------------------------------------ +r166 | nima | 2008-12-23 10:02:00 +1100 (Tue, 23 Dec 2008) | 2 lines + +Source file name change. + +------------------------------------------------------------------------ +r165 | nima | 2008-12-23 10:01:22 +1100 (Tue, 23 Dec 2008) | 2 lines + +A more complete dmidecode example. + +------------------------------------------------------------------------ +r164 | nima | 2008-12-23 09:40:51 +1100 (Tue, 23 Dec 2008) | 2 lines + +Applied the nice changes suggested by Piotr Ożarowsk. + +------------------------------------------------------------------------ +r163 | nima | 2008-12-23 00:37:43 +1100 (Tue, 23 Dec 2008) | 6 lines + +Cleaned up the fix for type(127). + +Added the second type of stuffed bios (upstream). + +Integrated dmidecode the binary into the test case for a more objective result. + +------------------------------------------------------------------------ +r162 | nima | 2008-12-22 20:06:43 +1100 (Mon, 22 Dec 2008) | 2 lines + +Fixed the type(127) problem (at least on this machine) - again. + +------------------------------------------------------------------------ +r161 | nima | 2008-12-21 23:52:51 +1100 (Sun, 21 Dec 2008) | 4 lines + +Removed unnecessay manpage. + +Spell my own name correctly. + +------------------------------------------------------------------------ +r160 | nima | 2008-12-21 22:31:36 +1100 (Sun, 21 Dec 2008) | 2 lines + +Added an upload into src.autonomy.net.au after source build. + +------------------------------------------------------------------------ +r159 | nima | 2008-12-21 22:27:52 +1100 (Sun, 21 Dec 2008) | 2 lines + +Fixed sample. + +------------------------------------------------------------------------ +r158 | nima | 2008-12-21 21:22:06 +1100 (Sun, 21 Dec 2008) | 6 lines + +Cleanup copyright. + +Cleanup debian/rules. + +Adding test.py to examples. + +------------------------------------------------------------------------ +r157 | nima | 2008-12-21 21:04:03 +1100 (Sun, 21 Dec 2008) | 2 lines + +Remove README.Debian - no point. + +------------------------------------------------------------------------ +r156 | nima | 2008-12-21 18:57:49 +1100 (Sun, 21 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r155 | nima | 2008-12-21 18:53:54 +1100 (Sun, 21 Dec 2008) | 3 lines + +Handle cases where user does not have appropriate permission to access the +memory file or device. + +------------------------------------------------------------------------ +r154 | nima | 2008-12-21 16:44:04 +1100 (Sun, 21 Dec 2008) | 2 lines + +Names. + +------------------------------------------------------------------------ +r153 | nima | 2008-12-21 16:43:06 +1100 (Sun, 21 Dec 2008) | 2 lines + +Better naming. + +------------------------------------------------------------------------ +r152 | nima | 2008-12-21 15:41:39 +1100 (Sun, 21 Dec 2008) | 4 lines + +Upped debhelper build-required version from 5 to 7. + +Final cleanups. + +------------------------------------------------------------------------ +r151 | nima | 2008-12-21 13:55:19 +1100 (Sun, 21 Dec 2008) | 2 lines + +Cleaned up and Lintian-approved. + +------------------------------------------------------------------------ +r150 | nima | 2008-12-21 13:48:05 +1100 (Sun, 21 Dec 2008) | 2 lines + +Email address fixed. + +------------------------------------------------------------------------ +r149 | nima | 2008-12-21 13:39:16 +1100 (Sun, 21 Dec 2008) | 2 lines + +Sigh. + +------------------------------------------------------------------------ +r148 | nima | 2008-12-21 13:38:35 +1100 (Sun, 21 Dec 2008) | 2 lines + +Changing to svn-buildpackage. + +------------------------------------------------------------------------ +r147 | nima | 2008-12-21 13:22:20 +1100 (Sun, 21 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r146 | nima | 2008-12-21 13:07:56 +1100 (Sun, 21 Dec 2008) | 2 lines + +Source generation. + +------------------------------------------------------------------------ +r145 | nima | 2008-12-21 12:41:57 +1100 (Sun, 21 Dec 2008) | 6 lines + +Fixed watchfile now that I've created a src (orig.tar.gz) repository. + +Added more copyright/lisencing information. + +More debianizing. + +------------------------------------------------------------------------ +r144 | nima | 2008-12-21 04:00:56 +1100 (Sun, 21 Dec 2008) | 2 lines + +Required for dh_installdocs. + +------------------------------------------------------------------------ +r143 | nima | 2008-12-21 03:54:32 +1100 (Sun, 21 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r142 | nima | 2008-12-21 03:52:15 +1100 (Sun, 21 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r141 | nima | 2008-12-21 03:49:40 +1100 (Sun, 21 Dec 2008) | 2 lines + +Removed out-of-place README. + +------------------------------------------------------------------------ +r140 | nima | 2008-12-21 03:47:18 +1100 (Sun, 21 Dec 2008) | 2 lines + +Hide private data from subversion. + +------------------------------------------------------------------------ +r139 | nima | 2008-12-21 03:46:37 +1100 (Sun, 21 Dec 2008) | 2 lines + +Remove private memory dumps. + +------------------------------------------------------------------------ +r138 | nima | 2008-12-21 03:45:39 +1100 (Sun, 21 Dec 2008) | 4 lines + +Added missing info to copyright file. + +Source creation target. + +------------------------------------------------------------------------ +r137 | nima | 2008-12-21 03:26:43 +1100 (Sun, 21 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r136 | nima | 2008-12-21 02:49:18 +1100 (Sun, 21 Dec 2008) | 4 lines + +Handle cases where user asks for invalid types. + +Updated test cases to test for this too. + +------------------------------------------------------------------------ +r135 | nima | 2008-12-21 02:32:30 +1100 (Sun, 21 Dec 2008) | 6 lines + +Version information now set once during init(). + +Bettered test cases. + +Case 127 magically fixed. + +------------------------------------------------------------------------ +r134 | nima | 2008-12-20 12:46:42 +1100 (Sat, 20 Dec 2008) | 2 lines + +Debian specific target. + +------------------------------------------------------------------------ +r133 | nima | 2008-12-20 12:44:55 +1100 (Sat, 20 Dec 2008) | 8 lines + +Removed "detected" from appearing in every single function call. TODO: An ivar +should be implemented to return this string, so further cleanup is still +required; as it stands, there is no access to this information anymore! + +Updated test case. + +Further general cleanup. + +------------------------------------------------------------------------ +r132 | nima | 2008-12-20 10:55:53 +1100 (Sat, 20 Dec 2008) | 4 lines + +Further testing shows that the segfault does not occur when the device is +/dev/mem, but does so for all images (where requested type is 127), suggesting +that the problem could be with the image or surrounding processes. + +------------------------------------------------------------------------ +r131 | nima | 2008-12-20 10:46:46 +1100 (Sat, 20 Dec 2008) | 2 lines + +Oops - fixed. + +------------------------------------------------------------------------ +r130 | nima | 2008-12-20 10:45:55 +1100 (Sat, 20 Dec 2008) | 3 lines + +Test case is close to complete, type 127 results in a segfault - (test case +is serving its purpose). + +------------------------------------------------------------------------ +r129 | nima | 2008-12-20 10:29:50 +1100 (Sat, 20 Dec 2008) | 3 lines + +Adding an image from parallel's desktop running Debian lenny, and another for +a physical server also running Debian. Both are intel 32 bit. + +------------------------------------------------------------------------ +r128 | nima | 2008-12-20 10:27:10 +1100 (Sat, 20 Dec 2008) | 4 lines + +More work on test case. + +Updated setup.py to reflect new version. + +------------------------------------------------------------------------ +r127 | nima | 2008-12-20 00:49:19 +1100 (Sat, 20 Dec 2008) | 2 lines + +More testing and fixes. + +------------------------------------------------------------------------ +r126 | nima | 2008-12-20 00:42:10 +1100 (Sat, 20 Dec 2008) | 2 lines + +Improved test case. + +------------------------------------------------------------------------ +r125 | nima | 2008-12-20 00:32:35 +1100 (Sat, 20 Dec 2008) | 2 lines + +Removed a printf() comment. + +------------------------------------------------------------------------ +r124 | nima | 2008-12-20 00:21:24 +1100 (Sat, 20 Dec 2008) | 6 lines + +Check that the path given with set_dev() is writeable. + +Don't crash when writing to a read-only file, return False instead. + +Missing an INCREF in get_dev() fixed. + +------------------------------------------------------------------------ +r123 | nima | 2008-12-19 22:56:39 +1100 (Fri, 19 Dec 2008) | 2 lines + +Test for write permission prior to write attempts. + +------------------------------------------------------------------------ +r122 | nima | 2008-12-19 20:02:52 +1100 (Fri, 19 Dec 2008) | 2 lines + +Fixed watch file. + +------------------------------------------------------------------------ +r121 | nima | 2008-12-19 16:05:38 +1100 (Fri, 19 Dec 2008) | 4 lines + +Received ITP auto-ack: #509169. + +More debianizing cleanup. + +------------------------------------------------------------------------ +r120 | nima | 2008-12-19 15:13:24 +1100 (Fri, 19 Dec 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r119 | nima | 2008-12-19 15:07:06 +1100 (Fri, 19 Dec 2008) | 3 lines + +Further work in enforcing the Debian policy in package based on advice from +`POX' and the documentation. + +------------------------------------------------------------------------ +r118 | nima | 2008-12-19 13:23:32 +1100 (Fri, 19 Dec 2008) | 2 lines + +Removed junk and doing more debianizing - WIP. + +------------------------------------------------------------------------ +r117 | nima | 2008-12-19 00:49:57 +1100 (Fri, 19 Dec 2008) | 2 lines + +Updated. + +------------------------------------------------------------------------ +r116 | nima | 2008-12-19 00:48:52 +1100 (Fri, 19 Dec 2008) | 6 lines + +The dmidecode.type() call not takes ints, not strings. + +Adding an example directory. + +Adding test case. + +------------------------------------------------------------------------ +r115 | nima | 2008-12-19 00:45:37 +1100 (Fri, 19 Dec 2008) | 4 lines + +The dmidecode.type() call not takes ints, not strings. + +Adding an example directory. + +------------------------------------------------------------------------ +r114 | nima | 2008-12-18 12:12:50 +1100 (Thu, 18 Dec 2008) | 5 lines + +More upstream changes implemented, see CHANGELOG by Jean Delvare from the +period 2008-02-16 to 2008-11-23. + +These changes have been made, but not yet fully tested. + +------------------------------------------------------------------------ +r113 | nima | 2008-12-18 00:26:57 +1100 (Thu, 18 Dec 2008) | 5 lines + +Claim to support revision 32 of Intel AP-485 (CPUID). No relevant change since +revision 31. + +Update reference to AMD CPUID document. + +------------------------------------------------------------------------ +r112 | nima | 2008-12-18 00:11:35 +1100 (Thu, 18 Dec 2008) | 2 lines + +Handle chassis information records of size 19 (DMI type 3). + +------------------------------------------------------------------------ +r111 | nima | 2008-12-18 00:00:12 +1100 (Thu, 18 Dec 2008) | 2 lines + +And the debian subfolder itself... + +------------------------------------------------------------------------ +r110 | nima | 2008-12-17 23:59:32 +1100 (Wed, 17 Dec 2008) | 2 lines + +Debianizing dmidecode. + +------------------------------------------------------------------------ +r109 | nima | 2008-12-17 18:30:04 +1100 (Wed, 17 Dec 2008) | 2 lines + +Adding spec file written by Joel Heenan. + +------------------------------------------------------------------------ +r108 | nima | 2008-12-17 18:20:56 +1100 (Wed, 17 Dec 2008) | 2 lines + +Cleaning up source area, ready for debianizing, and rpm after that. + +------------------------------------------------------------------------ +r107 | nima | 2008-11-01 01:45:34 +1100 (Sat, 01 Nov 2008) | 2 lines + +Changed default target of Makefile back to `setup.py' method of installation. + +------------------------------------------------------------------------ +r106 | nima | 2008-11-01 01:41:02 +1100 (Sat, 01 Nov 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r105 | nima | 2008-11-01 01:33:03 +1100 (Sat, 01 Nov 2008) | 3 lines + +This commit closes #2 reported by Justin Cook, the ticket will remain open +until Justin confirms this however. + +------------------------------------------------------------------------ +r104 | nima | 2008-11-01 01:07:22 +1100 (Sat, 01 Nov 2008) | 6 lines + +Implemented reading a dump to - this concludes syncing to the upstream release. + +Next, exceptions should be thrown in certain places, more error checking in the +python side of things, and also in relation to setting and unsetting of the +alternate memory file. + +------------------------------------------------------------------------ +r103 | nima | 2008-11-01 00:42:35 +1100 (Sat, 01 Nov 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r102 | nima | 2008-11-01 00:38:24 +1100 (Sat, 01 Nov 2008) | 3 lines + +Fixed dump. The `offset' problem was not really an offset problem - it was a +silly typo. + +------------------------------------------------------------------------ +r101 | nima | 2008-11-01 00:24:04 +1100 (Sat, 01 Nov 2008) | 2 lines + +Missed two lines. + +------------------------------------------------------------------------ +r100 | nima | 2008-11-01 00:19:50 +1100 (Sat, 01 Nov 2008) | 3 lines + +Dump-to-file is almost working, there seems to be a 4-byte misalignment in the +produced file though for now - needs to be fixed. + +------------------------------------------------------------------------ +r99 | nima | 2008-10-31 22:43:15 +1100 (Fri, 31 Oct 2008) | 2 lines + +Removed junk comments. + +------------------------------------------------------------------------ +r98 | nima | 2008-10-31 22:21:24 +1100 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r97 | nima | 2008-10-31 22:15:19 +1100 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r96 | nima | 2008-10-31 21:24:41 +1100 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r95 | nima | 2008-10-31 20:05:23 +1100 (Fri, 31 Oct 2008) | 6 lines + +Integration of required `dmiopt.h' bits. +Removed QUIETness code. +Other cleanups. +Added get/set methods for changinf the default /dev/mem device. + + +------------------------------------------------------------------------ +r94 | nima | 2008-10-31 20:02:21 +1100 (Fri, 31 Oct 2008) | 2 lines + +Removed traces of `_' and integrating required bits from dmiopt.h. + +------------------------------------------------------------------------ +r93 | nima | 2008-10-31 20:01:41 +1100 (Fri, 31 Oct 2008) | 2 lines + +Removed traces of `_'. + +------------------------------------------------------------------------ +r92 | nima | 2008-10-31 20:00:26 +1100 (Fri, 31 Oct 2008) | 2 lines + +Integrating the required bits from dmiopt into dmihelper. + +------------------------------------------------------------------------ +r91 | nima | 2008-10-31 19:39:12 +1100 (Fri, 31 Oct 2008) | 4 lines + +Removed `_' buffer. +Removed use of `FLAGS_QUIET' as it makes no sense for a module. +Removed the `submain()' function. + +------------------------------------------------------------------------ +r90 | nima | 2008-10-31 19:30:00 +1100 (Fri, 31 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r89 | nima | 2008-10-31 19:29:06 +1100 (Fri, 31 Oct 2008) | 2 lines + +Removed dependency on dmiopt. + +------------------------------------------------------------------------ +r88 | nima | 2008-10-31 19:28:33 +1100 (Fri, 31 Oct 2008) | 2 lines + +Removed verbose printout. + +------------------------------------------------------------------------ +r87 | nima | 2008-10-30 21:14:24 +1100 (Thu, 30 Oct 2008) | 2 lines + +Removed final traces of the `_' buffer. + +------------------------------------------------------------------------ +r86 | nima | 2008-10-30 13:11:56 +1100 (Thu, 30 Oct 2008) | 2 lines + +Implementing (incomplete) upstream changes. + +------------------------------------------------------------------------ +r85 | nima | 2008-10-29 18:15:35 +1100 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r84 | nima | 2008-10-29 18:13:49 +1100 (Wed, 29 Oct 2008) | 5 lines + +Adding man pages from upstream. Sooner or later, these will be removed, as will +all other work that's simply replicating the demidecode binary. All this +package should provide is the python module, and some py-module-specific man +pages. + +------------------------------------------------------------------------ +r83 | nima | 2008-10-29 18:10:24 +1100 (Wed, 29 Oct 2008) | 4 lines + +Recoded the new work from upstream into these (main) files. The options to +dump the memory image onto file, and read back from it has not yet been +worked in, but the underlying work has been completed. + +------------------------------------------------------------------------ +r82 | nima | 2008-10-29 18:09:10 +1100 (Wed, 29 Oct 2008) | 3 lines + +Tested new dmidecode python module with this example file. A real test case +will be implemented sometime in future. + +------------------------------------------------------------------------ +r81 | nima | 2008-10-29 18:07:56 +1100 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r80 | nima | 2008-10-29 18:07:13 +1100 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r79 | nima | 2008-10-29 18:06:47 +1100 (Wed, 29 Oct 2008) | 2 lines + +Using dmihelper now. + +------------------------------------------------------------------------ +r78 | nima | 2008-10-29 18:05:58 +1100 (Wed, 29 Oct 2008) | 2 lines + +Upstream. + +------------------------------------------------------------------------ +r77 | nima | 2008-10-29 18:04:19 +1100 (Wed, 29 Oct 2008) | 2 lines + +Upstream. + +------------------------------------------------------------------------ +r76 | nima | 2008-10-29 18:04:03 +1100 (Wed, 29 Oct 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r75 | nima | 2008-10-29 17:36:23 +1100 (Wed, 29 Oct 2008) | 2 lines + +Renamed to a more appropriate name. + +------------------------------------------------------------------------ +r74 | nima | 2008-10-29 17:35:21 +1100 (Wed, 29 Oct 2008) | 3 lines + +Committing new dmidecode helper functions, and next, renaming it to a +meaningful name. + +------------------------------------------------------------------------ +r73 | nima | 2008-10-29 17:27:31 +1100 (Wed, 29 Oct 2008) | 3 lines + +Synced to the latest from upstream, with a light modification required for the +module. + +------------------------------------------------------------------------ +r72 | nima | 2008-10-18 20:34:09 +1100 (Sat, 18 Oct 2008) | 5 lines + +Python does not have unsigned integers, hence %u and %lu in printf style +strings are taken to be literal strings, not space-holders. All occurences +of '%u' (78) have been amended to '%i', there was no '%lu'. + + +------------------------------------------------------------------------ +r71 | nima | 2008-10-18 20:28:46 +1100 (Sat, 18 Oct 2008) | 4 lines + +Fixed bug reported by by Justin Cook, where dmidecode.type() would segfault. +It turned out to be some code that was forgotten about during the conversion, or +at least very incomplete and wrong. + +------------------------------------------------------------------------ +r70 | nima | 2008-10-17 02:52:48 +1100 (Fri, 17 Oct 2008) | 2 lines + +Remove efence. + +------------------------------------------------------------------------ +r69 | nima | 2008-09-05 13:08:02 +1000 (Fri, 05 Sep 2008) | 2 lines + +Fixed a bug that crashed dmidecode.slot(). + +------------------------------------------------------------------------ +r68 | nima | 2008-09-04 16:09:55 +1000 (Thu, 04 Sep 2008) | 5 lines + +Cleaning up of the dmidecode module, mostly conversion of things that can be +Python `None's or `Int's but were `String'. + +Replaced a meaningless int dictionary key to `data'. + +------------------------------------------------------------------------ +r67 | nima | 2008-09-04 12:26:09 +1000 (Thu, 04 Sep 2008) | 3 lines + +Work on CPU details - seemed to been a bug with appending to a string rather +than rewriting it. + +------------------------------------------------------------------------ +r66 | nima | 2008-08-09 00:15:47 +1000 (Sat, 09 Aug 2008) | 4 lines + +Replaced `%X' with `%x'. + +Logic cleanup - Put the `Handle' info back into the dictionary. + +------------------------------------------------------------------------ +r65 | nima | 2008-08-08 17:57:44 +1000 (Fri, 08 Aug 2008) | 2 lines + +Anoher bug fix, this time in baseboard. + +------------------------------------------------------------------------ +r64 | nima | 2008-08-08 17:27:36 +1000 (Fri, 08 Aug 2008) | 3 lines + +Fixed many major bugs (all of which were expected based on the way we mass +converted all the `case' blocks. + +------------------------------------------------------------------------ +r63 | nima | 2008-08-07 22:32:39 +1000 (Thu, 07 Aug 2008) | 2 lines + +Cleaned up a little. + +------------------------------------------------------------------------ +r62 | nima | 2008-08-07 11:34:15 +1000 (Thu, 07 Aug 2008) | 2 lines + +Fixed some conversion bits missed during last night. + +------------------------------------------------------------------------ +r61 | nima | 2008-08-06 23:32:37 +1000 (Wed, 06 Aug 2008) | 2 lines + +Updated authors file with developers of the dmidecode python module. + +------------------------------------------------------------------------ +r60 | nima | 2008-08-06 23:27:26 +1000 (Wed, 06 Aug 2008) | 2 lines + +Changed to GNU GPL v3 License. + +------------------------------------------------------------------------ +r59 | nima | 2008-08-06 22:59:03 +1000 (Wed, 06 Aug 2008) | 2 lines + +Removed `sudo'. + +------------------------------------------------------------------------ +r58 | nima | 2008-08-06 22:52:46 +1000 (Wed, 06 Aug 2008) | 4 lines + +Completed `case 126', thought to have been completed in previous commit. + +Some housekeeping elsewhere. + +------------------------------------------------------------------------ +r57 | nima | 2008-08-06 18:51:05 +1000 (Wed, 06 Aug 2008) | 4 lines + +Completed all conversions! Only problem now is of course finding all the memory +leaks and introduced logic errors which (confirmed) do exists - use valgrind and +see. + +------------------------------------------------------------------------ +r56 | vwhitteron | 2008-08-06 18:29:18 +1000 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 34' through `Case 39' +------------------------------------------------------------------------ +r55 | nima | 2008-08-06 18:12:43 +1000 (Wed, 06 Aug 2008) | 2 lines + +Almost there! + +------------------------------------------------------------------------ +r54 | vwhitteron | 2008-08-06 17:49:23 +1000 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 29' and `Case 32' +------------------------------------------------------------------------ +r53 | nima | 2008-08-06 17:42:34 +1000 (Wed, 06 Aug 2008) | 2 lines + +Converted `case 30'. + +------------------------------------------------------------------------ +r52 | vwhitteron | 2008-08-06 17:40:42 +1000 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 26', `Case 27' and `Case 28' +------------------------------------------------------------------------ +r51 | nima | 2008-08-06 17:30:41 +1000 (Wed, 06 Aug 2008) | 3 lines + +Added `PyObject *data;' to all remaining functions which will generate a warning +as to indicate these need to be converted. + +------------------------------------------------------------------------ +r50 | nima | 2008-08-06 17:27:30 +1000 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `csae 28'. + +------------------------------------------------------------------------ +r49 | nima | 2008-08-06 17:23:35 +1000 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `case 27', and fixed error in last commit for `case 26'. + +------------------------------------------------------------------------ +r48 | nima | 2008-08-06 17:19:27 +1000 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `case 26'. + +------------------------------------------------------------------------ +r47 | vwhitteron | 2008-08-06 17:09:11 +1000 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 23', `Case 24', `Case24' and `Case 25' +------------------------------------------------------------------------ +r46 | nima | 2008-08-06 17:07:20 +1000 (Wed, 06 Aug 2008) | 2 lines + +Completed functions for `case 25'. + +------------------------------------------------------------------------ +r45 | nima | 2008-08-06 17:00:41 +1000 (Wed, 06 Aug 2008) | 2 lines + +Converted function for `case 24'. + +------------------------------------------------------------------------ +r44 | nima | 2008-08-06 16:59:35 +1000 (Wed, 06 Aug 2008) | 2 lines + +More fixes on recent commits (by me), and more conversions on functions. + +------------------------------------------------------------------------ +r43 | vwhitteron | 2008-08-06 16:57:13 +1000 (Wed, 06 Aug 2008) | 1 line + +Completed `Case 22' +------------------------------------------------------------------------ +r42 | nima | 2008-08-06 16:53:24 +1000 (Wed, 06 Aug 2008) | 2 lines + +Oops. Fixed stupidity on last commit. + +------------------------------------------------------------------------ +r41 | nima | 2008-08-06 16:52:01 +1000 (Wed, 06 Aug 2008) | 2 lines + +Completed functions called by `case 21' and `case 22'. + +------------------------------------------------------------------------ +r40 | nima | 2008-08-06 16:42:54 +1000 (Wed, 06 Aug 2008) | 3 lines + +Completed `case 21' functions. +Cleanup. + +------------------------------------------------------------------------ +r39 | vwhitteron | 2008-08-06 16:39:53 +1000 (Wed, 06 Aug 2008) | 2 lines + +Completed `case 19' and `case 20'. + +------------------------------------------------------------------------ +r38 | nima | 2008-08-06 16:17:21 +1000 (Wed, 06 Aug 2008) | 2 lines + +Started on `case 19'. + +------------------------------------------------------------------------ +r37 | nima | 2008-08-06 15:43:05 +1000 (Wed, 06 Aug 2008) | 2 lines + +Completed `case 18' and `case 19'. + +------------------------------------------------------------------------ +r36 | nima | 2008-08-06 15:06:03 +1000 (Wed, 06 Aug 2008) | 2 lines + +Added `case 16' and `case 17'. + +------------------------------------------------------------------------ +r35 | nima | 2008-08-06 14:26:45 +1000 (Wed, 06 Aug 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r34 | nima | 2008-08-06 14:05:06 +1000 (Wed, 06 Aug 2008) | 2 lines + +Converted `case 5', `case 6', and `case 7'. + +------------------------------------------------------------------------ +r33 | nima | 2008-08-01 17:59:51 +1000 (Fri, 01 Aug 2008) | 2 lines + +Default case set to return python's `None'. + +------------------------------------------------------------------------ +r32 | nima | 2008-08-01 17:58:24 +1000 (Fri, 01 Aug 2008) | 2 lines + +Completed `case 15'. + +------------------------------------------------------------------------ +r31 | nima | 2008-07-29 14:33:59 +1000 (Tue, 29 Jul 2008) | 2 lines + +Completed `case 9' and case `8'. + +------------------------------------------------------------------------ +r30 | nima | 2008-07-29 11:31:21 +1000 (Tue, 29 Jul 2008) | 2 lines + +Completed `case 11'. + +------------------------------------------------------------------------ +r29 | nima | 2008-07-29 11:28:04 +1000 (Tue, 29 Jul 2008) | 2 lines + +Completed `case 12' and `case 14'. + +------------------------------------------------------------------------ +r28 | nima | 2008-07-29 10:29:05 +1000 (Tue, 29 Jul 2008) | 6 lines + +Bug fix (removed unnecessary breakr). + +Changed %i back to %u for now, even though it does not work with Python. +Better to do the change globally - later. + + +------------------------------------------------------------------------ +r27 | nima | 2008-07-28 20:14:38 +1000 (Mon, 28 Jul 2008) | 2 lines + +Try and determine python version dynamically. + +------------------------------------------------------------------------ +r26 | nima | 2008-07-27 22:15:51 +1000 (Sun, 27 Jul 2008) | 2 lines + +Completed `case 4', which was thought to have been completed falsely before. + +------------------------------------------------------------------------ +r25 | nima | 2008-07-26 19:15:53 +1000 (Sat, 26 Jul 2008) | 6 lines + +Completed cases 1, 4, and 13. Also altered the main PyDict object such that +each case has a value of a list to which items are appended. Without this, +each object of the same type would overwrite the previous, for example, 8 +processors would result in one single cpu with data pertaining to the last +cpu (7). + +------------------------------------------------------------------------ +r24 | nima | 2008-07-26 09:35:30 +1000 (Sat, 26 Jul 2008) | 2 lines + +Completed `case 0'. + +------------------------------------------------------------------------ +r23 | root | 2008-07-25 23:17:24 +1000 (Fri, 25 Jul 2008) | 2 lines + +Added `case 3'. + +------------------------------------------------------------------------ +r22 | root | 2008-07-25 22:51:02 +1000 (Fri, 25 Jul 2008) | 2 lines + +No new moves, cleanup on last commit and better test file template. + +------------------------------------------------------------------------ +r21 | root | 2008-07-25 22:27:26 +1000 (Fri, 25 Jul 2008) | 8 lines + +Next phase is to start converting all pure C functions returning `char *' and +such to new Pythonized functions returning `PyObject *', to save from having +to `PyString_FromString()' and similar, and more importantly, some functions +return a long string that could better be represented by a PyDict, PyList etc. + +This is the first commit of many more to come, converting a `case XX:' at a +time, making sure that each commit can actually compile and run. + +------------------------------------------------------------------------ +r20 | root | 2008-07-25 11:13:13 +1000 (Fri, 25 Jul 2008) | 2 lines + +Cleanup (DECREF). + +------------------------------------------------------------------------ +r19 | root | 2008-07-25 11:12:46 +1000 (Fri, 25 Jul 2008) | 2 lines + +Add in electric fence for now. + +------------------------------------------------------------------------ +r18 | root | 2008-07-25 11:11:39 +1000 (Fri, 25 Jul 2008) | 5 lines + +This was the culprit causing the `Abort' crash, valgrind showed that this file +is where the error lied. Stephen Darragh discovered this, and the fix has been +to use vsnprintf() and not vsprintf(), which should have been the case to begin +with really. + +------------------------------------------------------------------------ +r17 | root | 2008-07-25 10:46:00 +1000 (Fri, 25 Jul 2008) | 2 lines + +Cleaner to not vsprintf() at all if `format' is NULL. + +------------------------------------------------------------------------ +r16 | root | 2008-07-25 10:45:11 +1000 (Fri, 25 Jul 2008) | 2 lines + + The `biosdecode' is a program, nothing to do with the module, removed. + +------------------------------------------------------------------------ +r15 | nima | 2008-07-25 00:36:16 +1000 (Fri, 25 Jul 2008) | 2 lines + +Added my small role in AUTHORS so nobody bugs others for my code. + +------------------------------------------------------------------------ +r14 | nima | 2008-07-25 00:17:16 +1000 (Fri, 25 Jul 2008) | 2 lines + +Cleanup. + +------------------------------------------------------------------------ +r13 | nima | 2008-07-24 22:02:12 +1000 (Thu, 24 Jul 2008) | 2 lines + +Some cleaning, crash in interactive mode on dmidecode.bios() still not fixed. + +------------------------------------------------------------------------ +r12 | nima | 2008-07-24 20:48:01 +1000 (Thu, 24 Jul 2008) | 3 lines + +Now that code has been converted, work has started on "bios", and at the point +of proof-of-concept. + +------------------------------------------------------------------------ +r11 | nima | 2008-07-05 01:24:22 +1000 (Sat, 05 Jul 2008) | 3 lines + +Removing printf() statements, instead adding to Python dictionary object, +untested. + +------------------------------------------------------------------------ +r10 | nima | 2008-07-04 01:59:08 +1000 (Fri, 04 Jul 2008) | 6 lines + +Major changes have been implemented, alas, untested, in hope to move towards +a new version of dmi decode where rather than having data just printed to +screen in functions, data is passed around, and some data structure is +constructed, which is then used to construct the Python list/dicitonary +objects. + +------------------------------------------------------------------------ +r9 | nima | 2008-07-02 17:02:05 +1000 (Wed, 02 Jul 2008) | 4 lines + +WIP - Adding h->type value to catsprintf (as int major), later will add minor +too, and finally will replace the buffer with a linked list of structs, which +will be added to the python dictionary/list. + +------------------------------------------------------------------------ +r8 | nima | 2008-07-02 14:53:48 +1000 (Wed, 02 Jul 2008) | 3 lines + +Now the `Handle' hex codes are the key values in the python dictionaries +returned. + +------------------------------------------------------------------------ +r7 | nima | 2008-07-02 09:14:17 +1000 (Wed, 02 Jul 2008) | 2 lines + +Brought main() back into the python module and fixed malloc/free problems. + +------------------------------------------------------------------------ +r6 | nima | 2008-07-01 17:05:57 +1000 (Tue, 01 Jul 2008) | 2 lines + +Removed junk comments. + +------------------------------------------------------------------------ +r5 | nima | 2008-07-01 16:11:21 +1000 (Tue, 01 Jul 2008) | 2 lines + +Update for file renames. + +------------------------------------------------------------------------ +r4 | nima | 2008-07-01 16:04:02 +1000 (Tue, 01 Jul 2008) | 2 lines + +Better named. + +------------------------------------------------------------------------ +r3 | nima | 2008-07-01 16:01:21 +1000 (Tue, 01 Jul 2008) | 5 lines + +Project progressing along excellently. The python module is now functional and +has as many methods as the --type option takes. + +Next is to expand and harness the code around the `--string' option. + +------------------------------------------------------------------------ +r2 | nima | 2008-07-01 00:14:46 +1000 (Tue, 01 Jul 2008) | 4 lines + +Split out the module header into its own file. + +Cleaned up Makefile a little. + +------------------------------------------------------------------------ +r1 | nima | 2008-06-30 22:08:58 +1000 (Mon, 30 Jun 2008) | 2 lines + +First commit to SVN. + +------------------------------------------------------------------------ diff --git a/doc/dmidump.py b/doc/dmidump.py new file mode 100755 index 0000000..a6c7bf7 --- /dev/null +++ b/doc/dmidump.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python2.4 +import dmidecode +import sys +from pprint import pprint + +#. Test all functions using /dev/mem... +print "*** bios ***\n"; dmidecode.bios() +print "*** system ***\n"; dmidecode.system() +print "*** system ***\n"; dmidecode.system() +print "*** baseboard ***\n"; dmidecode.baseboard() +print "*** chassis ***\n"; dmidecode.chassis() +print "*** processor ***\n"; dmidecode.processor() +print "*** memory ***\n"; dmidecode.memory() +print "*** cache ***\n"; dmidecode.cache() +print "*** connector ***\n"; dmidecode.connector() +print "*** slot ***\n"; dmidecode.slot() + +#. Now test get/set of memory device file... +print dmidecode.get_dev() +print dmidecode.set_dev("private/mem-XXX"); +print dmidecode.get_dev() + +#. Test taking a dump... +print dmidecode.dump() + +#. Test reading the dump... +print "*** bios ***\n"; pprint(dmidecode.bios()) +print "*** system ***\n"; pprint(dmidecode.system()) +print "*** system ***\n"; pprint(dmidecode.system()) +print "*** baseboard ***\n"; pprint(dmidecode.baseboard()) +print "*** chassis ***\n"; pprint(dmidecode.chassis()) +print "*** processor ***\n"; pprint(dmidecode.processor()) +print "*** memory ***\n"; pprint(dmidecode.memory()) +print "*** cache ***\n"; pprint(dmidecode.cache()) +print "*** connector ***\n"; pprint(dmidecode.connector()) +print "*** slot ***\n"; pprint(dmidecode.slot()) + +sys.exit(0) +print "*** bios ***\n"; pprint(dmidecode.bios()) +print "*** system ***\n"; pprint(dmidecode.system()) +print "*** baseboard ***\n"; pprint(dmidecode.baseboard()) +print "*** chassis ***\n"; pprint(dmidecode.chassis()) +print "*** processor ***\n"; pprint(dmidecode.processor()) +print "*** memory ***\n"; pprint(dmidecode.memory()) +print "*** cache ***\n"; pprint(dmidecode.cache()) +print "*** connector ***\n"; pprint(dmidecode.connector()) +print "*** slot ***\n"; pprint(dmidecode.slot()) + +for v in dmidecode.memory().values(): + if type(v) == dict and v['dmi_type'] == 17: + pprint(v['data']['Size']), + +pprint(dmidecode.type('3')) +pprint(dmidecode.type('bios')) diff --git a/examples/dmidump.py b/examples/dmidump.py new file mode 100755 index 0000000..161da44 --- /dev/null +++ b/examples/dmidump.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python2.4 +import dmidecode +import sys +from pprint import pprint + +#. Test reading the dump... +print "*** bios ***\n"; pprint(dmidecode.bios()) +print "*** system ***\n"; pprint(dmidecode.system()) +print "*** system ***\n"; pprint(dmidecode.system()) +print "*** baseboard ***\n"; pprint(dmidecode.baseboard()) +print "*** chassis ***\n"; pprint(dmidecode.chassis()) +print "*** processor ***\n"; pprint(dmidecode.processor()) +print "*** memory ***\n"; pprint(dmidecode.memory()) +print "*** cache ***\n"; pprint(dmidecode.cache()) +print "*** connector ***\n"; pprint(dmidecode.connector()) +print "*** slot ***\n"; pprint(dmidecode.slot()) + +_=[dmidecode.type(_) and pprint(dmidecode.type(_)) for _ in range(1,128)] diff --git a/examples/test.py b/examples/test.py new file mode 100755 index 0000000..79f11d3 --- /dev/null +++ b/examples/test.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +#.awk '$0 ~ /case [0-9]+: .. 3/ { sys.stdout.write($2 }' src/dmidecode.c|tr ':\n' ', ' + +from pprint import pprint +import os, sys, random, tempfile, time +import commands + +dmidecode = True in [os.path.exists(os.path.join(_, "dmidecode")) for _ in os.getenv("PATH").split(':')] +if dmidecode: + print "Please install `dmidecode' (the binary) for complete testing." + +FH, DUMP = tempfile.mkstemp() +os.unlink(DUMP) +os.close(FH) + +total = 0 +success = 0 + +def test(r): + global total + global success + + total += 1 + if r: + sys.stdout.write("Good\n") + success += 1 + return True + else: + sys.stdout.write("FAILED\n") + return False + +total += 1 +print "-"*80 +sys.stdout.write("Importing module...") +try: + import dmidecode + success += 1 + sys.stdout.write("Done\n") + sys.stdout.write(" * Version: %s\n"%dmidecode.version) + sys.stdout.write(" * DMI Version String: %s\n"%dmidecode.dmi) + + print "-"*80 + sys.stdout.write("Testing that default device is /dev/mem...") + test(dmidecode.get_dev() == "/dev/mem") + + sys.stdout.write("Testing that write-lock will not break on dump()...") + test(not dmidecode.dump()) + + sys.stdout.write("Testing ability to change device to %s..."%DUMP) + test(dmidecode.set_dev(DUMP)) + + sys.stdout.write("Testing that device has changed to %s..."%DUMP) + test(dmidecode.get_dev() == DUMP) + + sys.stdout.write("Testing that write on new file is ok...") + test(dmidecode.dump()) + + sys.stdout.write("Testing that file was actually written...") + time.sleep(0.1) + test(os.path.exists(DUMP)) + os.unlink(DUMP) + + types = range(0, 42)+range(126, 128) + bad_types = [-1, -1000, 256] + sections = ["bios", "system", "baseboard", "chassis", "processor", "memory", "cache", "connector", "slot"] + devices = [] + if os.path.exists("private"): + devices.extend([os.path.join("private", _) for _ in os.listdir("private")]) + devices.remove('private/.svn') + else: + sys.stdout.write("If you have memory dumps to test, create a directory called `private' and drop them in there.\n") + devices.append("/dev/mem") + random.shuffle(types) + random.shuffle(devices) + random.shuffle(sections) + + for dev in devices: + sys.stdout.write(" * Testing %s..."%dev); sys.stdout.flush() + if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): + print "-"*80 + print sections + for section in sections: + sys.stdout.write(" * Testing %s..."%section); sys.stdout.flush() + output = getattr(dmidecode, section)() + test(output is not False) + if output: sys.stdout.write(" * %s\n"%output.keys()) + + print "-"*80 + for i in bad_types: + sys.stdout.write(" * Testing bad type %i..."%i); sys.stdout.flush() + try: + output = dmidecode.type(i) + test(output is False) + except SystemError: + sys.stdout.write("FAILED\n") + + print "-"*80 + for i in types: + sys.stdout.write(" * Testing type %i..."%i); sys.stdout.flush() + output = dmidecode.type(i) + if dmidecode: + _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') + test(len(_output) == 1 and len(output) == 0 or True) + else: + test(output is not False) + if output: + sys.stdout.write(" * %s\n"%output.keys()) + +except ImportError: + sys.stdout.write("FAILED\n") + +sys.stdout.write("Score: %d/%d\n"%(success, total)) diff --git a/man/biosdecode.8 b/man/biosdecode.8 new file mode 100644 index 0000000..46bea95 --- /dev/null +++ b/man/biosdecode.8 @@ -0,0 +1,83 @@ +.TH BIOSDECODE 8 "February 2007" "dmidecode" +.SH NAME +biosdecode \- \s-1BIOS\s0 information decoder +.SH SYNOPSIS +.B biosdecode +.RB [ OPTIONS ] + +.SH DESCRIPTION +.B biosdecode +parses the \s-1BIOS\s0 memory and prints information about all structures (or +entry points) it knows of. Currently known entry point types are: +.IP \(bu "\w'\(bu'u+1n" +\s-1SMBIOS\s0 (System Management \s-1BIOS\s0) +.br +Use +.B dmidecode +for a more detailed output. +.IP \(bu +\s-1DMI\s0 (Desktop Management Interface, a legacy version of \s-1SMBIOS\s0) +.br +Use +.B dmidecode +for a more detailed output. +.IP \(bu +\s-1SYSID\s0 +.IP \(bu +\s-1PNP\s0 (Plug and Play) +.IP \(bu +\s-1ACPI\s0 (Advanced Configuration and Power Interface) +.IP \(bu +\s-1BIOS32\s0 (\s-1BIOS32\s0 Service Directory) +.IP \(bu +\s-1PIR\s0 (\s-1PCI\s0 \s-1IRQ\s0 Routing) +.IP \(bu +\s-132OS\s0 (\s-1BIOS32\s0 Extension, Compaq-specific) +.br +See +.B ownership +for a Compaq ownership tag retrieval tool. +.IP \(bu +\s-1SNY\s0 (Sony-specific, not decoded) +.IP \(bu +\s-1VPD\s0 (Vital Product Data, IBM-specific) +.br +Use +.B vpddecode +for a more detailed output. +.IP \(bu +\s-1FJKEYINF\s0 (Application Panel, Fujitsu-specific) + +.PP +.B biosdecode +started its life as a part of +.B dmidecode +but as more entry point types were added, if was moved to a different +program. + +.SH OPTIONS +.TP +.BR "-d" ", " "--dev-mem FILE" +Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) +.TP +.BR "-h" ", " "--help" +Display usage information and exit +.TP +.BR "-V" ", " "--version" +Display the version and exit + +.SH FILES +.I /dev/mem +.SH BUGS +Most of the time, +.B biosdecode +prints too much information (you don't really care about addresses) +or not enough (because it doesn't follow pointers and has no lookup +tables). +.SH AUTHORS +Alan Cox, Jean Delvare +.SH "SEE ALSO" +.BR dmidecode (8), +.BR mem (4), +.BR ownership (8), +.BR vpddecode (8) diff --git a/man/dmidecode.8 b/man/dmidecode.8 new file mode 100644 index 0000000..1e8fed8 --- /dev/null +++ b/man/dmidecode.8 @@ -0,0 +1,236 @@ +.TH DMIDECODE 8 "October 2008" "dmidecode" +.SH NAME +dmidecode \- \s-1DMI\s0 table decoder +.SH SYNOPSIS +.B dmidecode +.RB [ OPTIONS ] + +.SH DESCRIPTION +.B dmidecode +is a tool for dumping a computer's \s-1DMI\s0 (some say \s-1SMBIOS\s0) table +contents in a human-readable format. This table contains a description of the +system's hardware components, as well as other useful pieces of information +such as serial numbers and \s-1BIOS\s0 revision. Thanks to this table, you can +retrieve this information without having to probe for the actual hardware. +While this is a good point in terms of report speed and safeness, this also +makes the presented information possibly unreliable. + +The \s-1DMI\s0 table doesn't only describe what the system is currently made +of, it also can report the possible evolutions (such as the fastest supported +\s-1CPU\s0 or the maximal amount of memory supported). + +\s-1SMBIOS\s0 stands for System Management \s-1BIOS\s0, while \s-1DMI\s0 +stands for Desktop Management Interface. Both standards are tightly related +and developed by the \s-1DMTF\s0 (Desktop Management Task Force). + +As you run it, +.B dmidecode +will try to locate the \s-1DMI\s0 table. If it succeeds, it will then parse +this table and display a list of records like this one: + +Handle 0x0002, DMI type 2, 8 bytes. +Base Board Information + Manufacturer: Intel + Product Name: C440GX+ + Version: 727281-001 + Serial Number: INCY92700942 + +Each record has: +.IP \(bu "\w'\(bu'u+1n" +A handle. This is a unique identifier, which allows records to +reference each other. For example, processor records usually reference +cache memory records using their handles. +.IP \(bu +A type. The \s-1SMBIOS\s0 specification defines different types of elements +a computer can be made of. In this example, the type is 2, which +means that the record contains "Base Board Information". +.IP \(bu +A size. Each record has a 4-byte header (2 for the handle, 1 for the type, +1 for the size), the rest is used by the record data. This value doesn't +take text strings into account (these are placed at the end of the record), +so the actual length of the record may be (and is often) greater than the +displayed value. +.IP \(bu +Decoded values. The information presented of course depends on the type +of record. Here, we learn about the board's manufacturer, model, version +and serial number. + +.SH OPTIONS +.TP +.BR "-d" ", " "--dev-mem FILE" +Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) +.TP +.BR "-q" ", " "--quiet" +Be less verbose. Unknown, inactive and \s-1OEM\s0-specific entries are not +displayed. Meta-data and handle references are hidden. +.TP +.BR "-s" ", " "--string KEYWORD" +Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR. +\fBKEYWORD\fR must be a keyword from the following list: \fBbios-vendor\fR, +\fBbios-version\fR, \fBbios-release-date\fR, +\fBsystem-manufacturer\fR, \fBsystem-product-name\fR, +\fBsystem-version\fR, \fBsystem-serial-number\fR, +\fBsystem-uuid\fR, +\fBbaseboard-manufacturer\fR, \fBbaseboard-product-name\fR, +\fBbaseboard-version\fR, \fBbaseboard-serial-number\fR, +\fBbaseboard-asset-tag\fR, \fBchassis-manufacturer\fR, +\fBchassis-type\fR, +\fBchassis-version\fR, \fBchassis-serial-number\fR, +\fBchassis-asset-tag\fR, \fBprocessor-family\fR, +\fBprocessor-manufacturer\fR, +\fBprocessor-version\fR, \fBprocessor-frequency\fR. +Each keyword corresponds to a given \s-1DMI\s0 type and a given offset +within this entry type. +Not all strings may be meaningful or even defined on all systems. Some +keywords may return more than one result on some systems (e.g. +\fBprocessor-version\fR on a multi-processor system). +If \fBKEYWORD\fR is not provided or not valid, a list of all valid +keywords is printed and +.B dmidecode +exits with an error. +This option cannot be used more than once. +.TP +.BR "-t" ", " "--type TYPE" +Only display the entries of type \fBTYPE\fR. \fBTYPE\fR can be either a +\s-1DMI\s0 type number, or a comma-separated list of type numbers, or a +keyword from the following list: \fBbios\fR, \fBsystem\fR, +\fBbaseboard\fR, \fBchassis\fR, \fBprocessor\fR, \fBmemory\fR, +\fBcache\fR, \fBconnector\fR, \fBslot\fR. Refer to the DMI TYPES section +below for details. +If this option is used more than once, the set of displayed entries will be +the union of all the given types. +If \fBTYPE\fR is not provided or not valid, a list of all valid keywords +is printed and +.B dmidecode +exits with an error. +.TP +.BR "-u" ", " "--dump" +Do not decode the entries, dump their contents as hexadecimal instead. +Note that this is still a text output, no binary data will be thrown upon +you. The strings attached to each entry are displayed as both +hexadecimal and \s-1ASCII\s0. This option is mainly useful for debugging. +.TP +.BR " " " " "--dump-bin FILE" +Do not decode the entries, instead dump the DMI data to a file in binary +form. The generated file is suitable to pass to \fB--from-dump\fR +later. +.TP +.BR " " " " "--from-dump FILE" +Read the DMI data from a binary file previously generated using +\fB--dump-bin\fR. +.TP +.BR "-h" ", " "--help" +Display usage information and exit +.TP +.BR "-V" ", " "--version" +Display the version and exit +.P +Options --string, --type, --dump and --dump-bin +determine the output format and are mutually exclusive. + +.SH "DMI TYPES" +The \s-1SMBIOS\s0 specification defines the following \s-1DMI\s0 types: + +.TS +r l +__ +r l. +Type Information +0 BIOS +1 System +2 Base Board +3 Chassis +4 Processor +5 Memory Controller +6 Memory Module +7 Cache +8 Port Connector +9 System Slots +10 On Board Devices +11 OEM Strings +12 System Configuration Options +13 BIOS Language +14 Group Associations +15 System Event Log +16 Physical Memory Array +17 Memory Device +18 32-bit Memory Error +19 Memory Array Mapped Address +20 Memory Device Mapped Address +21 Built-in Pointing Device +22 Portable Battery +23 System Reset +24 Hardware Security +25 System Power Controls +26 Voltage Probe +27 Cooling Device +28 Temperature Probe +29 Electrical Current Probe +30 Out-of-band Remote Access +31 Boot Integrity Services +32 System Boot +33 64-bit Memory Error +34 Management Device +35 Management Device Component +36 Management Device Threshold Data +37 Memory Channel +38 IPMI Device +39 Power Supply +.TE + +Additionally, type 126 is used for disabled entries and type 127 is an +end-of-table marker. Types 128 to 255 are for \s-1OEM\s0-specific data. +.B dmidecode +will display these entries by default, but it can only decode them +when the vendors have contributed documentation or code for them. + +Keywords can be used instead of type numbers with \fB--type\fR. +Each keyword is equivalent to a list of type numbers: + +.TS +l l +__ +l l. +Keyword Types +bios 0, 13 +system 1, 12, 15, 23, 32 +baseboard 2, 10 +chassis 3 +processor 4 +memory 5, 6, 16, 17 +cache 7 +connector 8 +slot 9 +.TE + +Keywords are matched case-insensitively. The following command lines are equivalent: +.IP \(bu "\w'\(bu'u+1n" +dmidecode --type 0 --type 13 +.IP \(bu +dmidecode --type 0,13 +.IP \(bu +dmidecode --type bios +.IP \(bu +dmidecode --type BIOS + +.SH BINARY DUMP FILE FORMAT +The binary dump files generated by --dump-bin and read using --from-dump +are formatted as follows: +.IP \(bu "\w'\(bu'u+1n" +The SMBIOS or DMI entry point is located at offset 0x00. +It is crafted to hard-code the table address at offset 0x20. +.IP \(bu "\w'\(bu'u+1n" +The DMI table is located at offset 0x20. + +.SH FILES +.I /dev/mem +.SH BUGS +More often than not, information contained in the \s-1DMI\s0 tables is inaccurate, +incomplete or simply wrong. +.SH AUTHORS +Alan Cox, Jean Delvare +.SH "SEE ALSO" +.BR biosdecode (8), +.BR mem (4), +.BR ownership (8), +.BR vpddecode (8) diff --git a/man/ownership.8 b/man/ownership.8 new file mode 100644 index 0000000..f24ef94 --- /dev/null +++ b/man/ownership.8 @@ -0,0 +1,37 @@ +.TH OWNERSHIP 8 "February 2005" "dmidecode" +.SH NAME +ownership \- Compaq ownership tag retriever +.SH SYNOPSIS +.B ownership +.RB [ OPTIONS ] + +.SH DESCRIPTION +.B ownership +retrieves and prints the "ownership tag" that can be set on Compaq +computers. Contrary to all other programs of the +.B dmidecode +package, +.B ownership +doesn't print any version information, nor labels, but only the raw +ownership tag. This should help its integration in scripts. + +.SH OPTIONS +.TP +.BR "-d" ", " "--dev-mem FILE" +Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) +.TP +.BR "-h" ", " "--help" +Display usage information and exit +.TP +.BR "-V" ", " "--version" +Display the version and exit + +.SH FILES +.I /dev/mem +.SH AUTHOR +Jean Delvare +.SH "SEE ALSO" +.BR biosdecode (8), +.BR dmidecode (8), +.BR mem (4), +.BR vpddecode (8) diff --git a/man/vpddecode.8 b/man/vpddecode.8 new file mode 100644 index 0000000..c9e4acf --- /dev/null +++ b/man/vpddecode.8 @@ -0,0 +1,74 @@ +.TH VPDDECODE 8 "February 2007" "dmidecode" +.SH NAME +vpddecode \- \s-1VPD\s0 structure decoder +.SH SYNOPSIS +.B vpddecode +.RB [ OPTIONS ] + +.SH DESCRIPTION +.B vpddecode +prints the "vital product data" information that can be found in almost +all IBM and Lenovo computers. Available items are: +.IP \(bu "\w'\(bu'u+1n" +\s-1BIOS\s0 Build \s-1ID\s0 +.IP \(bu +Box Serial Number +.IP \(bu +Motherboard Serial Number +.IP \(bu +Machine Type/Model + +.PP +Some systems have these additional items: +.IP \(bu "\w'\(bu'u+1n" +BIOS Release Date +.IP \(bu +Default Flash Image File Name + +.PP +Note that these additional items are not documented by IBM, so this is +guess work, and as such should not be blindly trusted. Feedback about +the accuracy of these labels is welcome. + +.SH OPTIONS +.TP +.BR "-d" ", " "--dev-mem FILE" +Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) +.TP +.BR "-s" ", " "--string KEYWORD" +Only display the value of the \s-1VPD\s0 string identified by \fBKEYWORD\fR. +\fBKEYWORD\fR must be a keyword from the following list: \fBbios-build-id\fR, +\fBbox-serial-number\fR, \fBmotherboard-serial-number\fR, +\fBmachine-type-model\fR, \fBbios-release-date\fR. +Each keyword corresponds to an offset and a length within the \s-1VPD\s0 +record. +Not all strings may be defined on all \s-1VPD\s0-enabled systems. +If \fBKEYWORD\fR is not provided or not valid, a list of all valid +keywords is printed and +.B vpddecode +exits with an error. +This option cannot be used more than once. +Mutually exclusive with \fB--dump\fR. +.TP +.BR "-u" ", " "--dump" +Do not decode the VPD records, dump their contents as hexadecimal instead. +Note that this is still a text output, no binary data will be thrown upon +you. ASCII equivalent is displayed when possible. This option is mainly +useful for debugging. +Mutually exclusive with \fB--string\fR. +.TP +.BR "-h" ", " "--help" +Display usage information and exit +.TP +.BR "-V" ", " "--version" +Display the version and exit + +.SH FILES +.I /dev/mem +.SH AUTHOR +Jean Delvare +.SH "SEE ALSO" +.BR biosdecode (8), +.BR dmidecode (8), +.BR mem (4), +.BR ownership (8) diff --git a/python-dmidecode.spec b/python-dmidecode.spec new file mode 100644 index 0000000..bee613c --- /dev/null +++ b/python-dmidecode.spec @@ -0,0 +1,44 @@ +%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%{!?python_ver: %define python_ver %(%{__python} -c "import sys ; print sys.version[:3]")} + +Summary: python extension module to access DMI data +Name: python-dmidecode +Version: 2.10 +Release: 1 +License: GPLv3 +Group: System Environment/Libraries +URL: http://projects.autonomy.net.au/dmidecode/ +Source0: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + +%description +python-dmidecode is a python extension module that uses the +code-base of the 'dmidecode' utility, and presents the data +as python data structures + +%prep +%setup -q + +%build +make + +%install +rm -rf $RPM_BUILD_ROOT +python src/setup.py install --root $RPM_BUILD_ROOT + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%doc +%{python_sitearch}/dmidecode.so +%if "%{python_ver}" >= "2.5" +%{python_sitearch}/*.egg-info +%endif + +%changelog +* Sat Mar 7 2009 Clark Williams - 2.10.3-1 +- Initial build. + diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..c1d7d03 --- /dev/null +++ b/src/config.h @@ -0,0 +1,25 @@ +/* + * Configuration + */ + +#ifndef CONFIG_H +#define CONFIG_H + +/* Default memory device file */ +#ifdef __BEOS__ +#define DEFAULT_MEM_DEV "/dev/misc/mem" +#else +#define DEFAULT_MEM_DEV "/dev/mem" +#endif + +/* Use mmap or not */ +#ifndef __BEOS__ +#define USE_MMAP +#endif + +/* Use memory alignment workaround or not */ +#ifdef __ia64__ +#define ALIGNMENT_WORKAROUND +#endif + +#endif diff --git a/src/dmidecode.c b/src/dmidecode.c new file mode 100644 index 0000000..40cb861 --- /dev/null +++ b/src/dmidecode.c @@ -0,0 +1,4785 @@ +/* + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DMI Decode + * + * Copyright 2000-2002 Alan Cox + * Copyright 2002-2008 Jean Delvare + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For the avoidance of doubt the "preferred form" of this code is one which + * is in an open unpatent encumbered format. Where cryptographic key signing + * forms part of the process of creating an executable the information + * including keys needed to generate an equivalently functional executable + * are deemed to be part of the source code. + * + * Unless specified otherwise, all references are aimed at the "System + * Management BIOS Reference Specification, Version 2.6" document, + * available from http://www.dmtf.org/standards/smbios/. + * + * Note to contributors: + * Please reference every value you add or modify, especially if the + * information does not come from the above mentioned specification. + * + * Additional references: + * - Intel AP-485 revision 32 + * "Intel Processor Identification and the CPUID Instruction" + * http://developer.intel.com/design/xeon/applnots/241618.htm + * - DMTF Common Information Model + * CIM Schema version 2.19.1 + * http://www.dmtf.org/standards/cim/ + * - IPMI 2.0 revision 1.0 + * "Intelligent Platform Management Interface Specification" + * http://developer.intel.com/design/servers/ipmi/spec.htm + * - AMD publication #25481 revision 2.28 + * "CPUID Specification" + * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf + * - BIOS Integrity Services Application Programming Interface version 1.0 + * http://www.intel.com/design/archives/wfm/downloads/bisspec.htm + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DMI Decode Python Module (Extension) + * + * Copyright: 2007-2008 Nima Talebi + * License: GPLv3 + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + */ + +#include + +/* +#undef NDEBUG +#include +*/ + +#include +#include +#include +#include + +#include "version.h" +#include "config.h" +#include "types.h" +#include "util.h" +#include "dmidecode.h" +#include "dmioem.h" + +#include "dmihelper.h" + +#define EFI_NOT_FOUND (-1) +#define EFI_NO_SMBIOS (-2) + +static const char *out_of_spec = ""; +static const char *bad_index = ""; +#define BAD_INDEX PyString_FromString("") +#define OUT_OF_SPEC PyString_FromString("") + +/******************************************************************************* +** Type-independant Stuff +*/ + +static PyObject *dmi_string_py(const struct dmi_header *dm, u8 s) { + char *bp=(char *)dm->data; + size_t i, len; + + PyObject *data; + + if(s==0) data = PyString_FromString("Not Specified"); + else { + bp += dm->length; + while(s>1 && *bp) { bp += strlen(bp); bp++; s--; } + + if(!*bp) data = BAD_INDEX; + else { + /* ASCII filtering */ + len=strlen(bp); + for(i=0; idata; + size_t i, len; + + if(s == 0) return "Not Specified"; + + bp += dm->length; + while(s>1 && *bp) { + bp+=strlen(bp); + bp++; + s--; + } + + if(!*bp) return bad_index; + + /* ASCII filtering */ + len = strlen(bp); + for(i=0; i0x99 || (value&0x0F)>0x09) return 0; + if(valuehigh) return 0; + return 1; +} + +PyObject* dmi_dump(struct dmi_header *h) { + int row, i; + const char *s; + + PyObject *data = PyDict_New(); + PyObject *data1 = PyList_New(0); + for(row=0; row<((h->length-1)>>4)+1; row++) { + for(i=0; i<16 && ilength-(row<<4); i++) + PyList_Append(data1, PyString_FromFormat("0x%02x", (h->data)[(row<<4)+i])); + } + PyDict_SetItemString(data, "Header and Data", data1); + + if((h->data)[h->length] || (h->data)[h->length+1]) { + i=1; + PyObject *data2 = PyList_New(0); + while((s=dmi_string(h, i++))!=bad_index) { + //. FIXME: DUMP + /* + if(opt.flags & FLAG_DUMP) { + int j, l = strlen(s)+1; + for(row=0; row<((l-1)>>4)+1; row++) { + for(j=0; j<16 && j>10); +} + +/* 3.3.1.1 */ +static PyObject* dmi_bios_characteristics(u64 code) { + static const char *characteristics[] = { + "BIOS characteristics not supported", /* 3 */ + "ISA is supported", + "MCA is supported", + "EISA is supported", + "PCI is supported", + "PC Card (PCMCIA) is supported", + "PNP is supported", + "APM is supported", + "BIOS is upgradeable", + "BIOS shadowing is allowed", + "VLB is supported", + "ESCD support is available", + "Boot from CD is supported", + "Selectable boot is supported", + "BIOS ROM is socketed", + "Boot from PC Card (PCMCIA) is supported", + "EDD is supported", + "Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)", + "Japanese floppy for Toshiba 1.2 MB is supported (int 13h)", + "5.25\"/360 KB floppy services are supported (int 13h)", + "5.25\"/1.2 MB floppy services are supported (int 13h)", + "3.5\"/720 KB floppy services are supported (int 13h)", + "3.5\"/2.88 MB floppy services are supported (int 13h)", + "Print screen service is supported (int 5h)", + "8042 keyboard services are supported (int 9h)", + "Serial services are supported (int 14h)", + "Printer services are supported (int 17h)", + "CGA/mono video services are supported (int 10h)", + "NEC PC-98" /* 31 */ + }; + + PyObject *data; + if(code.l&(1<<3)) { + data = PyString_FromString(characteristics[0]); + } else { + int i; + data = PyDict_New(); + for(i=4; i<=31; i++) + PyDict_SetItemString(data, characteristics[i-3], code.l&(1<= 0x0206) + return PyString_FromFormat("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", + p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6], + p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] + ); + else + return PyString_FromFormat("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], + p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] + ); +} + +/* 3.3.2.1 */ +static PyObject *dmi_system_wake_up_type(u8 code) { + static const char *type[]={ + "Reserved", /* 0x00 */ + "Other", + "Unknown", + "APM Timer", + "Modem Ring", + "LAN Remote", + "Power Switch", + "PCI PME#", + "AC Power Restored" /* 0x08 */ + }; + + if(code<=0x08) return PyString_FromString(type[code]); + return OUT_OF_SPEC; +} + +/******************************************************************************* +** 3.3.3 Base Board Information (Type 2) +*/ + +/* 3.3.3.1 */ +static PyObject *dmi_base_board_features(u8 code) { + static const char *features[] = { + "Board is a hosting board", /* 0 */ + "Board requires at least one daughter board", + "Board is removable", + "Board is replaceable", + "Board is hot swappable" /* 4 */ + }; + + PyObject *data; + if((code&0x1F)==0) data = Py_None; + else { + int i; + data = PyList_New(5); + for(i=0; i<=4; i++) { + if(code&(1<=0x01 && code<=0x0D) + return PyString_FromString(type[code-0x01]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_base_board_handles(u8 count, const u8 *p) { + int i; + + PyObject *dict = PyDict_New(); + PyObject *list = PyList_New(count); + + for(i=0; i=0x01 && code<=0x1B) + return type[code-0x01]; + return out_of_spec; +} + +static PyObject *dmi_chassis_type_py(u8 code) { + return PyString_FromString(dmi_chassis_type(code)); +} + +static PyObject *dmi_chassis_lock(u8 code) { + static const char *lock[] = { + "Not Present", /* 0x00 */ + "Present" /* 0x01 */ + }; + + return PyString_FromString(lock[code]); +} + +/* 3.3.4.2 */ +static PyObject *dmi_chassis_state(u8 code) { + static const char *state[]={ + "Other", /* 0x01 */ + "Unknown", + "Safe", /* master.mif says OK */ + "Warning", + "Critical", + "Non-recoverable" /* 0x06 */ + }; + + if(code>=0x01 && code<=0x06) + return PyString_FromString(state[code-0x01]); + return OUT_OF_SPEC; +} + +/* 3.3.4.3 */ +static const char *dmi_chassis_security_status(u8 code) { + static const char *status[]={ + "Other", /* 0x01 */ + "Unknown", + "None", + "External Interface Locked Out", + "External Interface Enabled" /* 0x05 */ + }; + + if(code>=0x01 && code<=0x05) + return(status[code-0x01]); + return out_of_spec; +} + +static PyObject *dmi_chassis_height(u8 code) { + if(code==0x00) return PyString_FromString("Unspecified"); + else return PyString_FromFormat("%i U", code); +} + +static PyObject *dmi_chassis_power_cords(u8 code) { + if(code==0x00) return PyString_FromString("Unspecified"); + else return PyString_FromFormat("%i", code); +} + +static PyObject *dmi_chassis_elements(u8 count, u8 len, const u8 *p) { + int i; + + PyObject *data = PyDict_New(); + PyDict_SetItemString(data, "Contained Elements", PyInt_FromLong(count)); + + PyObject *_key, *_val; + for(i=0; i=0x03) { + + _key = PyString_FromFormat("%s", + p[i*len]&0x80? + dmi_smbios_structure_type(p[i*len]&0x7F): + PyString_AS_STRING(dmi_base_board_type(p[i*len]&0x7F)) + ); + + if (p[1+i*len]==p[2+i*len]) _val = PyString_FromFormat("%i", p[1+i*len]); + else _val = PyString_FromFormat("%i-%i", p[1+i*len], p[2+i*len]); + + PyDict_SetItem(data, _key, _val); + + Py_DECREF(_key); + Py_DECREF(_val); + } + } + + return data; +} + +/******************************************************************************* +** 3.3.5 Processor Information (Type 4) +*/ + +static PyObject *dmi_processor_type(u8 code) { + /* 3.3.5.1 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "Central Processor", + "Math Processor", + "DSP Processor", + "Video Processor" /* 0x06 */ + }; + + if(code>=0x01 && code<=0x06) return PyString_FromString(type[code-0x01]); + return OUT_OF_SPEC; +} + +static const char *dmi_processor_family(const struct dmi_header *h) { + const u8 *data = h->data; + unsigned int i, low, high; + u16 code; + + /* 3.3.5.2 */ + static struct { + int value; + const char *name; + } family2[] = { + { 0x01, "Other" }, + { 0x02, "Unknown" }, + { 0x03, "8086" }, + { 0x04, "80286" }, + { 0x05, "80386" }, + { 0x06, "80486" }, + { 0x07, "8087" }, + { 0x08, "80287" }, + { 0x09, "80387" }, + { 0x0A, "80487" }, + { 0x0B, "Pentium" }, + { 0x0C, "Pentium Pro" }, + { 0x0D, "Pentium II" }, + { 0x0E, "Pentium MMX" }, + { 0x0F, "Celeron" }, + { 0x10, "Pentium II Xeon" }, + { 0x11, "Pentium III" }, + { 0x12, "M1" }, + { 0x13, "M2" }, + { 0x14, "Celeron M" }, /* From CIM_Processor.Family */ + { 0x15, "Pentium 4 HT" }, /* From CIM_Processor.Family */ + + { 0x18, "Duron" }, + { 0x19, "K5" }, + { 0x1A, "K6" }, + { 0x1B, "K6-2" }, + { 0x1C, "K6-3" }, + { 0x1D, "Athlon" }, + { 0x1E, "AMD29000" }, + { 0x1F, "K6-2+" }, + { 0x20, "Power PC" }, + { 0x21, "Power PC 601" }, + { 0x22, "Power PC 603" }, + { 0x23, "Power PC 603+" }, + { 0x24, "Power PC 604" }, + { 0x25, "Power PC 620" }, + { 0x26, "Power PC x704" }, + { 0x27, "Power PC 750" }, + { 0x28, "Core Duo" }, /* From CIM_Processor.Family */ + { 0x29, "Core Duo Mobile" }, /* From CIM_Processor.Family */ + { 0x2A, "Core Solo Mobile" }, /* From CIM_Processor.Family */ + { 0x2B, "Atom" }, /* From CIM_Processor.Family */ + + { 0x30, "Alpha" }, + { 0x31, "Alpha 21064" }, + { 0x32, "Alpha 21066" }, + { 0x33, "Alpha 21164" }, + { 0x34, "Alpha 21164PC" }, + { 0x35, "Alpha 21164a" }, + { 0x36, "Alpha 21264" }, + { 0x37, "Alpha 21364" }, + + { 0x40, "MIPS" }, + { 0x41, "MIPS R4000" }, + { 0x42, "MIPS R4200" }, + { 0x43, "MIPS R4400" }, + { 0x44, "MIPS R4600" }, + { 0x45, "MIPS R10000" }, + + { 0x50, "SPARC" }, + { 0x51, "SuperSPARC" }, + { 0x52, "MicroSPARC II" }, + { 0x53, "MicroSPARC IIep" }, + { 0x54, "UltraSPARC" }, + { 0x55, "UltraSPARC II" }, + { 0x56, "UltraSPARC IIi" }, + { 0x57, "UltraSPARC III" }, + { 0x58, "UltraSPARC IIIi" }, + + { 0x60, "68040" }, + { 0x61, "68xxx" }, + { 0x62, "68000" }, + { 0x63, "68010" }, + { 0x64, "68020" }, + { 0x65, "68030" }, + + { 0x70, "Hobbit" }, + + { 0x78, "Crusoe TM5000" }, + { 0x79, "Crusoe TM3000" }, + { 0x7A, "Efficeon TM8000" }, + + { 0x80, "Weitek" }, + + { 0x82, "Itanium" }, + { 0x83, "Athlon 64" }, + { 0x84, "Opteron" }, + { 0x85, "Sempron" }, + { 0x86, "Turion 64" }, + { 0x87, "Dual-Core Opteron" }, + { 0x88, "Athlon 64 X2" }, + { 0x89, "Turion 64 X2" }, + { 0x8A, "Quad-Core Opteron" }, /* From CIM_Processor.Family */ + { 0x8B, "Third-Generation Opteron" }, /* From CIM_Processor.Family */ + { 0x8C, "Phenom FX" }, /* From CIM_Processor.Family */ + { 0x8D, "Phenom X4" }, /* From CIM_Processor.Family */ + { 0x8E, "Phenom X2" }, /* From CIM_Processor.Family */ + { 0x8F, "Athlon X2" }, /* From CIM_Processor.Family */ + { 0x90, "PA-RISC" }, + { 0x91, "PA-RISC 8500" }, + { 0x92, "PA-RISC 8000" }, + { 0x93, "PA-RISC 7300LC" }, + { 0x94, "PA-RISC 7200" }, + { 0x95, "PA-RISC 7100LC" }, + { 0x96, "PA-RISC 7100" }, + + { 0xA0, "V30" }, + { 0xA1, "Quad-Core Xeon 3200" }, /* From CIM_Processor.Family */ + { 0xA2, "Dual-Core Xeon 3000" }, /* From CIM_Processor.Family */ + { 0xA3, "Quad-Core Xeon 5300" }, /* From CIM_Processor.Family */ + { 0xA4, "Dual-Core Xeon 5100" }, /* From CIM_Processor.Family */ + { 0xA5, "Dual-Core Xeon 5000" }, /* From CIM_Processor.Family */ + { 0xA6, "Dual-Core Xeon LV" }, /* From CIM_Processor.Family */ + { 0xA7, "Dual-Core Xeon ULV" }, /* From CIM_Processor.Family */ + { 0xA8, "Dual-Core Xeon 7100" }, /* From CIM_Processor.Family */ + { 0xA9, "Quad-Core Xeon 5400" }, /* From CIM_Processor.Family */ + { 0xAA, "Quad-Core Xeon" }, /* From CIM_Processor.Family */ + + { 0xB0, "Pentium III Xeon" }, + { 0xB1, "Pentium III Speedstep" }, + { 0xB2, "Pentium 4" }, + { 0xB3, "Xeon" }, + { 0xB4, "AS400" }, + { 0xB5, "Xeon MP" }, + { 0xB6, "Athlon XP" }, + { 0xB7, "Athlon MP" }, + { 0xB8, "Itanium 2" }, + { 0xB9, "Pentium M" }, + { 0xBA, "Celeron D" }, + { 0xBB, "Pentium D" }, + { 0xBC, "Pentium EE" }, + { 0xBD, "Core Solo" }, + /* 0xBE handled as a special case */ + { 0xBF, "Core 2 Duo" }, + { 0xC0, "Core 2 Solo" }, /* From CIM_Processor.Family */ + { 0xC1, "Core 2 Extreme" }, /* From CIM_Processor.Family */ + { 0xC2, "Core 2 Quad" }, /* From CIM_Processor.Family */ + { 0xC3, "Core 2 Extreme Mobile" }, /* From CIM_Processor.Family */ + { 0xC4, "Core 2 Duo Mobile" }, /* From CIM_Processor.Family */ + { 0xC5, "Core 2 Solo Mobile" }, /* From CIM_Processor.Family */ + + { 0xC8, "IBM390" }, + { 0xC9, "G4" }, + { 0xCA, "G5" }, + { 0xCB, "ESA/390 G6" }, + { 0xCC, "z/Architectur" }, + + { 0xD2, "C7-M" }, + { 0xD3, "C7-D" }, + { 0xD4, "C7" }, + { 0xD5, "Eden" }, + + { 0xFA, "i860" }, + { 0xFB, "i960" }, + + { 0x104, "SH-3" }, + { 0x105, "SH-4" }, + + { 0x118, "ARM" }, + { 0x119, "StrongARM" }, + + { 0x12C, "6x86" }, + { 0x12D, "MediaGX" }, + { 0x12E, "MII" }, + + { 0x140, "WinChip" }, + + { 0x15E, "DSP" }, + + { 0x1F4, "Video Processor" }, + }; + + /* Linear Search - Slow + for(i=0; ilength>=0x2A)?WORD(data+0x28):data[0x06]; + + /* Special case for ambiguous value 0xBE */ + if(code == 0xBE) { + const char *manufacturer = dmi_string(h, data[0x07]); + + /* Best bet based on manufacturer string */ + if(strstr(manufacturer, "Intel") != NULL || strncasecmp(manufacturer, "Intel", 5) == 0) + return "Core 2"; + if(strstr(manufacturer, "AMD") != NULL || strncasecmp(manufacturer, "AMD", 3) == 0) + return "K7"; + return "Core 2 or K7"; + } + + /* Perform a binary search */ + low = 0; + high = ARRAY_SIZE(family2) - 1; + while(1) { + i = (low + high) / 2; + if (family2[i].value == code) return family2[i].name; + if (low == high) /* Not found */ return out_of_spec; + if (code < family2[i].value) high = i; + else low = i + 1; + } + + return out_of_spec; +} + +static PyObject *dmi_processor_id(u8 type, const u8 *p, const char *version) { + PyObject *data = PyDict_New(); + + /* Intel AP-485 revision 31, table 3-4 */ + static const char *flags[32]={ + "FPU (Floating-point unit on-chip)", /* 0 */ + "VME (Virtual mode extension)", + "DE (Debugging extension)", + "PSE (Page size extension)", + "TSC (Time stamp counter)", + "MSR (Model specific registers)", + "PAE (Physical address extension)", + "MCE (Machine check exception)", + "CX8 (CMPXCHG8 instruction supported)", + "APIC (On-chip APIC hardware supported)", + NULL, /* 10 */ + "SEP (Fast system call)", + "MTRR (Memory type range registers)", + "PGE (Page global enable)", + "MCA (Machine check architecture)", + "CMOV (Conditional move instruction supported)", + "PAT (Page attribute table)", + "PSE-36 (36-bit page size extension)", + "PSN (Processor serial number present and enabled)", + "CLFSH (CLFLUSH instruction supported)", + NULL, /* 20 */ + "DS (Debug store)", + "ACPI (ACPI supported)", + "MMX (MMX technology supported)", + "FXSR (Fast floating-point save and restore)", + "SSE (Streaming SIMD extensions)", + "SSE2 (Streaming SIMD extensions 2)", + "SS (Self-snoop)", + "HTT (Hyper-threading technology)", + "TM (Thermal monitor supported)", + "IA64 (IA64 capabilities)", + "PBE (Pending break enabled)" /* 31 */ + }; + /* + ** Extra flags are now returned in the ECX register when one calls + ** the CPUID instruction. Their meaning is explained in table 3-5, but + ** DMI doesn't support this yet. + */ + u32 eax, edx; + int sig=0; + + /* + ** This might help learn about new processors supporting the + ** CPUID instruction or another form of identification. + */ + + //. TODO: PyString_FromFormat does not support %x (yet?)... + PyDict_SetItemString(data, "ID", + PyString_FromFormat("%02x %02x %02x %02x %02x %02x %02x %02x", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7] + ) + ); + + if(type==0x05) /* 80386 */ { + u16 dx=WORD(p); + /* + ** 80386 have a different signature. + */ + PyDict_SetItemString(data, "Signature", + PyString_FromFormat( + "Type %i, Family %i, Major Stepping %i, Minor Stepping %i", + dx>>12, (dx>>8)&0xF, (dx>>4)&0xF, dx&0xF + ) + ); + return data; + } + + if(type==0x06) /* 80486 */ { + u16 dx=WORD(p); + /* + ** Not all 80486 CPU support the CPUID instruction, we have to find + ** wether the one we have here does or not. Note that this trick + ** works only because we know that 80486 must be little-endian. + */ + if((dx&0x0F00)==0x0400 + &&((dx&0x00F0)==0x0040 || (dx&0x00F0)>=0x0070) + &&((dx&0x000F)>=0x0003)) sig=1; + else { + PyDict_SetItemString(data, "Signature", + PyString_FromFormat( + "Type %i, Family %i, Model %i, Stepping %i", + (dx>>12)&0x3, (dx>>8)&0xF, (dx>>4)&0xF, dx&0xF + ) + ); + return data; + } + } else if( + ( + type >= 0x0B && type <= 0x15) /* Intel, Cyrix */ + || (type >= 0x28 && type <= 0x2B) /* Intel */ + || (type >= 0xA1 && type <= 0xAA) /* Intel */ + || (type >= 0xB0 && type <= 0xB3) /* Intel */ + || type == 0xB5 /* Intel */ + || (type >= 0xB9 && type <= 0xC5) /* Intel */ + || (type >= 0xD2 && type <= 0xD5) /* VIA */ + ) sig=1; + else if( + ( + type >= 0x18 && type <= 0x1D) /* AMD */ + || type == 0x1F /* AMD */ + || (type >= 0x83 && type <= 0x8F) /* AMD */ + || (type >= 0xB6 && type <= 0xB7) /* AMD */ + || (type >= 0xE6 && type <= 0xEB) /* AMD */ + ) sig=2; + else if(type==0x01 || type==0x02) { + /* + ** Some X86-class CPU have family "Other" or "Unknown". In this case, + ** we use the version string to determine if they are known to + ** support the CPUID instruction. + */ + if( + strncmp(version, "Pentium III MMX", 15) == 0 + || strncmp(version, "Intel(R) Core(TM)2", 18) == 0 + || strncmp(version, "Intel(R) Pentium(R)", 19) == 0 + || strcmp(version, "Genuine Intel(R) CPU U1400") == 0 + ) sig = 1; + else if( + strncmp(version, "AMD Athlon(TM)", 14) == 0 + || strncmp(version, "AMD Opteron(tm)", 15) == 0 + || strncmp(version, "Dual-Core AMD Opteron(tm)", 25) == 0 + ) sig = 2; + else return data; + } else /* not X86-class */ return data; + + eax=DWORD(p); + edx=DWORD(p+4); + switch(sig) { + case 1: /* Intel */ + PyDict_SetItemString(data, "Signature", + PyString_FromFormat( + "Type %i, Family %i, Model %i, Stepping %i", + (eax>>12)&0x3, ((eax>>20)&0xFF)+((eax>>8)&0x0F), + ((eax>>12)&0xF0)+((eax>>4)&0x0F), eax&0xF + ) + ); + break; + case 2: /* AMD, publication #25481 revision 2.28 */ + PyDict_SetItemString(data, "Signature", + PyString_FromFormat( + "Family %i, Model %i, Stepping %i", + ((eax>>8)&0xF)+(((eax>>8)&0xF)==0xF?(eax>>20)&0xFF:0), + ((eax>>4)&0xF)|(((eax>>8)&0xF)==0xF?(eax>>12)&0xF0:0), + eax&0xF + ) + ); + break; + } + + edx=DWORD(p+4); + if((edx&0xFFEFFBFF)==0) PyDict_SetItemString(data, "Flags", Py_None); + else { + int i; + PyObject *subdata = PyDict_New(); + for(i=0; i<=31; i++) + if(flags[i]!=NULL) + PyDict_SetItemString(subdata, flags[i], (edx&(1<=0x01 && code<=0x15) return PyString_FromString(upgrade[code-0x01]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_processor_cache(u16 code, const char *level, u16 ver) { + PyObject *data; + if(code==0xFFFF) { + if(ver>=0x0203) data = PyString_FromString("Not Provided"); + else data = PyString_FromFormat("No %s Cache", level); + } else data = PyString_FromFormat("0x%04x", code); + return data; +} + +/* 3.3.5.9 */ +static PyObject *dmi_processor_characteristics(u16 code) { + static const char *characteristics[]={ + "64-bit capable" /* 2 */ + }; + + PyObject *data; + if((code&0x0004)==0) { + data = Py_None; + } else { + data = PyList_New(1); + int i; + for(i=2; i<=2; i++) + if(code&(1<=0x01 && code<=0x08) return(PyString_FromString(method[code-0x01])); + return OUT_OF_SPEC; +} + +/* 3.3.6.2 */ +static PyObject *dmi_memory_controller_ec_capabilities(u8 code) { + static const char *capabilities[]={ + "Other", /* 0 */ + "Unknown", + "None", + "Single-bit Error Correcting", + "Double-bit Error Correcting", + "Error Scrubbing" /* 5 */ + }; + + PyObject *data = Py_None; + if((code&0x3F)==0) return Py_None; + else { + int i; + + data = PyList_New(6); + for(i=0; i<=5; i++) + if(code&(1<=0x01 && code<=0x07) return PyString_FromString(interleave[code-0x01]); + return OUT_OF_SPEC; +} + +/* 3.3.6.4 */ +static PyObject *dmi_memory_controller_speeds(u16 code) { + const char *speeds[]={ + "Other", /* 0 */ + "Unknown", + "70 ns", + "60 ns", + "50 ns" /* 4 */ + }; + + PyObject *data; + if((code&0x001F)!=0) data = Py_None; + else { + int i; + + data = PyList_New(5); + for(i=0; i<=4; i++) + if(code&(1<>4)); + if((code&0x0F)!=0x0F) PyList_Append(data, PyInt_FromLong(code&0x0F)); + } + return data; +} + +static PyObject *dmi_memory_module_speed(u8 code) { + if(code==0) return PyString_FromString("Unknown"); + else return PyString_FromFormat("%i ns", code); +} + +/* 3.3.7.2 */ +static PyObject *dmi_memory_module_size(u8 code) { + PyObject *data = PyDict_New(); + int check_conn = 1; + + switch(code&0x7F) { + case 0x7D: + PyDict_SetItemString(data, "Size", PyString_FromString("Not Determinable")); + break; + case 0x7E: + PyDict_SetItemString(data, "Size", PyString_FromString("Disabled")); + break; + case 0x7F: + PyDict_SetItemString(data, "Size", PyString_FromString("Not Installed")); + check_conn = 0; + default: + PyDict_SetItemString(data, "Size", PyString_FromFormat("%i MB", 1<<(code&0x7F))); + } + + if(check_conn) { + if(code&0x80) PyDict_SetItemString(data, "Connection", PyString_FromString("Double-bank")); + else PyDict_SetItemString(data, "Connection", PyString_FromString("Single-bank")); + } + return data; +} + +static PyObject *dmi_memory_module_error(u8 code) { + PyObject *data = NULL; + if(code&(1<<2)) data = Py_None; //. TODO: sprintf(_, "See Event Log"); + else { + if((code&0x03)==0) data = Py_True; + if(code&(1<<0)) data = PyString_FromString("Uncorrectable Errors"); + if(code&(1<<1)) data = PyString_FromString("Correctable Errors"); + } + return data; +} + +/******************************************************************************* +** 3.3.8 Cache Information (Type 7) +*/ +static PyObject *dmi_cache_mode(u8 code) { + static const char *mode[]={ + "Write Through", /* 0x00 */ + "Write Back", + "Varies With Memory Address", + "Unknown" /* 0x03 */ + }; + + return PyString_FromString(mode[code]); +} + +static PyObject *dmi_cache_location(u8 code) { + static const char *location[4]={ + "Internal", /* 0x00 */ + "External", + NULL, /* 0x02 */ + "Unknown" /* 0x03 */ + }; + + PyObject *data; + if(location[code]!=NULL) data = PyString_FromString(location[code]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_cache_size(u16 code) { + PyObject *data; + if(code&0x8000) data = PyString_FromFormat("%i KB", (code&0x7FFF)<<6); + else data = PyString_FromFormat("%i KB", code); + return data; +} + +/* 3.3.8.2 */ +static PyObject *dmi_cache_types(u16 code) { + static const char *types[] = { + "Other", /* 0 */ + "Unknown", + "Non-burst", + "Burst", + "Pipeline Burst", + "Synchronous", + "Asynchronous" /* 6 */ + }; + PyObject *data; + + if((code&0x007F)==0) data = Py_None; + else { + int i; + + data = PyList_New(7); + for(i=0; i<=6; i++) + if(code&(1<=0x01 && code<=0x06) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_cache_type(u8 code) { + /* 3.3.8.4 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "Instruction", + "Data", + "Unified" /* 0x05 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x05) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_cache_associativity(u8 code) { + /* 3.3.8.5 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "Direct Mapped", + "2-way Set-associative", + "4-way Set-associative", + "Fully Associative", + "8-way Set-associative", + "16-way Set-associative" /* 0x08 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x08) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +/******************************************************************************* +** 3.3.9 Port Connector Information (Type 8) +*/ + +static PyObject *dmi_port_connector_type(u8 code) { + /* 3.3.9.2 */ + static const char *type[] = { + "None", /* 0x00 */ + "Centronics", + "Mini Centronics", + "Proprietary", + "DB-25 male", + "DB-25 female", + "DB-15 male", + "DB-15 female", + "DB-9 male", + "DB-9 female", + "RJ-11", + "RJ-45", + "50 Pin MiniSCSI", + "Mini DIN", + "Micro DIN", + "PS/2", + "Infrared", + "HP-HIL", + "Access Bus (USB)", + "SSA SCSI", + "Circular DIN-8 male", + "Circular DIN-8 female", + "On Board IDE", + "On Board Floppy", + "9 Pin Dual Inline (pin 10 cut)", + "25 Pin Dual Inline (pin 26 cut)", + "50 Pin Dual Inline", + "68 Pin Dual Inline", + "On Board Sound Input From CD-ROM", + "Mini Centronics Type-14", + "Mini Centronics Type-26", + "Mini Jack (headphones)", + "BNC", + "IEEE 1394", + "SAS/SATA Plug Receptacle" /* 0x22 */ + }; + static const char *type_0xA0[]={ + "PC-98", /* 0xA0 */ + "PC-98 Hireso", + "PC-H98", + "PC-98 Note", + "PC-98 Full" /* 0xA4 */ + }; + + if(code<=0x22) return PyString_FromString(type[code]); + if(code>=0xA0 && code<=0xA4) return PyString_FromString(type_0xA0[code-0xA0]); + if(code==0xFF) return PyString_FromString("Other"); + return OUT_OF_SPEC; +} + +static PyObject *dmi_port_type(u8 code) { + /* 3.3.9.3 */ + static const char *type[] = { + "None", /* 0x00 */ + "Parallel Port XT/AT Compatible", + "Parallel Port PS/2", + "Parallel Port ECP", + "Parallel Port EPP", + "Parallel Port ECP/EPP", + "Serial Port XT/AT Compatible", + "Serial Port 16450 Compatible", + "Serial Port 16550 Compatible", + "Serial Port 16550A Compatible", + "SCSI Port", + "MIDI Port", + "Joystick Port", + "Keyboard Port", + "Mouse Port", + "SSA SCSI", + "USB", + "Firewire (IEEE P1394)", + "PCMCIA Type I", + "PCMCIA Type II", + "PCMCIA Type III", + "Cardbus", + "Access Bus Port", + "SCSI II", + "SCSI Wide", + "PC-98", + "PC-98 Hireso", + "PC-H98", + "Video Port", + "Audio Port", + "Modem Port", + "Network Port", + "SATA", + "SAS" /* 0x21 */ + }; + static const char *type_0xA0[]={ + "8251 Compatible", /* 0xA0 */ + "8251 FIFO Compatible" /* 0xA1 */ + }; + + if(code<=0x21) return PyString_FromString(type[code]); + if(code>=0xA0 && code<=0xA1) return PyString_FromString(type_0xA0[code-0xA0]); + if(code==0xFF) return PyString_FromString("Other"); + return OUT_OF_SPEC; +} + +/******************************************************************************* +** 3.3.10 System Slots (Type 9) +*/ + +static PyObject *dmi_slot_type(u8 code) { + /* 3.3.10.1 */ + static const char *type[] = { + "Other", /* 0x01 */ + "Unknown", + "ISA", + "MCA", + "EISA", + "PCI", + "PC Card (PCMCIA)", + "VLB", + "Proprietary", + "Processor Card", + "Proprietary Memory Card", + "I/O Riser Card", + "NuBus", + "PCI-66", + "AGP", + "AGP 2x", + "AGP 4x", + "PCI-X", + "AGP 8x" /* 0x13 */ + }; + static const char *type_0xA0[]={ + "PC-98/C20", /* 0xA0 */ + "PC-98/C24", + "PC-98/E", + "PC-98/Local Bus", + "PC-98/Card", + "PCI Express", + "PCI Express x1", + "PCI Express x2", + "PCI Express x4", + "PCI Express x8", + "PCI Express x16" /* 0xAA */ + }; + + if(code>=0x01 && code<=0x13) return PyString_FromString(type[code-0x01]); + if(code>=0xA0 && code<=0xAA) return PyString_FromString(type_0xA0[code-0xA0]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_slot_bus_width(u8 code) { + /* 3.3.10.2 */ + static const char *width[]={ + "", /* 0x01, "Other" */ + "", /* "Unknown" */ + "8-bit ", + "16-bit ", + "32-bit ", + "64-bit ", + "128-bit ", + "x1 ", + "x2 ", + "x4 ", + "x8 ", + "x12 ", + "x16 ", + "x32 " /* 0x0E */ + }; + + if(code>=0x01 && code<=0x0E) return PyString_FromString(width[code-0x01]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_slot_current_usage(u8 code) { + /* 3.3.10.3 */ + static const char *usage[]={ + "Other", /* 0x01 */ + "Unknown", + "Available", + "In Use" /* 0x04 */ + }; + + if(code>=0x01 && code<=0x04) return PyString_FromString(usage[code-0x01]); + return OUT_OF_SPEC; +} + +/* 3.3.1O.4 */ +static PyObject *dmi_slot_length(u8 code) { + static const char *length[]={ + "Other", /* 0x01 */ + "Unknown", + "Short", + "Long" /* 0x04 */ + }; + + if(code>=0x01 && code<=0x04) + return PyString_FromString(length[code-0x01]); + return OUT_OF_SPEC; +} + +/* 3.3.10.5 */ +static PyObject *dmi_slot_id(u8 code1, u8 code2, u8 type) { + PyObject *data; + switch(type) { + case 0x04: /* MCA */ + data = PyString_FromFormat("%i", code1); + break; + case 0x05: /* EISA */ + data = PyString_FromFormat("%i", code1); + break; + case 0x06: /* PCI */ + case 0x0E: /* PCI */ + case 0x0F: /* AGP */ + case 0x10: /* AGP */ + case 0x11: /* AGP */ + case 0x12: /* PCI-X */ + case 0x13: /* AGP */ + case 0xA5: /* PCI Express */ + data = PyString_FromFormat("%i", code1); + break; + case 0x07: /* PCMCIA */ + data = PyString_FromFormat("Adapter %i, Socket %i", code1, code2); + break; + default: + data = Py_None; + } + return data; +} + +static PyObject *dmi_slot_characteristics(u8 code1, u8 code2) { + /* 3.3.10.6 */ + static const char *characteristics1[]={ + "5.0 V is provided", /* 1 */ + "3.3 V is provided", + "Opening is shared", + "PC Card-16 is supported", + "Cardbus is supported", + "Zoom Video is supported", + "Modem ring resume is supported" /* 7 */ + }; + + /* 3.3.10.7 */ + static const char *characteristics2[]={ + "PME signal is supported", /* 0 */ + "Hot-plug devices are supported", + "SMBus signal is supported" /* 2 */ + }; + + PyObject *data; + if(code1&(1<<0)) data = PyString_FromString("Unknown"); + else if((code1&0xFE)==0 && (code2&0x07)==0) data = Py_None; + else { + int i; + + data = PyList_New(7+3); + for(i=1; i<=7; i++) { + if(code1&(1<> 3, code3 & 0x7); + else data = Py_None; + return data; +} + +/******************************************************************************* +** 3.3.11 On Board Devices Information (Type 10) +*/ + +static const char *dmi_on_board_devices_type(u8 code) { + /* 3.3.11.1 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "Video", + "SCSI Controller", + "Ethernet", + "Token Ring", + "Sound", + "PATA Controller", + "SATA Controller", + "SAS Controller" /* 0x0A */ + }; + + if(code>=0x01 && code<=0x0A) return type[code-0x01]; + return out_of_spec; +} + +static PyObject *dmi_on_board_devices(struct dmi_header *h) { + PyObject *data = NULL; + u8 *p = h->data+4; + u8 count = (h->length-0x04)/2; + int i; + + if((data = PyList_New(count))) { + PyObject *_pydict; + PyObject *_val; + for(i=0; idata+4; + u8 count=p[0x00]; + int i; + + PyObject *data = PyDict_New(); + PyObject *val; + + for(i=1; i<=count; i++) { + val = dmi_string_py(h, i); + PyDict_SetItem(data, PyInt_FromLong(i), val); + Py_DECREF(val); + } + + return data; +} + +/******************************************************************************* +** 3.3.13 System Configuration Options (Type 12) +*/ + +static PyObject *dmi_system_configuration_options(struct dmi_header *h) { + u8 *p=h->data+4; + u8 count=p[0x00]; + int i; + + PyObject *data = PyDict_New(); + PyObject *val; + for(i=1; i<=count; i++) { + val = dmi_string_py(h, i); + PyDict_SetItem(data, PyInt_FromLong(i), val); + Py_DECREF(val); + } + + return data; +} + +/******************************************************************************* +** 3.3.14 BIOS Language Information (Type 13) +*/ + +static PyObject *dmi_bios_languages(struct dmi_header *h) { + u8 *p = h->data+4; + u8 count = p[0x00]; + int i; + + PyObject *data = PyList_New(count + 1); + for(i=1; i<=count; i++) + PyList_SET_ITEM(data, i, dmi_string_py(h, i)); + + return data; +} + +/******************************************************************************* +** 3.3.15 Group Associations (Type 14) +*/ + +static PyObject *dmi_group_associations_items(u8 count, const u8 *p) { + int i; + + PyObject *data = PyList_New(count); + PyObject *val; + for(i=0; i=0x80) return "OEM-specific"; + return out_of_spec; +} + +static PyObject *dmi_event_log_status_py(u8 code) { + static const char *valid[]={ + "Invalid", /* 0 */ + "Valid" /* 1 */ + }; + static const char *full[]={ + "Not Full", /* 0 */ + "Full" /* 1 */ + }; + + return PyString_FromFormat("%s, %s", valid[(code>>0)&1], full[(code>>1)&1]); +} + +static PyObject *dmi_event_log_address_py(u8 method, const u8 *p) { + /* 3.3.16.3 */ + switch(method) { + case 0x00: + case 0x01: + case 0x02: + return PyString_FromFormat("Index 0x%04x, Data 0x%04x", WORD(p), WORD(p+2)); + break; + case 0x03: + return PyString_FromFormat("0x%08x", DWORD(p)); + break; + case 0x04: + return PyString_FromFormat("0x%04x", WORD(p)); + break; + default: + return PyString_FromString("Unknown"); + } +} + +static const char *dmi_event_log_header_type(u8 code) { + static const char *type[]={ + "No Header", /* 0x00 */ + "Type 1" /* 0x01 */ + }; + + if(code<=0x01) return type[code]; + if(code>=0x80) return "OEM-specific"; + return out_of_spec; +} + +static PyObject *dmi_event_log_descriptor_type(u8 code) { + /* 3.3.16.6.1 */ + static const char *type[]={ + NULL, /* 0x00 */ + "Single-bit ECC memory error", + "Multi-bit ECC memory error", + "Parity memory error", + "Bus timeout", + "I/O channel block", + "Software NMI", + "POST memory resize", + "POST error", + "PCI parity error", + "PCI system error", + "CPU failure", + "EISA failsafe timer timeout", + "Correctable memory log disabled", + "Logging disabled", + NULL, /* 0x0F */ + "System limit exceeded", + "Asynchronous hardware timer expired", + "System configuration information", + "Hard disk information", + "System reconfigured", + "Uncorrectable CPU-complex error", + "Log area reset/cleared", + "System boot" /* 0x17 */ + }; + + const char *data; + if(code<=0x17 && type[code]!=NULL) data = type[code]; + else if(code>=0x80 && code<=0xFE) data = "OEM-specific"; + else if(code==0xFF) data = "End of log"; + else data = out_of_spec; + return PyString_FromString(data); +} + +static PyObject *dmi_event_log_descriptor_format(u8 code) { + /* 3.3.16.6.2 */ + static const char *format[]={ + "None", /* 0x00 */ + "Handle", + "Multiple-event", + "Multiple-event handle", + "POST results bitmap", + "System management", + "Multiple-event system management" /* 0x06 */ + }; + + const char *data; + if(code<=0x06) data = format[code]; + else if(code>=0x80) data = "OEM-specific"; + else data = out_of_spec; + return PyString_FromString(data); +} + +static PyObject *dmi_event_log_descriptors(u8 count, const u8 len, const u8 *p) { + /* 3.3.16.1 */ + int i; + + PyObject* data; + data = PyList_New(count); + for(i=0; i=0x02) { + PyObject *subdata = PyDict_New(); + PyDict_SetItemString(subdata, "Descriptor", dmi_event_log_descriptor_type(p[i*len])); + PyDict_SetItemString(subdata, "Data Format", dmi_event_log_descriptor_format(p[i*len+1])); + PyList_SET_ITEM(data, i, subdata); + } + } + return data; +} + +/******************************************************************************* +** 3.3.17 Physical Memory Array (Type 16) +*/ + +static PyObject *dmi_memory_array_location(u8 code) { + /* 3.3.17.1 */ + static const char *location[]={ + "Other", /* 0x01 */ + "Unknown", + "System Board Or Motherboard", + "ISA Add-on Card", + "EISA Add-on Card", + "PCI Add-on Card", + "MCA Add-on Card", + "PCMCIA Add-on Card", + "Proprietary Add-on Card", + "NuBus" /* 0x0A, master.mif says 16 */ + }; + static const char *location_0xA0[]={ + "PC-98/C20 Add-on Card", /* 0xA0 */ + "PC-98/C24 Add-on Card", + "PC-98/E Add-on Card", + "PC-98/Local Bus Add-on Card", + "PC-98/Card Slot Add-on Card" /* 0xA4, from master.mif */ + }; + + if(code>=0x01 && code<=0x0A) return PyString_FromString(location[code-0x01]); + if(code>=0xA0 && code<=0xA4) return PyString_FromString(location_0xA0[code-0xA0]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_memory_array_use(u8 code) { + /* 3.3.17.2 */ + static const char *use[]={ + "Other", /* 0x01 */ + "Unknown", + "System Memory", + "Video Memory", + "Flash Memory", + "Non-volatile RAM", + "Cache Memory" /* 0x07 */ + }; + + if(code>=0x01 && code<=0x07) return PyString_FromString(use[code-0x01]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_memory_array_ec_type(u8 code) { + /* 3.3.17.3 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "None", + "Parity", + "Single-bit ECC", + "Multi-bit ECC", + "CRC" /* 0x07 */ + }; + + if(code>=0x01 && code<=0x07) return PyString_FromString(type[code-0x01]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_memory_array_capacity(u32 code) { + PyObject *data; + if(code==0x8000000) data = PyString_FromString("Unknown"); + else { + if((code&0x000FFFFF)==0) data = PyString_FromFormat("%i GB", code>>20); + else if((code&0x000003FF)==0) data = PyString_FromFormat("%i MB", code>>10); + else data = PyString_FromFormat("%i kB", code); + } + return data; +} + +static PyObject *dmi_memory_array_error_handle(u16 code) { + PyObject *data; + if(code==0xFFFE) data = PyString_FromString("Not Provided"); + else if(code==0xFFFF) data = PyString_FromString("No Error"); + else data = PyString_FromFormat("0x%04x", code); + return data; +} + +/******************************************************************************* +** 3.3.18 Memory Device (Type 17) +*/ + +static PyObject *dmi_memory_device_width(u16 code) { + /* + ** If no memory module is present, width may be 0 + */ + PyObject *data; + if(code==0xFFFF || code==0) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%i bits", code); + return data; +} + +static PyObject *dmi_memory_device_size(u16 code) { + PyObject *data = NULL; + if(code==0) data = Py_None; //. No Module Installed + else if(code==0xFFFF) data = PyString_FromString("Unknown"); //. Unknown + else { + //. Keeping this as String rather than Int as it has KB and MB representations... + if(code&0x8000) data = PyString_FromFormat("%d KB", code&0x7FFF); + else data = PyString_FromFormat("%d MB", code); + } + return data; +} + +static PyObject *dmi_memory_device_form_factor(u8 code) { + /* 3.3.18.1 */ + static const char *form_factor[]={ + "Other", /* 0x01 */ + "Unknown", + "SIMM", + "SIP", + "Chip", + "DIP", + "ZIP", + "Proprietary Card", + "DIMM", + "TSOP", + "Row Of Chips", + "RIMM", + "SODIMM", + "SRIMM", + "FB-DIMM" /* 0x0F */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x0F) return data = PyString_FromString(form_factor[code-0x01]); + return data = OUT_OF_SPEC; +} + +static PyObject *dmi_memory_device_set(u8 code) { + PyObject *data; + if(code==0) data = Py_None; + else if(code==0xFF) data = PyString_FromString("Unknown"); + else data = PyInt_FromLong(code); + return data; +} + +static PyObject *dmi_memory_device_type(u8 code) { + /* 3.3.18.2 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "DRAM", + "EDRAM", + "VRAM", + "SRAM", + "RAM", + "ROM", + "Flash", + "EEPROM", + "FEPROM", + "EPROM", + "CDRAM", + "3DRAM", + "SDRAM", + "SGRAM", + "RDRAM", + "DDR", + "DDR2", + "DDR2 FB-DIMM" /* 0x14 */ + }; + + if(code>=0x01 && code<=0x14) return PyString_FromString(type[code-0x01]); + return OUT_OF_SPEC; +} + +static PyObject *dmi_memory_device_type_detail(u16 code) { + /* 3.3.18.3 */ + static const char *detail[]={ + "Other", /* 1 */ + "Unknown", + "Fast-paged", + "Static Column", + "Pseudo-static", + "RAMBus", + "Synchronous", + "CMOS", + "EDO", + "Window DRAM", + "Cache DRAM", + "Non-Volatile" /* 12 */ + }; + + PyObject *data; + if((code&0x1FFE)==0) data = Py_None; + else { + int i; + + data = PyList_New(12); + for(i=1; i<=12; i++) + if(code&(1<=0x01 && code<=0x0E) data = PyString_FromString(type[code-0x01]); + data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_memory_error_granularity(u8 code) { + /* 3.3.19.2 */ + static const char *granularity[]={ + "Other", /* 0x01 */ + "Unknown", + "Device Level", + "Memory Partition Level" /* 0x04 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x04) data = PyString_FromString(granularity[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_memory_error_operation(u8 code) { + /* 3.3.19.3 */ + static const char *operation[]={ + "Other", /* 0x01 */ + "Unknown", + "Read", + "Write", + "Partial Write" /* 0x05 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x05) data = PyString_FromString(operation[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_memory_error_syndrome(u32 code) { + PyObject *data; + if(code==0x00000000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("0x%08x", code); + return data; +} + +static PyObject *dmi_32bit_memory_error_address(u32 code) { + PyObject *data; + if(code==0x80000000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("0x%08x", code); + return data; +} + +/******************************************************************************* +** 3.3.20 Memory Array Mapped Address (Type 19) +*/ + +static PyObject *dmi_mapped_address_size(u32 code) { + PyObject *data; + if(code==0) data = PyString_FromString("Invalid"); + else if((code&0x000FFFFF)==0) data = PyString_FromFormat("%i GB", code>>20); + else if((code&0x000003FF)==0) data = PyString_FromFormat("%i MB", code>>10); + else data = PyString_FromFormat("%i kB", code); + return data; +} + +/******************************************************************************* +** 3.3.21 Memory Device Mapped Address (Type 20) +*/ + +static PyObject *dmi_mapped_address_row_position(u8 code) { + PyObject *data; + if(code==0) data = OUT_OF_SPEC; + else if(code==0xFF) data = PyString_FromString("Unknown"); + else data = PyInt_FromLong(code); + return data; +} + +static PyObject *dmi_mapped_address_interleave_position(u8 code) { + PyObject *data; + if(code!=0) { + data = PyDict_New(); + PyDict_SetItemString(data, "Interleave Position", (code==0xFF)?PyString_FromString("Unknown"):PyInt_FromLong(code)); + } else data = Py_None; + return data; +} + +static PyObject *dmi_mapped_address_interleaved_data_depth(u8 code) { + PyObject *data; + if(code!=0) { + data = PyDict_New(); + PyDict_SetItemString(data, "Interleave Data Depth", (code==0xFF)?PyString_FromString("Unknown"):PyInt_FromLong(code)); + } else data = Py_None; + return data; +} + +/******************************************************************************* +** 3.3.22 Built-in Pointing Device (Type 21) +*/ + +static PyObject *dmi_pointing_device_type(u8 code) { + /* 3.3.22.1 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "Mouse", + "Track Ball", + "Track Point", + "Glide Point", + "Touch Pad", + "Touch Screen", + "Optical Sensor" /* 0x09 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x09) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_pointing_device_interface(u8 code) { + /* 3.3.22.2 */ + static const char *interface[]={ + "Other", /* 0x01 */ + "Unknown", + "Serial", + "PS/2", + "Infrared", + "HIP-HIL", + "Bus Mouse", + "ADB (Apple Desktop Bus)" /* 0x08 */ + }; + static const char *interface_0xA0[]={ + "Bus Mouse DB-9", /* 0xA0 */ + "Bus Mouse Micro DIN", + "USB" /* 0xA2 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x08) data = PyString_FromString(interface[code-0x01]); + else if(code>=0xA0 && code<=0xA2) data = PyString_FromString(interface_0xA0[code-0xA0]); + else data = OUT_OF_SPEC; + return data; +} + +/******************************************************************************* +** 3.3.23 Portable Battery (Type 22) +*/ + +static PyObject *dmi_battery_chemistry(u8 code) { + /* 3.3.23.1 */ + static const char *chemistry[]={ + "Other", /* 0x01 */ + "Unknown", + "Lead Acid", + "Nickel Cadmium", + "Nickel Metal Hydride", + "Lithium Ion", + "Zinc Air", + "Lithium Polymer" /* 0x08 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x08) data = PyString_FromString(chemistry[code-0x01]); + data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_battery_capacity(u16 code, u8 multiplier) { + PyObject *data; + if(code==0) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%i mWh", code*multiplier); + return data; +} + +static PyObject *dmi_battery_voltage(u16 code) { + PyObject *data; + if(code==0) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%i mV", code); + return data; +} + +static PyObject *dmi_battery_maximum_error(u8 code) { + PyObject *data; + if(code==0xFF) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%i%%", code); + return data; +} + +/******************************************************************************* +** 3.3.24 System Reset (Type 23) +*/ + +static PyObject *dmi_system_reset_boot_option(u8 code) { + static const char *option[]={ + "Operating System", /* 0x1 */ + "System Utilities", + "Do Not Reboot" /* 0x3 */ + }; + PyObject *data; + + if(code>=0x1) data = PyString_FromString(option[code-0x1]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_system_reset_count(u16 code) { + PyObject *data; + if(code==0xFFFF) data = PyString_FromString("Unknown"); + else data = PyInt_FromLong(code); + return data; +} + +static PyObject *dmi_system_reset_timer(u16 code) { + PyObject *data; + if(code==0xFFFF) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%i min", code); + return data; +} + +/******************************************************************************* + * 3.3.25 Hardware Security (Type 24) + */ + +static PyObject *dmi_hardware_security_status(u8 code) { + static const char *status[]={ + "Disabled", /* 0x00 */ + "Enabled", + "Not Implemented", + "Unknown" /* 0x03 */ + }; + + return PyString_FromString(status[code]); +} + +/******************************************************************************* +** 3.3.26 System Power Controls (Type 25) +*/ + +static PyObject *dmi_power_controls_power_on(const u8 *p) { + /* 3.3.26.1 */ + PyObject *data = PyList_New(5); + + PyList_SET_ITEM(data, 0, dmi_bcd_range(p[0], 0x01, 0x12)?PyString_FromFormat(" %02x", p[0]):PyString_FromString(" *")); + PyList_SET_ITEM(data, 1, dmi_bcd_range(p[1], 0x01, 0x31)?PyString_FromFormat("-%02x", p[1]):PyString_FromString("-*")); + PyList_SET_ITEM(data, 2, dmi_bcd_range(p[2], 0x00, 0x23)?PyString_FromFormat(" %02x", p[2]):PyString_FromString(" *")); + PyList_SET_ITEM(data, 3, dmi_bcd_range(p[3], 0x00, 0x59)?PyString_FromFormat(":%02x", p[3]):PyString_FromString(":*")); + PyList_SET_ITEM(data, 4, dmi_bcd_range(p[4], 0x00, 0x59)?PyString_FromFormat(":%02x", p[4]):PyString_FromString(":*")); + + return data; +} + +/******************************************************************************* +* 3.3.27 Voltage Probe (Type 26) +*/ + +static PyObject *dmi_voltage_probe_location(u8 code) { + /* 3.3.27.1 */ + static const char *location[]={ + "Other", /* 0x01 */ + "Unknown", + "Processor", + "Disk", + "Peripheral Bay", + "System Management Module", + "Motherboard", + "Memory Module", + "Processor Module", + "Power Unit", + "Add-in Card" /* 0x0B */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x0B) data = PyString_FromString(location[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_probe_status(u8 code) { + /* 3.3.27.1 */ + static const char *status[]={ + "Other", /* 0x01 */ + "Unknown", + "OK", + "Non-critical", + "Critical", + "Non-recoverable" /* 0x06 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x06) data = PyString_FromString(status[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_voltage_probe_value(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.3f V", (float)(i16)code/1000); + return data; +} + +static PyObject *dmi_voltage_probe_resolution(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.1f mV", (float)code/10); + return data; +} + +static PyObject *dmi_probe_accuracy(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.2f%%", (float)code/100); + return data; +} + +/******************************************************************************* +** 3.3.28 Cooling Device (Type 27) +*/ + +static PyObject *dmi_cooling_device_type(u8 code) { + /* 3.3.28.1 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "Fan", + "Centrifugal Blower", + "Chip Fan", + "Cabinet Fan", + "Power Supply Fan", + "Heat Pipe", + "Integrated Refrigeration" /* 0x09 */ + }; + static const char *type_0x10[]={ + "Active Cooling", /* 0x10, master.mif says 32 */ + "Passive Cooling" /* 0x11, master.mif says 33 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x09) data = PyString_FromString(type[code-0x01]); + else if(code>=0x10 && code<=0x11) data = PyString_FromString(type_0x10[code-0x10]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_cooling_device_speed(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown Or Non-rotating"); + else data = PyString_FromFormat("%i rpm", code); + return data; +} + +/******************************************************************************* +** 3.3.29 Temperature Probe (Type 28) +*/ + +static PyObject *dmi_temperature_probe_location(u8 code) { + /* 3.3.29.1 */ + static const char *location[]={ + "Other", /* 0x01 */ + "Unknown", + "Processor", + "Disk", + "Peripheral Bay", + "System Management Module", /* master.mif says SMB Master */ + "Motherboard", + "Memory Module", + "Processor Module", + "Power Unit", + "Add-in Card", + "Front Panel Board", + "Back Panel Board", + "Power System Board", + "Drive Back Plane" /* 0x0F */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x0F) data = PyString_FromString(location[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_temperature_probe_value(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.1f deg C", (float)(i16)code/10); + return data; +} + +static PyObject *dmi_temperature_probe_resolution(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.3f deg C", (float)code/1000); + return data; +} + +/******************************************************************************* +** 3.3.30 Electrical Current Probe (Type 29) +*/ + +static PyObject *dmi_current_probe_value(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.3f A", (float)(i16)code/1000); + return data; +} + +static PyObject *dmi_current_probe_resolution(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.1f mA", (float)code/10); + return data; +} + +/******************************************************************************* +** 3.3.33 System Boot Information (Type 32) +*/ + +static PyObject *dmi_system_boot_status(u8 code) { + static const char *status[]={ + "No errors detected", /* 0 */ + "No bootable media", + "Operating system failed to load", + "Firmware-detected hardware failure", + "Operating system-detected hardware failure", + "User-requested boot", + "System security violation", + "Previously-requested image", + "System watchdog timer expired" /* 8 */ + }; + PyObject *data; + + if(code<=8) data = PyString_FromString(status[code]); + else if(code>=128 && code<=191) data = PyString_FromString("OEM-specific"); + else if(code>=192) data = PyString_FromString("Product-specific"); + else data = OUT_OF_SPEC; + return data; +} + +/******************************************************************************* +** 3.3.34 64-bit Memory Error Information (Type 33) +*/ + +static PyObject *dmi_64bit_memory_error_address(u64 code) { + PyObject *data; + if(code.h==0x80000000 && code.l==0x00000000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("0x%08x%08x", code.h, code.l); + return data; +} + +/******************************************************************************* +** 3.3.35 Management Device (Type 34) +*/ + +static PyObject *dmi_management_device_type(u8 code) { + /* 3.3.35.1 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "LM75", + "LM78", + "LM79", + "LM80", + "LM81", + "ADM9240", + "DS1780", + "MAX1617", + "GL518SM", + "W83781D", + "HT82H791" /* 0x0D */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x0D) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_management_device_address_type(u8 code) { + /* 3.3.35.2 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "I/O Port", + "Memory", + "SMBus" /* 0x05 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x05) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +/******************************************************************************* +** 3.3.38 Memory Channel (Type 37) +*/ + +static PyObject *dmi_memory_channel_type(u8 code) { + /* 3.3.38.1 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "RamBus", + "SyncLink" /* 0x04 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x04) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_memory_channel_devices(u8 count, const u8 *p) { + PyObject *data = PyDict_New(); + PyObject *subdata, *val; + int i; + + for(i=1; i<=count; i++) { + subdata = PyList_New(2); + + val = PyString_FromFormat("Load: %i", p[3*i]); + PyList_SET_ITEM(subdata, 0, val); + Py_DECREF(val); + + val = PyString_FromFormat("Handle: 0x%04x", WORD(p+3*i+1)); + PyList_SET_ITEM(subdata, 1, val); + Py_DECREF(val); + + PyDict_SetItem(data, PyInt_FromLong(i), subdata); + Py_DECREF(subdata); + } + return data; +} + +/******************************************************************************* +** 3.3.39 IPMI Device Information (Type 38) +*/ + +static PyObject *dmi_ipmi_interface_type(u8 code) { + /* 3.3.39.1 and IPMI 2.0, appendix C1, table C1-2 */ + static const char *type[]={ + "Unknown", /* 0x00 */ + "KCS (Keyboard Control Style)", + "SMIC (Server Management Interface Chip)", + "BT (Block Transfer)", + "SSIF (SMBus System Interface)" /* 0x04 */ + }; + PyObject *data; + + if(code<=0x04) data = PyString_FromString(type[code]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_ipmi_base_address(u8 type, const u8 *p, u8 lsb) { + PyObject *data; + if(type==0x04) /* SSIF */ { + data = PyString_FromFormat("0x%02x (SMBus)", (*p)>>1); + } else { + u64 address=QWORD(p); + data = PyString_FromFormat("0x%08x%08x (%s)", address.h, (address.l&~1)|lsb, address.l&1?"I/O":"Memory-mapped"); + } + return data; +} + +static PyObject *dmi_ipmi_register_spacing(u8 code) { + /* IPMI 2.0, appendix C1, table C1-1 */ + static const char *spacing[]={ + "Successive Byte Boundaries", /* 0x00 */ + "32-bit Boundaries", + "16-byte Boundaries" /* 0x02 */ + }; + PyObject *data; + + if(code<=0x02) return data = PyString_FromString(spacing[code]); + return data = OUT_OF_SPEC; +} + +/******************************************************************************* +** 3.3.40 System Power Supply (Type 39) +*/ + +static PyObject *dmi_power_supply_power(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%.3f W", (float)code/1000); + return data; +} + +static PyObject *dmi_power_supply_type(u8 code) { + /* 3.3.40.1 */ + static const char *type[]={ + "Other", /* 0x01 */ + "Unknown", + "Linear", + "Switching", + "Battery", + "UPS", + "Converter", + "Regulator" /* 0x08 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x08) data = PyString_FromString(type[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_power_supply_status(u8 code) { + /* 3.3.40.1 */ + static const char *status[]={ + "Other", /* 0x01 */ + "Unknown", + "OK", + "Non-critical", + "Critical" /* 0x05 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x05) data = PyString_FromString(status[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +static PyObject *dmi_power_supply_range_switching(u8 code) { + /* 3.3.40.1 */ + static const char *switching[]={ + "Other", /* 0x01 */ + "Unknown", + "Manual", + "Auto-switch", + "Wide Range", + "N/A" /* 0x06 */ + }; + PyObject *data; + + if(code>=0x01 && code<=0x06) data = PyString_FromString(switching[code-0x01]); + else data = OUT_OF_SPEC; + return data; +} + +/* +** 3.3.41 Additional Information (Type 40) +** +** Proper support of this entry type would require redesigning a large part of +** the code, so I am waiting to see actual implementations of it to decide +** whether it's worth the effort. +*/ + +static PyObject *dmi_additional_info(const struct dmi_header *h, const char *prefix) { + u8 *p = h->data + 4; + u8 count = *p++; + u8 length; + int i, offset = 5; + PyObject *data = PyList_New(count); + + for(i=0; ilength < offset + 1) break; + length = p[0x00]; + if (length < 0x05 || h->length < offset + length) break; + + PyDict_SetItemString(subdata, + "Referenced Handle", + PyString_FromFormat("0x%04x", WORD(p + 0x01)) + ); + + PyDict_SetItemString(subdata, + "Referenced Offset", + PyString_FromFormat("0x%02x", p[0x03]) + ); + + PyDict_SetItemString(subdata, + "String", + dmi_string_py(h, p[0x04]) + ); + + PyObject *_val; + switch (length - 0x05) { + case 1: + _val = PyString_FromFormat("0x%02x", p[0x05]); + break; + case 2: + _val = PyString_FromFormat("0x%04x", WORD(p + 0x05)); + break; + case 4: + _val = PyString_FromFormat("0x%08x", DWORD(p + 0x05)); + break; + default: + _val = PyString_FromString("Unexpected size"); + break; + } + PyDict_SetItemString(subdata, "Value", _val); + Py_DECREF(_val); + + p += length; + offset += length; + PyList_SET_ITEM(data, i, subdata); + } + return data; +} + +/******************************************************************************* +** Main +*/ + +PyObject* dmi_decode(struct dmi_header *h, u16 ver) { + + const u8 *data = h->data; + + //. 0xF1 --> 0xF100 + //int minor = h->type<<8; + char _[2048]; bzero(_, 2048); + //dmi_codes_major *dmiMajor = (dmi_codes_major *)&dmiCodesMajor[map_maj[h->type]]; + dmi_codes_major *dmiMajor = (dmi_codes_major *)&dmiCodesMajor[h->type]; + PyObject *pylist = PyDict_New(); + PyDict_SetItemString(pylist, "id", PyString_FromString(dmiMajor->id)); + PyDict_SetItemString(pylist, "desc", PyString_FromString(dmiMajor->desc)); + PyObject *_val; //. A Temporary pointer (value) + PyObject *_key; //. Another temporary pointer (key) + PyObject *caseData = PyDict_New(); + + switch(h->type) { + + case 0: /* 3.3.1 BIOS Information */ + + if(h->length<0x12) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Vendor", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x05]); + PyDict_SetItemString(caseData, "Version", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x08]); + PyDict_SetItemString(caseData, "Release Date", _val); + Py_DECREF(_val); + + /* + * On IA-64, the BIOS base address will read 0 because + * there is no BIOS. Skip the base address and the + * runtime size in this case. + */ + if(WORD(data+0x06)!=0) { + _val = PyString_FromFormat("0x%04x0", WORD(data+0x06)); + PyDict_SetItemString(caseData, "Address", _val); + Py_DECREF(_val); + + _val = dmi_bios_runtime_size((0x10000-WORD(data+0x06))<<4); + PyDict_SetItemString(caseData, "Runtime Size", _val); + Py_DECREF(_val); + } + + _val = PyString_FromFormat("%i kB", (data[0x09]+1)<<6); + PyDict_SetItemString(caseData, "ROM Size", _val); + Py_DECREF(_val); + + _val = dmi_bios_characteristics(QWORD(data+0x0A)); + PyDict_SetItemString(caseData, "Characteristics", _val); + Py_DECREF(_val); + + if(h->length<0x13) break; + _val = dmi_bios_characteristics_x1(data[0x12]); + PyDict_SetItemString(caseData, "Characteristics x1", _val); + Py_DECREF(_val); + + if(h->length<0x14) break; + _val = dmi_bios_characteristics_x2(data[0x13]); + PyDict_SetItemString(caseData, "Characteristics x2", _val); + Py_DECREF(_val); + + if(h->length<0x18) break; + + if(data[0x14]!=0xFF && data[0x15]!=0xFF) { + _val = PyString_FromFormat("%i.%i", data[0x14], data[0x15]); + PyDict_SetItemString(caseData, "BIOS Revision", _val); + Py_DECREF(_val); + } + + if(data[0x16]!=0xFF && data[0x17]!=0xFF) { + _val = PyString_FromFormat("%i.%i", data[0x16], data[0x17]); + PyDict_SetItemString(caseData, "Firmware Revision", _val); + Py_DECREF(_val); + } + + break; + + case 1: /* 3.3.2 System Information */ + + if(h->length<0x08) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Manufacturer", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x05]); + PyDict_SetItemString(caseData, "Product Name", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x06]); + PyDict_SetItemString(caseData, "Version", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x07]); + PyDict_SetItemString(caseData, "Serial Number", _val); + Py_DECREF(_val); + + if(h->length<0x19) break; + _val = dmi_system_uuid_py(data+0x08, ver); + PyDict_SetItemString(caseData, "UUID", _val); + Py_DECREF(_val); + + _val = dmi_system_wake_up_type(data[0x18]); + PyDict_SetItemString(caseData, "Wake-Up Type", _val); + Py_DECREF(_val); + + if(h->length<0x1B) break; + _val = dmi_string_py(h, data[0x19]); + PyDict_SetItemString(caseData, "SKU Number", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x1A]); + PyDict_SetItemString(caseData, "Family", _val); + Py_DECREF(_val); + break; + + case 2: /* 3.3.3 Base Board Information */ + + if(h->length<0x08) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Manufacturer", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x05]); + PyDict_SetItemString(caseData, "Product Name", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x06]); + PyDict_SetItemString(caseData, "Version", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x07]); + PyDict_SetItemString(caseData, "Serial Number", _val); + Py_DECREF(_val); + + if(h->length<0x0F) break; + _val = dmi_string_py(h, data[0x08]); + PyDict_SetItemString(caseData, "Asset Tag", _val); + Py_DECREF(_val); + + _val = dmi_base_board_features(data[0x09]); + PyDict_SetItemString(caseData, "Features", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x0A]); + PyDict_SetItemString(caseData, "Location In Chassis", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%04x", WORD(data+0x0B)); + PyDict_SetItemString(caseData, "Chassis Handle", _val); + Py_DECREF(_val); + + _val = dmi_base_board_type(data[0x0D]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + if(h->length<0x0F+data[0x0E]*sizeof(u16)) break; + _val = dmi_base_board_handles(data[0x0E], data+0x0F); + PyDict_SetItemString(caseData, "Type ???", _val); + Py_DECREF(_val); + break; + + case 3: /* 3.3.4 Chassis Information */ + + if(h->length<0x09) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Manufacturer", _val); + Py_DECREF(_val); + + _val = dmi_chassis_type_py(data[0x05]&0x7F); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_chassis_lock(data[0x05]>>7); + PyDict_SetItemString(caseData, "Lock", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x06]); + PyDict_SetItemString(caseData, "Version", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x07]); + PyDict_SetItemString(caseData, "Serial Number", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x08]); + PyDict_SetItemString(caseData, "Asset Tag", _val); + Py_DECREF(_val); + + if(h->length<0x0D) break; + _val = dmi_chassis_state(data[0x09]); + PyDict_SetItemString(caseData, "Boot-Up State", _val); + Py_DECREF(_val); + + _val = dmi_chassis_state(data[0x0A]); + PyDict_SetItemString(caseData, "Power Supply State", _val); + Py_DECREF(_val); + + _val = dmi_chassis_state(data[0x0B]); + PyDict_SetItemString(caseData, "Thermal State", _val); + Py_DECREF(_val); + + _val = PyString_FromString(dmi_chassis_security_status(data[0x0C])); + PyDict_SetItemString(caseData, "Security Status", _val); + Py_DECREF(_val); + + if(h->length<0x11) break; + _val = PyString_FromFormat("0x%08x", DWORD(data+0x0D)); + PyDict_SetItemString(caseData, "OEM Information", _val); + Py_DECREF(_val); + + if(h->length<0x13) break; + _val = dmi_chassis_height(data[0x11]); + PyDict_SetItemString(caseData, "Height", _val); + Py_DECREF(_val); + + _val = dmi_chassis_power_cords(data[0x12]); + PyDict_SetItemString(caseData, "Number Of Power Cords", _val); + Py_DECREF(_val); + + if(h->length < 0x15) break; + if(h->length<0x15+data[0x13]*data[0x14]) break; + _val = dmi_chassis_elements(data[0x13], data[0x14], data+0x15); + PyDict_SetItemString(caseData, "Elements", _val); + Py_DECREF(_val); + + break; + + + case 4: /* 3.3.5 Processor Information */ + + if(h->length<0x1A) break; + + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Socket Designation", _val); + Py_DECREF(_val); + + _val = dmi_processor_type(data[0x05]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = PyString_FromString(dmi_processor_family(h)); + PyDict_SetItemString(caseData, "Family", _val); + Py_DECREF(_val); + + _val = dmi_processor_id(data[0x06], data+8, dmi_string(h, data[0x10])); + PyDict_SetItemString(_val, "Vendor", dmi_string_py(h, data[0x07])); + PyDict_SetItemString(caseData, "Manufacturer", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x10]); + PyDict_SetItemString(caseData, "Version", _val); + Py_DECREF(_val); + + _val = dmi_processor_voltage(data[0x11]); + PyDict_SetItemString(caseData, "Voltage", _val); + Py_DECREF(_val); + + _val = dmi_processor_frequency_py(data+0x12); + PyDict_SetItemString(caseData, "External Clock", _val); + Py_DECREF(_val); + + _val = dmi_processor_frequency_py(data+0x14); + PyDict_SetItemString(caseData, "Max Speed", _val); + Py_DECREF(_val); + + _val = dmi_processor_frequency_py(data+0x16); + PyDict_SetItemString(caseData, "Current Speed", _val); + Py_DECREF(_val); + + if(data[0x18]&(1<<6)) { + _val = PyString_FromFormat("Populated:%s", dmi_processor_status(data[0x18]&0x07)); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + } else { + _val = PyString_FromString("Populated:No"); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + } + _val = dmi_processor_upgrade(data[0x19]); + PyDict_SetItemString(caseData, "Upgrade", _val); + Py_DECREF(_val); + + if(h->length<0x20) break; + _val = dmi_processor_cache(WORD(data+0x1A), "L1", ver); + PyDict_SetItemString(caseData, "L1 Cache Handle", _val); + Py_DECREF(_val); + + _val = dmi_processor_cache(WORD(data+0x1C), "L2", ver); + PyDict_SetItemString(caseData, "L2 Cache Handle", _val); + Py_DECREF(_val); + + _val = dmi_processor_cache(WORD(data+0x1E), "L3", ver); + PyDict_SetItemString(caseData, "L3 Cache Handle", _val); + Py_DECREF(_val); + + if(h->length<0x23) break; + _val = dmi_string_py(h, data[0x20]); + PyDict_SetItemString(caseData, "Serial Number", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x21]); + PyDict_SetItemString(caseData, "Asset Tag", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x22]); + PyDict_SetItemString(caseData, "Part Number", _val); + Py_DECREF(_val); + + if(h->length<0x28) break; + if(data[0x23]!=0) { + _val = PyString_FromFormat("%i", data[0x23]); + PyDict_SetItemString(caseData, "Core Count", _val); + Py_DECREF(_val); + } + + if(data[0x24]!=0) { + _val = PyString_FromFormat("%i", data[0x24]); + PyDict_SetItemString(caseData, "Core Enabled", _val); + Py_DECREF(_val); + } + + if(data[0x25]!=0) { + _val = PyString_FromFormat("%i", data[0x25]); + PyDict_SetItemString(caseData, "Thread Count", _val); + Py_DECREF(_val); + } + + _val = dmi_processor_characteristics(WORD(data+0x26)); + PyDict_SetItemString(caseData, "Characteristics", _val); + Py_DECREF(_val); + break; + + case 5: /* 3.3.6 Memory Controller Information */ + + PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); + + if(h->length<0x0F) break; + _val = dmi_memory_controller_ed_method(data[0x04]); + PyDict_SetItemString(caseData, "Error Detecting Method", _val); + Py_DECREF(_val); + + _val = dmi_memory_controller_ec_capabilities(data[0x05]); + PyDict_SetItemString(caseData, "Error Correcting Capabilities", _val); + Py_DECREF(_val); + + _val = dmi_memory_controller_interleave(data[0x06]); + PyDict_SetItemString(caseData, "Supported Interleave", _val); + Py_DECREF(_val); + + _val = dmi_memory_controller_interleave(data[0x07]); + PyDict_SetItemString(caseData, "Current Interleave", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i MB", 1<length<0x0F+data[0x0E]*sizeof(u16)) break; + _val = dmi_memory_controller_slots(data[0x0E], data+0x0F); + PyDict_SetItemString(caseData, "Associated Memory Sluts", _val); + Py_DECREF(_val); + + if(h->length<0x10+data[0x0E]*sizeof(u16)) break; + _val = dmi_memory_controller_ec_capabilities(data[0x0F+data[0x0E]*sizeof(u16)]); + PyDict_SetItemString(caseData, "Enabled Error Correcting Capabilities", _val); + Py_DECREF(_val); + break; + + case 6: /* 3.3.7 Memory Module Information */ + + PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); + + if(h->length<0x0C) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Socket Designation", _val); + Py_DECREF(_val); + + _val = dmi_memory_module_connections(data[0x05]); + PyDict_SetItemString(caseData, "Bank Connections", _val); + Py_DECREF(_val); + + _val = dmi_memory_module_speed(data[0x06]); + PyDict_SetItemString(caseData, "Current Speed", _val); + Py_DECREF(_val); + + _val = dmi_memory_module_types(WORD(data+0x07)); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_memory_module_size(data[0x09]); + PyDict_SetItemString(caseData, "Installed Size", _val); + Py_DECREF(_val); + + _val = dmi_memory_module_size(data[0x0A]); + PyDict_SetItemString(caseData, "Enabled Size", _val); + Py_DECREF(_val); + + _val = dmi_memory_module_error(data[0x0B]); + PyDict_SetItemString(caseData, "Error Status", _val); + Py_DECREF(_val); + break; + + case 7: /* 3.3.8 Cache Information */ + + PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); + + if(h->length<0x0F) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Socket Designation", _val); + Py_DECREF(_val); + + _val = PyDict_New(); + PyDict_SetItemString(_val, "Enabled", WORD(data+0x05)&0x0080?Py_True:Py_False); + PyDict_SetItemString(_val, "Socketed", WORD(data+0x05)&0x0008?Py_True:Py_False); + PyDict_SetItemString(_val, "Level", PyInt_FromLong((WORD(data+0x05)&0x0007)+1)); + PyDict_SetItemString(caseData, "Configuration" , _val); + Py_DECREF(_val); + + _val = dmi_cache_mode((WORD(data+0x05)>>8)&0x0003); + PyDict_SetItemString(caseData, "Operational Mode", _val); + Py_DECREF(_val); + + _val = dmi_cache_location((WORD(data+0x05)>>5)&0x0003); + PyDict_SetItemString(caseData, "Location", _val); + Py_DECREF(_val); + + _val = dmi_cache_size(WORD(data+0x09)); + PyDict_SetItemString(caseData, "Installed Size", _val); + Py_DECREF(_val); + + _val = dmi_cache_size(WORD(data+0x07)); + PyDict_SetItemString(caseData, "Maximum Size", _val); + Py_DECREF(_val); + + _val = dmi_cache_types(WORD(data+0x0B)); + PyDict_SetItemString(caseData, "Supported SRAM Types", _val); + Py_DECREF(_val); + + _val = dmi_cache_types(WORD(data+0x0D)); + PyDict_SetItemString(caseData, "Installed SRAM Type", _val); + Py_DECREF(_val); + + if(h->length<0x13) break; + _val = dmi_memory_module_speed(data[0x0F]); + PyDict_SetItemString(caseData, "Speed", _val); + Py_DECREF(_val); + + _val = dmi_cache_ec_type(data[0x10]); + PyDict_SetItemString(caseData, "Error Correction Type", _val); + Py_DECREF(_val); + + _val = dmi_cache_type(data[0x11]); + PyDict_SetItemString(caseData, "System Type", _val); + Py_DECREF(_val); + + _val = dmi_cache_associativity(data[0x12]); + PyDict_SetItemString(caseData, "Associativity", _val); + Py_DECREF(_val); + + break; + + case 8: /* 3.3.9 Port Connector Information */ + + PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); + + if(h->length<0x09) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Internal Reference Designator", _val); + Py_DECREF(_val); + + _val = dmi_port_connector_type(data[0x05]); + PyDict_SetItemString(caseData, "Internal Connector Type", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x06]); + PyDict_SetItemString(caseData, "External Reference Designator", _val); + Py_DECREF(_val); + + _val = dmi_port_connector_type(data[0x07]); + PyDict_SetItemString(caseData, "External Connector Type", _val); + Py_DECREF(_val); + + _val = dmi_port_type(data[0x08]); + PyDict_SetItemString(caseData, "Port Type", _val); + Py_DECREF(_val); + + break; + + case 9: /* 3.3.10 System Slots */ + + PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); + + if(h->length<0x0C) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Designation", _val); + Py_DECREF(_val); + + _val = dmi_slot_bus_width(data[0x06]); + PyDict_SetItemString(caseData, "Type:SlotBusWidth", _val); + Py_DECREF(_val); + _val = dmi_slot_type(data[0x05]); + PyDict_SetItemString(caseData, "Type:SlotType", _val); + Py_DECREF(_val); + + _val = dmi_slot_current_usage(data[0x07]); + PyDict_SetItemString(caseData, "Current Usage", _val); + Py_DECREF(_val); + + _val = dmi_slot_length(data[0x08]); + PyDict_SetItemString(caseData, "SlotLength", _val); + Py_DECREF(_val); + _val = dmi_slot_id(data[0x09], data[0x0A], data[0x05]); + PyDict_SetItemString(caseData, "SlotId", _val); + Py_DECREF(_val); + + _val = (h->length<0x0D)?dmi_slot_characteristics(data[0x0B], 0x00):dmi_slot_characteristics(data[0x0B], data[0x0C]); + PyDict_SetItemString(caseData, "Characteristics", _val); + Py_DECREF(_val); + break; + + case 10: /* 3.3.11 On Board Devices Information */ + + PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); + + break; + + case 11: /* 3.3.12 OEM Strings */ + + PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); + + if(h->length<0x05) break; + _val = dmi_oem_strings(h); + PyDict_SetItemString(caseData, "Strings", _val); + Py_DECREF(_val); + + break; + + case 12: /* 3.3.13 System Configuration Options */ + + if(h->length<0x05) break; + _val = dmi_system_configuration_options(h); + PyDict_SetItemString(caseData, "Options", _val); + Py_DECREF(_val); + + break; + + case 13: /* 3.3.14 BIOS Language Information */ + + if(h->length<0x16) break; + _val = PyString_FromFormat("%i", data[0x04]); + PyDict_SetItemString(caseData, "Installable Languages", _val); + Py_DECREF(_val); + + _val = dmi_bios_languages(h); + PyList_SET_ITEM(_val, 0, dmi_string_py(h, data[0x15])); + PyDict_SetItemString(caseData, "Currently Installed Language", _val); + Py_DECREF(_val); + + break; + + case 14: /* 3.3.15 Group Associations */ + + if(h->length<0x05) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Name", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i", (h->length-0x05)/3); + PyDict_SetItemString(caseData, "Items", _val); + Py_DECREF(_val); + + _val = dmi_group_associations_items((h->length-0x05)/3, data+0x05); + PyDict_SetItemString(caseData, "Items2", _val); //. FIXME: Title + Py_DECREF(_val); + break; + + case 15: /* 3.3.16 System Event Log */ + + if(h->length<0x14) break; + _val = PyString_FromFormat("%i bytes", WORD(data+0x04)); + PyDict_SetItemString(caseData, "Area Length", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%04x", WORD(data+0x06)); + PyDict_SetItemString(caseData, "Header Start Offset", _val); + Py_DECREF(_val); + + if(WORD(data+0x08)-WORD(data+0x06)) { + _val = PyString_FromFormat("%i byte%s", WORD(data+0x08)-WORD(data+0x06), WORD(data+0x08)-WORD(data+0x06)>1?"s":""); + PyDict_SetItemString(caseData, "Header Length", _val); + Py_DECREF(_val); + } + + _val = PyString_FromFormat("0x%04x", WORD(data+0x08)); + PyDict_SetItemString(caseData, "Data Start Offset", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%s", dmi_event_log_method(data[0x0A])); + PyDict_SetItemString(caseData, "Access Method", _val); + Py_DECREF(_val); + + _val = dmi_event_log_address_py(data[0x0A], data+0x10); + PyDict_SetItemString(caseData, "Access Address", _val); + Py_DECREF(_val); + + _val = dmi_event_log_status_py(data[0x0B]); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%08x", DWORD(data+0x0C)); + PyDict_SetItemString(caseData, "Change Token", _val); + Py_DECREF(_val); + + if(h->length<0x17) break; + _val = PyString_FromFormat("%s", dmi_event_log_header_type(data[0x14])); + PyDict_SetItemString(caseData, "Header Format", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i", data[0x15]); + PyDict_SetItemString(caseData, "Supported Log Type Descriptors", _val); + Py_DECREF(_val); + + if(h->length<0x17+data[0x15]*data[0x16]) break; + _val = dmi_event_log_descriptors(data[0x15], data[0x16], data+0x17); + PyDict_SetItemString(caseData, "DMI Event Log Descriptors", _val); + Py_DECREF(_val); + + break; + + case 16: /* 3.3.17 Physical Memory Array */ + + if(h->length<0x0F) break; + _val = dmi_memory_array_location(data[0x04]); + PyDict_SetItemString(caseData, "Location", _val); + Py_DECREF(_val); + + _val = dmi_memory_array_use(data[0x05]); + PyDict_SetItemString(caseData, "Use", _val); + Py_DECREF(_val); + + _val = dmi_memory_array_ec_type(data[0x06]); + PyDict_SetItemString(caseData, "Error Correction Type", _val); + Py_DECREF(_val); + + _val = dmi_memory_array_capacity(DWORD(data+0x07)); + PyDict_SetItemString(caseData, "Maximum Capacity", _val); + Py_DECREF(_val); + + _val = dmi_memory_array_error_handle(WORD(data+0x0B)); + PyDict_SetItemString(caseData, "Error Information Handle", _val); + Py_DECREF(_val); + + _val = PyInt_FromLong(WORD(data+0x0D)); + PyDict_SetItemString(caseData, "Number Of Devices", _val); + Py_DECREF(_val); + break; + + + case 17: /* 3.3.18 Memory Device */ + + if(h->length<0x15) break; + _val = PyString_FromFormat("0x%04x", WORD(data+0x04)); + PyDict_SetItemString(caseData, "Array Handle", _val); + Py_DECREF(_val); + + _val = dmi_memory_array_error_handle(WORD(data+0x06)); + PyDict_SetItemString(caseData, "Error Information Handle", _val); + Py_DECREF(_val); + + _val = dmi_memory_device_width(WORD(data+0x08)); + PyDict_SetItemString(caseData, "Total Width", _val); + Py_DECREF(_val); + + _val = dmi_memory_device_width(WORD(data+0x0A)); + PyDict_SetItemString(caseData, "Data Width", _val); + Py_DECREF(_val); + + _val = dmi_memory_device_size(WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Size", _val); + Py_DECREF(_val); + + _val = dmi_memory_device_form_factor(data[0x0E]); + PyDict_SetItemString(caseData, "Form Factor", _val); + Py_DECREF(_val); + + _val = dmi_memory_device_set(data[0x0F]); + PyDict_SetItemString(caseData, "Set", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x10]); + PyDict_SetItemString(caseData, "Locator", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x11]); + PyDict_SetItemString(caseData, "Bank Locator", _val); + Py_DECREF(_val); + + _val = dmi_memory_device_type(data[0x12]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_memory_device_type_detail(WORD(data+0x13)); + PyDict_SetItemString(caseData, "Type Detail", _val); + Py_DECREF(_val); + + if(h->length<0x17) break; + _val = dmi_memory_device_speed(WORD(data+0x15)); + PyDict_SetItemString(caseData, "Speed", _val); + Py_DECREF(_val); + + if(h->length<0x1B) break; + _val = dmi_string_py(h, data[0x17]); + PyDict_SetItemString(caseData, "Manufacturer", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x18]); + PyDict_SetItemString(caseData,"Serial Number" , _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x19]); + PyDict_SetItemString(caseData, "Asset Tag", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x1A]); + PyDict_SetItemString(caseData, "Part Number", _val); + Py_DECREF(_val); + break; + + case 18: /* 3.3.19 32-bit Memory Error Information */ + + if(h->length<0x17) break; + _val = dmi_memory_error_type(data[0x04]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_memory_error_granularity(data[0x05]); + PyDict_SetItemString(caseData, "Granularity", _val); + Py_DECREF(_val); + + _val = dmi_memory_error_operation(data[0x06]); + PyDict_SetItemString(caseData, "Operation", _val); + Py_DECREF(_val); + + _val = dmi_memory_error_syndrome(DWORD(data+0x07)); + PyDict_SetItemString(caseData, "Vendor Syndrome", _val); + Py_DECREF(_val); + + _val = dmi_32bit_memory_error_address(DWORD(data+0x0B)); + PyDict_SetItemString(caseData, "Memory Array Address", _val); + Py_DECREF(_val); + + _val = dmi_32bit_memory_error_address(DWORD(data+0x0F)); + PyDict_SetItemString(caseData, "Device Address", _val); + Py_DECREF(_val); + + _val = dmi_32bit_memory_error_address(DWORD(data+0x13)); + PyDict_SetItemString(caseData, "Resolution", _val); + Py_DECREF(_val); + break; + + case 19: /* 3.3.20 Memory Array Mapped Address */ + + if(h->length<0x0F) break; + _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x04)>>2, (DWORD(data+0x04)&0x3)<<10); + PyDict_SetItemString(caseData, "Starting Address", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x08)>>2, ((DWORD(data+0x08)&0x3)<<10)+0x3FF); + PyDict_SetItemString(caseData, "Ending Address", _val); + Py_DECREF(_val); + + _val = dmi_mapped_address_size(DWORD(data+0x08)-DWORD(data+0x04)+1); + PyDict_SetItemString(caseData, "Range Size", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%04x", WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Physical Array Handle", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i", data[0x0F]); + PyDict_SetItemString(caseData, "Partition Width", _val); + Py_DECREF(_val); + break; + + case 20: /* 3.3.21 Memory Device Mapped Address */ + + if(h->length<0x13) break; + _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x04)>>2, (DWORD(data+0x04)&0x3)<<10); + PyDict_SetItemString(caseData, "Starting Address", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x08)>>2, ((DWORD(data+0x08)&0x3)<<10)+0x3FF); + PyDict_SetItemString(caseData, "Ending Address", _val); + Py_DECREF(_val); + + _val = dmi_mapped_address_size(DWORD(data+0x08)-DWORD(data+0x04)+1); + PyDict_SetItemString(caseData, "Range Size", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%04x", WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Physical Device Handle", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%04x", WORD(data+0x0E)); + PyDict_SetItemString(caseData, "Memory Array Mapped Address Handle", _val); + Py_DECREF(_val); + + _val = dmi_mapped_address_row_position(data[0x10]); + PyDict_SetItemString(caseData, "Partition Row Position", _val); + Py_DECREF(_val); + + _val = dmi_mapped_address_interleave_position(data[0x11]); + PyDict_SetItemString(caseData, ">>>", _val); + Py_DECREF(_val); + + _val = dmi_mapped_address_interleaved_data_depth(data[0x12]); + PyDict_SetItemString(caseData, ">>>", _val); + Py_DECREF(_val); + break; + + case 21: /* 3.3.22 Built-in Pointing Device */ + + if(h->length<0x07) break; + _val = dmi_pointing_device_type(data[0x04]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_pointing_device_interface(data[0x05]); + PyDict_SetItemString(caseData, "Interface", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i", data[0x06]); + PyDict_SetItemString(caseData, "Buttons", _val); + Py_DECREF(_val); + break; + + case 22: /* 3.3.23 Portable Battery */ + + if(h->length<0x10) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Location", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x05]); + PyDict_SetItemString(caseData, "Manufacturer", _val); + Py_DECREF(_val); + + if(data[0x06] || h->length<0x1A) { + _val = dmi_string_py(h, data[0x06]); + PyDict_SetItemString(caseData, "Manufacture Date", _val); + Py_DECREF(_val); + } + + if(data[0x07] || h->length<0x1A) { + _val = dmi_string_py(h, data[0x07]); + PyDict_SetItemString(caseData, "Serial Number", _val); + Py_DECREF(_val); + } + + _val = dmi_string_py(h, data[0x08]); + PyDict_SetItemString(caseData, "Name", _val); + Py_DECREF(_val); + + if(data[0x09]!=0x02 || h->length<0x1A) { + _val = dmi_battery_chemistry(data[0x09]); + PyDict_SetItemString(caseData, "Chemistry", _val); + Py_DECREF(_val); + } + _val = (h->length<0x1A)?dmi_battery_capacity(WORD(data+0x0A), 1):dmi_battery_capacity(WORD(data+0x0A), data[0x15]); + PyDict_SetItemString(caseData, "Design Capacity", _val); + Py_DECREF(_val); + + _val = dmi_battery_voltage(WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Design Voltage", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x0E]); + PyDict_SetItemString(caseData, "SBDS Version", _val); + Py_DECREF(_val); + + _val = dmi_battery_maximum_error(data[0x0F]); + PyDict_SetItemString(caseData, "Maximum Error", _val); + Py_DECREF(_val); + + if(h->length<0x1A) break; + if(data[0x07]==0) { + _val = PyString_FromFormat("%04x", WORD(data+0x10)); + PyDict_SetItemString(caseData, "SBDS Serial Number", _val); + Py_DECREF(_val); + } + if(data[0x06]==0) { + _val = PyString_FromFormat("%i-%02u-%02u", 1980+(WORD(data+0x12)>>9), (WORD(data+0x12)>>5)&0x0F, WORD(data+0x12)&0x1F); + PyDict_SetItemString(caseData, "SBDS Manufacture Date", _val); + Py_DECREF(_val); + } + if(data[0x09]==0x02) { + _val = dmi_string_py(h, data[0x14]); + PyDict_SetItemString(caseData, "SBDS Chemistry", _val); + Py_DECREF(_val); + } + + _val = PyString_FromFormat("0x%08x", DWORD(data+0x16)); + PyDict_SetItemString(caseData, "OEM-specific Information", _val); + Py_DECREF(_val); + break; + + case 23: /* 3.3.24 System Reset */ + + if(h->length<0x0D) break; + _val = PyString_FromFormat("%s", data[0x04]&(1<<0)?"Enabled":"Disabled"); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%s", data[0x04]&(1<<5)?"Present":"Not Present"); + PyDict_SetItemString(caseData, "Watchdog Timer", _val); + Py_DECREF(_val); + + if(!(data[0x04]&(1<<5))) break; + _val = dmi_system_reset_boot_option((data[0x04]>>1)&0x3); + PyDict_SetItemString(caseData, "Boot Option", _val); + Py_DECREF(_val); + + _val = dmi_system_reset_boot_option((data[0x04]>>3)&0x3); + PyDict_SetItemString(caseData, "Boot Option On Limit", _val); + Py_DECREF(_val); + + _val = dmi_system_reset_count(WORD(data+0x05)); + PyDict_SetItemString(caseData, "Reset Count", _val); + Py_DECREF(_val); + + _val = dmi_system_reset_count(WORD(data+0x07)); + PyDict_SetItemString(caseData, "Reset Limit", _val); + Py_DECREF(_val); + + _val = dmi_system_reset_timer(WORD(data+0x09)); + PyDict_SetItemString(caseData, "Timer Interval", _val); + Py_DECREF(_val); + + _val = dmi_system_reset_timer(WORD(data+0x0B)); + PyDict_SetItemString(caseData, "Timeout", _val); + Py_DECREF(_val); + + break; + + case 24: /* 3.3.25 Hardware Security */ + + if(h->length<0x05) break; + _val = dmi_hardware_security_status(data[0x04]>>6); + PyDict_SetItemString(caseData, "Power-On Password Status", _val); + Py_DECREF(_val); + + _val = dmi_hardware_security_status((data[0x04]>>4)&0x3); + PyDict_SetItemString(caseData, "Keyboard Password Status", _val); + Py_DECREF(_val); + + _val = dmi_hardware_security_status((data[0x04]>>2)&0x3); + PyDict_SetItemString(caseData, "Administrator Password Status", _val); + Py_DECREF(_val); + + _val = dmi_hardware_security_status(data[0x04]&0x3); + PyDict_SetItemString(caseData, "Front Panel Reset Status", _val); + Py_DECREF(_val); + + break; + + case 25: /* 3.3.26 System Power Controls */ + + if(h->length<0x09) break; + _val = dmi_power_controls_power_on(data+0x04); + PyDict_SetItemString(caseData, "Next Scheduled Power-on", _val); + Py_DECREF(_val); + + break; + + case 26: /* 3.3.27 Voltage Probe */ + + if(h->length<0x14) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Description", _val); + Py_DECREF(_val); + + _val = dmi_voltage_probe_location(data[0x05]&0x1f); + PyDict_SetItemString(caseData, "Location", _val); + Py_DECREF(_val); + + _val = dmi_probe_status(data[0x05]>>5); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + + _val = dmi_voltage_probe_value(WORD(data+0x06)); + PyDict_SetItemString(caseData, "Maximum Value", _val); + Py_DECREF(_val); + + _val = dmi_voltage_probe_value(WORD(data+0x08)); + PyDict_SetItemString(caseData, "Minimum Value", _val); + Py_DECREF(_val); + + _val = dmi_voltage_probe_resolution(WORD(data+0x0A)); + PyDict_SetItemString(caseData, "Resolution", _val); + Py_DECREF(_val); + + _val = dmi_voltage_probe_value(WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Tolerance", _val); + Py_DECREF(_val); + + _val = dmi_probe_accuracy(WORD(data+0x0E)); + PyDict_SetItemString(caseData, "Accuracy", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%08x", DWORD(data+0x10)); + PyDict_SetItemString(caseData, "OEM-specific Information", _val); + Py_DECREF(_val); + + if(h->length<0x16) break; + _val = dmi_voltage_probe_value(WORD(data+0x14)); + PyDict_SetItemString(caseData, "Nominal Value", _val); + Py_DECREF(_val); + + break; + + case 27: /* 3.3.28 Cooling Device */ + + if(h->length<0x0C) break; + if(WORD(data+0x04)!=0xFFFF) { + _val = PyString_FromFormat("0x%04x", WORD(data+0x04)); + PyDict_SetItemString(caseData, "Temperature Probe Handle", _val); + Py_DECREF(_val); + } + + _val = dmi_cooling_device_type(data[0x06]&0x1f); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_probe_status(data[0x06]>>5); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + + if(data[0x07]!=0x00) { + _val = PyString_FromFormat("%i", data[0x07]); + PyDict_SetItemString(caseData, "Cooling Unit Group", _val); + Py_DECREF(_val); + } + + _val = PyString_FromFormat("0x%08x", DWORD(data+0x08)); + PyDict_SetItemString(caseData, "OEM-specific Information", _val); + Py_DECREF(_val); + + if(h->length<0x0E) break; + _val = dmi_cooling_device_speed(WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Nominal Speed", _val); + Py_DECREF(_val); + + break; + + case 28: /* 3.3.29 Temperature Probe */ + + if(h->length<0x14) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Description", _val); + Py_DECREF(_val); + + _val = dmi_temperature_probe_location(data[0x05]&0x1F); + PyDict_SetItemString(caseData, "Location", _val); + Py_DECREF(_val); + + _val = dmi_probe_status(data[0x05]>>5); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + + _val = dmi_temperature_probe_value(WORD(data+0x06)); + PyDict_SetItemString(caseData, "Maximum Value", _val); + Py_DECREF(_val); + + _val = dmi_temperature_probe_value(WORD(data+0x08)); + PyDict_SetItemString(caseData, "Minimum Value", _val); + Py_DECREF(_val); + + _val = dmi_temperature_probe_resolution(WORD(data+0x0A)); + PyDict_SetItemString(caseData, "Resolution", _val); + Py_DECREF(_val); + + _val = dmi_temperature_probe_value(WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Tolerance", _val); + Py_DECREF(_val); + + _val = dmi_probe_accuracy(WORD(data+0x0E)); + PyDict_SetItemString(caseData, "Accuracy", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%08x", DWORD(data+0x10)); + PyDict_SetItemString(caseData, "OEM-specific Information", _val); + Py_DECREF(_val); + + if(h->length<0x16) break; + _val = dmi_temperature_probe_value(WORD(data+0x14)); + PyDict_SetItemString(caseData, "Nominal Value", _val); + Py_DECREF(_val); + + break; + + case 29: /* 3.3.30 Electrical Current Probe */ + + if(h->length<0x14) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Description", _val); + Py_DECREF(_val); + + _val = dmi_voltage_probe_location(data[5]&0x1F); + PyDict_SetItemString(caseData, "Location", _val); + Py_DECREF(_val); + + _val = dmi_probe_status(data[0x05]>>5); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + + _val = dmi_current_probe_value(WORD(data+0x06)); + PyDict_SetItemString(caseData, "Maximum Value", _val); + Py_DECREF(_val); + + _val = dmi_current_probe_value(WORD(data+0x08)); + PyDict_SetItemString(caseData, "Minimum Value", _val); + Py_DECREF(_val); + + _val = dmi_current_probe_resolution(WORD(data+0x0A)); + PyDict_SetItemString(caseData, "Resolution", _val); + Py_DECREF(_val); + + _val = dmi_current_probe_value(WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Tolerance", _val); + Py_DECREF(_val); + + _val = dmi_probe_accuracy(WORD(data+0x0E)); + PyDict_SetItemString(caseData, "Accuracy", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%08x", DWORD(data+0x10)); + PyDict_SetItemString(caseData, "OEM-specific Information", _val); + Py_DECREF(_val); + + if(h->length<0x16) break; + _val = dmi_current_probe_value(WORD(data+0x14)); + PyDict_SetItemString(caseData, "Nominal Value", _val); + Py_DECREF(_val); + + break; + + case 30: /* 3.3.31 Out-of-band Remote Access */ + + if(h->length<0x06) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Manufacturer Name", _val); + Py_DECREF(_val); + + _val = data[0x05]&(1<<0)?Py_True:Py_False; + PyDict_SetItemString(caseData, "Inbound Connection Enabled", _val); + Py_DECREF(_val); + + _val = data[0x05]&(1<<1)?Py_True:Py_False; + PyDict_SetItemString(caseData, "Outbound Connection Enabled", _val); + Py_DECREF(_val); + break; + + case 31: /* 3.3.32 Boot Integrity Services Entry Point */ + + break; + + case 32: /* 3.3.33 System Boot Information */ + + if(h->length<0x0B) break; + _val = dmi_system_boot_status(data[0x0A]); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + + break; + + case 33: /* 3.3.34 64-bit Memory Error Information */ + if(h->length<0x1F) break; + + _val = dmi_memory_error_type(data[0x04]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_memory_error_granularity(data[0x05]); + PyDict_SetItemString(caseData, "Granularity", _val); + Py_DECREF(_val); + + _val = dmi_memory_error_operation(data[0x06]); + PyDict_SetItemString(caseData, "Operation", _val); + Py_DECREF(_val); + + _val = dmi_memory_error_syndrome(DWORD(data+0x07)); + PyDict_SetItemString(caseData, "Vendor Syndrome", _val); + Py_DECREF(_val); + + _val = dmi_64bit_memory_error_address(QWORD(data+0x0B)); + PyDict_SetItemString(caseData, "Memory Array Address", _val); + Py_DECREF(_val); + + _val = dmi_64bit_memory_error_address(QWORD(data+0x13)); + PyDict_SetItemString(caseData, "Device Address", _val); + Py_DECREF(_val); + + _val = dmi_32bit_memory_error_address(DWORD(data+0x1B)); + PyDict_SetItemString(caseData, "Resolution", _val); + Py_DECREF(_val); + + break; + + case 34: /* 3.3.35 Management Device */ + + if(h->length<0x0B) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Description", _val); + Py_DECREF(_val); + + _val = dmi_management_device_type(data[0x05]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%08x", DWORD(data+0x06)); + PyDict_SetItemString(caseData, "Address", _val); + Py_DECREF(_val); + + _val = dmi_management_device_address_type(data[0x0A]); + PyDict_SetItemString(caseData, "Address Type", _val); + Py_DECREF(_val); + + break; + + case 35: /* 3.3.36 Management Device Component */ + + if(h->length<0x0B) break; + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(caseData, "Description", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%04x", WORD(data+0x05)); + PyDict_SetItemString(caseData, "Management Device Handle", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%04x", WORD(data+0x07)); + PyDict_SetItemString(caseData, "Component Handle", _val); + Py_DECREF(_val); + + if(WORD(data+0x09)!=0xFFFF) { + _val = PyString_FromFormat("0x%04x", WORD(data+0x09)); + PyDict_SetItemString(caseData, "Threshold Handle", _val); + Py_DECREF(_val); + } + + break; + + case 36: /* 3.3.37 Management Device Threshold Data */ + + if(h->length<0x10) break; + if(WORD(data+0x04)!=0x8000) { + _val = PyString_FromFormat("%d", (i16)WORD(data+0x04)); + PyDict_SetItemString(caseData, "Lower Non-critical Threshold", _val); + Py_DECREF(_val); + } + if(WORD(data+0x06)!=0x8000) { + _val = PyString_FromFormat("%d", (i16)WORD(data+0x06)); + PyDict_SetItemString(caseData, "Upper Non-critical Threshold", _val); + Py_DECREF(_val); + } + if(WORD(data+0x08)!=0x8000) { + _val = PyString_FromFormat("%d", (i16)WORD(data+0x08)); + PyDict_SetItemString(caseData, "Lower Critical Threshold", _val); + Py_DECREF(_val); + } + if(WORD(data+0x0A)!=0x8000) { + _val = PyString_FromFormat("%d", (i16)WORD(data+0x0A)); + PyDict_SetItemString(caseData, "Upper Critical Threshold", _val); + Py_DECREF(_val); + } + if(WORD(data+0x0C)!=0x8000) { + _val = PyString_FromFormat("%d", (i16)WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Lower Non-recoverable Threshold", _val); + Py_DECREF(_val); + } + if(WORD(data+0x0E)!=0x8000) { + _val = PyString_FromFormat("%d", (i16)WORD(data+0x0E)); + PyDict_SetItemString(caseData, "Upper Non-recoverable Threshold", _val); + Py_DECREF(_val); + } + + break; + + case 37: /* 3.3.38 Memory Channel */ + + if(h->length<0x07) break; + _val = dmi_memory_channel_type(data[0x04]); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i", data[0x05]); + PyDict_SetItemString(caseData, "Maximal Load", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i", data[0x06]); + PyDict_SetItemString(caseData, "Devices", _val); + Py_DECREF(_val); + + if(h->length<0x07+3*data[0x06]) break; + _val = dmi_memory_channel_devices(data[0x06], data+0x07); + PyDict_SetItemString(caseData, ">>>", _val); + Py_DECREF(_val); + + break; + + case 38: /* 3.3.39 IPMI Device Information */ + /* + * We use the word "Version" instead of "Revision", conforming to + * the IPMI specification. + */ + + if(h->length<0x10) break; + _val = dmi_ipmi_interface_type(data[0x04]); + PyDict_SetItemString(caseData, "Interface Type", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%i.%i", data[0x05]>>4, data[0x05]&0x0F); + PyDict_SetItemString(caseData, "Specification Version", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("0x%02x", data[0x06]>>1); + PyDict_SetItemString(caseData, "I2C Slave Address", _val); + Py_DECREF(_val); + + if(data[0x07]!=0xFF) { + _val = PyString_FromFormat("%i", data[0x07]); + PyDict_SetItemString(caseData, "NV Storage Device Address", _val); + Py_DECREF(_val); + } else { + _val = Py_None; + PyDict_SetItemString(caseData, "NV Storage Device: Not Present", _val); + Py_DECREF(_val); + } + + _val = dmi_ipmi_base_address(data[0x04], data+0x08, h->length<0x12?0:(data[0x10]>>5)&1); + PyDict_SetItemString(caseData, "Base Address", _val); + Py_DECREF(_val); + + if(h->length<0x12) break; + if(data[0x04]!=0x04) { + _val = dmi_ipmi_register_spacing(data[0x10]>>6); + PyDict_SetItemString(caseData, "Register Spacing", _val); + Py_DECREF(_val); + + if(data[0x10]&(1<<3)) { + _val = PyString_FromFormat("%s", data[0x10]&(1<<1)?"Active High":"Active Low"); + PyDict_SetItemString(caseData, "Interrupt Polarity", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%s", data[0x10]&(1<<0)?"Level":"Edge"); + PyDict_SetItemString(caseData, "Interrupt Trigger Mode", _val); + Py_DECREF(_val); + } + } + if(data[0x11]!=0x00) { + _val = PyString_FromFormat("%x", data[0x11]); + PyDict_SetItemString(caseData, "Interrupt Number", _val); + Py_DECREF(_val); + } + break; + + case 39: /* 3.3.40 System Power Supply */ + + if(h->length<0x10) break; + if(data[0x04]!=0x00) { + _val = PyString_FromFormat("%i", data[0x04]); + PyDict_SetItemString(caseData, "Power Unit Group", _val); + Py_DECREF(_val); + } + + _val = dmi_string_py(h, data[0x05]); + PyDict_SetItemString(caseData, "Location", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x06]); + PyDict_SetItemString(caseData, "Name", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x07]); + PyDict_SetItemString(caseData, "Manufacturer", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x08]); + PyDict_SetItemString(caseData, "Serial Numberr", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x09]); + PyDict_SetItemString(caseData, "Asset Tag", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x0A]); + PyDict_SetItemString(caseData, "Model Part Number", _val); + Py_DECREF(_val); + + _val = dmi_string_py(h, data[0x0B]); + PyDict_SetItemString(caseData, "Revision", _val); + Py_DECREF(_val); + + _val = dmi_power_supply_power(WORD(data+0x0C)); + PyDict_SetItemString(caseData, "Max Power Capacity", _val); + Py_DECREF(_val); + + if(WORD(data+0x0E)&(1<<1)) { + _val = dmi_power_supply_status((WORD(data+0x0E)>>7)&0x07); + PyDict_SetItemString(caseData, "Status Present", _val); + Py_DECREF(_val); + } else { + _val = PyString_FromString("Not Present"); + PyDict_SetItemString(caseData, "Status", _val); + Py_DECREF(_val); + } + _val = dmi_power_supply_type((WORD(data+0x0E)>>10)&0x0F); + PyDict_SetItemString(caseData, "Type", _val); + Py_DECREF(_val); + + _val = dmi_power_supply_range_switching((WORD(data+0x0E)>>3)&0x0F); + PyDict_SetItemString(caseData, "Input Voltage Range Switching", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%s", WORD(data+0x0E)&(1<<2)?"No":"Yes"); + PyDict_SetItemString(caseData, "Plugged", _val); + Py_DECREF(_val); + + _val = PyString_FromFormat("%s", WORD(data+0x0E)&(1<<0)?"Yes":"No"); + PyDict_SetItemString(caseData, "Hot Replaceable", _val); + Py_DECREF(_val); + + if(h->length<0x16) break; + if(WORD(data+0x10)!=0xFFFF) { + _val = PyString_FromFormat("0x%04x", WORD(data+0x10)); + PyDict_SetItemString(caseData, "Input Voltage Probe Handle", _val); + Py_DECREF(_val); + } + + if(WORD(data+0x12)!=0xFFFF) { + _val = PyString_FromFormat("0x%04x", WORD(data+0x12)); + PyDict_SetItemString(caseData, "Cooling Device Handle", _val); + Py_DECREF(_val); + } + + if(WORD(data+0x14)!=0xFFFF) { + _val = PyString_FromFormat("0x%04x", WORD(data+0x14)); + PyDict_SetItemString(caseData, "Input Current Probe Handle", _val); + Py_DECREF(_val); + } + + break; + + case 40: /* 3.3.41 Additional Information */ + if(h->length < 0x0B) break; + _key = PyString_FromFormat("Additional Information"); + _val = dmi_additional_info(h, ""); + PyDict_SetItem(caseData, _key, _val); + Py_DECREF(_key); + Py_DECREF(_val); + break; + + case 41: /* 3.3.42 Onboard Device Extended Information */ + if (h->length < 0x0B) break; + PyObject *subdata = PyDict_New(); + + _val = dmi_string_py(h, data[0x04]); + PyDict_SetItemString(subdata, "Reference Designation", _val); + Py_DECREF(_val); + + _val = PyString_FromString(dmi_on_board_devices_type(data[0x05] & 0x7F)); + PyDict_SetItemString(subdata, "Type", _val); + Py_DECREF(_val); + + _val = PyString_FromString(data[0x05]&0x80 ? "Enabled" : "Disabled"); + PyDict_SetItemString(subdata, "Status", _val); + Py_DECREF(_val); + + _val = PyInt_FromLong(data[0x06]); + PyDict_SetItemString(subdata, "Type Instance", _val); + Py_DECREF(_val); + + _val = dmi_slot_segment_bus_func(WORD(data + 0x07), data[0x09], data[0x0A]); + PyDict_SetItemString(subdata, "Bus Address", _val); + Py_DECREF(_val); + + PyDict_SetItemString(caseData, "Onboard Device", subdata); + Py_DECREF(subdata); + break; + + case 126: /* 3.3.43 Inactive */ + _val = Py_None; + PyDict_SetItemString(caseData, "Inactive", _val); + Py_DECREF(_val); + break; + + case 127: /* 3.3.44 End Of Table */ + _val = Py_None; + PyDict_SetItemString(caseData, "End Of Table", _val); + Py_DECREF(_val); + break; + + default: + if(dmi_decode_oem(h)) break; + _key = PyString_FromFormat("%s Type", h->type>=128?"OEM-specific":"Unknown"); + _val = dmi_dump(h); + PyDict_SetItem(caseData, _key, _val); + Py_DECREF(_key); + Py_DECREF(_val); + } + + Py_INCREF(caseData); + return caseData; +} + +void to_dmi_header(struct dmi_header *h, u8 *data) { + h->type=data[0]; + h->length=data[1]; + h->handle=WORD(data+2); + h->data=data; +} + +static void dmi_table_string_py(const struct dmi_header *h, const u8 *data, PyObject *hDict, u16 ver) { + int key; + u8 offset = opt.string->offset; + + if (offset >= h->length) return; + + //. TODO: These should have more meaningful dictionary names + key = (opt.string->type << 8) | offset; + PyObject *_val; + switch(key) { + case 0x108: + _val = dmi_system_uuid_py(data+offset, ver); + PyDict_SetItemString(hDict, "0x108", _val); + break; + case 0x305: + _val = dmi_chassis_type_py(data[offset]); + PyDict_SetItemString(hDict, "0x305", _val); + case 0x406: + _val = PyString_FromString(dmi_processor_family(h)); + PyDict_SetItemString(hDict, "0x406", _val); + break; + case 0x416: + _val = dmi_processor_frequency_py((u8 *)data + offset); + PyDict_SetItemString(hDict, "0x416", _val); + break; + default: + _val = dmi_string_py(h, data[offset]); + PyDict_SetItemString(hDict, "0x???", _val); + } + Py_DECREF(_val); +} + +/* +static void dmi_table_dump(u32 base, u16 len, const char *devmem) +{ + u8 *buf; + + if ((buf = mem_chunk(base, len, devmem)) == NULL) + { + fprintf(stderr, "Failed to read table, sorry.\n"); + return; + } + + printf("# Writing %d bytes to %s.\n", len, PyString_AS_STRING(opt.dumpfile)); + write_dump(32, len, buf, PyString_AS_STRING(opt.dumpfile), 0); + free(buf); +} +*/ + +/* + * Build a crafted entry point with table address hard-coded to 32, + * as this is where we will put it in the output file. We adjust the + * DMI checksum appropriately. The SMBIOS checksum needs no adjustment. + */ +static void overwrite_dmi_address(u8 *buf) { + buf[0x05] += buf[0x08] + buf[0x09] + buf[0x0A] + buf[0x0B] - 32; + buf[0x08] = 32; + buf[0x09] = 0; + buf[0x0A] = 0; + buf[0x0B] = 0; +} + + +#define NON_LEGACY 0 +#define LEGACY 1 +int dumpling(u8 *buf, const char *dumpfile, u8 mode) { + u32 base; + u16 len; + if(mode == NON_LEGACY) { + if(!checksum(buf, buf[0x05]) || !memcmp(buf+0x10, "_DMI_", 5)==0 || !checksum(buf+0x10, 0x0F)) return 0; + base = DWORD(buf+0x18); + len = WORD(buf+0x16); + } else { + if(!checksum(buf, 0x0F)) return 0; + base = DWORD(buf+0x08); + len = WORD(buf+0x06); + } + + u8 *buff; + if((buff = mem_chunk(base, len, DEFAULT_MEM_DEV)) != NULL) { + //. Part 1. + printf("# Writing %d bytes to %s.\n", len, dumpfile); + write_dump(32, len, buff, dumpfile, 0); + free(buff); + + //. Part 2. + if(mode != LEGACY) { + u8 crafted[32]; + memcpy(crafted, buf, 32); + overwrite_dmi_address(crafted+0x10); + printf("# Writing %d bytes to %s.\n", crafted[0x05], dumpfile); + write_dump(0, crafted[0x05], crafted, dumpfile, 1); + } else { + u8 crafted[16]; + memcpy(crafted, buf, 16); + overwrite_dmi_address(crafted); + printf("# Writing %d bytes to %s.\n", 0x0F, dumpfile); + write_dump(0, 0x0F, crafted, dumpfile, 1); + } + } else { + fprintf(stderr, "Failed to read table, sorry.\n"); + } + + //. TODO: Cleanup + return 1; +} + +int dump(const char *dumpfile) { + /* On success, return found, otherwise return -1 */ + int ret=0; + int found=0; + size_t fp; + int efi; + u8 *buf; + + /* First try EFI (ia64, Intel-based Mac) */ + efi = address_from_efi(&fp); + if(efi == EFI_NOT_FOUND) { + /* Fallback to memory scan (x86, x86_64) */ + if((buf=mem_chunk(0xF0000, 0x10000, DEFAULT_MEM_DEV))!=NULL) { + for(fp=0; fp<=0xFFF0; fp+=16) { + if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) { + if(dumpling(buf+fp, dumpfile, NON_LEGACY)) found++; + fp+=16; + } else if(memcmp(buf+fp, "_DMI_", 5)==0) { + if(dumpling(buf+fp, dumpfile, LEGACY)) found++; + } + } + } else ret = -1; + } else if(efi == EFI_NO_SMBIOS) { + ret = -1; + } else { + if((buf=mem_chunk(fp, 0x20, DEFAULT_MEM_DEV))==NULL) ret = -1; + else if(dumpling(buf, dumpfile, NON_LEGACY)) found++; + } + + if(ret==0) { + free(buf); + + //. TODO: Exception + //dmiSetItem(pydata, "detect", "No SMBIOS nor DMI entry point found, sorry G."); + if(!found) ret = -1; + } + + return ret==0?found:ret; +} + + + +static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, PyObject *pydata) { + u8 *buf; + u8 *data; + int i=0; + + if(opt.type==NULL) { + dmiSetItem(pydata, "dmi_table_size", "%i structures occupying %i bytes", num, len); + /* TODO DUMP + if (!(opt.flags & FLAG_FROM_DUMP)) + dmiSetItem(pydata, "dmi_table_base", "Table at 0x%08x", base); + */ + dmiSetItem(pydata, "dmi_table_base", "Table at 0x%08x", base); + } + + if((buf=mem_chunk(base, len, devmem))==NULL) { + fprintf(stderr, "Table is unreachable, sorry." +#ifndef USE_MMAP + "Try compiling dmidecode with -DUSE_MMAP."; +#endif + "\n"); + return; + } + + data=buf; + while(i39 && h.type<=127) + && !opt.string); + + /* + ** If a short entry is found (less than 4 bytes), not only it + ** is invalid, but we cannot reliably locate the next entry. + ** Better stop at this point, and let the user know his/her + ** table is broken. + */ + if(h.length<4) { + fprintf(stderr, "Invalid entry length (%i). DMI table is broken! Stop.", (unsigned int)h.length); + break; + } + + /* In quiet mode (FLAG_QUIET - removed for python-dmidecode all together), stop decoding at end of table marker */ + + char hid[7]; + sprintf(hid, "0x%04x", h.handle); + PyObject *hDict = PyDict_New(); + dmiSetItem(hDict, "dmi_handle", hid); + dmiSetItem(hDict, "dmi_type", "%d", h.type); + dmiSetItem(hDict, "dmi_size", "%d", h.length); + + /* assign vendor for vendor-specific decodes later */ + if(h.type==0 && h.length>=5) + dmi_set_vendor(dmi_string(&h, data[0x04])); + + /* look for the next handle */ + next=data+h.length; + while(next-buf+1"); + } else if(opt.string!=NULL && opt.string->type==h.type) { + dmi_table_string_py(&h, data, hDict, ver); + } + + data=next; + i++; + } + + if(i!=num) + fprintf(stderr, "Wrong DMI structures count: %d announced, only %d decoded.\n", num, i); + if(data-buf!=len) + fprintf(stderr, "Wrong DMI structures length: %d bytes announced, structures occupy %d bytes.\n", + len, (unsigned int)(data-buf)); + + free(buf); +} + + + + +int _smbios_decode_check(u8 *buf) { + int check = (!checksum(buf, buf[0x05]) || memcmp(buf + 0x10, "_DMI_", 5)!=0 || !checksum(buf+0x10, 0x0F)) ? 0 : 1; + return check; +} +int smbios_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata) { + int check = _smbios_decode_check(buf); + char vbuf[64]; bzero(vbuf, 64); + if(check == 1) { + u16 ver = (buf[0x06] << 8) + buf[0x07]; + /* Some BIOS report weird SMBIOS version, fix that up */ + int _m, _M; + _m = 0; + _M = 0; + switch(ver) { + case 0x021F: + _m = 31; + _M = 3; + ver = 0x0203; + break; + case 0x0233: + _m = 51; + _M = 6; + ver = 0x0206; + break; + } + if(_m || _M) sprintf(vbuf, "SMBIOS %i.%i present (Version fixup 2.%d -> 2.%d)", ver>>8, ver&0xFF, _m, _M); + else sprintf(vbuf, "SMBIOS %i.%i present", ver>>8, ver&0xFF); + } else if(check == 0) { + sprintf(vbuf, "No SMBIOS nor DMI entry point found"); + } + if(check == 1) { + if(*pydata) { Py_DECREF(*pydata); } + *pydata = PyString_FromString(vbuf); + Py_INCREF(*pydata); + } + return check; +} +int smbios_decode(u8 *buf, const char *devmem, PyObject* pydata) { + int check = _smbios_decode_check(buf); + if(check == 1) { + u16 ver = (buf[0x06] << 8) + buf[0x07]; + switch(ver) { + case 0x021F: + ver = 0x0203; + break; + case 0x0233: + ver = 0x0206; + break; + } + //printf(">>%d @ %d, %d<<\n", DWORD(buf+0x18), WORD(buf+0x16), WORD(buf+0x1C)); + dmi_table(DWORD(buf+0x18), WORD(buf+0x16), WORD(buf+0x1C), ver, devmem, pydata); + } + return check; +} + + + + +int _legacy_decode_check(u8 *buf) { + int check; + if(!checksum(buf, 0x0F)) check = 0; //. Bad + else check = 1; //. Good + return check; +} +int legacy_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata) { + int check = _legacy_decode_check(buf); + char vbuf[64]; bzero(vbuf, 64); + if(check == 1) { + sprintf(vbuf, "Legacy DMI %i.%i present", buf[0x0E]>>4, buf[0x0E]&0x0F); + } else if(check == 0) { + sprintf(vbuf, "No SMBIOS nor DMI entry point found"); + } + if(check == 1) { + if(*pydata) { Py_DECREF(*pydata); } + *pydata = PyString_FromString(vbuf); + Py_INCREF(*pydata); + } + return check; +} +int legacy_decode(u8 *buf, const char *devmem, PyObject* pydata) { + int check = _legacy_decode_check(buf); + if(check == 1) + dmi_table(DWORD(buf+0x08), WORD(buf+0x06), WORD(buf+0x0C), ((buf[0x0E]&0xF0)<<4)+(buf[0x0E]&0x0F), devmem, pydata); + return check; +} + + + + +/******************************************************************************* +** Probe for EFI interface +*/ +int address_from_efi(size_t *address) { + FILE *efi_systab; + const char *filename; + char linebuf[64]; + int ret; + + *address = 0; /* Prevent compiler warning */ + + /* + ** Linux <= 2.6.6: /proc/efi/systab + ** Linux >= 2.6.7: /sys/firmware/efi/systab + */ + if((efi_systab=fopen(filename="/sys/firmware/efi/systab", "r"))==NULL + && (efi_systab=fopen(filename="/proc/efi/systab", "r"))==NULL) { + /* No EFI interface, fallback to memory scan */ + return EFI_NOT_FOUND; + } + ret=EFI_NO_SMBIOS; + while((fgets(linebuf, sizeof(linebuf)-1, efi_systab))!=NULL) { + char *addrp=strchr(linebuf, '='); + *(addrp++)='\0'; + if(strcmp(linebuf, "SMBIOS")==0) { + *address=strtoul(addrp, NULL, 0); + printf("# SMBIOS entry point at 0x%08lx\n", (unsigned long)*address); + ret=0; + break; + } + } + if(fclose(efi_systab)!=0) + perror(filename); + + if(ret==EFI_NO_SMBIOS) + fprintf(stderr, "%s: SMBIOS entry point missing\n", filename); + + return ret; +} diff --git a/src/dmidecode.h b/src/dmidecode.h new file mode 100644 index 0000000..7e99faa --- /dev/null +++ b/src/dmidecode.h @@ -0,0 +1,45 @@ +/* + * This file is part of the dmidecode project. + * + * (C) 2005-2007 Jean Delvare + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +struct dmi_header { + u8 type; + u8 length; + u16 handle; + u8 *data; +}; + +PyObject *dmi_dump(struct dmi_header *h); +PyObject* dmi_decode(struct dmi_header *h, u16 ver); +int address_from_efi(size_t *address); +void to_dmi_header(struct dmi_header *h, u8 *data); +int smbios_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); +int smbios_decode(u8 *buf, const char *devmem, PyObject* pydata); +int legacy_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); +int legacy_decode(u8 *buf, const char *devmem, PyObject* pydata); + +const char *dmi_string(const struct dmi_header *dm, u8 s); +const char *dmi_system_uuid(u8 *p); +PyObject *dmi_system_uuid_py(const u8 *p, u16 ver); +const char *dmi_chassis_type(u8 code); +int dmi_processor_frequency(const u8 *p); + +int dump(const char *dumpfile); +int dumpling(u8 *buf, const char *devmem, u8 mode); diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c new file mode 100644 index 0000000..345b151 --- /dev/null +++ b/src/dmidecodemodule.c @@ -0,0 +1,305 @@ +#include "dmidecodemodule.h" +#include + +options opt; +static void init(void) { + /* sanity check */ + if(sizeof(u8)!=1 || sizeof(u16)!=2 || sizeof(u32)!=4 || '\0'!=0) + fprintf(stderr, "%s: compiler incompatibility\n", "dmidecodemodule"); + + opt.devmem = DEFAULT_MEM_DEV; + opt.dumpfile = NULL; + opt.flags=0; + opt.type = NULL; +} + + +u8 *parse_opt_type(u8 *p, const char *arg) { + + /* Allocate memory on first call only */ + if(p == NULL) { + if(!(p = (u8 *)calloc(256, sizeof(u8)))) { + perror("calloc"); + return NULL; + } + } + + unsigned int i, j; + /* First try as a keyword */ + for(i = 0; i < ARRAY_SIZE(opt_type_keyword); i++) { + if(!strcasecmp(arg, opt_type_keyword[i].keyword)) { + j = 0; + while(opt_type_keyword[i].type[j] != 255) + p[opt_type_keyword[i].type[j++]] = 1; + return p; + } + } + + /* Else try as a number */ + while(*arg != '\0') { + unsigned long val; + char *next; + + val = strtoul(arg, &next, 0); + if(next == arg) { + fprintf(stderr, "Invalid type keyword: %s\n", arg); + free(p); + return NULL; + } + if (val > 0xff) { + fprintf(stderr, "Invalid type number: %lu\n", val); + free(p); + return NULL; + } + + p[val] = 1; + arg = next; + while(*arg == ',' || *arg == ' ') + arg++; + } + + return p; +} + + +static int dmidecode_set_version(PyObject** pydata) { + int ret=0; + int found=0; + size_t fp; + int efi; + u8 *buf; + + /* Set default option values */ + opt.devmem = DEFAULT_MEM_DEV; + + /***********************************/ + /* Read from dump if so instructed */ + if(opt.dumpfile != NULL) { + const char *dumpfile = PyString_AS_STRING(opt.dumpfile); + //. printf("Reading SMBIOS/DMI data from file %s.\n", dumpfile); + if((buf = mem_chunk(0, 0x20, dumpfile))!=NULL) { + if(memcmp(buf, "_SM_", 4)==0) { + if(smbios_decode_set_version(buf, dumpfile, pydata)) found++; + } else if (memcmp(buf, "_DMI_", 5)==0) { + if(legacy_decode_set_version(buf, dumpfile, pydata)) found++; + } + } else ret = 1; + } else { /* Read from /dev/mem */ + /* First try EFI (ia64, Intel-based Mac) */ + efi = address_from_efi(&fp); + if(efi == EFI_NOT_FOUND) { + /* Fallback to memory scan (x86, x86_64) */ + if((buf=mem_chunk(0xF0000, 0x10000, opt.devmem))!=NULL) { + for(fp=0; fp<=0xFFF0; fp+=16) { + if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) { + if(smbios_decode_set_version(buf+fp, opt.devmem, pydata)) found++; + fp+=16; + } else if(memcmp(buf+fp, "_DMI_", 5)==0) { + if(legacy_decode_set_version(buf+fp, opt.devmem, pydata)) found++; + } + } + } else ret = 1; + } else if(efi == EFI_NO_SMBIOS) { + ret = 1; + } else { + if((buf=mem_chunk(fp, 0x20, opt.devmem))==NULL) ret = 1; + else if(smbios_decode_set_version(buf, opt.devmem, pydata)) found++; + //. TODO: dmiSetItem(pydata, "efi_address", efiAddress); + } + } + + if(ret==0) { + free(buf); + if(!found) { + fprintf(stderr, "No SMBIOS nor DMI entry point found, sorry G."); + } + } + free(opt.type); + return ret; +} + + +static PyObject* dmidecode_get(PyObject *self, const char* section) { + //mtrace(); + + int ret=0; + int found=0; + size_t fp; + int efi; + u8 *buf; + + /* Set default option values */ + opt.devmem = DEFAULT_MEM_DEV; + opt.flags = 0; + opt.type = NULL; + opt.type = parse_opt_type(opt.type, section); + if(opt.type==NULL) return NULL; + + const char *f = opt.dumpfile ? PyString_AsString(opt.dumpfile) : opt.devmem; + if(access(f, R_OK) < 0) + PyErr_SetString(PyExc_IOError, "Permission denied to memory file/device"); + + PyObject* pydata = PyDict_New(); + + /***********************************/ + /* Read from dump if so instructed */ + if(opt.dumpfile != NULL) { + const char *dumpfile = PyString_AS_STRING(opt.dumpfile); + //. printf("Reading SMBIOS/DMI data from file %s.\n", dumpfile); + if((buf = mem_chunk(0, 0x20, dumpfile))!=NULL) { + if(memcmp(buf, "_SM_", 4)==0) { + if(smbios_decode(buf, dumpfile, pydata)) found++; + } else if (memcmp(buf, "_DMI_", 5)==0) { + if(legacy_decode(buf, dumpfile, pydata)) found++; + } + } else ret = 1; + } else { /* Read from /dev/mem */ + /* First try EFI (ia64, Intel-based Mac) */ + efi = address_from_efi(&fp); + if(efi == EFI_NOT_FOUND) { + /* Fallback to memory scan (x86, x86_64) */ + if((buf=mem_chunk(0xF0000, 0x10000, opt.devmem))!=NULL) { + for(fp=0; fp<=0xFFF0; fp+=16) { + if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) { + if(smbios_decode(buf+fp, opt.devmem, pydata)) { + found++; + fp+=16; + } + } else if(memcmp(buf+fp, "_DMI_", 5)==0) { + if(legacy_decode(buf+fp, opt.devmem, pydata)) found++; + } + } + } else ret = 1; + } else if(efi == EFI_NO_SMBIOS) { + ret = 1; + } else { + if((buf=mem_chunk(fp, 0x20, opt.devmem))==NULL) ret = 1; + else if(smbios_decode(buf, opt.devmem, pydata)) found++; + //. TODO: dmiSetItem(pydata, "efi_address", efiAddress); + } + } + + free(opt.type); + if(ret==0) { + free(buf); + } else { + Py_DECREF(pydata); + pydata = NULL; + } + + //muntrace(); + return pydata; +} + +static PyObject* dmidecode_get_bios(PyObject *self, PyObject *args) { return dmidecode_get(self, "bios"); } +static PyObject* dmidecode_get_system(PyObject *self, PyObject *args) { return dmidecode_get(self, "system"); } +static PyObject* dmidecode_get_baseboard(PyObject *self, PyObject *args) { return dmidecode_get(self, "baseboard"); } +static PyObject* dmidecode_get_chassis(PyObject *self, PyObject *args) { return dmidecode_get(self, "chassis"); } +static PyObject* dmidecode_get_processor(PyObject *self, PyObject *args) { return dmidecode_get(self, "processor"); } +static PyObject* dmidecode_get_memory(PyObject *self, PyObject *args) { return dmidecode_get(self, "memory"); } +static PyObject* dmidecode_get_cache(PyObject *self, PyObject *args) { return dmidecode_get(self, "cache"); } +static PyObject* dmidecode_get_connector(PyObject *self, PyObject *args) { return dmidecode_get(self, "connector"); } +static PyObject* dmidecode_get_slot(PyObject *self, PyObject *args) { return dmidecode_get(self, "slot"); } +static PyObject* dmidecode_get_type(PyObject *self, PyObject *args) { + long unsigned int lu; + if(PyArg_ParseTuple(args, (char *)"i", &lu)) { + if(lu < 256) { + char s[8]; + sprintf(s, "%lu", lu); + return dmidecode_get(self, s); + } + return Py_False; + } + return Py_None; +} + +static PyObject* dmidecode_dump(PyObject *self, PyObject *null) { + const char *f; + f = opt.dumpfile ? PyString_AsString(opt.dumpfile) : opt.devmem; + struct stat _buf; + stat(f, &_buf); + + if((access(f, F_OK) != 0) || ((access(f, W_OK) == 0) && S_ISREG(_buf.st_mode))) + if(dump(PyString_AS_STRING(opt.dumpfile))) + Py_RETURN_TRUE; + Py_RETURN_FALSE; +} + +static PyObject* dmidecode_get_dev(PyObject *self, PyObject *null) { + PyObject *dev; + if(opt.dumpfile != NULL) dev = opt.dumpfile; + else dev = PyString_FromString(opt.devmem); + Py_INCREF(dev); + return dev; +} + +static PyObject* dmidecode_set_dev(PyObject *self, PyObject *arg) { + if(PyString_Check(arg)) { + if(opt.dumpfile == arg) Py_RETURN_TRUE; + + struct stat buf; + char *f = PyString_AsString(arg); + stat(f, &buf); + if(opt.dumpfile) { Py_DECREF(opt.dumpfile); } + + if(S_ISCHR(buf.st_mode)) { + if(memcmp(PyString_AsString(arg), "/dev/mem", 8)==0) { + opt.dumpfile = NULL; + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } + } else if(!S_ISDIR(buf.st_mode)) { + opt.dumpfile = arg; + Py_INCREF(opt.dumpfile); + Py_RETURN_TRUE; + } + } + Py_RETURN_FALSE; + //PyErr_Occurred(); +} + +/* +typedef struct { + PyObject_HEAD char *version; +} ivars; + +static PyMemberDef DMIDataMembers[] = { + { (char *)"fred", T_STRING, offsetof(ivars, version), 0, "2.10" }, + { NULL } +}; +*/ + +static PyMethodDef DMIDataMethods[] = { + { (char *)"dump", dmidecode_dump, METH_NOARGS, (char *)"Dump dmidata to set file" }, + { (char *)"get_dev", dmidecode_get_dev, METH_NOARGS, (char *)"Get an alternative memory device file" }, + { (char *)"set_dev", dmidecode_set_dev, METH_O, (char *)"Set an alternative memory device file" }, + + { (char *)"bios", dmidecode_get_bios, METH_VARARGS, (char *)"BIOS Data" }, + { (char *)"system", dmidecode_get_system, METH_VARARGS, (char *)"System Data" }, + { (char *)"baseboard", dmidecode_get_baseboard, METH_VARARGS, (char *)"Baseboard Data" }, + { (char *)"chassis", dmidecode_get_chassis, METH_VARARGS, (char *)"Chassis Data" }, + { (char *)"processor", dmidecode_get_processor, METH_VARARGS, (char *)"Processor Data" }, + { (char *)"memory", dmidecode_get_memory, METH_VARARGS, (char *)"Memory Data" }, + { (char *)"cache", dmidecode_get_cache, METH_VARARGS, (char *)"Cache Data" }, + { (char *)"connector", dmidecode_get_connector, METH_VARARGS, (char *)"Connector Data" }, + { (char *)"slot", dmidecode_get_slot, METH_VARARGS, (char *)"Slot Data" }, + + { (char *)"type", dmidecode_get_type, METH_VARARGS, (char *)"By Type" }, + + { NULL, NULL, 0, NULL } +}; + +PyMODINIT_FUNC initdmidecode(void) { + init(); + + PyObject *module = Py_InitModule3((char *)"dmidecode", DMIDataMethods, "Python extension module for dmidecode"); + + PyObject *version = PyString_FromString("2.10"); + Py_INCREF(version); + PyModule_AddObject(module, "version", version); + + PyObject *dmi_version = NULL; + dmidecode_set_version(&dmi_version); + PyModule_AddObject(module, "dmi", dmi_version?dmi_version:Py_None); +} diff --git a/src/dmidecodemodule.h b/src/dmidecodemodule.h new file mode 100644 index 0000000..cf1e5f4 --- /dev/null +++ b/src/dmidecodemodule.h @@ -0,0 +1,63 @@ +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "version.h" +#include "config.h" +#include "types.h" +#include "util.h" +#include "dmidecode.h" +#include "dmioem.h" + +#define EFI_NOT_FOUND (-1) +#define EFI_NO_SMBIOS (-2) + +#include "dmihelper.h" + +//extern void dmi_decode(struct dmi_header *h, u16 ver, PyObject* pydata); +extern PyObject *dmi_dump(struct dmi_header *h); +extern PyObject* dmi_decode(struct dmi_header *h, u16 ver); +extern int address_from_efi(size_t *address); +extern void to_dmi_header(struct dmi_header *h, u8 *data); +extern void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem); +extern int smbios_decode(u8 *buf, const char *devmem, PyObject* pydata); +extern int legacy_decode(u8 *buf, const char *devmem, PyObject* pydata); +extern int smbios_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); +extern int legacy_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); +extern void *mem_chunk(size_t base, size_t len, const char *devmem); + +extern u8 *parse_opt_type(u8 *p, const char *arg); +static const u8 opt_type_bios[] = { 0, 13, 255 }; +static const u8 opt_type_system[] = { 1, 12, 15, 23, 32, 255 }; +static const u8 opt_type_baseboard[] = { 2, 10, 255 }; +static const u8 opt_type_chassis[] = { 3, 255 }; +static const u8 opt_type_processor[] = { 4, 255 }; +static const u8 opt_type_memory[] = { 5, 6, 16, 17, 255 }; +static const u8 opt_type_cache[] = { 7, 255 }; +static const u8 opt_type_connector[] = { 8, 255 }; +static const u8 opt_type_slot[] = { 9, 255 }; +struct type_keyword { + const char *keyword; + const u8 *type; +}; + +static const struct type_keyword opt_type_keyword[] = { + { "bios", opt_type_bios }, + { "system", opt_type_system }, + { "baseboard", opt_type_baseboard }, + { "chassis", opt_type_chassis }, + { "processor", opt_type_processor }, + { "memory", opt_type_memory }, + { "cache", opt_type_cache }, + { "connector", opt_type_connector }, + { "slot", opt_type_slot }, +}; + +PyMODINIT_FUNC initdmidecode(void); diff --git a/src/dmihelper.c b/src/dmihelper.c new file mode 100644 index 0000000..6d52e04 --- /dev/null +++ b/src/dmihelper.c @@ -0,0 +1,115 @@ +#include +#include + +#include "dmihelper.h" + +/* +dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...) { + static dmi_minor* last = NULL; + + //. int minor = code&0x00FF; + //. int major = code>>8; + + va_list arg; + va_start(arg, format); + + dmi_minor *o = (dmi_minor *)malloc(sizeof(dmi_minor)); + o->next = last; + o->id = code; + o->major = (dmi_codes_major *)&dmiCodesMajor[map_maj[code>>8]]; + o->key = (char *)key; + + if((format != NULL)&&(vsnprintf(o->value, MAXVAL-1, format, arg) > MAXVAL)) { + free(o); + o = NULL; + //. TODO: Make this a python exception. + printf("dmidecode: Internal (python module) error; Value too long.\n"); + } + + last = o; + va_end(arg); // cleanup + + return o; +} +*/ + +int dmiSetItem(PyObject* dict, const char *key, const char *format, ...) { + va_list arg; + va_start(arg, format); + char buffer[2048]; + vsprintf(buffer, format, arg); + va_end(arg); + //printf("DEBUG: Setting k:%s, f:%s s:%s...", key, format, buffer); + PyDict_SetItem(dict, PyString_FromString(key), PyString_FromString(buffer)); + //printf("Done.\n"); + return 0; +} + + +/* NOTE: Decomissioned helper function... +void dmiAppendData(PyObject *pydata, const int count) { + dmi_minor* last = dmiAppendObject(count, "JUNK", "NODATA"); + + const char *id = last->major->id; + PyObject *_key, *_val; + + PyObject *pymajor = PyDict_New(); + + _key = PyString_FromString("code"); + _val = PyInt_FromLong((long)last->major->code); + PyDict_SetItem(pymajor, _key, _val); + Py_DECREF(_key); + Py_DECREF(_val); + + _key = PyString_FromString("id"); + _val = PyString_FromString(last->major->id); + PyDict_SetItem(pymajor, _key, _val); + Py_DECREF(_key); + Py_DECREF(_val); + + _key = PyString_FromString("name"); + _val = PyString_FromString(last->major->desc); + PyDict_SetItem(pymajor, _key, _val); + Py_DECREF(_key); + Py_DECREF(_val); + + PyObject *pyminor = PyDict_New(); + while((last = last->next)) { + //printf("%d:<%s, %s> | %ld:[%s => %s]\n", last->major->code, last->major->id, last->major->desc, last->id, last->key, last->value); + _key = PyString_FromString(last->key); + _val = PyString_FromString(last->value); + PyDict_SetItem(pyminor, _key, _val); + Py_DECREF(_key); + Py_DECREF(_val); + } + _key = PyString_FromString("data"); + PyDict_SetItem(pymajor, _key, pyminor); + Py_DECREF(_key); + Py_DECREF(pyminor); + + _key = PyString_FromString(id); + PyDict_SetItem(pydata, _key, pymajor); + Py_DECREF(_key); + Py_DECREF(pymajor); +} +*/ + +/* NOTE: Decomissioned helper function... +int catsprintf(char *buf, const char *format, ...) { + if(format == NULL) { + bzero(buf, strlen(buf)); + return 0; + } + + va_list arg; // will point to each unnamed argument in turn + va_start(arg, format); // point to first element after fmt + + char b[8192]; + int c = vsprintf (b, format, arg); + + strcat(buf, b); + va_end(arg); // cleanp + + return c; +} +*/ diff --git a/src/dmihelper.h b/src/dmihelper.h new file mode 100644 index 0000000..a056eb2 --- /dev/null +++ b/src/dmihelper.h @@ -0,0 +1,114 @@ +#ifndef HELPER +#define HELPER 1 + +#include + +#include +#include +#include +#include +#include + +#include "types.h" + +#define MAXVAL 1024 + +static const int map_maj[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, +}; + +typedef struct _dmi_codes_major { + const unsigned short code; + const char *id; + const char *desc; +} dmi_codes_major; + +static const dmi_codes_major dmiCodesMajor[] = { + { 0, "3.3.1", "BIOS Information" }, + { 1, "3.3.2", "System Information" }, + { 2, "3.3.3", "Base Board Information" }, + { 3, "3.3.4", "Chassis Information" }, + { 4, "3.3.5", "Processor Information" }, + { 5, "3.3.6", "Memory Controller Information" }, + { 6, "3.3.7", "Memory Module Information" }, + { 7, "3.3.8", "Cache Information" }, + { 8, "3.3.9", "Port Connector Information" }, + { 9, "3.3.10", "System Slots" }, + { 10, "3.3.11", "On Board Devices Information" }, + { 11, "3.3.12", "OEM Strings" }, + { 12, "3.3.13", "System Configuration Options" }, + { 13, "3.3.14", "BIOS Language Information" }, + { 14, "3.3.15", "Group Associations" }, + { 15, "3.3.16", "System Event Log" }, + { 16, "3.3.17", "Physical Memory Array" }, + { 17, "3.3.18", "Memory Device" }, + { 18, "3.3.19", "32-bit Memory Error Information" }, + { 19, "3.3.20", "Memory Array Mapped Address" }, + { 20, "3.3.21", "Memory Device Mapped Address" }, + { 21, "3.3.22", "Built-in Pointing Device" }, + { 22, "3.3.23", "Portable Battery" }, + { 23, "3.3.24", "System Reset" }, + { 24, "3.3.25", "Hardware Security" }, + { 25, "3.3.26", "System Power Controls" }, + { 26, "3.3.27", "Voltage Probe" }, + { 27, "3.3.28", "Cooling Device" }, + { 28, "3.3.29", "Temperature Probe" }, + { 29, "3.3.30", "Electrical Current Probe" }, + { 30, "3.3.31", "Out-of-band Remote Access" }, + { 31, "3.3.32", "Boot Integrity Services Entry Point" }, + { 32, "3.3.33", "System Boot Information" }, + { 33, "3.3.34", "64-bit Memory Error Information" }, + { 34, "3.3.35", "Management Device" }, + { 35, "3.3.36", "Management Device Component" }, + { 36, "3.3.37", "Management Device Threshold Data" }, + { 37, "3.3.38", "Memory Channel" }, + { 38, "3.3.39", "IPMI Device Information" }, + { 39, "3.3.40", "System Power Supply" }, + { 40, "3.3.41", "-------------------" }, + { 41, "3.3.42", "-------------------" }, + { 126, "3.3.41", "Inactive" }, + { 127, "3.3.42", "End Of Table" }, +}; + +typedef struct _dmi_minor { + long id; + dmi_codes_major* major; + char *key; + char value[MAXVAL]; + struct _dmi_minor* next; +} dmi_minor; + +void dmiAppendData(PyObject *pydata, const int count); +int dmiSetItem(PyObject* dict, const char *key, const char *format, ...); +//dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...); + +/*** dmiopt.h ***/ +struct string_keyword { + const char *keyword; + u8 type; + u8 offset; +}; + +/*** dmiopt.h ***/ +typedef struct _options { + const char *devmem; + unsigned int flags; + u8 *type; + const struct string_keyword *string; + PyObject *dumpfile; +} options; +extern options opt; + +#endif diff --git a/src/dmioem.c b/src/dmioem.c new file mode 100644 index 0000000..a2fd2a2 --- /dev/null +++ b/src/dmioem.c @@ -0,0 +1,128 @@ +/* + * Decoding of OEM-specific entries + * This file is part of the dmidecode project. + * + * (C) 2007 Jean Delvare + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "types.h" +#include "dmidecode.h" +#include "dmioem.h" + +/* + * Globals for vendor-specific decodes + */ + +enum DMI_VENDORS { VENDOR_UNKNOWN, VENDOR_HP }; + +static enum DMI_VENDORS dmi_vendor=VENDOR_UNKNOWN; + +/* + * Remember the system vendor for later use. We only actually store the + * value if we know how to decode at least one specific entry type for + * that vendor. + */ +void dmi_set_vendor(const char *s) +{ + if(strcmp(s, "HP")==0) + dmi_vendor=VENDOR_HP; +} + +/* + * HP-specific data structures are decoded here. + * + * Code contributed by John Cagle. + */ + +static int dmi_decode_hp(struct dmi_header *h) +{ + u8 *data=h->data; + int nic, ptr; + + switch(h->type) + { + case 204: + /* + * Vendor Specific: HP ProLiant System/Rack Locator + */ + printf("HP ProLiant System/Rack Locator\n"); + if(h->length<0x0B) break; + printf("\tRack Name: %s\n", dmi_string(h, data[0x04])); + printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05])); + printf("\tEnclosure Model: %s\n", dmi_string(h, data[0x06])); + printf("\tEnclosure Serial: %s\n", dmi_string(h, data[0x0A])); + printf("\tEnclosure Bays: %d\n", data[0x08]); + printf("\tServer Bay: %s\n", dmi_string(h, data[0x07])); + printf("\tBays Filled: %d\n", data[0x09]); + break; + + case 209: + case 221: + /* + * Vendor Specific: HP ProLiant NIC MAC Information + * + * This prints the BIOS NIC number, + * PCI bus/device/function, and MAC address + */ + printf(h->type==221? + "HP BIOS iSCSI NIC PCI and MAC Information\n": + "HP BIOS NIC PCI and MAC Information\n"); + nic=1; + ptr=4; + while(h->length>=ptr+8) + { + if(data[ptr]==0x00 && data[ptr+1]==0x00) + printf("\tNIC %d: Disabled\n", nic); + else if(data[ptr]==0xFF && data[ptr+1]==0xFF) + printf("\tNIC %d: Not Installed\n", nic); + else + { + printf("\tNIC %d: PCI device %02x:%02x.%x, " + "MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", + nic, data[ptr+1], data[ptr]>>3, data[ptr]&7, + data[ptr+2], data[ptr+3], + data[ptr+4], data[ptr+5], + data[ptr+6], data[ptr+7]); + } + nic++; + ptr+=8; + } + break; + + default: + return 0; + } + return 1; +} + +/* + * Dispatch vendor-specific entries decoding + * Return 1 if decoding was successful, 0 otherwise + */ +int dmi_decode_oem(struct dmi_header *h) +{ + switch(dmi_vendor) + { + case VENDOR_HP: + return dmi_decode_hp(h); + default: + return 0; + } +} diff --git a/src/dmioem.h b/src/dmioem.h new file mode 100644 index 0000000..00483f2 --- /dev/null +++ b/src/dmioem.h @@ -0,0 +1,25 @@ +/* + * Decoding of OEM-specific entries + * This file is part of the dmidecode project. + * + * (C) 2007 Jean Delvare + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +struct dmi_header; + +void dmi_set_vendor(const char *s); +int dmi_decode_oem(struct dmi_header *h); diff --git a/src/setup-dbg.py b/src/setup-dbg.py new file mode 100644 index 0000000..1a23240 --- /dev/null +++ b/src/setup-dbg.py @@ -0,0 +1,25 @@ +from distutils.core import setup, Extension + +setup( + name = "python-dmidecode-dbg", + version = "2.10.3", + description = "Python extension module for dmidecode", + author = "Nima Talebi", + author_email = "nima@autonomy.net.au", + url = "http://projects.autonomy.net.au/dmidecode/", + ext_modules = [ + Extension( + "dmidecode", + sources = [ + "src/dmidecodemodule.c", + "src/dmihelper.c", + "src/util.c", + "src/dmioem.c", + "src/dmidecode.c" + ], + library_dirs = [ "/home/nima/dev-room/projects/dmidecode" ], + libraries = [ "util" ], + #libraries = [ "util", "efence" ], + ) + ] +) diff --git a/src/setup.py b/src/setup.py new file mode 100644 index 0000000..b0999b5 --- /dev/null +++ b/src/setup.py @@ -0,0 +1,25 @@ +from distutils.core import setup, Extension + +setup( + name = "python-dmidecode", + version = "2.10.3", + description = "Python extension module for dmidecode", + author = "Nima Talebi", + author_email = "nima@autonomy.net.au", + url = "http://projects.autonomy.net.au/dmidecode/", + ext_modules = [ + Extension( + "dmidecode", + sources = [ + "src/dmidecodemodule.c", + "src/dmihelper.c", + "src/util.c", + "src/dmioem.c", + "src/dmidecode.c" + ], + library_dirs = [ "/home/nima/dev-room/projects/dmidecode" ], + libraries = [ "util" ], + #libraries = [ "util", "efence" ], + ) + ] +) diff --git a/src/types.h b/src/types.h new file mode 100644 index 0000000..b124ecf --- /dev/null +++ b/src/types.h @@ -0,0 +1,62 @@ +#ifndef TYPES_H +#define TYPES_H + +#include "config.h" + +typedef unsigned char u8; +typedef unsigned short u16; +typedef signed short i16; +typedef unsigned int u32; + +/* + * You may use the following defines to adjust the type definitions + * depending on the architecture: + * - Define BIGENDIAN on big-endian systems. Untested, as all target + * systems to date are little-endian. + * - Define ALIGNMENT_WORKAROUND if your system doesn't support + * non-aligned memory access. In this case, we use a slower, but safer, + * memory access method. This should be done automatically in config.h + * for architectures which need it. + */ + +#ifdef BIGENDIAN +typedef struct { + u32 h; + u32 l; +} u64; +#else +typedef struct { + u32 l; + u32 h; +} u64; +#endif + +#ifdef ALIGNMENT_WORKAROUND +static inline u64 U64(u32 low, u32 high) +{ + u64 self; + + self.l=low; + self.h=high; + + return self; +} +#endif + +#ifdef ALIGNMENT_WORKAROUND +# ifdef BIGENDIAN +# define WORD(x) (u16)((x)[1]+((x)[0]<<8)) +# define DWORD(x) (u32)((x)[3]+((x)[2]<<8)+((x)[1]<<16)+((x)[0]<<24)) +# define QWORD(x) (U64(DWORD(x+4), DWORD(x))) +# else /* BIGENDIAN */ +# define WORD(x) (u16)((x)[0]+((x)[1]<<8)) +# define DWORD(x) (u32)((x)[0]+((x)[1]<<8)+((x)[2]<<16)+((x)[3]<<24)) +# define QWORD(x) (U64(DWORD(x), DWORD(x+4))) +# endif /* BIGENDIAN */ +#else /* ALIGNMENT_WORKAROUND */ +#define WORD(x) (u16)(*(const u16 *)(x)) +#define DWORD(x) (u32)(*(const u32 *)(x)) +#define QWORD(x) (*(const u64 *)(x)) +#endif /* ALIGNMENT_WORKAROUND */ + +#endif diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..15d24a7 --- /dev/null +++ b/src/util.c @@ -0,0 +1,205 @@ +/* + * Common "util" functions + * This file is part of the dmidecode project. + * + * Copyright (C) 2002-2008 Jean Delvare + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For the avoidance of doubt the "preferred form" of this code is one which + * is in an open unpatent encumbered format. Where cryptographic key signing + * forms part of the process of creating an executable the information + * including keys needed to generate an equivalently functional executable + * are deemed to be part of the source code. + */ + +#include +#include + +#include "config.h" + +#ifdef USE_MMAP +#include +#ifndef MAP_FAILED +#define MAP_FAILED ((void *) -1) +#endif /* !MAP_FAILED */ +#endif /* USE MMAP */ + +#include +#include +#include +#include +#include +#include + +#include "types.h" +#include "util.h" + +#ifndef USE_MMAP +static int myread(int fd, u8 *buf, size_t count, const char *prefix) +{ + ssize_t r = 1; + size_t r2 = 0; + + while (r2 != count && r != 0) + { + r = read(fd, buf + r2, count - r2); + if (r == -1) + { + if (errno != EINTR) + { + close(fd); + perror(prefix); + return -1; + } + } + else + r2 += r; + } + + if (r2 != count) + { + close(fd); + fprintf(stderr, "%s: Unexpected end of file\n", prefix); + return -1; + } + + return 0; +} +#endif + +int checksum(const u8 *buf, size_t len) +{ + u8 sum = 0; + size_t a; + + for (a = 0; a < len; a++) + sum += buf[a]; + return (sum == 0); +} + +/* + * Copy a physical memory chunk into a memory buffer. + * This function allocates memory. + */ +void *mem_chunk(size_t base, size_t len, const char *devmem) +{ + void *p; + int fd; +#ifdef USE_MMAP + size_t mmoffset; + void *mmp; +#endif + + if ((fd = open(devmem, O_RDONLY)) == -1) + { + perror(devmem); + return NULL; + } + + if ((p = malloc(len)) == NULL) + { + perror("malloc"); + return NULL; + } + +#ifdef USE_MMAP +#ifdef _SC_PAGESIZE + mmoffset = base % sysconf(_SC_PAGESIZE); +#else + mmoffset = base % getpagesize(); +#endif /* _SC_PAGESIZE */ + /* + * Please note that we don't use mmap() for performance reasons here, + * but to workaround problems many people encountered when trying + * to read from /dev/mem using regular read() calls. + */ + mmp = mmap(0, mmoffset + len, PROT_READ, MAP_SHARED, fd, base - mmoffset); + if (mmp == MAP_FAILED) + { + fprintf(stderr, "%s: ", devmem); + perror("mmap"); + free(p); + return NULL; + } + + memcpy(p, (u8 *)mmp + mmoffset, len); + + if (munmap(mmp, mmoffset + len) == -1) + { + fprintf(stderr, "%s: ", devmem); + perror("munmap"); + } +#else /* USE_MMAP */ + if (lseek(fd, base, SEEK_SET) == -1) + { + fprintf(stderr, "%s: ", devmem); + perror("lseek"); + free(p); + return NULL; + } + + if (myread(fd, p, len, devmem) == -1) + { + free(p); + return NULL; + } +#endif /* USE_MMAP */ + + if (close(fd) == -1) + perror(devmem); + + return p; +} + +int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add) +{ + FILE *f; + + f = fopen(dumpfile, add ? "r+b" : "wb"); + if (!f) + { + fprintf(stderr, "%s: ", dumpfile); + perror("fopen"); + return -1; + } + + if (fseek(f, base, SEEK_SET) != 0) + { + fprintf(stderr, "%s: ", dumpfile); + perror("fseek"); + goto err_close; + } + + if (fwrite(data, len, 1, f) != 1) + { + fprintf(stderr, "%s: ", dumpfile); + perror("fwrite"); + goto err_close; + } + + if (fclose(f)) + { + fprintf(stderr, "%s: ", dumpfile); + perror("fclose"); + return -1; + } + + return 0; + +err_close: + fclose(f); + return -1; +} diff --git a/src/util.h b/src/util.h new file mode 100644 index 0000000..894bd2f --- /dev/null +++ b/src/util.h @@ -0,0 +1,29 @@ +/* + * This file is part of the dmidecode project. + * + * Copyright (C) 2003-2008 Jean Delvare + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "types.h" + +#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) + +int checksum(const u8 *buf, size_t len); +void *mem_chunk(size_t base, size_t len, const char *devmem); +int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add); diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..050cf7a --- /dev/null +++ b/src/version.h @@ -0,0 +1 @@ +#define VERSION "2.9" diff --git a/trunk/Makefile b/trunk/Makefile deleted file mode 100644 index 8e69bb5..0000000 --- a/trunk/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -#. -#. DMI Decode Python Extension Module -#. -#. (C) 2008 Nima Talebi -#. -#. Licensed under the GNU Public License v3 -#. - -VERSION := 2.10 -PY := $(shell python -V 2>&1 |sed -e 's/.\(ython\) \(2\.[0-9]\)\..*/p\1\2/') -PY_VER := $(subst python,,$(PY)) -PACKAGE := python-dmidecode -SRCSRV := /var/www/nima/sites/src.autonomy.net.au/pub - -CC := gcc -RM := rm -f -SRC_D := src -OBJ_D := lib -CFLAGS = -g -D_XOPEN_SOURCE=600 -CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -CFLAGS += -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual -CFLAGS += -pthread -fno-strict-aliasing -DNDEBUG -fPIC -CFLAGS += -I/usr/include/$(PY) -CFLAGS += -O3 -#CFLAGS += -DNDEBUG -#CFLAGS += -DBIGENDIAN -#CFLAGS += -DALIGNMENT_WORKAROUND -#LDFLAGS = -lefence -LDFLAGS = -SOFLAGS = -pthread -shared -L/home/nima/dev-room/projects/dmidecode -lutil -SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecode.so - -#. Search -vpath %.o $(OBJ_D) -vpath %.c $(SRC_D) -vpath %.h $(SRC_D) -vpath % $(OBJ_D) - - -############################################################################### -build: $(PY)-dmidecode.so -$(PY)-dmidecode.so: $(SO) - cp $< $@ - -build: $(SO) -$(SO): - $(PY) src/setup.py build - -install: - $(PY) src/setup.py install - -uninstall: - $(PY) src/setup.py uninstall - -clean : - dh_clean - $(PY) src/setup.py clean - -$(RM) *.so lib/*.o core - -rm -rf build .dpkg - -tarball: - rm -rf $(PACKAGE)-$(VERSION) - mkdir $(PACKAGE)-$(VERSION) - cp -r contrib doc examples lib Makefile man README src $(PACKAGE)-$(VERSION) - tar -czvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) - -rpm: tarball - rm -rf rpm - mkdir -p rpm/{BUILD,RPMS,SRPMS,SPECS,SOURCES} - cp contrib/$(PACKAGE).spec rpm/SPECS - cp $(PACKAGE)-$(VERSION).tar.gz rpm/SOURCES - rpmbuild -ba --define "_topdir $(shell pwd)/rpm" rpm/SPECS/$(PACKAGE).spec - -############################################################################### -libdmidecode.so: dmihelper.o util.o dmioem.o dmidecode.o dmidecodemodule.o - $(CC) $(LDFLAGS) $(SOFLAGS) $^ -o $@ - -$(OBJ_D)/dmidecodemodule.o: dmidecodemodule.c - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/dmidecode.o: dmidecode.c version.h types.h util.h config.h dmidecode.h dmioem.h - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/dmihelper.o: dmihelper.c dmihelper.h - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/util.o: util.c types.h util.h config.h - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/dmioem.o: dmioem.c types.h dmidecode.h dmioem.h - $(CC) $(CFLAGS) -c -o $@ $< - - - -############################################################################### -.PHONY: install clean uninstall build dupload -.PHONY: srcsrv binary source orig.tar.gz all diff --git a/trunk/README b/trunk/README deleted file mode 100644 index 089a6f3..0000000 --- a/trunk/README +++ /dev/null @@ -1 +0,0 @@ -Please visit http://projects.autonomy.net.au/dmidecode/ diff --git a/trunk/debian/changelog b/trunk/debian/changelog deleted file mode 100644 index 940a149..0000000 --- a/trunk/debian/changelog +++ /dev/null @@ -1,60 +0,0 @@ -python-dmidecode (2.10.5-1) unstable; urgency=low - - * Upstream (cleanup) release. - - -- Nima Talebi Mon, 09 Mar 2009 10:29:52 +1100 - -python-dmidecode (2.10.4-1) unstable; urgency=low - - * Upstream release - purely to do with rpm packaging. - * Added upstream changelog. - - -- Nima Talebi Mon, 09 Mar 2009 00:45:19 +1100 - -python-dmidecode (2.10.3-1) unstable; urgency=low - - * Upstream release - separate setup.py for debug and non-debug versions of - python-dmidecode (Closes: #516358). - - -- Nima Talebi Mon, 23 Feb 2009 00:34:11 +1100 - -python-dmidecode (2.10.2-1) unstable; urgency=low - - * Upstream release. - * Added upstream changelog. - * Added hopepage to the control file. - * Change (C) to © in the copyright. - * Changed generic (GPL) license to specific (GPL-3). - - -- Nima Talebi Fri, 13 Feb 2009 06:36:30 -0800 - -python-dmidecode (2.10.1-3) unstable; urgency=low - - * Updated copyright file. - - -- Nima Talebi Wed, 14 Jan 2009 13:24:58 -0800 - -python-dmidecode (2.10.1-2) unstable; urgency=low - - * Fixed watchfile. - - -- Nima Talebi Mon, 12 Jan 2009 23:43:17 -0800 - -python-dmidecode (2.10.1-1) unstable; urgency=low - - * The separation between the upstream and the debian files is now complete. - - -- Nima Talebi Mon, 12 Jan 2009 00:19:29 -0800 - -python-dmidecode (2.10-2) unstable; urgency=low - - * Conform the the latest Lintian rules. - - -- Nima Talebi Sun, 11 Jan 2009 15:04:58 -0800 - -python-dmidecode (2.10-1) unstable; urgency=low - - * Initial release (Closes: #509169) - - -- Nima Talebi Fri, 19 Dec 2008 14:04:16 +0900 - diff --git a/trunk/debian/compat b/trunk/debian/compat deleted file mode 100644 index 7f8f011..0000000 --- a/trunk/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/trunk/debian/control b/trunk/debian/control deleted file mode 100644 index 17740f3..0000000 --- a/trunk/debian/control +++ /dev/null @@ -1,35 +0,0 @@ -Source: python-dmidecode -XS-Python-Version: >= 2.3 -Section: python -Priority: optional -Homepage: http://projects.autonomy.net.au/dmidecode -Maintainer: Nima Talebi -Build-Depends: debhelper (>= 7), python-all-dev (>= 2.3.5-11), python-central (>= 0.6), python-all-dbg -Standards-Version: 3.8.0 - -Package: python-dmidecode -XB-Python-Version: ${python:Versions} -Architecture: any -Provides: ${python:Provides} -Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends} -Description: Python extension module for dmidecode - DMI (the desktop management interface) provides a standardized description of - a computer's hardware, including characteristics such as BIOS serial number - and hardware connectors. - . - This package provides an interface to the DMI data available from the BIOS. - It is intended to be used as a back-end tool by other hardware detection - programs implemented in Python. - -Package: python-dmidecode-dbg -Architecture: any -Priority: extra -Depends: python-dmidecode (= ${binary:Version}), python-dbg, ${shlibs:Depends}, ${misc:Depends} -Provides: ${python:Provides} -XB-Python-Version: ${python:Versions} -Description: Python extension module for dmidecode (debug) - DMI (the desktop management interface) provides a standardized description of - a computer's hardware, including characteristics such as BIOS serial number - and hardware connectors. - . - This package contains the extension built for the Python debug interpreter. diff --git a/trunk/debian/copyright b/trunk/debian/copyright deleted file mode 100644 index 2515d56..0000000 --- a/trunk/debian/copyright +++ /dev/null @@ -1,56 +0,0 @@ -DMIDecode Python Extension Module shadows the DMIDecode utility -=============================================================== - - -DMIDecode Python Extension Module -================================= - -This package was authored and debianized by Nima Talebi on -Wed, 17 Dec 2008 19:52:44 +0900. - -It was downloaded from http://projects.autonomy.net.au/dmidecode/ - -Upstream Author: Nima Talebi - -The Debian packaging is © 2008, Nima Talebi and is licensed -under the GPL, see `/usr/share/common-licenses/GPL-3'. - -License: - GPLv3 - The python-dmidecode packages is available under the terms of - the GNU General Public license version 3. On Debian systems, the complete - text of the GNU General Public License can be found in - `/usr/share/common-licenses/GPL-3'. - - -DMIDecode -========= - -Original Author: Alan Cox - -Developer & Maintainer: Jean Delvare - -License: GNU GPLv2 - - -Copyrights -========== - © 2000-2002 Alan Cox - © 2000-2008 Jean Delvare - © 2007-2009Nima Talebi - -License: - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -// vim: ft=asciidoc diff --git a/trunk/debian/python-dmidecode-dbg.docs b/trunk/debian/python-dmidecode-dbg.docs deleted file mode 100644 index 5ac33e9..0000000 --- a/trunk/debian/python-dmidecode-dbg.docs +++ /dev/null @@ -1,2 +0,0 @@ -README -doc/changelog diff --git a/trunk/debian/python-dmidecode.docs b/trunk/debian/python-dmidecode.docs deleted file mode 100644 index 5ac33e9..0000000 --- a/trunk/debian/python-dmidecode.docs +++ /dev/null @@ -1,2 +0,0 @@ -README -doc/changelog diff --git a/trunk/debian/rules b/trunk/debian/rules deleted file mode 100755 index 5e4d832..0000000 --- a/trunk/debian/rules +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/make -f - -export DH_VERBOSE=0 -PACKAGE = $(shell dh_listpackages) -PYVERS = $(shell pyversions -vr) - -################################################################################ -#. Build -build: build-stamp -build-stamp: $(PYVERS:%=build-ext-%) $(PYVERS:%=build-dbg-ext-%) - dh_testdir - touch $@ -build-ext-%: - python$* src/setup.py build - touch $@ -build-dbg-ext-%: - python$*-dbg src/setup-dbg.py build - touch $@ - -################################################################################ -#. Install -install: install-stamp - dh_testdir - dh_testroot - dh_installdirs - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install - dh_pycentral - dh_installman -install-stamp: build-stamp $(PYVERS:%=install-ext-%) $(PYVERS:%=install-dbg-ext-%) -install-ext-%: - python$* src/setup.py install --root $(CURDIR)/debian/python-dmidecode - touch $@ -install-dbg-ext-%: - python$*-dbg src/setup-dbg.py install --root $(CURDIR)/debian/python-dmidecode-dbg - #find $(CURDIR)/debian/python-dmidecode-dbg/usr/lib/python$*/ ! -type d ! -name '*_d\.so' -delete - #find $(CURDIR)/debian/python-dmidecode-dbg/usr/lib/python$*/ -depth -empty -delete - touch $@ - -################################################################################ -#. Binary -binary: binary-indep binary-arch -binary-indep: -binary-arch: build install - dh_testdir - dh_testroot - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - - -################################################################################ -#. Clean -clean: - dh_testdir - dh_testroot - $(MAKE) -f Makefile clean - test $(CL_AGE) -le $(CACHE_AGE) || dh_clean - dh_clean build-stamp install-stamp \ - $(PYVERS:%=install-ext-%) $(PYVERS:%=build-ext-%) \ - $(PYVERS:%=install-dbg-ext-%) $(PYVERS:%=build-dbg-ext-%) - -.PHONY: build clean binary-indep binary-arch binary install diff --git a/trunk/debian/upstream.changelog b/trunk/debian/upstream.changelog deleted file mode 100644 index e0f0ddc..0000000 --- a/trunk/debian/upstream.changelog +++ /dev/null @@ -1,952 +0,0 @@ ------------------------------------------------------------------------- -r166 | nima | 2008-12-22 15:02:00 -0800 (Mon, 22 Dec 2008) | 2 lines - -Source file name change. - ------------------------------------------------------------------------- -r165 | nima | 2008-12-22 15:01:22 -0800 (Mon, 22 Dec 2008) | 2 lines - -A more complete dmidecode example. - ------------------------------------------------------------------------- -r164 | nima | 2008-12-22 14:40:51 -0800 (Mon, 22 Dec 2008) | 2 lines - -Applied the nice changes suggested by Piotr Ożarowsk. - ------------------------------------------------------------------------- -r163 | nima | 2008-12-22 05:37:43 -0800 (Mon, 22 Dec 2008) | 6 lines - -Cleaned up the fix for type(127). - -Added the second type of stuffed bios (upstream). - -Integrated dmidecode the binary into the test case for a more objective result. - ------------------------------------------------------------------------- -r162 | nima | 2008-12-22 01:06:43 -0800 (Mon, 22 Dec 2008) | 2 lines - -Fixed the type(127) problem (at least on this machine) - again. - ------------------------------------------------------------------------- -r161 | nima | 2008-12-21 04:52:51 -0800 (Sun, 21 Dec 2008) | 4 lines - -Removed unnecessay manpage. - -Spell my own name correctly. - ------------------------------------------------------------------------- -r160 | nima | 2008-12-21 03:31:36 -0800 (Sun, 21 Dec 2008) | 2 lines - -Added an upload into src.autonomy.net.au after source build. - ------------------------------------------------------------------------- -r159 | nima | 2008-12-21 03:27:52 -0800 (Sun, 21 Dec 2008) | 2 lines - -Fixed sample. - ------------------------------------------------------------------------- -r158 | nima | 2008-12-21 02:22:06 -0800 (Sun, 21 Dec 2008) | 6 lines - -Cleanup copyright. - -Cleanup debian/rules. - -Adding test.py to examples. - ------------------------------------------------------------------------- -r157 | nima | 2008-12-21 02:04:03 -0800 (Sun, 21 Dec 2008) | 2 lines - -Remove README.Debian - no point. - ------------------------------------------------------------------------- -r156 | nima | 2008-12-20 23:57:49 -0800 (Sat, 20 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r155 | nima | 2008-12-20 23:53:54 -0800 (Sat, 20 Dec 2008) | 3 lines - -Handle cases where user does not have appropriate permission to access the -memory file or device. - ------------------------------------------------------------------------- -r154 | nima | 2008-12-20 21:44:04 -0800 (Sat, 20 Dec 2008) | 2 lines - -Names. - ------------------------------------------------------------------------- -r153 | nima | 2008-12-20 21:43:06 -0800 (Sat, 20 Dec 2008) | 2 lines - -Better naming. - ------------------------------------------------------------------------- -r152 | nima | 2008-12-20 20:41:39 -0800 (Sat, 20 Dec 2008) | 4 lines - -Upped debhelper build-required version from 5 to 7. - -Final cleanups. - ------------------------------------------------------------------------- -r151 | nima | 2008-12-20 18:55:19 -0800 (Sat, 20 Dec 2008) | 2 lines - -Cleaned up and Lintian-approved. - ------------------------------------------------------------------------- -r150 | nima | 2008-12-20 18:48:05 -0800 (Sat, 20 Dec 2008) | 2 lines - -Email address fixed. - ------------------------------------------------------------------------- -r149 | nima | 2008-12-20 18:39:16 -0800 (Sat, 20 Dec 2008) | 2 lines - -Sigh. - ------------------------------------------------------------------------- -r148 | nima | 2008-12-20 18:38:35 -0800 (Sat, 20 Dec 2008) | 2 lines - -Changing to svn-buildpackage. - ------------------------------------------------------------------------- -r147 | nima | 2008-12-20 18:22:20 -0800 (Sat, 20 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r146 | nima | 2008-12-20 18:07:56 -0800 (Sat, 20 Dec 2008) | 2 lines - -Source generation. - ------------------------------------------------------------------------- -r145 | nima | 2008-12-20 17:41:57 -0800 (Sat, 20 Dec 2008) | 6 lines - -Fixed watchfile now that I've created a src (orig.tar.gz) repository. - -Added more copyright/lisencing information. - -More debianizing. - ------------------------------------------------------------------------- -r144 | nima | 2008-12-20 09:00:56 -0800 (Sat, 20 Dec 2008) | 2 lines - -Required for dh_installdocs. - ------------------------------------------------------------------------- -r143 | nima | 2008-12-20 08:54:32 -0800 (Sat, 20 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r142 | nima | 2008-12-20 08:52:15 -0800 (Sat, 20 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r141 | nima | 2008-12-20 08:49:40 -0800 (Sat, 20 Dec 2008) | 2 lines - -Removed out-of-place README. - ------------------------------------------------------------------------- -r140 | nima | 2008-12-20 08:47:18 -0800 (Sat, 20 Dec 2008) | 2 lines - -Hide private data from subversion. - ------------------------------------------------------------------------- -r139 | nima | 2008-12-20 08:46:37 -0800 (Sat, 20 Dec 2008) | 2 lines - -Remove private memory dumps. - ------------------------------------------------------------------------- -r138 | nima | 2008-12-20 08:45:39 -0800 (Sat, 20 Dec 2008) | 4 lines - -Added missing info to copyright file. - -Source creation target. - ------------------------------------------------------------------------- -r137 | nima | 2008-12-20 08:26:43 -0800 (Sat, 20 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r136 | nima | 2008-12-20 07:49:18 -0800 (Sat, 20 Dec 2008) | 4 lines - -Handle cases where user asks for invalid types. - -Updated test cases to test for this too. - ------------------------------------------------------------------------- -r135 | nima | 2008-12-20 07:32:30 -0800 (Sat, 20 Dec 2008) | 6 lines - -Version information now set once during init(). - -Bettered test cases. - -Case 127 magically fixed. - ------------------------------------------------------------------------- -r134 | nima | 2008-12-19 17:46:42 -0800 (Fri, 19 Dec 2008) | 2 lines - -Debian specific target. - ------------------------------------------------------------------------- -r133 | nima | 2008-12-19 17:44:55 -0800 (Fri, 19 Dec 2008) | 8 lines - -Removed "detected" from appearing in every single function call. TODO: An ivar -should be implemented to return this string, so further cleanup is still -required; as it stands, there is no access to this information anymore! - -Updated test case. - -Further general cleanup. - ------------------------------------------------------------------------- -r132 | nima | 2008-12-19 15:55:53 -0800 (Fri, 19 Dec 2008) | 4 lines - -Further testing shows that the segfault does not occur when the device is -/dev/mem, but does so for all images (where requested type is 127), suggesting -that the problem could be with the image or surrounding processes. - ------------------------------------------------------------------------- -r131 | nima | 2008-12-19 15:46:46 -0800 (Fri, 19 Dec 2008) | 2 lines - -Oops - fixed. - ------------------------------------------------------------------------- -r130 | nima | 2008-12-19 15:45:55 -0800 (Fri, 19 Dec 2008) | 3 lines - -Test case is close to complete, type 127 results in a segfault - (test case -is serving its purpose). - ------------------------------------------------------------------------- -r129 | nima | 2008-12-19 15:29:50 -0800 (Fri, 19 Dec 2008) | 3 lines - -Adding an image from parallel's desktop running Debian lenny, and another for -a physical server also running Debian. Both are intel 32 bit. - ------------------------------------------------------------------------- -r128 | nima | 2008-12-19 15:27:10 -0800 (Fri, 19 Dec 2008) | 4 lines - -More work on test case. - -Updated setup.py to reflect new version. - ------------------------------------------------------------------------- -r127 | nima | 2008-12-19 05:49:19 -0800 (Fri, 19 Dec 2008) | 2 lines - -More testing and fixes. - ------------------------------------------------------------------------- -r126 | nima | 2008-12-19 05:42:10 -0800 (Fri, 19 Dec 2008) | 2 lines - -Improved test case. - ------------------------------------------------------------------------- -r125 | nima | 2008-12-19 05:32:35 -0800 (Fri, 19 Dec 2008) | 2 lines - -Removed a printf() comment. - ------------------------------------------------------------------------- -r124 | nima | 2008-12-19 05:21:24 -0800 (Fri, 19 Dec 2008) | 6 lines - -Check that the path given with set_dev() is writeable. - -Don't crash when writing to a read-only file, return False instead. - -Missing an INCREF in get_dev() fixed. - ------------------------------------------------------------------------- -r123 | nima | 2008-12-19 03:56:39 -0800 (Fri, 19 Dec 2008) | 2 lines - -Test for write permission prior to write attempts. - ------------------------------------------------------------------------- -r122 | nima | 2008-12-19 01:02:52 -0800 (Fri, 19 Dec 2008) | 2 lines - -Fixed watch file. - ------------------------------------------------------------------------- -r121 | nima | 2008-12-18 21:05:38 -0800 (Thu, 18 Dec 2008) | 4 lines - -Received ITP auto-ack: #509169. - -More debianizing cleanup. - ------------------------------------------------------------------------- -r120 | nima | 2008-12-18 20:13:24 -0800 (Thu, 18 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r119 | nima | 2008-12-18 20:07:06 -0800 (Thu, 18 Dec 2008) | 3 lines - -Further work in enforcing the Debian policy in package based on advice from -`POX' and the documentation. - ------------------------------------------------------------------------- -r118 | nima | 2008-12-18 18:23:32 -0800 (Thu, 18 Dec 2008) | 2 lines - -Removed junk and doing more debianizing - WIP. - ------------------------------------------------------------------------- -r117 | nima | 2008-12-18 05:49:57 -0800 (Thu, 18 Dec 2008) | 2 lines - -Updated. - ------------------------------------------------------------------------- -r116 | nima | 2008-12-18 05:48:52 -0800 (Thu, 18 Dec 2008) | 6 lines - -The dmidecode.type() call not takes ints, not strings. - -Adding an example directory. - -Adding test case. - ------------------------------------------------------------------------- -r115 | nima | 2008-12-18 05:45:37 -0800 (Thu, 18 Dec 2008) | 4 lines - -The dmidecode.type() call not takes ints, not strings. - -Adding an example directory. - ------------------------------------------------------------------------- -r114 | nima | 2008-12-17 17:12:50 -0800 (Wed, 17 Dec 2008) | 5 lines - -More upstream changes implemented, see CHANGELOG by Jean Delvare from the -period 2008-02-16 to 2008-11-23. - -These changes have been made, but not yet fully tested. - ------------------------------------------------------------------------- -r113 | nima | 2008-12-17 05:26:57 -0800 (Wed, 17 Dec 2008) | 5 lines - -Claim to support revision 32 of Intel AP-485 (CPUID). No relevant change since -revision 31. - -Update reference to AMD CPUID document. - ------------------------------------------------------------------------- -r112 | nima | 2008-12-17 05:11:35 -0800 (Wed, 17 Dec 2008) | 2 lines - -Handle chassis information records of size 19 (DMI type 3). - ------------------------------------------------------------------------- -r111 | nima | 2008-12-17 05:00:12 -0800 (Wed, 17 Dec 2008) | 2 lines - -And the debian subfolder itself... - ------------------------------------------------------------------------- -r110 | nima | 2008-12-17 04:59:32 -0800 (Wed, 17 Dec 2008) | 2 lines - -Debianizing dmidecode. - ------------------------------------------------------------------------- -r109 | nima | 2008-12-16 23:30:04 -0800 (Tue, 16 Dec 2008) | 2 lines - -Adding spec file written by Joel Heenan. - ------------------------------------------------------------------------- -r108 | nima | 2008-12-16 23:20:56 -0800 (Tue, 16 Dec 2008) | 2 lines - -Cleaning up source area, ready for debianizing, and rpm after that. - ------------------------------------------------------------------------- -r107 | nima | 2008-10-31 07:45:34 -0700 (Fri, 31 Oct 2008) | 2 lines - -Changed default target of Makefile back to `setup.py' method of installation. - ------------------------------------------------------------------------- -r106 | nima | 2008-10-31 07:41:02 -0700 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r105 | nima | 2008-10-31 07:33:03 -0700 (Fri, 31 Oct 2008) | 3 lines - -This commit closes #2 reported by Justin Cook, the ticket will remain open -until Justin confirms this however. - ------------------------------------------------------------------------- -r104 | nima | 2008-10-31 07:07:22 -0700 (Fri, 31 Oct 2008) | 6 lines - -Implemented reading a dump to - this concludes syncing to the upstream release. - -Next, exceptions should be thrown in certain places, more error checking in the -python side of things, and also in relation to setting and unsetting of the -alternate memory file. - ------------------------------------------------------------------------- -r103 | nima | 2008-10-31 06:42:35 -0700 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r102 | nima | 2008-10-31 06:38:24 -0700 (Fri, 31 Oct 2008) | 3 lines - -Fixed dump. The `offset' problem was not really an offset problem - it was a -silly typo. - ------------------------------------------------------------------------- -r101 | nima | 2008-10-31 06:24:04 -0700 (Fri, 31 Oct 2008) | 2 lines - -Missed two lines. - ------------------------------------------------------------------------- -r100 | nima | 2008-10-31 06:19:50 -0700 (Fri, 31 Oct 2008) | 3 lines - -Dump-to-file is almost working, there seems to be a 4-byte misalignment in the -produced file though for now - needs to be fixed. - ------------------------------------------------------------------------- -r99 | nima | 2008-10-31 04:43:15 -0700 (Fri, 31 Oct 2008) | 2 lines - -Removed junk comments. - ------------------------------------------------------------------------- -r98 | nima | 2008-10-31 04:21:24 -0700 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r97 | nima | 2008-10-31 04:15:19 -0700 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r96 | nima | 2008-10-31 03:24:41 -0700 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r95 | nima | 2008-10-31 02:05:23 -0700 (Fri, 31 Oct 2008) | 6 lines - -Integration of required `dmiopt.h' bits. -Removed QUIETness code. -Other cleanups. -Added get/set methods for changinf the default /dev/mem device. - - ------------------------------------------------------------------------- -r94 | nima | 2008-10-31 02:02:21 -0700 (Fri, 31 Oct 2008) | 2 lines - -Removed traces of `_' and integrating required bits from dmiopt.h. - ------------------------------------------------------------------------- -r93 | nima | 2008-10-31 02:01:41 -0700 (Fri, 31 Oct 2008) | 2 lines - -Removed traces of `_'. - ------------------------------------------------------------------------- -r92 | nima | 2008-10-31 02:00:26 -0700 (Fri, 31 Oct 2008) | 2 lines - -Integrating the required bits from dmiopt into dmihelper. - ------------------------------------------------------------------------- -r91 | nima | 2008-10-31 01:39:12 -0700 (Fri, 31 Oct 2008) | 4 lines - -Removed `_' buffer. -Removed use of `FLAGS_QUIET' as it makes no sense for a module. -Removed the `submain()' function. - ------------------------------------------------------------------------- -r90 | nima | 2008-10-31 01:30:00 -0700 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r89 | nima | 2008-10-31 01:29:06 -0700 (Fri, 31 Oct 2008) | 2 lines - -Removed dependency on dmiopt. - ------------------------------------------------------------------------- -r88 | nima | 2008-10-31 01:28:33 -0700 (Fri, 31 Oct 2008) | 2 lines - -Removed verbose printout. - ------------------------------------------------------------------------- -r87 | nima | 2008-10-30 03:14:24 -0700 (Thu, 30 Oct 2008) | 2 lines - -Removed final traces of the `_' buffer. - ------------------------------------------------------------------------- -r86 | nima | 2008-10-29 19:11:56 -0700 (Wed, 29 Oct 2008) | 2 lines - -Implementing (incomplete) upstream changes. - ------------------------------------------------------------------------- -r85 | nima | 2008-10-29 00:15:35 -0700 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r84 | nima | 2008-10-29 00:13:49 -0700 (Wed, 29 Oct 2008) | 5 lines - -Adding man pages from upstream. Sooner or later, these will be removed, as will -all other work that's simply replicating the demidecode binary. All this -package should provide is the python module, and some py-module-specific man -pages. - ------------------------------------------------------------------------- -r83 | nima | 2008-10-29 00:10:24 -0700 (Wed, 29 Oct 2008) | 4 lines - -Recoded the new work from upstream into these (main) files. The options to -dump the memory image onto file, and read back from it has not yet been -worked in, but the underlying work has been completed. - ------------------------------------------------------------------------- -r82 | nima | 2008-10-29 00:09:10 -0700 (Wed, 29 Oct 2008) | 3 lines - -Tested new dmidecode python module with this example file. A real test case -will be implemented sometime in future. - ------------------------------------------------------------------------- -r81 | nima | 2008-10-29 00:07:56 -0700 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r80 | nima | 2008-10-29 00:07:13 -0700 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r79 | nima | 2008-10-29 00:06:47 -0700 (Wed, 29 Oct 2008) | 2 lines - -Using dmihelper now. - ------------------------------------------------------------------------- -r78 | nima | 2008-10-29 00:05:58 -0700 (Wed, 29 Oct 2008) | 2 lines - -Upstream. - ------------------------------------------------------------------------- -r77 | nima | 2008-10-29 00:04:19 -0700 (Wed, 29 Oct 2008) | 2 lines - -Upstream. - ------------------------------------------------------------------------- -r76 | nima | 2008-10-29 00:04:03 -0700 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r75 | nima | 2008-10-28 23:36:23 -0700 (Tue, 28 Oct 2008) | 2 lines - -Renamed to a more appropriate name. - ------------------------------------------------------------------------- -r74 | nima | 2008-10-28 23:35:21 -0700 (Tue, 28 Oct 2008) | 3 lines - -Committing new dmidecode helper functions, and next, renaming it to a -meaningful name. - ------------------------------------------------------------------------- -r73 | nima | 2008-10-28 23:27:31 -0700 (Tue, 28 Oct 2008) | 3 lines - -Synced to the latest from upstream, with a light modification required for the -module. - ------------------------------------------------------------------------- -r72 | nima | 2008-10-18 02:34:09 -0700 (Sat, 18 Oct 2008) | 5 lines - -Python does not have unsigned integers, hence %u and %lu in printf style -strings are taken to be literal strings, not space-holders. All occurences -of '%u' (78) have been amended to '%i', there was no '%lu'. - - ------------------------------------------------------------------------- -r71 | nima | 2008-10-18 02:28:46 -0700 (Sat, 18 Oct 2008) | 4 lines - -Fixed bug reported by by Justin Cook, where dmidecode.type() would segfault. -It turned out to be some code that was forgotten about during the conversion, or -at least very incomplete and wrong. - ------------------------------------------------------------------------- -r70 | nima | 2008-10-16 08:52:48 -0700 (Thu, 16 Oct 2008) | 2 lines - -Remove efence. - ------------------------------------------------------------------------- -r69 | nima | 2008-09-04 20:08:02 -0700 (Thu, 04 Sep 2008) | 2 lines - -Fixed a bug that crashed dmidecode.slot(). - ------------------------------------------------------------------------- -r68 | nima | 2008-09-03 23:09:55 -0700 (Wed, 03 Sep 2008) | 5 lines - -Cleaning up of the dmidecode module, mostly conversion of things that can be -Python `None's or `Int's but were `String'. - -Replaced a meaningless int dictionary key to `data'. - ------------------------------------------------------------------------- -r67 | nima | 2008-09-03 19:26:09 -0700 (Wed, 03 Sep 2008) | 3 lines - -Work on CPU details - seemed to been a bug with appending to a string rather -than rewriting it. - ------------------------------------------------------------------------- -r66 | nima | 2008-08-08 07:15:47 -0700 (Fri, 08 Aug 2008) | 4 lines - -Replaced `%X' with `%x'. - -Logic cleanup - Put the `Handle' info back into the dictionary. - ------------------------------------------------------------------------- -r65 | nima | 2008-08-08 00:57:44 -0700 (Fri, 08 Aug 2008) | 2 lines - -Anoher bug fix, this time in baseboard. - ------------------------------------------------------------------------- -r64 | nima | 2008-08-08 00:27:36 -0700 (Fri, 08 Aug 2008) | 3 lines - -Fixed many major bugs (all of which were expected based on the way we mass -converted all the `case' blocks. - ------------------------------------------------------------------------- -r63 | nima | 2008-08-07 05:32:39 -0700 (Thu, 07 Aug 2008) | 2 lines - -Cleaned up a little. - ------------------------------------------------------------------------- -r62 | nima | 2008-08-06 18:34:15 -0700 (Wed, 06 Aug 2008) | 2 lines - -Fixed some conversion bits missed during last night. - ------------------------------------------------------------------------- -r61 | nima | 2008-08-06 06:32:37 -0700 (Wed, 06 Aug 2008) | 2 lines - -Updated authors file with developers of the dmidecode python module. - ------------------------------------------------------------------------- -r60 | nima | 2008-08-06 06:27:26 -0700 (Wed, 06 Aug 2008) | 2 lines - -Changed to GNU GPL v3 License. - ------------------------------------------------------------------------- -r59 | nima | 2008-08-06 05:59:03 -0700 (Wed, 06 Aug 2008) | 2 lines - -Removed `sudo'. - ------------------------------------------------------------------------- -r58 | nima | 2008-08-06 05:52:46 -0700 (Wed, 06 Aug 2008) | 4 lines - -Completed `case 126', thought to have been completed in previous commit. - -Some housekeeping elsewhere. - ------------------------------------------------------------------------- -r57 | nima | 2008-08-06 01:51:05 -0700 (Wed, 06 Aug 2008) | 4 lines - -Completed all conversions! Only problem now is of course finding all the memory -leaks and introduced logic errors which (confirmed) do exists - use valgrind and -see. - ------------------------------------------------------------------------- -r56 | vwhitteron | 2008-08-06 01:29:18 -0700 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 34' through `Case 39' ------------------------------------------------------------------------- -r55 | nima | 2008-08-06 01:12:43 -0700 (Wed, 06 Aug 2008) | 2 lines - -Almost there! - ------------------------------------------------------------------------- -r54 | vwhitteron | 2008-08-06 00:49:23 -0700 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 29' and `Case 32' ------------------------------------------------------------------------- -r53 | nima | 2008-08-06 00:42:34 -0700 (Wed, 06 Aug 2008) | 2 lines - -Converted `case 30'. - ------------------------------------------------------------------------- -r52 | vwhitteron | 2008-08-06 00:40:42 -0700 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 26', `Case 27' and `Case 28' ------------------------------------------------------------------------- -r51 | nima | 2008-08-06 00:30:41 -0700 (Wed, 06 Aug 2008) | 3 lines - -Added `PyObject *data;' to all remaining functions which will generate a warning -as to indicate these need to be converted. - ------------------------------------------------------------------------- -r50 | nima | 2008-08-06 00:27:30 -0700 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `csae 28'. - ------------------------------------------------------------------------- -r49 | nima | 2008-08-06 00:23:35 -0700 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `case 27', and fixed error in last commit for `case 26'. - ------------------------------------------------------------------------- -r48 | nima | 2008-08-06 00:19:27 -0700 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `case 26'. - ------------------------------------------------------------------------- -r47 | vwhitteron | 2008-08-06 00:09:11 -0700 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 23', `Case 24', `Case24' and `Case 25' ------------------------------------------------------------------------- -r46 | nima | 2008-08-06 00:07:20 -0700 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `case 25'. - ------------------------------------------------------------------------- -r45 | nima | 2008-08-06 00:00:41 -0700 (Wed, 06 Aug 2008) | 2 lines - -Converted function for `case 24'. - ------------------------------------------------------------------------- -r44 | nima | 2008-08-05 23:59:35 -0700 (Tue, 05 Aug 2008) | 2 lines - -More fixes on recent commits (by me), and more conversions on functions. - ------------------------------------------------------------------------- -r43 | vwhitteron | 2008-08-05 23:57:13 -0700 (Tue, 05 Aug 2008) | 1 line - -Completed `Case 22' ------------------------------------------------------------------------- -r42 | nima | 2008-08-05 23:53:24 -0700 (Tue, 05 Aug 2008) | 2 lines - -Oops. Fixed stupidity on last commit. - ------------------------------------------------------------------------- -r41 | nima | 2008-08-05 23:52:01 -0700 (Tue, 05 Aug 2008) | 2 lines - -Completed functions called by `case 21' and `case 22'. - ------------------------------------------------------------------------- -r40 | nima | 2008-08-05 23:42:54 -0700 (Tue, 05 Aug 2008) | 3 lines - -Completed `case 21' functions. -Cleanup. - ------------------------------------------------------------------------- -r39 | vwhitteron | 2008-08-05 23:39:53 -0700 (Tue, 05 Aug 2008) | 2 lines - -Completed `case 19' and `case 20'. - ------------------------------------------------------------------------- -r38 | nima | 2008-08-05 23:17:21 -0700 (Tue, 05 Aug 2008) | 2 lines - -Started on `case 19'. - ------------------------------------------------------------------------- -r37 | nima | 2008-08-05 22:43:05 -0700 (Tue, 05 Aug 2008) | 2 lines - -Completed `case 18' and `case 19'. - ------------------------------------------------------------------------- -r36 | nima | 2008-08-05 22:06:03 -0700 (Tue, 05 Aug 2008) | 2 lines - -Added `case 16' and `case 17'. - ------------------------------------------------------------------------- -r35 | nima | 2008-08-05 21:26:45 -0700 (Tue, 05 Aug 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r34 | nima | 2008-08-05 21:05:06 -0700 (Tue, 05 Aug 2008) | 2 lines - -Converted `case 5', `case 6', and `case 7'. - ------------------------------------------------------------------------- -r33 | nima | 2008-08-01 00:59:51 -0700 (Fri, 01 Aug 2008) | 2 lines - -Default case set to return python's `None'. - ------------------------------------------------------------------------- -r32 | nima | 2008-08-01 00:58:24 -0700 (Fri, 01 Aug 2008) | 2 lines - -Completed `case 15'. - ------------------------------------------------------------------------- -r31 | nima | 2008-07-28 21:33:59 -0700 (Mon, 28 Jul 2008) | 2 lines - -Completed `case 9' and case `8'. - ------------------------------------------------------------------------- -r30 | nima | 2008-07-28 18:31:21 -0700 (Mon, 28 Jul 2008) | 2 lines - -Completed `case 11'. - ------------------------------------------------------------------------- -r29 | nima | 2008-07-28 18:28:04 -0700 (Mon, 28 Jul 2008) | 2 lines - -Completed `case 12' and `case 14'. - ------------------------------------------------------------------------- -r28 | nima | 2008-07-28 17:29:05 -0700 (Mon, 28 Jul 2008) | 6 lines - -Bug fix (removed unnecessary breakr). - -Changed %i back to %u for now, even though it does not work with Python. -Better to do the change globally - later. - - ------------------------------------------------------------------------- -r27 | nima | 2008-07-28 03:14:38 -0700 (Mon, 28 Jul 2008) | 2 lines - -Try and determine python version dynamically. - ------------------------------------------------------------------------- -r26 | nima | 2008-07-27 05:15:51 -0700 (Sun, 27 Jul 2008) | 2 lines - -Completed `case 4', which was thought to have been completed falsely before. - ------------------------------------------------------------------------- -r25 | nima | 2008-07-26 02:15:53 -0700 (Sat, 26 Jul 2008) | 6 lines - -Completed cases 1, 4, and 13. Also altered the main PyDict object such that -each case has a value of a list to which items are appended. Without this, -each object of the same type would overwrite the previous, for example, 8 -processors would result in one single cpu with data pertaining to the last -cpu (7). - ------------------------------------------------------------------------- -r24 | nima | 2008-07-25 16:35:30 -0700 (Fri, 25 Jul 2008) | 2 lines - -Completed `case 0'. - ------------------------------------------------------------------------- -r23 | root | 2008-07-25 06:17:24 -0700 (Fri, 25 Jul 2008) | 2 lines - -Added `case 3'. - ------------------------------------------------------------------------- -r22 | root | 2008-07-25 05:51:02 -0700 (Fri, 25 Jul 2008) | 2 lines - -No new moves, cleanup on last commit and better test file template. - ------------------------------------------------------------------------- -r21 | root | 2008-07-25 05:27:26 -0700 (Fri, 25 Jul 2008) | 8 lines - -Next phase is to start converting all pure C functions returning `char *' and -such to new Pythonized functions returning `PyObject *', to save from having -to `PyString_FromString()' and similar, and more importantly, some functions -return a long string that could better be represented by a PyDict, PyList etc. - -This is the first commit of many more to come, converting a `case XX:' at a -time, making sure that each commit can actually compile and run. - ------------------------------------------------------------------------- -r20 | root | 2008-07-24 18:13:13 -0700 (Thu, 24 Jul 2008) | 2 lines - -Cleanup (DECREF). - ------------------------------------------------------------------------- -r19 | root | 2008-07-24 18:12:46 -0700 (Thu, 24 Jul 2008) | 2 lines - -Add in electric fence for now. - ------------------------------------------------------------------------- -r18 | root | 2008-07-24 18:11:39 -0700 (Thu, 24 Jul 2008) | 5 lines - -This was the culprit causing the `Abort' crash, valgrind showed that this file -is where the error lied. Stephen Darragh discovered this, and the fix has been -to use vsnprintf() and not vsprintf(), which should have been the case to begin -with really. - ------------------------------------------------------------------------- -r17 | root | 2008-07-24 17:46:00 -0700 (Thu, 24 Jul 2008) | 2 lines - -Cleaner to not vsprintf() at all if `format' is NULL. - ------------------------------------------------------------------------- -r16 | root | 2008-07-24 17:45:11 -0700 (Thu, 24 Jul 2008) | 2 lines - - The `biosdecode' is a program, nothing to do with the module, removed. - ------------------------------------------------------------------------- -r15 | nima | 2008-07-24 07:36:16 -0700 (Thu, 24 Jul 2008) | 2 lines - -Added my small role in AUTHORS so nobody bugs others for my code. - ------------------------------------------------------------------------- -r14 | nima | 2008-07-24 07:17:16 -0700 (Thu, 24 Jul 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r13 | nima | 2008-07-24 05:02:12 -0700 (Thu, 24 Jul 2008) | 2 lines - -Some cleaning, crash in interactive mode on dmidecode.bios() still not fixed. - ------------------------------------------------------------------------- -r12 | nima | 2008-07-24 03:48:01 -0700 (Thu, 24 Jul 2008) | 3 lines - -Now that code has been converted, work has started on "bios", and at the point -of proof-of-concept. - ------------------------------------------------------------------------- -r11 | nima | 2008-07-04 08:24:22 -0700 (Fri, 04 Jul 2008) | 3 lines - -Removing printf() statements, instead adding to Python dictionary object, -untested. - ------------------------------------------------------------------------- -r10 | nima | 2008-07-03 08:59:08 -0700 (Thu, 03 Jul 2008) | 6 lines - -Major changes have been implemented, alas, untested, in hope to move towards -a new version of dmi decode where rather than having data just printed to -screen in functions, data is passed around, and some data structure is -constructed, which is then used to construct the Python list/dicitonary -objects. - ------------------------------------------------------------------------- -r9 | nima | 2008-07-02 00:02:05 -0700 (Wed, 02 Jul 2008) | 4 lines - -WIP - Adding h->type value to catsprintf (as int major), later will add minor -too, and finally will replace the buffer with a linked list of structs, which -will be added to the python dictionary/list. - ------------------------------------------------------------------------- -r8 | nima | 2008-07-01 21:53:48 -0700 (Tue, 01 Jul 2008) | 3 lines - -Now the `Handle' hex codes are the key values in the python dictionaries -returned. - ------------------------------------------------------------------------- -r7 | nima | 2008-07-01 16:14:17 -0700 (Tue, 01 Jul 2008) | 2 lines - -Brought main() back into the python module and fixed malloc/free problems. - ------------------------------------------------------------------------- -r6 | nima | 2008-07-01 00:05:57 -0700 (Tue, 01 Jul 2008) | 2 lines - -Removed junk comments. - ------------------------------------------------------------------------- -r5 | nima | 2008-06-30 23:11:21 -0700 (Mon, 30 Jun 2008) | 2 lines - -Update for file renames. - ------------------------------------------------------------------------- -r4 | nima | 2008-06-30 23:04:02 -0700 (Mon, 30 Jun 2008) | 2 lines - -Better named. - ------------------------------------------------------------------------- -r3 | nima | 2008-06-30 23:01:21 -0700 (Mon, 30 Jun 2008) | 5 lines - -Project progressing along excellently. The python module is now functional and -has as many methods as the --type option takes. - -Next is to expand and harness the code around the `--string' option. - ------------------------------------------------------------------------- -r2 | nima | 2008-06-30 07:14:46 -0700 (Mon, 30 Jun 2008) | 4 lines - -Split out the module header into its own file. - -Cleaned up Makefile a little. - ------------------------------------------------------------------------- -r1 | nima | 2008-06-30 05:08:58 -0700 (Mon, 30 Jun 2008) | 2 lines - -First commit to SVN. - ------------------------------------------------------------------------- diff --git a/trunk/debian/watch b/trunk/debian/watch deleted file mode 100644 index 2018f4f..0000000 --- a/trunk/debian/watch +++ /dev/null @@ -1,2 +0,0 @@ -version=3 -http://src.autonomy.net.au/python-dmidecode/python-dmidecode-(.*).tar.gz diff --git a/trunk/doc/AUTHORS b/trunk/doc/AUTHORS deleted file mode 100644 index 05475b7..0000000 --- a/trunk/doc/AUTHORS +++ /dev/null @@ -1,15 +0,0 @@ -DEVELOPER AND MAINTAINER OF PYTHON MODULE (http://projects.autonomy.net.au/dmidecode) -Nima Talebi - -DEVELOPER AND MAINTAINER OF DMIDECODE (Please see http://www.nongnu.org/dmidecode) -Jean Delvare - -ORIGINAL AUTHOR -Alan Cox - -MANY THANKS TO (IN CHRONOLOGICAL ORDER) -Jean Delvare -Stephen Darragh -Joel Heenan -Vaughan Whitteron -Justin Cook diff --git a/trunk/doc/AUTHORS.upstream b/trunk/doc/AUTHORS.upstream deleted file mode 100644 index 1ad50db..0000000 --- a/trunk/doc/AUTHORS.upstream +++ /dev/null @@ -1,70 +0,0 @@ -DEVELOPER AND MAINTAINER -Jean Delvare - -ORIGINAL AUTHOR -Alan Cox - -CODE CONTRIBUTORS (IN CHRONOLOGICAL ORDER) -Matt Domsch -Arjan van de Ven -Mark D. Studebaker -Larry Lile -Dave Johnson -Petter Reinholdtsen -Roberto Nibali -John Cagle -Jens Elkner - -MANY THANKS TO (IN CHRONOLOGICAL ORDER) -Werner Heuser -Alexandre Duret-Lutz -Xavier Roche -Pamela Huntley -Gael Stephan -Sebastian Henschel -Richard Sharpe -David Wilson -Glen Foster -Chad Smith -Joshua Goldenhar -Luc Van de Velde -Mario Lang -Hugues Lepesant -Sergey Leonovich -Mike Cooper -Marc Rieffel -Jeff Moyer -Josef Moellers -Zing Zing Shishak -Rafael Avila de Espindola -Roger Koot -Martin Pool -Doug Brenner -Alex Williamson -Durval Menezes -Raphael Raimbault -Raul Nunez de Arenas Coronado -Francois Revol -Dominik Klein -Erwan Velu -Don Howard -Frans Pop -Tomek Mateja -Myke Olson -Torsten Seemann -Garry Belka -Klaus Muth -Antoine Fuselier -Matthew Garrett -Landry Breuil -Luke Suchocki -Attila Nagy -Alex Iribarren -Sebastien Douche -William Lallemand -Olivier Guerrier -Pascal Terjan -Stuart Hayes -Sofian Brabez -Vincent Pelletier -Andreas Gruenbacher diff --git a/trunk/doc/LICENSE b/trunk/doc/LICENSE deleted file mode 100644 index 94a0453..0000000 --- a/trunk/doc/LICENSE +++ /dev/null @@ -1,621 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS diff --git a/trunk/doc/README.types b/trunk/doc/README.types deleted file mode 100644 index 5d65a3a..0000000 --- a/trunk/doc/README.types +++ /dev/null @@ -1,55 +0,0 @@ - Type Information - ---------------------------------------- - 0 BIOS - 1 System - 2 Base Board - 3 Chassis - 4 Processor - 5 Memory Controller - 6 Memory Module - 7 Cache - 8 Port Connector - 9 System Slots - 10 On Board Devices - 11 OEM Strings - 12 System Configuration Options - 13 BIOS Language - 14 Group Associations - 15 System Event Log - 16 Physical Memory Array - 17 Memory Device - 18 32-bit Memory Error - 19 Memory Array Mapped Address - 20 Memory Device Mapped Address - 21 Built-in Pointing Device - 22 Portable Battery - 23 System Reset - 24 Hardware Security - 25 System Power Controls - 26 Voltage Probe - 27 Cooling Device - 28 Temperature Probe - 29 Electrical Current Probe - 30 Out-of-band Remote Access - 31 Boot Integrity Services - 32 System Boot - 33 64-bit Memory Error - 34 Management Device - 35 Management Device Component - 36 Management Device Threshold Data - 37 Memory Channel - 38 IPMI Device - 39 Power Supply - - - Keyword Types - ------------------------------ - bios 0, 13 - system 1, 12, 15, 23, 32 - baseboard 2, 10 - chassis 3 - processor 4 - memory 5, 6, 16, 17 - cache 7 - connector 8 - slot 9 diff --git a/trunk/doc/README.upstream b/trunk/doc/README.upstream deleted file mode 100644 index 391a5cb..0000000 --- a/trunk/doc/README.upstream +++ /dev/null @@ -1,116 +0,0 @@ -** INTRODUCTION ** - -Dmidecode reports information about your system's hardware as described in -your system BIOS according to the SMBIOS/DMI standard. This information -typically includes system manufacturer, model name, serial number, BIOS -version, asset tag as well as a lot of other details of varying level of -interest and reliability depending on the manufacturer. This will often -include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, -ISA) and memory module slots, and the list of I/O ports (e.g. serial, -parallel, USB). - -DMI data can be used to enable or disable specific portions of kernel code -depending on the specific hardware. Thus, one use of dmidecode is for kernel -developers to detect system "signatures" and add them to the kernel source -code when needed. - -Beware that DMI data have proven to be too unreliable to be blindly trusted. -Dmidecode does not scan your hardware, it only reports what the BIOS told it -to. - - -** INSTALLATION ** - -The home web page for dmidecode is hosted on Savannah: - http://www.nongnu.org/dmidecode/ -You will find the latest version (including CVS) there, as well as fresh news -and other interesting material, such as a list of related projects and -articles. - -This program was first written for Linux, and has since been reported to work -on FreeBSD, NetBSD, OpenBSD, BeOS, Cygwin and Solaris as well. - -There's no configure script, so simply run "make" to build dmidecode, and -"make install" to install it. You also can use "make uninstall" to remove -all the files you installed. By default, files are installed in /usr/local -but you can change this behavior by editing the Makefile file and setting -prefix to wherever you want. You may change the C compiler and the -compilation flags as well. - -Optionally, you can run "make strip" prior to "make install" if you want -smaller binaries. However, be aware that this will prevent any further -attempt to debug the programs. - -Two parameters can be set in the Makefile file to make dmidecode work on -non-i386 systems. They should be used if your system uses the big endian -byte ordering (Motorola) or doesn't support unaligned memory accesses, -respectively. For example, compiling for a SPARC processor would require -both (but I am not aware of SPARC-based systems implementing SMBIOS). -Compiling for an IA64 processor requires the memory alignment workaround, -and it is enabled automatically. - - -** DOCUMENTATION ** - -Each tool has a manual page, found in the "man" subdirectory. Manual pages -are installed by "make install". See these manual pages for command line -interface details and tool specific information. - -For an history of the changes made to dmidecode, see the CHANGELOG file. - -If you need help, your best chances are to visit the web page (see the -INSTALLATION section above) or to get in touch with the developers directly. -Have a look at the AUTHORS file and contact one of the maintainers. - -If you want to help with the development of dmidecode, please consider -joining the dmidecode-devel discussion list: - http://lists.nongnu.org/mailman/listinfo/dmidecode-devel - - -** COMMON PROBLEMS ** - -IA-64 - -Non-Linux systems are not yet supported. - -MMAP - -Note that mmap() is now used by default wherever possible, since this seems -to solve a number of problems. This default behavior can be changed in -config.h. Just to make sure this is clear, mmap() is not used for performance -reasons but to increase the number of systems on which dmidecode can be -successfully run. - -CYGWIN - -Dmidecode was reported to work under Cygwin. It seems that /dev/mem doesn't -work properly before version 1.5.10 though, so you will need to use at least -this version. - - -** MISCELLANEOUS TOOLS ** - -Three other tools come along with dmidecode: biosdecode, ownership and -vpddecode. These tools are only useful on systems with a BIOS, so they -are not built on IA-64 by default. - -BIOSDECODE - -This one prints all BIOS related information it can find in /dev/mem. -It used to be part of dmidecode itself, but as dmidecode was growing, -we felt that the non-DMI part had to be moved to a separate tool. - -OWNERSHIP - -This tool was written on a request by Luc Van de Velde for use with Novell -tools in his company. It retrieves the "ownership tag" that can be set on -most Compaq computers. Since it uses the same mechanisms dmidecode and -biosdecode use, and could be of some use for other people as well, we -decided to make it part of the project. - -VPDDECODE - -This tool prints the contents of the "vital product data" structure as -found in most IBM and Lenovo computers. It used to have a lookup table -for the machine name, but it was unreliable and hard to maintain so it -was ultimately dropped. It has a command line interface. diff --git a/trunk/doc/changelog b/trunk/doc/changelog deleted file mode 100644 index 476de63..0000000 --- a/trunk/doc/changelog +++ /dev/null @@ -1,1009 +0,0 @@ ------------------------------------------------------------------------- -r177 | nima | 2009-03-09 00:49:21 +1100 (Mon, 09 Mar 2009) | 2 lines - -Releasing v2.10.4. - ------------------------------------------------------------------------- -r176 | nima | 2009-03-08 22:32:42 +1100 (Sun, 08 Mar 2009) | 2 lines - -Adding spec file supplied by Clark Williams . - ------------------------------------------------------------------------- -r175 | nima | 2009-03-08 22:31:31 +1100 (Sun, 08 Mar 2009) | 3 lines - -Applied patch submitted by Clark Williams . - - ------------------------------------------------------------------------- -r174 | nima | 2009-02-23 00:34:24 +1100 (Mon, 23 Feb 2009) | 2 lines - -Fixed bug reported by Ralf Treinen. - ------------------------------------------------------------------------- -r173 | nima | 2009-02-14 01:39:23 +1100 (Sat, 14 Feb 2009) | 2 lines - -Removing spec file from upstream. - ------------------------------------------------------------------------- -r172 | nima | 2009-02-14 01:36:16 +1100 (Sat, 14 Feb 2009) | 2 lines - -Upped sub-version. - ------------------------------------------------------------------------- -r171 | nima | 2009-02-14 01:32:06 +1100 (Sat, 14 Feb 2009) | 2 lines - -Small changes - final touches for 2.10.1. - ------------------------------------------------------------------------- -r170 | nima | 2009-02-14 01:30:37 +1100 (Sat, 14 Feb 2009) | 3 lines - -Versioning now chagned to reflect the version of the upstream (dmidecode) -version with which python-dmidecode is in sync with. - ------------------------------------------------------------------------- -r169 | nima | 2009-01-13 23:48:28 +1100 (Tue, 13 Jan 2009) | 2 lines - -Fixed watch file. - ------------------------------------------------------------------------- -r168 | nima | 2009-01-13 00:06:34 +1100 (Tue, 13 Jan 2009) | 2 lines - -Debian changes completely separated from upstream. - ------------------------------------------------------------------------- -r167 | nima | 2009-01-13 00:04:52 +1100 (Tue, 13 Jan 2009) | 2 lines - -Removed Debian-specific targets from the makefile. - ------------------------------------------------------------------------- -r166 | nima | 2008-12-23 10:02:00 +1100 (Tue, 23 Dec 2008) | 2 lines - -Source file name change. - ------------------------------------------------------------------------- -r165 | nima | 2008-12-23 10:01:22 +1100 (Tue, 23 Dec 2008) | 2 lines - -A more complete dmidecode example. - ------------------------------------------------------------------------- -r164 | nima | 2008-12-23 09:40:51 +1100 (Tue, 23 Dec 2008) | 2 lines - -Applied the nice changes suggested by Piotr Ożarowsk. - ------------------------------------------------------------------------- -r163 | nima | 2008-12-23 00:37:43 +1100 (Tue, 23 Dec 2008) | 6 lines - -Cleaned up the fix for type(127). - -Added the second type of stuffed bios (upstream). - -Integrated dmidecode the binary into the test case for a more objective result. - ------------------------------------------------------------------------- -r162 | nima | 2008-12-22 20:06:43 +1100 (Mon, 22 Dec 2008) | 2 lines - -Fixed the type(127) problem (at least on this machine) - again. - ------------------------------------------------------------------------- -r161 | nima | 2008-12-21 23:52:51 +1100 (Sun, 21 Dec 2008) | 4 lines - -Removed unnecessay manpage. - -Spell my own name correctly. - ------------------------------------------------------------------------- -r160 | nima | 2008-12-21 22:31:36 +1100 (Sun, 21 Dec 2008) | 2 lines - -Added an upload into src.autonomy.net.au after source build. - ------------------------------------------------------------------------- -r159 | nima | 2008-12-21 22:27:52 +1100 (Sun, 21 Dec 2008) | 2 lines - -Fixed sample. - ------------------------------------------------------------------------- -r158 | nima | 2008-12-21 21:22:06 +1100 (Sun, 21 Dec 2008) | 6 lines - -Cleanup copyright. - -Cleanup debian/rules. - -Adding test.py to examples. - ------------------------------------------------------------------------- -r157 | nima | 2008-12-21 21:04:03 +1100 (Sun, 21 Dec 2008) | 2 lines - -Remove README.Debian - no point. - ------------------------------------------------------------------------- -r156 | nima | 2008-12-21 18:57:49 +1100 (Sun, 21 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r155 | nima | 2008-12-21 18:53:54 +1100 (Sun, 21 Dec 2008) | 3 lines - -Handle cases where user does not have appropriate permission to access the -memory file or device. - ------------------------------------------------------------------------- -r154 | nima | 2008-12-21 16:44:04 +1100 (Sun, 21 Dec 2008) | 2 lines - -Names. - ------------------------------------------------------------------------- -r153 | nima | 2008-12-21 16:43:06 +1100 (Sun, 21 Dec 2008) | 2 lines - -Better naming. - ------------------------------------------------------------------------- -r152 | nima | 2008-12-21 15:41:39 +1100 (Sun, 21 Dec 2008) | 4 lines - -Upped debhelper build-required version from 5 to 7. - -Final cleanups. - ------------------------------------------------------------------------- -r151 | nima | 2008-12-21 13:55:19 +1100 (Sun, 21 Dec 2008) | 2 lines - -Cleaned up and Lintian-approved. - ------------------------------------------------------------------------- -r150 | nima | 2008-12-21 13:48:05 +1100 (Sun, 21 Dec 2008) | 2 lines - -Email address fixed. - ------------------------------------------------------------------------- -r149 | nima | 2008-12-21 13:39:16 +1100 (Sun, 21 Dec 2008) | 2 lines - -Sigh. - ------------------------------------------------------------------------- -r148 | nima | 2008-12-21 13:38:35 +1100 (Sun, 21 Dec 2008) | 2 lines - -Changing to svn-buildpackage. - ------------------------------------------------------------------------- -r147 | nima | 2008-12-21 13:22:20 +1100 (Sun, 21 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r146 | nima | 2008-12-21 13:07:56 +1100 (Sun, 21 Dec 2008) | 2 lines - -Source generation. - ------------------------------------------------------------------------- -r145 | nima | 2008-12-21 12:41:57 +1100 (Sun, 21 Dec 2008) | 6 lines - -Fixed watchfile now that I've created a src (orig.tar.gz) repository. - -Added more copyright/lisencing information. - -More debianizing. - ------------------------------------------------------------------------- -r144 | nima | 2008-12-21 04:00:56 +1100 (Sun, 21 Dec 2008) | 2 lines - -Required for dh_installdocs. - ------------------------------------------------------------------------- -r143 | nima | 2008-12-21 03:54:32 +1100 (Sun, 21 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r142 | nima | 2008-12-21 03:52:15 +1100 (Sun, 21 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r141 | nima | 2008-12-21 03:49:40 +1100 (Sun, 21 Dec 2008) | 2 lines - -Removed out-of-place README. - ------------------------------------------------------------------------- -r140 | nima | 2008-12-21 03:47:18 +1100 (Sun, 21 Dec 2008) | 2 lines - -Hide private data from subversion. - ------------------------------------------------------------------------- -r139 | nima | 2008-12-21 03:46:37 +1100 (Sun, 21 Dec 2008) | 2 lines - -Remove private memory dumps. - ------------------------------------------------------------------------- -r138 | nima | 2008-12-21 03:45:39 +1100 (Sun, 21 Dec 2008) | 4 lines - -Added missing info to copyright file. - -Source creation target. - ------------------------------------------------------------------------- -r137 | nima | 2008-12-21 03:26:43 +1100 (Sun, 21 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r136 | nima | 2008-12-21 02:49:18 +1100 (Sun, 21 Dec 2008) | 4 lines - -Handle cases where user asks for invalid types. - -Updated test cases to test for this too. - ------------------------------------------------------------------------- -r135 | nima | 2008-12-21 02:32:30 +1100 (Sun, 21 Dec 2008) | 6 lines - -Version information now set once during init(). - -Bettered test cases. - -Case 127 magically fixed. - ------------------------------------------------------------------------- -r134 | nima | 2008-12-20 12:46:42 +1100 (Sat, 20 Dec 2008) | 2 lines - -Debian specific target. - ------------------------------------------------------------------------- -r133 | nima | 2008-12-20 12:44:55 +1100 (Sat, 20 Dec 2008) | 8 lines - -Removed "detected" from appearing in every single function call. TODO: An ivar -should be implemented to return this string, so further cleanup is still -required; as it stands, there is no access to this information anymore! - -Updated test case. - -Further general cleanup. - ------------------------------------------------------------------------- -r132 | nima | 2008-12-20 10:55:53 +1100 (Sat, 20 Dec 2008) | 4 lines - -Further testing shows that the segfault does not occur when the device is -/dev/mem, but does so for all images (where requested type is 127), suggesting -that the problem could be with the image or surrounding processes. - ------------------------------------------------------------------------- -r131 | nima | 2008-12-20 10:46:46 +1100 (Sat, 20 Dec 2008) | 2 lines - -Oops - fixed. - ------------------------------------------------------------------------- -r130 | nima | 2008-12-20 10:45:55 +1100 (Sat, 20 Dec 2008) | 3 lines - -Test case is close to complete, type 127 results in a segfault - (test case -is serving its purpose). - ------------------------------------------------------------------------- -r129 | nima | 2008-12-20 10:29:50 +1100 (Sat, 20 Dec 2008) | 3 lines - -Adding an image from parallel's desktop running Debian lenny, and another for -a physical server also running Debian. Both are intel 32 bit. - ------------------------------------------------------------------------- -r128 | nima | 2008-12-20 10:27:10 +1100 (Sat, 20 Dec 2008) | 4 lines - -More work on test case. - -Updated setup.py to reflect new version. - ------------------------------------------------------------------------- -r127 | nima | 2008-12-20 00:49:19 +1100 (Sat, 20 Dec 2008) | 2 lines - -More testing and fixes. - ------------------------------------------------------------------------- -r126 | nima | 2008-12-20 00:42:10 +1100 (Sat, 20 Dec 2008) | 2 lines - -Improved test case. - ------------------------------------------------------------------------- -r125 | nima | 2008-12-20 00:32:35 +1100 (Sat, 20 Dec 2008) | 2 lines - -Removed a printf() comment. - ------------------------------------------------------------------------- -r124 | nima | 2008-12-20 00:21:24 +1100 (Sat, 20 Dec 2008) | 6 lines - -Check that the path given with set_dev() is writeable. - -Don't crash when writing to a read-only file, return False instead. - -Missing an INCREF in get_dev() fixed. - ------------------------------------------------------------------------- -r123 | nima | 2008-12-19 22:56:39 +1100 (Fri, 19 Dec 2008) | 2 lines - -Test for write permission prior to write attempts. - ------------------------------------------------------------------------- -r122 | nima | 2008-12-19 20:02:52 +1100 (Fri, 19 Dec 2008) | 2 lines - -Fixed watch file. - ------------------------------------------------------------------------- -r121 | nima | 2008-12-19 16:05:38 +1100 (Fri, 19 Dec 2008) | 4 lines - -Received ITP auto-ack: #509169. - -More debianizing cleanup. - ------------------------------------------------------------------------- -r120 | nima | 2008-12-19 15:13:24 +1100 (Fri, 19 Dec 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r119 | nima | 2008-12-19 15:07:06 +1100 (Fri, 19 Dec 2008) | 3 lines - -Further work in enforcing the Debian policy in package based on advice from -`POX' and the documentation. - ------------------------------------------------------------------------- -r118 | nima | 2008-12-19 13:23:32 +1100 (Fri, 19 Dec 2008) | 2 lines - -Removed junk and doing more debianizing - WIP. - ------------------------------------------------------------------------- -r117 | nima | 2008-12-19 00:49:57 +1100 (Fri, 19 Dec 2008) | 2 lines - -Updated. - ------------------------------------------------------------------------- -r116 | nima | 2008-12-19 00:48:52 +1100 (Fri, 19 Dec 2008) | 6 lines - -The dmidecode.type() call not takes ints, not strings. - -Adding an example directory. - -Adding test case. - ------------------------------------------------------------------------- -r115 | nima | 2008-12-19 00:45:37 +1100 (Fri, 19 Dec 2008) | 4 lines - -The dmidecode.type() call not takes ints, not strings. - -Adding an example directory. - ------------------------------------------------------------------------- -r114 | nima | 2008-12-18 12:12:50 +1100 (Thu, 18 Dec 2008) | 5 lines - -More upstream changes implemented, see CHANGELOG by Jean Delvare from the -period 2008-02-16 to 2008-11-23. - -These changes have been made, but not yet fully tested. - ------------------------------------------------------------------------- -r113 | nima | 2008-12-18 00:26:57 +1100 (Thu, 18 Dec 2008) | 5 lines - -Claim to support revision 32 of Intel AP-485 (CPUID). No relevant change since -revision 31. - -Update reference to AMD CPUID document. - ------------------------------------------------------------------------- -r112 | nima | 2008-12-18 00:11:35 +1100 (Thu, 18 Dec 2008) | 2 lines - -Handle chassis information records of size 19 (DMI type 3). - ------------------------------------------------------------------------- -r111 | nima | 2008-12-18 00:00:12 +1100 (Thu, 18 Dec 2008) | 2 lines - -And the debian subfolder itself... - ------------------------------------------------------------------------- -r110 | nima | 2008-12-17 23:59:32 +1100 (Wed, 17 Dec 2008) | 2 lines - -Debianizing dmidecode. - ------------------------------------------------------------------------- -r109 | nima | 2008-12-17 18:30:04 +1100 (Wed, 17 Dec 2008) | 2 lines - -Adding spec file written by Joel Heenan. - ------------------------------------------------------------------------- -r108 | nima | 2008-12-17 18:20:56 +1100 (Wed, 17 Dec 2008) | 2 lines - -Cleaning up source area, ready for debianizing, and rpm after that. - ------------------------------------------------------------------------- -r107 | nima | 2008-11-01 01:45:34 +1100 (Sat, 01 Nov 2008) | 2 lines - -Changed default target of Makefile back to `setup.py' method of installation. - ------------------------------------------------------------------------- -r106 | nima | 2008-11-01 01:41:02 +1100 (Sat, 01 Nov 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r105 | nima | 2008-11-01 01:33:03 +1100 (Sat, 01 Nov 2008) | 3 lines - -This commit closes #2 reported by Justin Cook, the ticket will remain open -until Justin confirms this however. - ------------------------------------------------------------------------- -r104 | nima | 2008-11-01 01:07:22 +1100 (Sat, 01 Nov 2008) | 6 lines - -Implemented reading a dump to - this concludes syncing to the upstream release. - -Next, exceptions should be thrown in certain places, more error checking in the -python side of things, and also in relation to setting and unsetting of the -alternate memory file. - ------------------------------------------------------------------------- -r103 | nima | 2008-11-01 00:42:35 +1100 (Sat, 01 Nov 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r102 | nima | 2008-11-01 00:38:24 +1100 (Sat, 01 Nov 2008) | 3 lines - -Fixed dump. The `offset' problem was not really an offset problem - it was a -silly typo. - ------------------------------------------------------------------------- -r101 | nima | 2008-11-01 00:24:04 +1100 (Sat, 01 Nov 2008) | 2 lines - -Missed two lines. - ------------------------------------------------------------------------- -r100 | nima | 2008-11-01 00:19:50 +1100 (Sat, 01 Nov 2008) | 3 lines - -Dump-to-file is almost working, there seems to be a 4-byte misalignment in the -produced file though for now - needs to be fixed. - ------------------------------------------------------------------------- -r99 | nima | 2008-10-31 22:43:15 +1100 (Fri, 31 Oct 2008) | 2 lines - -Removed junk comments. - ------------------------------------------------------------------------- -r98 | nima | 2008-10-31 22:21:24 +1100 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r97 | nima | 2008-10-31 22:15:19 +1100 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r96 | nima | 2008-10-31 21:24:41 +1100 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r95 | nima | 2008-10-31 20:05:23 +1100 (Fri, 31 Oct 2008) | 6 lines - -Integration of required `dmiopt.h' bits. -Removed QUIETness code. -Other cleanups. -Added get/set methods for changinf the default /dev/mem device. - - ------------------------------------------------------------------------- -r94 | nima | 2008-10-31 20:02:21 +1100 (Fri, 31 Oct 2008) | 2 lines - -Removed traces of `_' and integrating required bits from dmiopt.h. - ------------------------------------------------------------------------- -r93 | nima | 2008-10-31 20:01:41 +1100 (Fri, 31 Oct 2008) | 2 lines - -Removed traces of `_'. - ------------------------------------------------------------------------- -r92 | nima | 2008-10-31 20:00:26 +1100 (Fri, 31 Oct 2008) | 2 lines - -Integrating the required bits from dmiopt into dmihelper. - ------------------------------------------------------------------------- -r91 | nima | 2008-10-31 19:39:12 +1100 (Fri, 31 Oct 2008) | 4 lines - -Removed `_' buffer. -Removed use of `FLAGS_QUIET' as it makes no sense for a module. -Removed the `submain()' function. - ------------------------------------------------------------------------- -r90 | nima | 2008-10-31 19:30:00 +1100 (Fri, 31 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r89 | nima | 2008-10-31 19:29:06 +1100 (Fri, 31 Oct 2008) | 2 lines - -Removed dependency on dmiopt. - ------------------------------------------------------------------------- -r88 | nima | 2008-10-31 19:28:33 +1100 (Fri, 31 Oct 2008) | 2 lines - -Removed verbose printout. - ------------------------------------------------------------------------- -r87 | nima | 2008-10-30 21:14:24 +1100 (Thu, 30 Oct 2008) | 2 lines - -Removed final traces of the `_' buffer. - ------------------------------------------------------------------------- -r86 | nima | 2008-10-30 13:11:56 +1100 (Thu, 30 Oct 2008) | 2 lines - -Implementing (incomplete) upstream changes. - ------------------------------------------------------------------------- -r85 | nima | 2008-10-29 18:15:35 +1100 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r84 | nima | 2008-10-29 18:13:49 +1100 (Wed, 29 Oct 2008) | 5 lines - -Adding man pages from upstream. Sooner or later, these will be removed, as will -all other work that's simply replicating the demidecode binary. All this -package should provide is the python module, and some py-module-specific man -pages. - ------------------------------------------------------------------------- -r83 | nima | 2008-10-29 18:10:24 +1100 (Wed, 29 Oct 2008) | 4 lines - -Recoded the new work from upstream into these (main) files. The options to -dump the memory image onto file, and read back from it has not yet been -worked in, but the underlying work has been completed. - ------------------------------------------------------------------------- -r82 | nima | 2008-10-29 18:09:10 +1100 (Wed, 29 Oct 2008) | 3 lines - -Tested new dmidecode python module with this example file. A real test case -will be implemented sometime in future. - ------------------------------------------------------------------------- -r81 | nima | 2008-10-29 18:07:56 +1100 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r80 | nima | 2008-10-29 18:07:13 +1100 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r79 | nima | 2008-10-29 18:06:47 +1100 (Wed, 29 Oct 2008) | 2 lines - -Using dmihelper now. - ------------------------------------------------------------------------- -r78 | nima | 2008-10-29 18:05:58 +1100 (Wed, 29 Oct 2008) | 2 lines - -Upstream. - ------------------------------------------------------------------------- -r77 | nima | 2008-10-29 18:04:19 +1100 (Wed, 29 Oct 2008) | 2 lines - -Upstream. - ------------------------------------------------------------------------- -r76 | nima | 2008-10-29 18:04:03 +1100 (Wed, 29 Oct 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r75 | nima | 2008-10-29 17:36:23 +1100 (Wed, 29 Oct 2008) | 2 lines - -Renamed to a more appropriate name. - ------------------------------------------------------------------------- -r74 | nima | 2008-10-29 17:35:21 +1100 (Wed, 29 Oct 2008) | 3 lines - -Committing new dmidecode helper functions, and next, renaming it to a -meaningful name. - ------------------------------------------------------------------------- -r73 | nima | 2008-10-29 17:27:31 +1100 (Wed, 29 Oct 2008) | 3 lines - -Synced to the latest from upstream, with a light modification required for the -module. - ------------------------------------------------------------------------- -r72 | nima | 2008-10-18 20:34:09 +1100 (Sat, 18 Oct 2008) | 5 lines - -Python does not have unsigned integers, hence %u and %lu in printf style -strings are taken to be literal strings, not space-holders. All occurences -of '%u' (78) have been amended to '%i', there was no '%lu'. - - ------------------------------------------------------------------------- -r71 | nima | 2008-10-18 20:28:46 +1100 (Sat, 18 Oct 2008) | 4 lines - -Fixed bug reported by by Justin Cook, where dmidecode.type() would segfault. -It turned out to be some code that was forgotten about during the conversion, or -at least very incomplete and wrong. - ------------------------------------------------------------------------- -r70 | nima | 2008-10-17 02:52:48 +1100 (Fri, 17 Oct 2008) | 2 lines - -Remove efence. - ------------------------------------------------------------------------- -r69 | nima | 2008-09-05 13:08:02 +1000 (Fri, 05 Sep 2008) | 2 lines - -Fixed a bug that crashed dmidecode.slot(). - ------------------------------------------------------------------------- -r68 | nima | 2008-09-04 16:09:55 +1000 (Thu, 04 Sep 2008) | 5 lines - -Cleaning up of the dmidecode module, mostly conversion of things that can be -Python `None's or `Int's but were `String'. - -Replaced a meaningless int dictionary key to `data'. - ------------------------------------------------------------------------- -r67 | nima | 2008-09-04 12:26:09 +1000 (Thu, 04 Sep 2008) | 3 lines - -Work on CPU details - seemed to been a bug with appending to a string rather -than rewriting it. - ------------------------------------------------------------------------- -r66 | nima | 2008-08-09 00:15:47 +1000 (Sat, 09 Aug 2008) | 4 lines - -Replaced `%X' with `%x'. - -Logic cleanup - Put the `Handle' info back into the dictionary. - ------------------------------------------------------------------------- -r65 | nima | 2008-08-08 17:57:44 +1000 (Fri, 08 Aug 2008) | 2 lines - -Anoher bug fix, this time in baseboard. - ------------------------------------------------------------------------- -r64 | nima | 2008-08-08 17:27:36 +1000 (Fri, 08 Aug 2008) | 3 lines - -Fixed many major bugs (all of which were expected based on the way we mass -converted all the `case' blocks. - ------------------------------------------------------------------------- -r63 | nima | 2008-08-07 22:32:39 +1000 (Thu, 07 Aug 2008) | 2 lines - -Cleaned up a little. - ------------------------------------------------------------------------- -r62 | nima | 2008-08-07 11:34:15 +1000 (Thu, 07 Aug 2008) | 2 lines - -Fixed some conversion bits missed during last night. - ------------------------------------------------------------------------- -r61 | nima | 2008-08-06 23:32:37 +1000 (Wed, 06 Aug 2008) | 2 lines - -Updated authors file with developers of the dmidecode python module. - ------------------------------------------------------------------------- -r60 | nima | 2008-08-06 23:27:26 +1000 (Wed, 06 Aug 2008) | 2 lines - -Changed to GNU GPL v3 License. - ------------------------------------------------------------------------- -r59 | nima | 2008-08-06 22:59:03 +1000 (Wed, 06 Aug 2008) | 2 lines - -Removed `sudo'. - ------------------------------------------------------------------------- -r58 | nima | 2008-08-06 22:52:46 +1000 (Wed, 06 Aug 2008) | 4 lines - -Completed `case 126', thought to have been completed in previous commit. - -Some housekeeping elsewhere. - ------------------------------------------------------------------------- -r57 | nima | 2008-08-06 18:51:05 +1000 (Wed, 06 Aug 2008) | 4 lines - -Completed all conversions! Only problem now is of course finding all the memory -leaks and introduced logic errors which (confirmed) do exists - use valgrind and -see. - ------------------------------------------------------------------------- -r56 | vwhitteron | 2008-08-06 18:29:18 +1000 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 34' through `Case 39' ------------------------------------------------------------------------- -r55 | nima | 2008-08-06 18:12:43 +1000 (Wed, 06 Aug 2008) | 2 lines - -Almost there! - ------------------------------------------------------------------------- -r54 | vwhitteron | 2008-08-06 17:49:23 +1000 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 29' and `Case 32' ------------------------------------------------------------------------- -r53 | nima | 2008-08-06 17:42:34 +1000 (Wed, 06 Aug 2008) | 2 lines - -Converted `case 30'. - ------------------------------------------------------------------------- -r52 | vwhitteron | 2008-08-06 17:40:42 +1000 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 26', `Case 27' and `Case 28' ------------------------------------------------------------------------- -r51 | nima | 2008-08-06 17:30:41 +1000 (Wed, 06 Aug 2008) | 3 lines - -Added `PyObject *data;' to all remaining functions which will generate a warning -as to indicate these need to be converted. - ------------------------------------------------------------------------- -r50 | nima | 2008-08-06 17:27:30 +1000 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `csae 28'. - ------------------------------------------------------------------------- -r49 | nima | 2008-08-06 17:23:35 +1000 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `case 27', and fixed error in last commit for `case 26'. - ------------------------------------------------------------------------- -r48 | nima | 2008-08-06 17:19:27 +1000 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `case 26'. - ------------------------------------------------------------------------- -r47 | vwhitteron | 2008-08-06 17:09:11 +1000 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 23', `Case 24', `Case24' and `Case 25' ------------------------------------------------------------------------- -r46 | nima | 2008-08-06 17:07:20 +1000 (Wed, 06 Aug 2008) | 2 lines - -Completed functions for `case 25'. - ------------------------------------------------------------------------- -r45 | nima | 2008-08-06 17:00:41 +1000 (Wed, 06 Aug 2008) | 2 lines - -Converted function for `case 24'. - ------------------------------------------------------------------------- -r44 | nima | 2008-08-06 16:59:35 +1000 (Wed, 06 Aug 2008) | 2 lines - -More fixes on recent commits (by me), and more conversions on functions. - ------------------------------------------------------------------------- -r43 | vwhitteron | 2008-08-06 16:57:13 +1000 (Wed, 06 Aug 2008) | 1 line - -Completed `Case 22' ------------------------------------------------------------------------- -r42 | nima | 2008-08-06 16:53:24 +1000 (Wed, 06 Aug 2008) | 2 lines - -Oops. Fixed stupidity on last commit. - ------------------------------------------------------------------------- -r41 | nima | 2008-08-06 16:52:01 +1000 (Wed, 06 Aug 2008) | 2 lines - -Completed functions called by `case 21' and `case 22'. - ------------------------------------------------------------------------- -r40 | nima | 2008-08-06 16:42:54 +1000 (Wed, 06 Aug 2008) | 3 lines - -Completed `case 21' functions. -Cleanup. - ------------------------------------------------------------------------- -r39 | vwhitteron | 2008-08-06 16:39:53 +1000 (Wed, 06 Aug 2008) | 2 lines - -Completed `case 19' and `case 20'. - ------------------------------------------------------------------------- -r38 | nima | 2008-08-06 16:17:21 +1000 (Wed, 06 Aug 2008) | 2 lines - -Started on `case 19'. - ------------------------------------------------------------------------- -r37 | nima | 2008-08-06 15:43:05 +1000 (Wed, 06 Aug 2008) | 2 lines - -Completed `case 18' and `case 19'. - ------------------------------------------------------------------------- -r36 | nima | 2008-08-06 15:06:03 +1000 (Wed, 06 Aug 2008) | 2 lines - -Added `case 16' and `case 17'. - ------------------------------------------------------------------------- -r35 | nima | 2008-08-06 14:26:45 +1000 (Wed, 06 Aug 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r34 | nima | 2008-08-06 14:05:06 +1000 (Wed, 06 Aug 2008) | 2 lines - -Converted `case 5', `case 6', and `case 7'. - ------------------------------------------------------------------------- -r33 | nima | 2008-08-01 17:59:51 +1000 (Fri, 01 Aug 2008) | 2 lines - -Default case set to return python's `None'. - ------------------------------------------------------------------------- -r32 | nima | 2008-08-01 17:58:24 +1000 (Fri, 01 Aug 2008) | 2 lines - -Completed `case 15'. - ------------------------------------------------------------------------- -r31 | nima | 2008-07-29 14:33:59 +1000 (Tue, 29 Jul 2008) | 2 lines - -Completed `case 9' and case `8'. - ------------------------------------------------------------------------- -r30 | nima | 2008-07-29 11:31:21 +1000 (Tue, 29 Jul 2008) | 2 lines - -Completed `case 11'. - ------------------------------------------------------------------------- -r29 | nima | 2008-07-29 11:28:04 +1000 (Tue, 29 Jul 2008) | 2 lines - -Completed `case 12' and `case 14'. - ------------------------------------------------------------------------- -r28 | nima | 2008-07-29 10:29:05 +1000 (Tue, 29 Jul 2008) | 6 lines - -Bug fix (removed unnecessary breakr). - -Changed %i back to %u for now, even though it does not work with Python. -Better to do the change globally - later. - - ------------------------------------------------------------------------- -r27 | nima | 2008-07-28 20:14:38 +1000 (Mon, 28 Jul 2008) | 2 lines - -Try and determine python version dynamically. - ------------------------------------------------------------------------- -r26 | nima | 2008-07-27 22:15:51 +1000 (Sun, 27 Jul 2008) | 2 lines - -Completed `case 4', which was thought to have been completed falsely before. - ------------------------------------------------------------------------- -r25 | nima | 2008-07-26 19:15:53 +1000 (Sat, 26 Jul 2008) | 6 lines - -Completed cases 1, 4, and 13. Also altered the main PyDict object such that -each case has a value of a list to which items are appended. Without this, -each object of the same type would overwrite the previous, for example, 8 -processors would result in one single cpu with data pertaining to the last -cpu (7). - ------------------------------------------------------------------------- -r24 | nima | 2008-07-26 09:35:30 +1000 (Sat, 26 Jul 2008) | 2 lines - -Completed `case 0'. - ------------------------------------------------------------------------- -r23 | root | 2008-07-25 23:17:24 +1000 (Fri, 25 Jul 2008) | 2 lines - -Added `case 3'. - ------------------------------------------------------------------------- -r22 | root | 2008-07-25 22:51:02 +1000 (Fri, 25 Jul 2008) | 2 lines - -No new moves, cleanup on last commit and better test file template. - ------------------------------------------------------------------------- -r21 | root | 2008-07-25 22:27:26 +1000 (Fri, 25 Jul 2008) | 8 lines - -Next phase is to start converting all pure C functions returning `char *' and -such to new Pythonized functions returning `PyObject *', to save from having -to `PyString_FromString()' and similar, and more importantly, some functions -return a long string that could better be represented by a PyDict, PyList etc. - -This is the first commit of many more to come, converting a `case XX:' at a -time, making sure that each commit can actually compile and run. - ------------------------------------------------------------------------- -r20 | root | 2008-07-25 11:13:13 +1000 (Fri, 25 Jul 2008) | 2 lines - -Cleanup (DECREF). - ------------------------------------------------------------------------- -r19 | root | 2008-07-25 11:12:46 +1000 (Fri, 25 Jul 2008) | 2 lines - -Add in electric fence for now. - ------------------------------------------------------------------------- -r18 | root | 2008-07-25 11:11:39 +1000 (Fri, 25 Jul 2008) | 5 lines - -This was the culprit causing the `Abort' crash, valgrind showed that this file -is where the error lied. Stephen Darragh discovered this, and the fix has been -to use vsnprintf() and not vsprintf(), which should have been the case to begin -with really. - ------------------------------------------------------------------------- -r17 | root | 2008-07-25 10:46:00 +1000 (Fri, 25 Jul 2008) | 2 lines - -Cleaner to not vsprintf() at all if `format' is NULL. - ------------------------------------------------------------------------- -r16 | root | 2008-07-25 10:45:11 +1000 (Fri, 25 Jul 2008) | 2 lines - - The `biosdecode' is a program, nothing to do with the module, removed. - ------------------------------------------------------------------------- -r15 | nima | 2008-07-25 00:36:16 +1000 (Fri, 25 Jul 2008) | 2 lines - -Added my small role in AUTHORS so nobody bugs others for my code. - ------------------------------------------------------------------------- -r14 | nima | 2008-07-25 00:17:16 +1000 (Fri, 25 Jul 2008) | 2 lines - -Cleanup. - ------------------------------------------------------------------------- -r13 | nima | 2008-07-24 22:02:12 +1000 (Thu, 24 Jul 2008) | 2 lines - -Some cleaning, crash in interactive mode on dmidecode.bios() still not fixed. - ------------------------------------------------------------------------- -r12 | nima | 2008-07-24 20:48:01 +1000 (Thu, 24 Jul 2008) | 3 lines - -Now that code has been converted, work has started on "bios", and at the point -of proof-of-concept. - ------------------------------------------------------------------------- -r11 | nima | 2008-07-05 01:24:22 +1000 (Sat, 05 Jul 2008) | 3 lines - -Removing printf() statements, instead adding to Python dictionary object, -untested. - ------------------------------------------------------------------------- -r10 | nima | 2008-07-04 01:59:08 +1000 (Fri, 04 Jul 2008) | 6 lines - -Major changes have been implemented, alas, untested, in hope to move towards -a new version of dmi decode where rather than having data just printed to -screen in functions, data is passed around, and some data structure is -constructed, which is then used to construct the Python list/dicitonary -objects. - ------------------------------------------------------------------------- -r9 | nima | 2008-07-02 17:02:05 +1000 (Wed, 02 Jul 2008) | 4 lines - -WIP - Adding h->type value to catsprintf (as int major), later will add minor -too, and finally will replace the buffer with a linked list of structs, which -will be added to the python dictionary/list. - ------------------------------------------------------------------------- -r8 | nima | 2008-07-02 14:53:48 +1000 (Wed, 02 Jul 2008) | 3 lines - -Now the `Handle' hex codes are the key values in the python dictionaries -returned. - ------------------------------------------------------------------------- -r7 | nima | 2008-07-02 09:14:17 +1000 (Wed, 02 Jul 2008) | 2 lines - -Brought main() back into the python module and fixed malloc/free problems. - ------------------------------------------------------------------------- -r6 | nima | 2008-07-01 17:05:57 +1000 (Tue, 01 Jul 2008) | 2 lines - -Removed junk comments. - ------------------------------------------------------------------------- -r5 | nima | 2008-07-01 16:11:21 +1000 (Tue, 01 Jul 2008) | 2 lines - -Update for file renames. - ------------------------------------------------------------------------- -r4 | nima | 2008-07-01 16:04:02 +1000 (Tue, 01 Jul 2008) | 2 lines - -Better named. - ------------------------------------------------------------------------- -r3 | nima | 2008-07-01 16:01:21 +1000 (Tue, 01 Jul 2008) | 5 lines - -Project progressing along excellently. The python module is now functional and -has as many methods as the --type option takes. - -Next is to expand and harness the code around the `--string' option. - ------------------------------------------------------------------------- -r2 | nima | 2008-07-01 00:14:46 +1000 (Tue, 01 Jul 2008) | 4 lines - -Split out the module header into its own file. - -Cleaned up Makefile a little. - ------------------------------------------------------------------------- -r1 | nima | 2008-06-30 22:08:58 +1000 (Mon, 30 Jun 2008) | 2 lines - -First commit to SVN. - ------------------------------------------------------------------------- diff --git a/trunk/doc/dmidump.py b/trunk/doc/dmidump.py deleted file mode 100755 index a6c7bf7..0000000 --- a/trunk/doc/dmidump.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python2.4 -import dmidecode -import sys -from pprint import pprint - -#. Test all functions using /dev/mem... -print "*** bios ***\n"; dmidecode.bios() -print "*** system ***\n"; dmidecode.system() -print "*** system ***\n"; dmidecode.system() -print "*** baseboard ***\n"; dmidecode.baseboard() -print "*** chassis ***\n"; dmidecode.chassis() -print "*** processor ***\n"; dmidecode.processor() -print "*** memory ***\n"; dmidecode.memory() -print "*** cache ***\n"; dmidecode.cache() -print "*** connector ***\n"; dmidecode.connector() -print "*** slot ***\n"; dmidecode.slot() - -#. Now test get/set of memory device file... -print dmidecode.get_dev() -print dmidecode.set_dev("private/mem-XXX"); -print dmidecode.get_dev() - -#. Test taking a dump... -print dmidecode.dump() - -#. Test reading the dump... -print "*** bios ***\n"; pprint(dmidecode.bios()) -print "*** system ***\n"; pprint(dmidecode.system()) -print "*** system ***\n"; pprint(dmidecode.system()) -print "*** baseboard ***\n"; pprint(dmidecode.baseboard()) -print "*** chassis ***\n"; pprint(dmidecode.chassis()) -print "*** processor ***\n"; pprint(dmidecode.processor()) -print "*** memory ***\n"; pprint(dmidecode.memory()) -print "*** cache ***\n"; pprint(dmidecode.cache()) -print "*** connector ***\n"; pprint(dmidecode.connector()) -print "*** slot ***\n"; pprint(dmidecode.slot()) - -sys.exit(0) -print "*** bios ***\n"; pprint(dmidecode.bios()) -print "*** system ***\n"; pprint(dmidecode.system()) -print "*** baseboard ***\n"; pprint(dmidecode.baseboard()) -print "*** chassis ***\n"; pprint(dmidecode.chassis()) -print "*** processor ***\n"; pprint(dmidecode.processor()) -print "*** memory ***\n"; pprint(dmidecode.memory()) -print "*** cache ***\n"; pprint(dmidecode.cache()) -print "*** connector ***\n"; pprint(dmidecode.connector()) -print "*** slot ***\n"; pprint(dmidecode.slot()) - -for v in dmidecode.memory().values(): - if type(v) == dict and v['dmi_type'] == 17: - pprint(v['data']['Size']), - -pprint(dmidecode.type('3')) -pprint(dmidecode.type('bios')) diff --git a/trunk/examples/dmidump.py b/trunk/examples/dmidump.py deleted file mode 100755 index 161da44..0000000 --- a/trunk/examples/dmidump.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python2.4 -import dmidecode -import sys -from pprint import pprint - -#. Test reading the dump... -print "*** bios ***\n"; pprint(dmidecode.bios()) -print "*** system ***\n"; pprint(dmidecode.system()) -print "*** system ***\n"; pprint(dmidecode.system()) -print "*** baseboard ***\n"; pprint(dmidecode.baseboard()) -print "*** chassis ***\n"; pprint(dmidecode.chassis()) -print "*** processor ***\n"; pprint(dmidecode.processor()) -print "*** memory ***\n"; pprint(dmidecode.memory()) -print "*** cache ***\n"; pprint(dmidecode.cache()) -print "*** connector ***\n"; pprint(dmidecode.connector()) -print "*** slot ***\n"; pprint(dmidecode.slot()) - -_=[dmidecode.type(_) and pprint(dmidecode.type(_)) for _ in range(1,128)] diff --git a/trunk/examples/test.py b/trunk/examples/test.py deleted file mode 100755 index 79f11d3..0000000 --- a/trunk/examples/test.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env python -#.awk '$0 ~ /case [0-9]+: .. 3/ { sys.stdout.write($2 }' src/dmidecode.c|tr ':\n' ', ' - -from pprint import pprint -import os, sys, random, tempfile, time -import commands - -dmidecode = True in [os.path.exists(os.path.join(_, "dmidecode")) for _ in os.getenv("PATH").split(':')] -if dmidecode: - print "Please install `dmidecode' (the binary) for complete testing." - -FH, DUMP = tempfile.mkstemp() -os.unlink(DUMP) -os.close(FH) - -total = 0 -success = 0 - -def test(r): - global total - global success - - total += 1 - if r: - sys.stdout.write("Good\n") - success += 1 - return True - else: - sys.stdout.write("FAILED\n") - return False - -total += 1 -print "-"*80 -sys.stdout.write("Importing module...") -try: - import dmidecode - success += 1 - sys.stdout.write("Done\n") - sys.stdout.write(" * Version: %s\n"%dmidecode.version) - sys.stdout.write(" * DMI Version String: %s\n"%dmidecode.dmi) - - print "-"*80 - sys.stdout.write("Testing that default device is /dev/mem...") - test(dmidecode.get_dev() == "/dev/mem") - - sys.stdout.write("Testing that write-lock will not break on dump()...") - test(not dmidecode.dump()) - - sys.stdout.write("Testing ability to change device to %s..."%DUMP) - test(dmidecode.set_dev(DUMP)) - - sys.stdout.write("Testing that device has changed to %s..."%DUMP) - test(dmidecode.get_dev() == DUMP) - - sys.stdout.write("Testing that write on new file is ok...") - test(dmidecode.dump()) - - sys.stdout.write("Testing that file was actually written...") - time.sleep(0.1) - test(os.path.exists(DUMP)) - os.unlink(DUMP) - - types = range(0, 42)+range(126, 128) - bad_types = [-1, -1000, 256] - sections = ["bios", "system", "baseboard", "chassis", "processor", "memory", "cache", "connector", "slot"] - devices = [] - if os.path.exists("private"): - devices.extend([os.path.join("private", _) for _ in os.listdir("private")]) - devices.remove('private/.svn') - else: - sys.stdout.write("If you have memory dumps to test, create a directory called `private' and drop them in there.\n") - devices.append("/dev/mem") - random.shuffle(types) - random.shuffle(devices) - random.shuffle(sections) - - for dev in devices: - sys.stdout.write(" * Testing %s..."%dev); sys.stdout.flush() - if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): - print "-"*80 - print sections - for section in sections: - sys.stdout.write(" * Testing %s..."%section); sys.stdout.flush() - output = getattr(dmidecode, section)() - test(output is not False) - if output: sys.stdout.write(" * %s\n"%output.keys()) - - print "-"*80 - for i in bad_types: - sys.stdout.write(" * Testing bad type %i..."%i); sys.stdout.flush() - try: - output = dmidecode.type(i) - test(output is False) - except SystemError: - sys.stdout.write("FAILED\n") - - print "-"*80 - for i in types: - sys.stdout.write(" * Testing type %i..."%i); sys.stdout.flush() - output = dmidecode.type(i) - if dmidecode: - _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') - test(len(_output) == 1 and len(output) == 0 or True) - else: - test(output is not False) - if output: - sys.stdout.write(" * %s\n"%output.keys()) - -except ImportError: - sys.stdout.write("FAILED\n") - -sys.stdout.write("Score: %d/%d\n"%(success, total)) diff --git a/trunk/man/biosdecode.8 b/trunk/man/biosdecode.8 deleted file mode 100644 index 46bea95..0000000 --- a/trunk/man/biosdecode.8 +++ /dev/null @@ -1,83 +0,0 @@ -.TH BIOSDECODE 8 "February 2007" "dmidecode" -.SH NAME -biosdecode \- \s-1BIOS\s0 information decoder -.SH SYNOPSIS -.B biosdecode -.RB [ OPTIONS ] - -.SH DESCRIPTION -.B biosdecode -parses the \s-1BIOS\s0 memory and prints information about all structures (or -entry points) it knows of. Currently known entry point types are: -.IP \(bu "\w'\(bu'u+1n" -\s-1SMBIOS\s0 (System Management \s-1BIOS\s0) -.br -Use -.B dmidecode -for a more detailed output. -.IP \(bu -\s-1DMI\s0 (Desktop Management Interface, a legacy version of \s-1SMBIOS\s0) -.br -Use -.B dmidecode -for a more detailed output. -.IP \(bu -\s-1SYSID\s0 -.IP \(bu -\s-1PNP\s0 (Plug and Play) -.IP \(bu -\s-1ACPI\s0 (Advanced Configuration and Power Interface) -.IP \(bu -\s-1BIOS32\s0 (\s-1BIOS32\s0 Service Directory) -.IP \(bu -\s-1PIR\s0 (\s-1PCI\s0 \s-1IRQ\s0 Routing) -.IP \(bu -\s-132OS\s0 (\s-1BIOS32\s0 Extension, Compaq-specific) -.br -See -.B ownership -for a Compaq ownership tag retrieval tool. -.IP \(bu -\s-1SNY\s0 (Sony-specific, not decoded) -.IP \(bu -\s-1VPD\s0 (Vital Product Data, IBM-specific) -.br -Use -.B vpddecode -for a more detailed output. -.IP \(bu -\s-1FJKEYINF\s0 (Application Panel, Fujitsu-specific) - -.PP -.B biosdecode -started its life as a part of -.B dmidecode -but as more entry point types were added, if was moved to a different -program. - -.SH OPTIONS -.TP -.BR "-d" ", " "--dev-mem FILE" -Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) -.TP -.BR "-h" ", " "--help" -Display usage information and exit -.TP -.BR "-V" ", " "--version" -Display the version and exit - -.SH FILES -.I /dev/mem -.SH BUGS -Most of the time, -.B biosdecode -prints too much information (you don't really care about addresses) -or not enough (because it doesn't follow pointers and has no lookup -tables). -.SH AUTHORS -Alan Cox, Jean Delvare -.SH "SEE ALSO" -.BR dmidecode (8), -.BR mem (4), -.BR ownership (8), -.BR vpddecode (8) diff --git a/trunk/man/dmidecode.8 b/trunk/man/dmidecode.8 deleted file mode 100644 index 1e8fed8..0000000 --- a/trunk/man/dmidecode.8 +++ /dev/null @@ -1,236 +0,0 @@ -.TH DMIDECODE 8 "October 2008" "dmidecode" -.SH NAME -dmidecode \- \s-1DMI\s0 table decoder -.SH SYNOPSIS -.B dmidecode -.RB [ OPTIONS ] - -.SH DESCRIPTION -.B dmidecode -is a tool for dumping a computer's \s-1DMI\s0 (some say \s-1SMBIOS\s0) table -contents in a human-readable format. This table contains a description of the -system's hardware components, as well as other useful pieces of information -such as serial numbers and \s-1BIOS\s0 revision. Thanks to this table, you can -retrieve this information without having to probe for the actual hardware. -While this is a good point in terms of report speed and safeness, this also -makes the presented information possibly unreliable. - -The \s-1DMI\s0 table doesn't only describe what the system is currently made -of, it also can report the possible evolutions (such as the fastest supported -\s-1CPU\s0 or the maximal amount of memory supported). - -\s-1SMBIOS\s0 stands for System Management \s-1BIOS\s0, while \s-1DMI\s0 -stands for Desktop Management Interface. Both standards are tightly related -and developed by the \s-1DMTF\s0 (Desktop Management Task Force). - -As you run it, -.B dmidecode -will try to locate the \s-1DMI\s0 table. If it succeeds, it will then parse -this table and display a list of records like this one: - -Handle 0x0002, DMI type 2, 8 bytes. -Base Board Information - Manufacturer: Intel - Product Name: C440GX+ - Version: 727281-001 - Serial Number: INCY92700942 - -Each record has: -.IP \(bu "\w'\(bu'u+1n" -A handle. This is a unique identifier, which allows records to -reference each other. For example, processor records usually reference -cache memory records using their handles. -.IP \(bu -A type. The \s-1SMBIOS\s0 specification defines different types of elements -a computer can be made of. In this example, the type is 2, which -means that the record contains "Base Board Information". -.IP \(bu -A size. Each record has a 4-byte header (2 for the handle, 1 for the type, -1 for the size), the rest is used by the record data. This value doesn't -take text strings into account (these are placed at the end of the record), -so the actual length of the record may be (and is often) greater than the -displayed value. -.IP \(bu -Decoded values. The information presented of course depends on the type -of record. Here, we learn about the board's manufacturer, model, version -and serial number. - -.SH OPTIONS -.TP -.BR "-d" ", " "--dev-mem FILE" -Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) -.TP -.BR "-q" ", " "--quiet" -Be less verbose. Unknown, inactive and \s-1OEM\s0-specific entries are not -displayed. Meta-data and handle references are hidden. -.TP -.BR "-s" ", " "--string KEYWORD" -Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR. -\fBKEYWORD\fR must be a keyword from the following list: \fBbios-vendor\fR, -\fBbios-version\fR, \fBbios-release-date\fR, -\fBsystem-manufacturer\fR, \fBsystem-product-name\fR, -\fBsystem-version\fR, \fBsystem-serial-number\fR, -\fBsystem-uuid\fR, -\fBbaseboard-manufacturer\fR, \fBbaseboard-product-name\fR, -\fBbaseboard-version\fR, \fBbaseboard-serial-number\fR, -\fBbaseboard-asset-tag\fR, \fBchassis-manufacturer\fR, -\fBchassis-type\fR, -\fBchassis-version\fR, \fBchassis-serial-number\fR, -\fBchassis-asset-tag\fR, \fBprocessor-family\fR, -\fBprocessor-manufacturer\fR, -\fBprocessor-version\fR, \fBprocessor-frequency\fR. -Each keyword corresponds to a given \s-1DMI\s0 type and a given offset -within this entry type. -Not all strings may be meaningful or even defined on all systems. Some -keywords may return more than one result on some systems (e.g. -\fBprocessor-version\fR on a multi-processor system). -If \fBKEYWORD\fR is not provided or not valid, a list of all valid -keywords is printed and -.B dmidecode -exits with an error. -This option cannot be used more than once. -.TP -.BR "-t" ", " "--type TYPE" -Only display the entries of type \fBTYPE\fR. \fBTYPE\fR can be either a -\s-1DMI\s0 type number, or a comma-separated list of type numbers, or a -keyword from the following list: \fBbios\fR, \fBsystem\fR, -\fBbaseboard\fR, \fBchassis\fR, \fBprocessor\fR, \fBmemory\fR, -\fBcache\fR, \fBconnector\fR, \fBslot\fR. Refer to the DMI TYPES section -below for details. -If this option is used more than once, the set of displayed entries will be -the union of all the given types. -If \fBTYPE\fR is not provided or not valid, a list of all valid keywords -is printed and -.B dmidecode -exits with an error. -.TP -.BR "-u" ", " "--dump" -Do not decode the entries, dump their contents as hexadecimal instead. -Note that this is still a text output, no binary data will be thrown upon -you. The strings attached to each entry are displayed as both -hexadecimal and \s-1ASCII\s0. This option is mainly useful for debugging. -.TP -.BR " " " " "--dump-bin FILE" -Do not decode the entries, instead dump the DMI data to a file in binary -form. The generated file is suitable to pass to \fB--from-dump\fR -later. -.TP -.BR " " " " "--from-dump FILE" -Read the DMI data from a binary file previously generated using -\fB--dump-bin\fR. -.TP -.BR "-h" ", " "--help" -Display usage information and exit -.TP -.BR "-V" ", " "--version" -Display the version and exit -.P -Options --string, --type, --dump and --dump-bin -determine the output format and are mutually exclusive. - -.SH "DMI TYPES" -The \s-1SMBIOS\s0 specification defines the following \s-1DMI\s0 types: - -.TS -r l -__ -r l. -Type Information -0 BIOS -1 System -2 Base Board -3 Chassis -4 Processor -5 Memory Controller -6 Memory Module -7 Cache -8 Port Connector -9 System Slots -10 On Board Devices -11 OEM Strings -12 System Configuration Options -13 BIOS Language -14 Group Associations -15 System Event Log -16 Physical Memory Array -17 Memory Device -18 32-bit Memory Error -19 Memory Array Mapped Address -20 Memory Device Mapped Address -21 Built-in Pointing Device -22 Portable Battery -23 System Reset -24 Hardware Security -25 System Power Controls -26 Voltage Probe -27 Cooling Device -28 Temperature Probe -29 Electrical Current Probe -30 Out-of-band Remote Access -31 Boot Integrity Services -32 System Boot -33 64-bit Memory Error -34 Management Device -35 Management Device Component -36 Management Device Threshold Data -37 Memory Channel -38 IPMI Device -39 Power Supply -.TE - -Additionally, type 126 is used for disabled entries and type 127 is an -end-of-table marker. Types 128 to 255 are for \s-1OEM\s0-specific data. -.B dmidecode -will display these entries by default, but it can only decode them -when the vendors have contributed documentation or code for them. - -Keywords can be used instead of type numbers with \fB--type\fR. -Each keyword is equivalent to a list of type numbers: - -.TS -l l -__ -l l. -Keyword Types -bios 0, 13 -system 1, 12, 15, 23, 32 -baseboard 2, 10 -chassis 3 -processor 4 -memory 5, 6, 16, 17 -cache 7 -connector 8 -slot 9 -.TE - -Keywords are matched case-insensitively. The following command lines are equivalent: -.IP \(bu "\w'\(bu'u+1n" -dmidecode --type 0 --type 13 -.IP \(bu -dmidecode --type 0,13 -.IP \(bu -dmidecode --type bios -.IP \(bu -dmidecode --type BIOS - -.SH BINARY DUMP FILE FORMAT -The binary dump files generated by --dump-bin and read using --from-dump -are formatted as follows: -.IP \(bu "\w'\(bu'u+1n" -The SMBIOS or DMI entry point is located at offset 0x00. -It is crafted to hard-code the table address at offset 0x20. -.IP \(bu "\w'\(bu'u+1n" -The DMI table is located at offset 0x20. - -.SH FILES -.I /dev/mem -.SH BUGS -More often than not, information contained in the \s-1DMI\s0 tables is inaccurate, -incomplete or simply wrong. -.SH AUTHORS -Alan Cox, Jean Delvare -.SH "SEE ALSO" -.BR biosdecode (8), -.BR mem (4), -.BR ownership (8), -.BR vpddecode (8) diff --git a/trunk/man/ownership.8 b/trunk/man/ownership.8 deleted file mode 100644 index f24ef94..0000000 --- a/trunk/man/ownership.8 +++ /dev/null @@ -1,37 +0,0 @@ -.TH OWNERSHIP 8 "February 2005" "dmidecode" -.SH NAME -ownership \- Compaq ownership tag retriever -.SH SYNOPSIS -.B ownership -.RB [ OPTIONS ] - -.SH DESCRIPTION -.B ownership -retrieves and prints the "ownership tag" that can be set on Compaq -computers. Contrary to all other programs of the -.B dmidecode -package, -.B ownership -doesn't print any version information, nor labels, but only the raw -ownership tag. This should help its integration in scripts. - -.SH OPTIONS -.TP -.BR "-d" ", " "--dev-mem FILE" -Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) -.TP -.BR "-h" ", " "--help" -Display usage information and exit -.TP -.BR "-V" ", " "--version" -Display the version and exit - -.SH FILES -.I /dev/mem -.SH AUTHOR -Jean Delvare -.SH "SEE ALSO" -.BR biosdecode (8), -.BR dmidecode (8), -.BR mem (4), -.BR vpddecode (8) diff --git a/trunk/man/vpddecode.8 b/trunk/man/vpddecode.8 deleted file mode 100644 index c9e4acf..0000000 --- a/trunk/man/vpddecode.8 +++ /dev/null @@ -1,74 +0,0 @@ -.TH VPDDECODE 8 "February 2007" "dmidecode" -.SH NAME -vpddecode \- \s-1VPD\s0 structure decoder -.SH SYNOPSIS -.B vpddecode -.RB [ OPTIONS ] - -.SH DESCRIPTION -.B vpddecode -prints the "vital product data" information that can be found in almost -all IBM and Lenovo computers. Available items are: -.IP \(bu "\w'\(bu'u+1n" -\s-1BIOS\s0 Build \s-1ID\s0 -.IP \(bu -Box Serial Number -.IP \(bu -Motherboard Serial Number -.IP \(bu -Machine Type/Model - -.PP -Some systems have these additional items: -.IP \(bu "\w'\(bu'u+1n" -BIOS Release Date -.IP \(bu -Default Flash Image File Name - -.PP -Note that these additional items are not documented by IBM, so this is -guess work, and as such should not be blindly trusted. Feedback about -the accuracy of these labels is welcome. - -.SH OPTIONS -.TP -.BR "-d" ", " "--dev-mem FILE" -Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) -.TP -.BR "-s" ", " "--string KEYWORD" -Only display the value of the \s-1VPD\s0 string identified by \fBKEYWORD\fR. -\fBKEYWORD\fR must be a keyword from the following list: \fBbios-build-id\fR, -\fBbox-serial-number\fR, \fBmotherboard-serial-number\fR, -\fBmachine-type-model\fR, \fBbios-release-date\fR. -Each keyword corresponds to an offset and a length within the \s-1VPD\s0 -record. -Not all strings may be defined on all \s-1VPD\s0-enabled systems. -If \fBKEYWORD\fR is not provided or not valid, a list of all valid -keywords is printed and -.B vpddecode -exits with an error. -This option cannot be used more than once. -Mutually exclusive with \fB--dump\fR. -.TP -.BR "-u" ", " "--dump" -Do not decode the VPD records, dump their contents as hexadecimal instead. -Note that this is still a text output, no binary data will be thrown upon -you. ASCII equivalent is displayed when possible. This option is mainly -useful for debugging. -Mutually exclusive with \fB--string\fR. -.TP -.BR "-h" ", " "--help" -Display usage information and exit -.TP -.BR "-V" ", " "--version" -Display the version and exit - -.SH FILES -.I /dev/mem -.SH AUTHOR -Jean Delvare -.SH "SEE ALSO" -.BR biosdecode (8), -.BR dmidecode (8), -.BR mem (4), -.BR ownership (8) diff --git a/trunk/python-dmidecode.spec b/trunk/python-dmidecode.spec deleted file mode 100644 index bee613c..0000000 --- a/trunk/python-dmidecode.spec +++ /dev/null @@ -1,44 +0,0 @@ -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -%{!?python_ver: %define python_ver %(%{__python} -c "import sys ; print sys.version[:3]")} - -Summary: python extension module to access DMI data -Name: python-dmidecode -Version: 2.10 -Release: 1 -License: GPLv3 -Group: System Environment/Libraries -URL: http://projects.autonomy.net.au/dmidecode/ -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root - -%description -python-dmidecode is a python extension module that uses the -code-base of the 'dmidecode' utility, and presents the data -as python data structures - -%prep -%setup -q - -%build -make - -%install -rm -rf $RPM_BUILD_ROOT -python src/setup.py install --root $RPM_BUILD_ROOT - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -%defattr(-,root,root,-) -%doc -%{python_sitearch}/dmidecode.so -%if "%{python_ver}" >= "2.5" -%{python_sitearch}/*.egg-info -%endif - -%changelog -* Sat Mar 7 2009 Clark Williams - 2.10.3-1 -- Initial build. - diff --git a/trunk/src/config.h b/trunk/src/config.h deleted file mode 100644 index c1d7d03..0000000 --- a/trunk/src/config.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Configuration - */ - -#ifndef CONFIG_H -#define CONFIG_H - -/* Default memory device file */ -#ifdef __BEOS__ -#define DEFAULT_MEM_DEV "/dev/misc/mem" -#else -#define DEFAULT_MEM_DEV "/dev/mem" -#endif - -/* Use mmap or not */ -#ifndef __BEOS__ -#define USE_MMAP -#endif - -/* Use memory alignment workaround or not */ -#ifdef __ia64__ -#define ALIGNMENT_WORKAROUND -#endif - -#endif diff --git a/trunk/src/dmidecode.c b/trunk/src/dmidecode.c deleted file mode 100644 index 40cb861..0000000 --- a/trunk/src/dmidecode.c +++ /dev/null @@ -1,4785 +0,0 @@ -/* - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * DMI Decode - * - * Copyright 2000-2002 Alan Cox - * Copyright 2002-2008 Jean Delvare - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For the avoidance of doubt the "preferred form" of this code is one which - * is in an open unpatent encumbered format. Where cryptographic key signing - * forms part of the process of creating an executable the information - * including keys needed to generate an equivalently functional executable - * are deemed to be part of the source code. - * - * Unless specified otherwise, all references are aimed at the "System - * Management BIOS Reference Specification, Version 2.6" document, - * available from http://www.dmtf.org/standards/smbios/. - * - * Note to contributors: - * Please reference every value you add or modify, especially if the - * information does not come from the above mentioned specification. - * - * Additional references: - * - Intel AP-485 revision 32 - * "Intel Processor Identification and the CPUID Instruction" - * http://developer.intel.com/design/xeon/applnots/241618.htm - * - DMTF Common Information Model - * CIM Schema version 2.19.1 - * http://www.dmtf.org/standards/cim/ - * - IPMI 2.0 revision 1.0 - * "Intelligent Platform Management Interface Specification" - * http://developer.intel.com/design/servers/ipmi/spec.htm - * - AMD publication #25481 revision 2.28 - * "CPUID Specification" - * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf - * - BIOS Integrity Services Application Programming Interface version 1.0 - * http://www.intel.com/design/archives/wfm/downloads/bisspec.htm - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * DMI Decode Python Module (Extension) - * - * Copyright: 2007-2008 Nima Talebi - * License: GPLv3 - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - */ - -#include - -/* -#undef NDEBUG -#include -*/ - -#include -#include -#include -#include - -#include "version.h" -#include "config.h" -#include "types.h" -#include "util.h" -#include "dmidecode.h" -#include "dmioem.h" - -#include "dmihelper.h" - -#define EFI_NOT_FOUND (-1) -#define EFI_NO_SMBIOS (-2) - -static const char *out_of_spec = ""; -static const char *bad_index = ""; -#define BAD_INDEX PyString_FromString("") -#define OUT_OF_SPEC PyString_FromString("") - -/******************************************************************************* -** Type-independant Stuff -*/ - -static PyObject *dmi_string_py(const struct dmi_header *dm, u8 s) { - char *bp=(char *)dm->data; - size_t i, len; - - PyObject *data; - - if(s==0) data = PyString_FromString("Not Specified"); - else { - bp += dm->length; - while(s>1 && *bp) { bp += strlen(bp); bp++; s--; } - - if(!*bp) data = BAD_INDEX; - else { - /* ASCII filtering */ - len=strlen(bp); - for(i=0; idata; - size_t i, len; - - if(s == 0) return "Not Specified"; - - bp += dm->length; - while(s>1 && *bp) { - bp+=strlen(bp); - bp++; - s--; - } - - if(!*bp) return bad_index; - - /* ASCII filtering */ - len = strlen(bp); - for(i=0; i0x99 || (value&0x0F)>0x09) return 0; - if(valuehigh) return 0; - return 1; -} - -PyObject* dmi_dump(struct dmi_header *h) { - int row, i; - const char *s; - - PyObject *data = PyDict_New(); - PyObject *data1 = PyList_New(0); - for(row=0; row<((h->length-1)>>4)+1; row++) { - for(i=0; i<16 && ilength-(row<<4); i++) - PyList_Append(data1, PyString_FromFormat("0x%02x", (h->data)[(row<<4)+i])); - } - PyDict_SetItemString(data, "Header and Data", data1); - - if((h->data)[h->length] || (h->data)[h->length+1]) { - i=1; - PyObject *data2 = PyList_New(0); - while((s=dmi_string(h, i++))!=bad_index) { - //. FIXME: DUMP - /* - if(opt.flags & FLAG_DUMP) { - int j, l = strlen(s)+1; - for(row=0; row<((l-1)>>4)+1; row++) { - for(j=0; j<16 && j>10); -} - -/* 3.3.1.1 */ -static PyObject* dmi_bios_characteristics(u64 code) { - static const char *characteristics[] = { - "BIOS characteristics not supported", /* 3 */ - "ISA is supported", - "MCA is supported", - "EISA is supported", - "PCI is supported", - "PC Card (PCMCIA) is supported", - "PNP is supported", - "APM is supported", - "BIOS is upgradeable", - "BIOS shadowing is allowed", - "VLB is supported", - "ESCD support is available", - "Boot from CD is supported", - "Selectable boot is supported", - "BIOS ROM is socketed", - "Boot from PC Card (PCMCIA) is supported", - "EDD is supported", - "Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)", - "Japanese floppy for Toshiba 1.2 MB is supported (int 13h)", - "5.25\"/360 KB floppy services are supported (int 13h)", - "5.25\"/1.2 MB floppy services are supported (int 13h)", - "3.5\"/720 KB floppy services are supported (int 13h)", - "3.5\"/2.88 MB floppy services are supported (int 13h)", - "Print screen service is supported (int 5h)", - "8042 keyboard services are supported (int 9h)", - "Serial services are supported (int 14h)", - "Printer services are supported (int 17h)", - "CGA/mono video services are supported (int 10h)", - "NEC PC-98" /* 31 */ - }; - - PyObject *data; - if(code.l&(1<<3)) { - data = PyString_FromString(characteristics[0]); - } else { - int i; - data = PyDict_New(); - for(i=4; i<=31; i++) - PyDict_SetItemString(data, characteristics[i-3], code.l&(1<= 0x0206) - return PyString_FromFormat("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", - p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6], - p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] - ); - else - return PyString_FromFormat("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], - p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] - ); -} - -/* 3.3.2.1 */ -static PyObject *dmi_system_wake_up_type(u8 code) { - static const char *type[]={ - "Reserved", /* 0x00 */ - "Other", - "Unknown", - "APM Timer", - "Modem Ring", - "LAN Remote", - "Power Switch", - "PCI PME#", - "AC Power Restored" /* 0x08 */ - }; - - if(code<=0x08) return PyString_FromString(type[code]); - return OUT_OF_SPEC; -} - -/******************************************************************************* -** 3.3.3 Base Board Information (Type 2) -*/ - -/* 3.3.3.1 */ -static PyObject *dmi_base_board_features(u8 code) { - static const char *features[] = { - "Board is a hosting board", /* 0 */ - "Board requires at least one daughter board", - "Board is removable", - "Board is replaceable", - "Board is hot swappable" /* 4 */ - }; - - PyObject *data; - if((code&0x1F)==0) data = Py_None; - else { - int i; - data = PyList_New(5); - for(i=0; i<=4; i++) { - if(code&(1<=0x01 && code<=0x0D) - return PyString_FromString(type[code-0x01]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_base_board_handles(u8 count, const u8 *p) { - int i; - - PyObject *dict = PyDict_New(); - PyObject *list = PyList_New(count); - - for(i=0; i=0x01 && code<=0x1B) - return type[code-0x01]; - return out_of_spec; -} - -static PyObject *dmi_chassis_type_py(u8 code) { - return PyString_FromString(dmi_chassis_type(code)); -} - -static PyObject *dmi_chassis_lock(u8 code) { - static const char *lock[] = { - "Not Present", /* 0x00 */ - "Present" /* 0x01 */ - }; - - return PyString_FromString(lock[code]); -} - -/* 3.3.4.2 */ -static PyObject *dmi_chassis_state(u8 code) { - static const char *state[]={ - "Other", /* 0x01 */ - "Unknown", - "Safe", /* master.mif says OK */ - "Warning", - "Critical", - "Non-recoverable" /* 0x06 */ - }; - - if(code>=0x01 && code<=0x06) - return PyString_FromString(state[code-0x01]); - return OUT_OF_SPEC; -} - -/* 3.3.4.3 */ -static const char *dmi_chassis_security_status(u8 code) { - static const char *status[]={ - "Other", /* 0x01 */ - "Unknown", - "None", - "External Interface Locked Out", - "External Interface Enabled" /* 0x05 */ - }; - - if(code>=0x01 && code<=0x05) - return(status[code-0x01]); - return out_of_spec; -} - -static PyObject *dmi_chassis_height(u8 code) { - if(code==0x00) return PyString_FromString("Unspecified"); - else return PyString_FromFormat("%i U", code); -} - -static PyObject *dmi_chassis_power_cords(u8 code) { - if(code==0x00) return PyString_FromString("Unspecified"); - else return PyString_FromFormat("%i", code); -} - -static PyObject *dmi_chassis_elements(u8 count, u8 len, const u8 *p) { - int i; - - PyObject *data = PyDict_New(); - PyDict_SetItemString(data, "Contained Elements", PyInt_FromLong(count)); - - PyObject *_key, *_val; - for(i=0; i=0x03) { - - _key = PyString_FromFormat("%s", - p[i*len]&0x80? - dmi_smbios_structure_type(p[i*len]&0x7F): - PyString_AS_STRING(dmi_base_board_type(p[i*len]&0x7F)) - ); - - if (p[1+i*len]==p[2+i*len]) _val = PyString_FromFormat("%i", p[1+i*len]); - else _val = PyString_FromFormat("%i-%i", p[1+i*len], p[2+i*len]); - - PyDict_SetItem(data, _key, _val); - - Py_DECREF(_key); - Py_DECREF(_val); - } - } - - return data; -} - -/******************************************************************************* -** 3.3.5 Processor Information (Type 4) -*/ - -static PyObject *dmi_processor_type(u8 code) { - /* 3.3.5.1 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "Central Processor", - "Math Processor", - "DSP Processor", - "Video Processor" /* 0x06 */ - }; - - if(code>=0x01 && code<=0x06) return PyString_FromString(type[code-0x01]); - return OUT_OF_SPEC; -} - -static const char *dmi_processor_family(const struct dmi_header *h) { - const u8 *data = h->data; - unsigned int i, low, high; - u16 code; - - /* 3.3.5.2 */ - static struct { - int value; - const char *name; - } family2[] = { - { 0x01, "Other" }, - { 0x02, "Unknown" }, - { 0x03, "8086" }, - { 0x04, "80286" }, - { 0x05, "80386" }, - { 0x06, "80486" }, - { 0x07, "8087" }, - { 0x08, "80287" }, - { 0x09, "80387" }, - { 0x0A, "80487" }, - { 0x0B, "Pentium" }, - { 0x0C, "Pentium Pro" }, - { 0x0D, "Pentium II" }, - { 0x0E, "Pentium MMX" }, - { 0x0F, "Celeron" }, - { 0x10, "Pentium II Xeon" }, - { 0x11, "Pentium III" }, - { 0x12, "M1" }, - { 0x13, "M2" }, - { 0x14, "Celeron M" }, /* From CIM_Processor.Family */ - { 0x15, "Pentium 4 HT" }, /* From CIM_Processor.Family */ - - { 0x18, "Duron" }, - { 0x19, "K5" }, - { 0x1A, "K6" }, - { 0x1B, "K6-2" }, - { 0x1C, "K6-3" }, - { 0x1D, "Athlon" }, - { 0x1E, "AMD29000" }, - { 0x1F, "K6-2+" }, - { 0x20, "Power PC" }, - { 0x21, "Power PC 601" }, - { 0x22, "Power PC 603" }, - { 0x23, "Power PC 603+" }, - { 0x24, "Power PC 604" }, - { 0x25, "Power PC 620" }, - { 0x26, "Power PC x704" }, - { 0x27, "Power PC 750" }, - { 0x28, "Core Duo" }, /* From CIM_Processor.Family */ - { 0x29, "Core Duo Mobile" }, /* From CIM_Processor.Family */ - { 0x2A, "Core Solo Mobile" }, /* From CIM_Processor.Family */ - { 0x2B, "Atom" }, /* From CIM_Processor.Family */ - - { 0x30, "Alpha" }, - { 0x31, "Alpha 21064" }, - { 0x32, "Alpha 21066" }, - { 0x33, "Alpha 21164" }, - { 0x34, "Alpha 21164PC" }, - { 0x35, "Alpha 21164a" }, - { 0x36, "Alpha 21264" }, - { 0x37, "Alpha 21364" }, - - { 0x40, "MIPS" }, - { 0x41, "MIPS R4000" }, - { 0x42, "MIPS R4200" }, - { 0x43, "MIPS R4400" }, - { 0x44, "MIPS R4600" }, - { 0x45, "MIPS R10000" }, - - { 0x50, "SPARC" }, - { 0x51, "SuperSPARC" }, - { 0x52, "MicroSPARC II" }, - { 0x53, "MicroSPARC IIep" }, - { 0x54, "UltraSPARC" }, - { 0x55, "UltraSPARC II" }, - { 0x56, "UltraSPARC IIi" }, - { 0x57, "UltraSPARC III" }, - { 0x58, "UltraSPARC IIIi" }, - - { 0x60, "68040" }, - { 0x61, "68xxx" }, - { 0x62, "68000" }, - { 0x63, "68010" }, - { 0x64, "68020" }, - { 0x65, "68030" }, - - { 0x70, "Hobbit" }, - - { 0x78, "Crusoe TM5000" }, - { 0x79, "Crusoe TM3000" }, - { 0x7A, "Efficeon TM8000" }, - - { 0x80, "Weitek" }, - - { 0x82, "Itanium" }, - { 0x83, "Athlon 64" }, - { 0x84, "Opteron" }, - { 0x85, "Sempron" }, - { 0x86, "Turion 64" }, - { 0x87, "Dual-Core Opteron" }, - { 0x88, "Athlon 64 X2" }, - { 0x89, "Turion 64 X2" }, - { 0x8A, "Quad-Core Opteron" }, /* From CIM_Processor.Family */ - { 0x8B, "Third-Generation Opteron" }, /* From CIM_Processor.Family */ - { 0x8C, "Phenom FX" }, /* From CIM_Processor.Family */ - { 0x8D, "Phenom X4" }, /* From CIM_Processor.Family */ - { 0x8E, "Phenom X2" }, /* From CIM_Processor.Family */ - { 0x8F, "Athlon X2" }, /* From CIM_Processor.Family */ - { 0x90, "PA-RISC" }, - { 0x91, "PA-RISC 8500" }, - { 0x92, "PA-RISC 8000" }, - { 0x93, "PA-RISC 7300LC" }, - { 0x94, "PA-RISC 7200" }, - { 0x95, "PA-RISC 7100LC" }, - { 0x96, "PA-RISC 7100" }, - - { 0xA0, "V30" }, - { 0xA1, "Quad-Core Xeon 3200" }, /* From CIM_Processor.Family */ - { 0xA2, "Dual-Core Xeon 3000" }, /* From CIM_Processor.Family */ - { 0xA3, "Quad-Core Xeon 5300" }, /* From CIM_Processor.Family */ - { 0xA4, "Dual-Core Xeon 5100" }, /* From CIM_Processor.Family */ - { 0xA5, "Dual-Core Xeon 5000" }, /* From CIM_Processor.Family */ - { 0xA6, "Dual-Core Xeon LV" }, /* From CIM_Processor.Family */ - { 0xA7, "Dual-Core Xeon ULV" }, /* From CIM_Processor.Family */ - { 0xA8, "Dual-Core Xeon 7100" }, /* From CIM_Processor.Family */ - { 0xA9, "Quad-Core Xeon 5400" }, /* From CIM_Processor.Family */ - { 0xAA, "Quad-Core Xeon" }, /* From CIM_Processor.Family */ - - { 0xB0, "Pentium III Xeon" }, - { 0xB1, "Pentium III Speedstep" }, - { 0xB2, "Pentium 4" }, - { 0xB3, "Xeon" }, - { 0xB4, "AS400" }, - { 0xB5, "Xeon MP" }, - { 0xB6, "Athlon XP" }, - { 0xB7, "Athlon MP" }, - { 0xB8, "Itanium 2" }, - { 0xB9, "Pentium M" }, - { 0xBA, "Celeron D" }, - { 0xBB, "Pentium D" }, - { 0xBC, "Pentium EE" }, - { 0xBD, "Core Solo" }, - /* 0xBE handled as a special case */ - { 0xBF, "Core 2 Duo" }, - { 0xC0, "Core 2 Solo" }, /* From CIM_Processor.Family */ - { 0xC1, "Core 2 Extreme" }, /* From CIM_Processor.Family */ - { 0xC2, "Core 2 Quad" }, /* From CIM_Processor.Family */ - { 0xC3, "Core 2 Extreme Mobile" }, /* From CIM_Processor.Family */ - { 0xC4, "Core 2 Duo Mobile" }, /* From CIM_Processor.Family */ - { 0xC5, "Core 2 Solo Mobile" }, /* From CIM_Processor.Family */ - - { 0xC8, "IBM390" }, - { 0xC9, "G4" }, - { 0xCA, "G5" }, - { 0xCB, "ESA/390 G6" }, - { 0xCC, "z/Architectur" }, - - { 0xD2, "C7-M" }, - { 0xD3, "C7-D" }, - { 0xD4, "C7" }, - { 0xD5, "Eden" }, - - { 0xFA, "i860" }, - { 0xFB, "i960" }, - - { 0x104, "SH-3" }, - { 0x105, "SH-4" }, - - { 0x118, "ARM" }, - { 0x119, "StrongARM" }, - - { 0x12C, "6x86" }, - { 0x12D, "MediaGX" }, - { 0x12E, "MII" }, - - { 0x140, "WinChip" }, - - { 0x15E, "DSP" }, - - { 0x1F4, "Video Processor" }, - }; - - /* Linear Search - Slow - for(i=0; ilength>=0x2A)?WORD(data+0x28):data[0x06]; - - /* Special case for ambiguous value 0xBE */ - if(code == 0xBE) { - const char *manufacturer = dmi_string(h, data[0x07]); - - /* Best bet based on manufacturer string */ - if(strstr(manufacturer, "Intel") != NULL || strncasecmp(manufacturer, "Intel", 5) == 0) - return "Core 2"; - if(strstr(manufacturer, "AMD") != NULL || strncasecmp(manufacturer, "AMD", 3) == 0) - return "K7"; - return "Core 2 or K7"; - } - - /* Perform a binary search */ - low = 0; - high = ARRAY_SIZE(family2) - 1; - while(1) { - i = (low + high) / 2; - if (family2[i].value == code) return family2[i].name; - if (low == high) /* Not found */ return out_of_spec; - if (code < family2[i].value) high = i; - else low = i + 1; - } - - return out_of_spec; -} - -static PyObject *dmi_processor_id(u8 type, const u8 *p, const char *version) { - PyObject *data = PyDict_New(); - - /* Intel AP-485 revision 31, table 3-4 */ - static const char *flags[32]={ - "FPU (Floating-point unit on-chip)", /* 0 */ - "VME (Virtual mode extension)", - "DE (Debugging extension)", - "PSE (Page size extension)", - "TSC (Time stamp counter)", - "MSR (Model specific registers)", - "PAE (Physical address extension)", - "MCE (Machine check exception)", - "CX8 (CMPXCHG8 instruction supported)", - "APIC (On-chip APIC hardware supported)", - NULL, /* 10 */ - "SEP (Fast system call)", - "MTRR (Memory type range registers)", - "PGE (Page global enable)", - "MCA (Machine check architecture)", - "CMOV (Conditional move instruction supported)", - "PAT (Page attribute table)", - "PSE-36 (36-bit page size extension)", - "PSN (Processor serial number present and enabled)", - "CLFSH (CLFLUSH instruction supported)", - NULL, /* 20 */ - "DS (Debug store)", - "ACPI (ACPI supported)", - "MMX (MMX technology supported)", - "FXSR (Fast floating-point save and restore)", - "SSE (Streaming SIMD extensions)", - "SSE2 (Streaming SIMD extensions 2)", - "SS (Self-snoop)", - "HTT (Hyper-threading technology)", - "TM (Thermal monitor supported)", - "IA64 (IA64 capabilities)", - "PBE (Pending break enabled)" /* 31 */ - }; - /* - ** Extra flags are now returned in the ECX register when one calls - ** the CPUID instruction. Their meaning is explained in table 3-5, but - ** DMI doesn't support this yet. - */ - u32 eax, edx; - int sig=0; - - /* - ** This might help learn about new processors supporting the - ** CPUID instruction or another form of identification. - */ - - //. TODO: PyString_FromFormat does not support %x (yet?)... - PyDict_SetItemString(data, "ID", - PyString_FromFormat("%02x %02x %02x %02x %02x %02x %02x %02x", - p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7] - ) - ); - - if(type==0x05) /* 80386 */ { - u16 dx=WORD(p); - /* - ** 80386 have a different signature. - */ - PyDict_SetItemString(data, "Signature", - PyString_FromFormat( - "Type %i, Family %i, Major Stepping %i, Minor Stepping %i", - dx>>12, (dx>>8)&0xF, (dx>>4)&0xF, dx&0xF - ) - ); - return data; - } - - if(type==0x06) /* 80486 */ { - u16 dx=WORD(p); - /* - ** Not all 80486 CPU support the CPUID instruction, we have to find - ** wether the one we have here does or not. Note that this trick - ** works only because we know that 80486 must be little-endian. - */ - if((dx&0x0F00)==0x0400 - &&((dx&0x00F0)==0x0040 || (dx&0x00F0)>=0x0070) - &&((dx&0x000F)>=0x0003)) sig=1; - else { - PyDict_SetItemString(data, "Signature", - PyString_FromFormat( - "Type %i, Family %i, Model %i, Stepping %i", - (dx>>12)&0x3, (dx>>8)&0xF, (dx>>4)&0xF, dx&0xF - ) - ); - return data; - } - } else if( - ( - type >= 0x0B && type <= 0x15) /* Intel, Cyrix */ - || (type >= 0x28 && type <= 0x2B) /* Intel */ - || (type >= 0xA1 && type <= 0xAA) /* Intel */ - || (type >= 0xB0 && type <= 0xB3) /* Intel */ - || type == 0xB5 /* Intel */ - || (type >= 0xB9 && type <= 0xC5) /* Intel */ - || (type >= 0xD2 && type <= 0xD5) /* VIA */ - ) sig=1; - else if( - ( - type >= 0x18 && type <= 0x1D) /* AMD */ - || type == 0x1F /* AMD */ - || (type >= 0x83 && type <= 0x8F) /* AMD */ - || (type >= 0xB6 && type <= 0xB7) /* AMD */ - || (type >= 0xE6 && type <= 0xEB) /* AMD */ - ) sig=2; - else if(type==0x01 || type==0x02) { - /* - ** Some X86-class CPU have family "Other" or "Unknown". In this case, - ** we use the version string to determine if they are known to - ** support the CPUID instruction. - */ - if( - strncmp(version, "Pentium III MMX", 15) == 0 - || strncmp(version, "Intel(R) Core(TM)2", 18) == 0 - || strncmp(version, "Intel(R) Pentium(R)", 19) == 0 - || strcmp(version, "Genuine Intel(R) CPU U1400") == 0 - ) sig = 1; - else if( - strncmp(version, "AMD Athlon(TM)", 14) == 0 - || strncmp(version, "AMD Opteron(tm)", 15) == 0 - || strncmp(version, "Dual-Core AMD Opteron(tm)", 25) == 0 - ) sig = 2; - else return data; - } else /* not X86-class */ return data; - - eax=DWORD(p); - edx=DWORD(p+4); - switch(sig) { - case 1: /* Intel */ - PyDict_SetItemString(data, "Signature", - PyString_FromFormat( - "Type %i, Family %i, Model %i, Stepping %i", - (eax>>12)&0x3, ((eax>>20)&0xFF)+((eax>>8)&0x0F), - ((eax>>12)&0xF0)+((eax>>4)&0x0F), eax&0xF - ) - ); - break; - case 2: /* AMD, publication #25481 revision 2.28 */ - PyDict_SetItemString(data, "Signature", - PyString_FromFormat( - "Family %i, Model %i, Stepping %i", - ((eax>>8)&0xF)+(((eax>>8)&0xF)==0xF?(eax>>20)&0xFF:0), - ((eax>>4)&0xF)|(((eax>>8)&0xF)==0xF?(eax>>12)&0xF0:0), - eax&0xF - ) - ); - break; - } - - edx=DWORD(p+4); - if((edx&0xFFEFFBFF)==0) PyDict_SetItemString(data, "Flags", Py_None); - else { - int i; - PyObject *subdata = PyDict_New(); - for(i=0; i<=31; i++) - if(flags[i]!=NULL) - PyDict_SetItemString(subdata, flags[i], (edx&(1<=0x01 && code<=0x15) return PyString_FromString(upgrade[code-0x01]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_processor_cache(u16 code, const char *level, u16 ver) { - PyObject *data; - if(code==0xFFFF) { - if(ver>=0x0203) data = PyString_FromString("Not Provided"); - else data = PyString_FromFormat("No %s Cache", level); - } else data = PyString_FromFormat("0x%04x", code); - return data; -} - -/* 3.3.5.9 */ -static PyObject *dmi_processor_characteristics(u16 code) { - static const char *characteristics[]={ - "64-bit capable" /* 2 */ - }; - - PyObject *data; - if((code&0x0004)==0) { - data = Py_None; - } else { - data = PyList_New(1); - int i; - for(i=2; i<=2; i++) - if(code&(1<=0x01 && code<=0x08) return(PyString_FromString(method[code-0x01])); - return OUT_OF_SPEC; -} - -/* 3.3.6.2 */ -static PyObject *dmi_memory_controller_ec_capabilities(u8 code) { - static const char *capabilities[]={ - "Other", /* 0 */ - "Unknown", - "None", - "Single-bit Error Correcting", - "Double-bit Error Correcting", - "Error Scrubbing" /* 5 */ - }; - - PyObject *data = Py_None; - if((code&0x3F)==0) return Py_None; - else { - int i; - - data = PyList_New(6); - for(i=0; i<=5; i++) - if(code&(1<=0x01 && code<=0x07) return PyString_FromString(interleave[code-0x01]); - return OUT_OF_SPEC; -} - -/* 3.3.6.4 */ -static PyObject *dmi_memory_controller_speeds(u16 code) { - const char *speeds[]={ - "Other", /* 0 */ - "Unknown", - "70 ns", - "60 ns", - "50 ns" /* 4 */ - }; - - PyObject *data; - if((code&0x001F)!=0) data = Py_None; - else { - int i; - - data = PyList_New(5); - for(i=0; i<=4; i++) - if(code&(1<>4)); - if((code&0x0F)!=0x0F) PyList_Append(data, PyInt_FromLong(code&0x0F)); - } - return data; -} - -static PyObject *dmi_memory_module_speed(u8 code) { - if(code==0) return PyString_FromString("Unknown"); - else return PyString_FromFormat("%i ns", code); -} - -/* 3.3.7.2 */ -static PyObject *dmi_memory_module_size(u8 code) { - PyObject *data = PyDict_New(); - int check_conn = 1; - - switch(code&0x7F) { - case 0x7D: - PyDict_SetItemString(data, "Size", PyString_FromString("Not Determinable")); - break; - case 0x7E: - PyDict_SetItemString(data, "Size", PyString_FromString("Disabled")); - break; - case 0x7F: - PyDict_SetItemString(data, "Size", PyString_FromString("Not Installed")); - check_conn = 0; - default: - PyDict_SetItemString(data, "Size", PyString_FromFormat("%i MB", 1<<(code&0x7F))); - } - - if(check_conn) { - if(code&0x80) PyDict_SetItemString(data, "Connection", PyString_FromString("Double-bank")); - else PyDict_SetItemString(data, "Connection", PyString_FromString("Single-bank")); - } - return data; -} - -static PyObject *dmi_memory_module_error(u8 code) { - PyObject *data = NULL; - if(code&(1<<2)) data = Py_None; //. TODO: sprintf(_, "See Event Log"); - else { - if((code&0x03)==0) data = Py_True; - if(code&(1<<0)) data = PyString_FromString("Uncorrectable Errors"); - if(code&(1<<1)) data = PyString_FromString("Correctable Errors"); - } - return data; -} - -/******************************************************************************* -** 3.3.8 Cache Information (Type 7) -*/ -static PyObject *dmi_cache_mode(u8 code) { - static const char *mode[]={ - "Write Through", /* 0x00 */ - "Write Back", - "Varies With Memory Address", - "Unknown" /* 0x03 */ - }; - - return PyString_FromString(mode[code]); -} - -static PyObject *dmi_cache_location(u8 code) { - static const char *location[4]={ - "Internal", /* 0x00 */ - "External", - NULL, /* 0x02 */ - "Unknown" /* 0x03 */ - }; - - PyObject *data; - if(location[code]!=NULL) data = PyString_FromString(location[code]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_cache_size(u16 code) { - PyObject *data; - if(code&0x8000) data = PyString_FromFormat("%i KB", (code&0x7FFF)<<6); - else data = PyString_FromFormat("%i KB", code); - return data; -} - -/* 3.3.8.2 */ -static PyObject *dmi_cache_types(u16 code) { - static const char *types[] = { - "Other", /* 0 */ - "Unknown", - "Non-burst", - "Burst", - "Pipeline Burst", - "Synchronous", - "Asynchronous" /* 6 */ - }; - PyObject *data; - - if((code&0x007F)==0) data = Py_None; - else { - int i; - - data = PyList_New(7); - for(i=0; i<=6; i++) - if(code&(1<=0x01 && code<=0x06) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_cache_type(u8 code) { - /* 3.3.8.4 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "Instruction", - "Data", - "Unified" /* 0x05 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x05) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_cache_associativity(u8 code) { - /* 3.3.8.5 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "Direct Mapped", - "2-way Set-associative", - "4-way Set-associative", - "Fully Associative", - "8-way Set-associative", - "16-way Set-associative" /* 0x08 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x08) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -/******************************************************************************* -** 3.3.9 Port Connector Information (Type 8) -*/ - -static PyObject *dmi_port_connector_type(u8 code) { - /* 3.3.9.2 */ - static const char *type[] = { - "None", /* 0x00 */ - "Centronics", - "Mini Centronics", - "Proprietary", - "DB-25 male", - "DB-25 female", - "DB-15 male", - "DB-15 female", - "DB-9 male", - "DB-9 female", - "RJ-11", - "RJ-45", - "50 Pin MiniSCSI", - "Mini DIN", - "Micro DIN", - "PS/2", - "Infrared", - "HP-HIL", - "Access Bus (USB)", - "SSA SCSI", - "Circular DIN-8 male", - "Circular DIN-8 female", - "On Board IDE", - "On Board Floppy", - "9 Pin Dual Inline (pin 10 cut)", - "25 Pin Dual Inline (pin 26 cut)", - "50 Pin Dual Inline", - "68 Pin Dual Inline", - "On Board Sound Input From CD-ROM", - "Mini Centronics Type-14", - "Mini Centronics Type-26", - "Mini Jack (headphones)", - "BNC", - "IEEE 1394", - "SAS/SATA Plug Receptacle" /* 0x22 */ - }; - static const char *type_0xA0[]={ - "PC-98", /* 0xA0 */ - "PC-98 Hireso", - "PC-H98", - "PC-98 Note", - "PC-98 Full" /* 0xA4 */ - }; - - if(code<=0x22) return PyString_FromString(type[code]); - if(code>=0xA0 && code<=0xA4) return PyString_FromString(type_0xA0[code-0xA0]); - if(code==0xFF) return PyString_FromString("Other"); - return OUT_OF_SPEC; -} - -static PyObject *dmi_port_type(u8 code) { - /* 3.3.9.3 */ - static const char *type[] = { - "None", /* 0x00 */ - "Parallel Port XT/AT Compatible", - "Parallel Port PS/2", - "Parallel Port ECP", - "Parallel Port EPP", - "Parallel Port ECP/EPP", - "Serial Port XT/AT Compatible", - "Serial Port 16450 Compatible", - "Serial Port 16550 Compatible", - "Serial Port 16550A Compatible", - "SCSI Port", - "MIDI Port", - "Joystick Port", - "Keyboard Port", - "Mouse Port", - "SSA SCSI", - "USB", - "Firewire (IEEE P1394)", - "PCMCIA Type I", - "PCMCIA Type II", - "PCMCIA Type III", - "Cardbus", - "Access Bus Port", - "SCSI II", - "SCSI Wide", - "PC-98", - "PC-98 Hireso", - "PC-H98", - "Video Port", - "Audio Port", - "Modem Port", - "Network Port", - "SATA", - "SAS" /* 0x21 */ - }; - static const char *type_0xA0[]={ - "8251 Compatible", /* 0xA0 */ - "8251 FIFO Compatible" /* 0xA1 */ - }; - - if(code<=0x21) return PyString_FromString(type[code]); - if(code>=0xA0 && code<=0xA1) return PyString_FromString(type_0xA0[code-0xA0]); - if(code==0xFF) return PyString_FromString("Other"); - return OUT_OF_SPEC; -} - -/******************************************************************************* -** 3.3.10 System Slots (Type 9) -*/ - -static PyObject *dmi_slot_type(u8 code) { - /* 3.3.10.1 */ - static const char *type[] = { - "Other", /* 0x01 */ - "Unknown", - "ISA", - "MCA", - "EISA", - "PCI", - "PC Card (PCMCIA)", - "VLB", - "Proprietary", - "Processor Card", - "Proprietary Memory Card", - "I/O Riser Card", - "NuBus", - "PCI-66", - "AGP", - "AGP 2x", - "AGP 4x", - "PCI-X", - "AGP 8x" /* 0x13 */ - }; - static const char *type_0xA0[]={ - "PC-98/C20", /* 0xA0 */ - "PC-98/C24", - "PC-98/E", - "PC-98/Local Bus", - "PC-98/Card", - "PCI Express", - "PCI Express x1", - "PCI Express x2", - "PCI Express x4", - "PCI Express x8", - "PCI Express x16" /* 0xAA */ - }; - - if(code>=0x01 && code<=0x13) return PyString_FromString(type[code-0x01]); - if(code>=0xA0 && code<=0xAA) return PyString_FromString(type_0xA0[code-0xA0]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_slot_bus_width(u8 code) { - /* 3.3.10.2 */ - static const char *width[]={ - "", /* 0x01, "Other" */ - "", /* "Unknown" */ - "8-bit ", - "16-bit ", - "32-bit ", - "64-bit ", - "128-bit ", - "x1 ", - "x2 ", - "x4 ", - "x8 ", - "x12 ", - "x16 ", - "x32 " /* 0x0E */ - }; - - if(code>=0x01 && code<=0x0E) return PyString_FromString(width[code-0x01]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_slot_current_usage(u8 code) { - /* 3.3.10.3 */ - static const char *usage[]={ - "Other", /* 0x01 */ - "Unknown", - "Available", - "In Use" /* 0x04 */ - }; - - if(code>=0x01 && code<=0x04) return PyString_FromString(usage[code-0x01]); - return OUT_OF_SPEC; -} - -/* 3.3.1O.4 */ -static PyObject *dmi_slot_length(u8 code) { - static const char *length[]={ - "Other", /* 0x01 */ - "Unknown", - "Short", - "Long" /* 0x04 */ - }; - - if(code>=0x01 && code<=0x04) - return PyString_FromString(length[code-0x01]); - return OUT_OF_SPEC; -} - -/* 3.3.10.5 */ -static PyObject *dmi_slot_id(u8 code1, u8 code2, u8 type) { - PyObject *data; - switch(type) { - case 0x04: /* MCA */ - data = PyString_FromFormat("%i", code1); - break; - case 0x05: /* EISA */ - data = PyString_FromFormat("%i", code1); - break; - case 0x06: /* PCI */ - case 0x0E: /* PCI */ - case 0x0F: /* AGP */ - case 0x10: /* AGP */ - case 0x11: /* AGP */ - case 0x12: /* PCI-X */ - case 0x13: /* AGP */ - case 0xA5: /* PCI Express */ - data = PyString_FromFormat("%i", code1); - break; - case 0x07: /* PCMCIA */ - data = PyString_FromFormat("Adapter %i, Socket %i", code1, code2); - break; - default: - data = Py_None; - } - return data; -} - -static PyObject *dmi_slot_characteristics(u8 code1, u8 code2) { - /* 3.3.10.6 */ - static const char *characteristics1[]={ - "5.0 V is provided", /* 1 */ - "3.3 V is provided", - "Opening is shared", - "PC Card-16 is supported", - "Cardbus is supported", - "Zoom Video is supported", - "Modem ring resume is supported" /* 7 */ - }; - - /* 3.3.10.7 */ - static const char *characteristics2[]={ - "PME signal is supported", /* 0 */ - "Hot-plug devices are supported", - "SMBus signal is supported" /* 2 */ - }; - - PyObject *data; - if(code1&(1<<0)) data = PyString_FromString("Unknown"); - else if((code1&0xFE)==0 && (code2&0x07)==0) data = Py_None; - else { - int i; - - data = PyList_New(7+3); - for(i=1; i<=7; i++) { - if(code1&(1<> 3, code3 & 0x7); - else data = Py_None; - return data; -} - -/******************************************************************************* -** 3.3.11 On Board Devices Information (Type 10) -*/ - -static const char *dmi_on_board_devices_type(u8 code) { - /* 3.3.11.1 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "Video", - "SCSI Controller", - "Ethernet", - "Token Ring", - "Sound", - "PATA Controller", - "SATA Controller", - "SAS Controller" /* 0x0A */ - }; - - if(code>=0x01 && code<=0x0A) return type[code-0x01]; - return out_of_spec; -} - -static PyObject *dmi_on_board_devices(struct dmi_header *h) { - PyObject *data = NULL; - u8 *p = h->data+4; - u8 count = (h->length-0x04)/2; - int i; - - if((data = PyList_New(count))) { - PyObject *_pydict; - PyObject *_val; - for(i=0; idata+4; - u8 count=p[0x00]; - int i; - - PyObject *data = PyDict_New(); - PyObject *val; - - for(i=1; i<=count; i++) { - val = dmi_string_py(h, i); - PyDict_SetItem(data, PyInt_FromLong(i), val); - Py_DECREF(val); - } - - return data; -} - -/******************************************************************************* -** 3.3.13 System Configuration Options (Type 12) -*/ - -static PyObject *dmi_system_configuration_options(struct dmi_header *h) { - u8 *p=h->data+4; - u8 count=p[0x00]; - int i; - - PyObject *data = PyDict_New(); - PyObject *val; - for(i=1; i<=count; i++) { - val = dmi_string_py(h, i); - PyDict_SetItem(data, PyInt_FromLong(i), val); - Py_DECREF(val); - } - - return data; -} - -/******************************************************************************* -** 3.3.14 BIOS Language Information (Type 13) -*/ - -static PyObject *dmi_bios_languages(struct dmi_header *h) { - u8 *p = h->data+4; - u8 count = p[0x00]; - int i; - - PyObject *data = PyList_New(count + 1); - for(i=1; i<=count; i++) - PyList_SET_ITEM(data, i, dmi_string_py(h, i)); - - return data; -} - -/******************************************************************************* -** 3.3.15 Group Associations (Type 14) -*/ - -static PyObject *dmi_group_associations_items(u8 count, const u8 *p) { - int i; - - PyObject *data = PyList_New(count); - PyObject *val; - for(i=0; i=0x80) return "OEM-specific"; - return out_of_spec; -} - -static PyObject *dmi_event_log_status_py(u8 code) { - static const char *valid[]={ - "Invalid", /* 0 */ - "Valid" /* 1 */ - }; - static const char *full[]={ - "Not Full", /* 0 */ - "Full" /* 1 */ - }; - - return PyString_FromFormat("%s, %s", valid[(code>>0)&1], full[(code>>1)&1]); -} - -static PyObject *dmi_event_log_address_py(u8 method, const u8 *p) { - /* 3.3.16.3 */ - switch(method) { - case 0x00: - case 0x01: - case 0x02: - return PyString_FromFormat("Index 0x%04x, Data 0x%04x", WORD(p), WORD(p+2)); - break; - case 0x03: - return PyString_FromFormat("0x%08x", DWORD(p)); - break; - case 0x04: - return PyString_FromFormat("0x%04x", WORD(p)); - break; - default: - return PyString_FromString("Unknown"); - } -} - -static const char *dmi_event_log_header_type(u8 code) { - static const char *type[]={ - "No Header", /* 0x00 */ - "Type 1" /* 0x01 */ - }; - - if(code<=0x01) return type[code]; - if(code>=0x80) return "OEM-specific"; - return out_of_spec; -} - -static PyObject *dmi_event_log_descriptor_type(u8 code) { - /* 3.3.16.6.1 */ - static const char *type[]={ - NULL, /* 0x00 */ - "Single-bit ECC memory error", - "Multi-bit ECC memory error", - "Parity memory error", - "Bus timeout", - "I/O channel block", - "Software NMI", - "POST memory resize", - "POST error", - "PCI parity error", - "PCI system error", - "CPU failure", - "EISA failsafe timer timeout", - "Correctable memory log disabled", - "Logging disabled", - NULL, /* 0x0F */ - "System limit exceeded", - "Asynchronous hardware timer expired", - "System configuration information", - "Hard disk information", - "System reconfigured", - "Uncorrectable CPU-complex error", - "Log area reset/cleared", - "System boot" /* 0x17 */ - }; - - const char *data; - if(code<=0x17 && type[code]!=NULL) data = type[code]; - else if(code>=0x80 && code<=0xFE) data = "OEM-specific"; - else if(code==0xFF) data = "End of log"; - else data = out_of_spec; - return PyString_FromString(data); -} - -static PyObject *dmi_event_log_descriptor_format(u8 code) { - /* 3.3.16.6.2 */ - static const char *format[]={ - "None", /* 0x00 */ - "Handle", - "Multiple-event", - "Multiple-event handle", - "POST results bitmap", - "System management", - "Multiple-event system management" /* 0x06 */ - }; - - const char *data; - if(code<=0x06) data = format[code]; - else if(code>=0x80) data = "OEM-specific"; - else data = out_of_spec; - return PyString_FromString(data); -} - -static PyObject *dmi_event_log_descriptors(u8 count, const u8 len, const u8 *p) { - /* 3.3.16.1 */ - int i; - - PyObject* data; - data = PyList_New(count); - for(i=0; i=0x02) { - PyObject *subdata = PyDict_New(); - PyDict_SetItemString(subdata, "Descriptor", dmi_event_log_descriptor_type(p[i*len])); - PyDict_SetItemString(subdata, "Data Format", dmi_event_log_descriptor_format(p[i*len+1])); - PyList_SET_ITEM(data, i, subdata); - } - } - return data; -} - -/******************************************************************************* -** 3.3.17 Physical Memory Array (Type 16) -*/ - -static PyObject *dmi_memory_array_location(u8 code) { - /* 3.3.17.1 */ - static const char *location[]={ - "Other", /* 0x01 */ - "Unknown", - "System Board Or Motherboard", - "ISA Add-on Card", - "EISA Add-on Card", - "PCI Add-on Card", - "MCA Add-on Card", - "PCMCIA Add-on Card", - "Proprietary Add-on Card", - "NuBus" /* 0x0A, master.mif says 16 */ - }; - static const char *location_0xA0[]={ - "PC-98/C20 Add-on Card", /* 0xA0 */ - "PC-98/C24 Add-on Card", - "PC-98/E Add-on Card", - "PC-98/Local Bus Add-on Card", - "PC-98/Card Slot Add-on Card" /* 0xA4, from master.mif */ - }; - - if(code>=0x01 && code<=0x0A) return PyString_FromString(location[code-0x01]); - if(code>=0xA0 && code<=0xA4) return PyString_FromString(location_0xA0[code-0xA0]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_memory_array_use(u8 code) { - /* 3.3.17.2 */ - static const char *use[]={ - "Other", /* 0x01 */ - "Unknown", - "System Memory", - "Video Memory", - "Flash Memory", - "Non-volatile RAM", - "Cache Memory" /* 0x07 */ - }; - - if(code>=0x01 && code<=0x07) return PyString_FromString(use[code-0x01]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_memory_array_ec_type(u8 code) { - /* 3.3.17.3 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "None", - "Parity", - "Single-bit ECC", - "Multi-bit ECC", - "CRC" /* 0x07 */ - }; - - if(code>=0x01 && code<=0x07) return PyString_FromString(type[code-0x01]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_memory_array_capacity(u32 code) { - PyObject *data; - if(code==0x8000000) data = PyString_FromString("Unknown"); - else { - if((code&0x000FFFFF)==0) data = PyString_FromFormat("%i GB", code>>20); - else if((code&0x000003FF)==0) data = PyString_FromFormat("%i MB", code>>10); - else data = PyString_FromFormat("%i kB", code); - } - return data; -} - -static PyObject *dmi_memory_array_error_handle(u16 code) { - PyObject *data; - if(code==0xFFFE) data = PyString_FromString("Not Provided"); - else if(code==0xFFFF) data = PyString_FromString("No Error"); - else data = PyString_FromFormat("0x%04x", code); - return data; -} - -/******************************************************************************* -** 3.3.18 Memory Device (Type 17) -*/ - -static PyObject *dmi_memory_device_width(u16 code) { - /* - ** If no memory module is present, width may be 0 - */ - PyObject *data; - if(code==0xFFFF || code==0) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%i bits", code); - return data; -} - -static PyObject *dmi_memory_device_size(u16 code) { - PyObject *data = NULL; - if(code==0) data = Py_None; //. No Module Installed - else if(code==0xFFFF) data = PyString_FromString("Unknown"); //. Unknown - else { - //. Keeping this as String rather than Int as it has KB and MB representations... - if(code&0x8000) data = PyString_FromFormat("%d KB", code&0x7FFF); - else data = PyString_FromFormat("%d MB", code); - } - return data; -} - -static PyObject *dmi_memory_device_form_factor(u8 code) { - /* 3.3.18.1 */ - static const char *form_factor[]={ - "Other", /* 0x01 */ - "Unknown", - "SIMM", - "SIP", - "Chip", - "DIP", - "ZIP", - "Proprietary Card", - "DIMM", - "TSOP", - "Row Of Chips", - "RIMM", - "SODIMM", - "SRIMM", - "FB-DIMM" /* 0x0F */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x0F) return data = PyString_FromString(form_factor[code-0x01]); - return data = OUT_OF_SPEC; -} - -static PyObject *dmi_memory_device_set(u8 code) { - PyObject *data; - if(code==0) data = Py_None; - else if(code==0xFF) data = PyString_FromString("Unknown"); - else data = PyInt_FromLong(code); - return data; -} - -static PyObject *dmi_memory_device_type(u8 code) { - /* 3.3.18.2 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "DRAM", - "EDRAM", - "VRAM", - "SRAM", - "RAM", - "ROM", - "Flash", - "EEPROM", - "FEPROM", - "EPROM", - "CDRAM", - "3DRAM", - "SDRAM", - "SGRAM", - "RDRAM", - "DDR", - "DDR2", - "DDR2 FB-DIMM" /* 0x14 */ - }; - - if(code>=0x01 && code<=0x14) return PyString_FromString(type[code-0x01]); - return OUT_OF_SPEC; -} - -static PyObject *dmi_memory_device_type_detail(u16 code) { - /* 3.3.18.3 */ - static const char *detail[]={ - "Other", /* 1 */ - "Unknown", - "Fast-paged", - "Static Column", - "Pseudo-static", - "RAMBus", - "Synchronous", - "CMOS", - "EDO", - "Window DRAM", - "Cache DRAM", - "Non-Volatile" /* 12 */ - }; - - PyObject *data; - if((code&0x1FFE)==0) data = Py_None; - else { - int i; - - data = PyList_New(12); - for(i=1; i<=12; i++) - if(code&(1<=0x01 && code<=0x0E) data = PyString_FromString(type[code-0x01]); - data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_memory_error_granularity(u8 code) { - /* 3.3.19.2 */ - static const char *granularity[]={ - "Other", /* 0x01 */ - "Unknown", - "Device Level", - "Memory Partition Level" /* 0x04 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x04) data = PyString_FromString(granularity[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_memory_error_operation(u8 code) { - /* 3.3.19.3 */ - static const char *operation[]={ - "Other", /* 0x01 */ - "Unknown", - "Read", - "Write", - "Partial Write" /* 0x05 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x05) data = PyString_FromString(operation[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_memory_error_syndrome(u32 code) { - PyObject *data; - if(code==0x00000000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("0x%08x", code); - return data; -} - -static PyObject *dmi_32bit_memory_error_address(u32 code) { - PyObject *data; - if(code==0x80000000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("0x%08x", code); - return data; -} - -/******************************************************************************* -** 3.3.20 Memory Array Mapped Address (Type 19) -*/ - -static PyObject *dmi_mapped_address_size(u32 code) { - PyObject *data; - if(code==0) data = PyString_FromString("Invalid"); - else if((code&0x000FFFFF)==0) data = PyString_FromFormat("%i GB", code>>20); - else if((code&0x000003FF)==0) data = PyString_FromFormat("%i MB", code>>10); - else data = PyString_FromFormat("%i kB", code); - return data; -} - -/******************************************************************************* -** 3.3.21 Memory Device Mapped Address (Type 20) -*/ - -static PyObject *dmi_mapped_address_row_position(u8 code) { - PyObject *data; - if(code==0) data = OUT_OF_SPEC; - else if(code==0xFF) data = PyString_FromString("Unknown"); - else data = PyInt_FromLong(code); - return data; -} - -static PyObject *dmi_mapped_address_interleave_position(u8 code) { - PyObject *data; - if(code!=0) { - data = PyDict_New(); - PyDict_SetItemString(data, "Interleave Position", (code==0xFF)?PyString_FromString("Unknown"):PyInt_FromLong(code)); - } else data = Py_None; - return data; -} - -static PyObject *dmi_mapped_address_interleaved_data_depth(u8 code) { - PyObject *data; - if(code!=0) { - data = PyDict_New(); - PyDict_SetItemString(data, "Interleave Data Depth", (code==0xFF)?PyString_FromString("Unknown"):PyInt_FromLong(code)); - } else data = Py_None; - return data; -} - -/******************************************************************************* -** 3.3.22 Built-in Pointing Device (Type 21) -*/ - -static PyObject *dmi_pointing_device_type(u8 code) { - /* 3.3.22.1 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "Mouse", - "Track Ball", - "Track Point", - "Glide Point", - "Touch Pad", - "Touch Screen", - "Optical Sensor" /* 0x09 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x09) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_pointing_device_interface(u8 code) { - /* 3.3.22.2 */ - static const char *interface[]={ - "Other", /* 0x01 */ - "Unknown", - "Serial", - "PS/2", - "Infrared", - "HIP-HIL", - "Bus Mouse", - "ADB (Apple Desktop Bus)" /* 0x08 */ - }; - static const char *interface_0xA0[]={ - "Bus Mouse DB-9", /* 0xA0 */ - "Bus Mouse Micro DIN", - "USB" /* 0xA2 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x08) data = PyString_FromString(interface[code-0x01]); - else if(code>=0xA0 && code<=0xA2) data = PyString_FromString(interface_0xA0[code-0xA0]); - else data = OUT_OF_SPEC; - return data; -} - -/******************************************************************************* -** 3.3.23 Portable Battery (Type 22) -*/ - -static PyObject *dmi_battery_chemistry(u8 code) { - /* 3.3.23.1 */ - static const char *chemistry[]={ - "Other", /* 0x01 */ - "Unknown", - "Lead Acid", - "Nickel Cadmium", - "Nickel Metal Hydride", - "Lithium Ion", - "Zinc Air", - "Lithium Polymer" /* 0x08 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x08) data = PyString_FromString(chemistry[code-0x01]); - data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_battery_capacity(u16 code, u8 multiplier) { - PyObject *data; - if(code==0) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%i mWh", code*multiplier); - return data; -} - -static PyObject *dmi_battery_voltage(u16 code) { - PyObject *data; - if(code==0) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%i mV", code); - return data; -} - -static PyObject *dmi_battery_maximum_error(u8 code) { - PyObject *data; - if(code==0xFF) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%i%%", code); - return data; -} - -/******************************************************************************* -** 3.3.24 System Reset (Type 23) -*/ - -static PyObject *dmi_system_reset_boot_option(u8 code) { - static const char *option[]={ - "Operating System", /* 0x1 */ - "System Utilities", - "Do Not Reboot" /* 0x3 */ - }; - PyObject *data; - - if(code>=0x1) data = PyString_FromString(option[code-0x1]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_system_reset_count(u16 code) { - PyObject *data; - if(code==0xFFFF) data = PyString_FromString("Unknown"); - else data = PyInt_FromLong(code); - return data; -} - -static PyObject *dmi_system_reset_timer(u16 code) { - PyObject *data; - if(code==0xFFFF) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%i min", code); - return data; -} - -/******************************************************************************* - * 3.3.25 Hardware Security (Type 24) - */ - -static PyObject *dmi_hardware_security_status(u8 code) { - static const char *status[]={ - "Disabled", /* 0x00 */ - "Enabled", - "Not Implemented", - "Unknown" /* 0x03 */ - }; - - return PyString_FromString(status[code]); -} - -/******************************************************************************* -** 3.3.26 System Power Controls (Type 25) -*/ - -static PyObject *dmi_power_controls_power_on(const u8 *p) { - /* 3.3.26.1 */ - PyObject *data = PyList_New(5); - - PyList_SET_ITEM(data, 0, dmi_bcd_range(p[0], 0x01, 0x12)?PyString_FromFormat(" %02x", p[0]):PyString_FromString(" *")); - PyList_SET_ITEM(data, 1, dmi_bcd_range(p[1], 0x01, 0x31)?PyString_FromFormat("-%02x", p[1]):PyString_FromString("-*")); - PyList_SET_ITEM(data, 2, dmi_bcd_range(p[2], 0x00, 0x23)?PyString_FromFormat(" %02x", p[2]):PyString_FromString(" *")); - PyList_SET_ITEM(data, 3, dmi_bcd_range(p[3], 0x00, 0x59)?PyString_FromFormat(":%02x", p[3]):PyString_FromString(":*")); - PyList_SET_ITEM(data, 4, dmi_bcd_range(p[4], 0x00, 0x59)?PyString_FromFormat(":%02x", p[4]):PyString_FromString(":*")); - - return data; -} - -/******************************************************************************* -* 3.3.27 Voltage Probe (Type 26) -*/ - -static PyObject *dmi_voltage_probe_location(u8 code) { - /* 3.3.27.1 */ - static const char *location[]={ - "Other", /* 0x01 */ - "Unknown", - "Processor", - "Disk", - "Peripheral Bay", - "System Management Module", - "Motherboard", - "Memory Module", - "Processor Module", - "Power Unit", - "Add-in Card" /* 0x0B */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x0B) data = PyString_FromString(location[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_probe_status(u8 code) { - /* 3.3.27.1 */ - static const char *status[]={ - "Other", /* 0x01 */ - "Unknown", - "OK", - "Non-critical", - "Critical", - "Non-recoverable" /* 0x06 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x06) data = PyString_FromString(status[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_voltage_probe_value(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.3f V", (float)(i16)code/1000); - return data; -} - -static PyObject *dmi_voltage_probe_resolution(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.1f mV", (float)code/10); - return data; -} - -static PyObject *dmi_probe_accuracy(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.2f%%", (float)code/100); - return data; -} - -/******************************************************************************* -** 3.3.28 Cooling Device (Type 27) -*/ - -static PyObject *dmi_cooling_device_type(u8 code) { - /* 3.3.28.1 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "Fan", - "Centrifugal Blower", - "Chip Fan", - "Cabinet Fan", - "Power Supply Fan", - "Heat Pipe", - "Integrated Refrigeration" /* 0x09 */ - }; - static const char *type_0x10[]={ - "Active Cooling", /* 0x10, master.mif says 32 */ - "Passive Cooling" /* 0x11, master.mif says 33 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x09) data = PyString_FromString(type[code-0x01]); - else if(code>=0x10 && code<=0x11) data = PyString_FromString(type_0x10[code-0x10]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_cooling_device_speed(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown Or Non-rotating"); - else data = PyString_FromFormat("%i rpm", code); - return data; -} - -/******************************************************************************* -** 3.3.29 Temperature Probe (Type 28) -*/ - -static PyObject *dmi_temperature_probe_location(u8 code) { - /* 3.3.29.1 */ - static const char *location[]={ - "Other", /* 0x01 */ - "Unknown", - "Processor", - "Disk", - "Peripheral Bay", - "System Management Module", /* master.mif says SMB Master */ - "Motherboard", - "Memory Module", - "Processor Module", - "Power Unit", - "Add-in Card", - "Front Panel Board", - "Back Panel Board", - "Power System Board", - "Drive Back Plane" /* 0x0F */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x0F) data = PyString_FromString(location[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_temperature_probe_value(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.1f deg C", (float)(i16)code/10); - return data; -} - -static PyObject *dmi_temperature_probe_resolution(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.3f deg C", (float)code/1000); - return data; -} - -/******************************************************************************* -** 3.3.30 Electrical Current Probe (Type 29) -*/ - -static PyObject *dmi_current_probe_value(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.3f A", (float)(i16)code/1000); - return data; -} - -static PyObject *dmi_current_probe_resolution(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.1f mA", (float)code/10); - return data; -} - -/******************************************************************************* -** 3.3.33 System Boot Information (Type 32) -*/ - -static PyObject *dmi_system_boot_status(u8 code) { - static const char *status[]={ - "No errors detected", /* 0 */ - "No bootable media", - "Operating system failed to load", - "Firmware-detected hardware failure", - "Operating system-detected hardware failure", - "User-requested boot", - "System security violation", - "Previously-requested image", - "System watchdog timer expired" /* 8 */ - }; - PyObject *data; - - if(code<=8) data = PyString_FromString(status[code]); - else if(code>=128 && code<=191) data = PyString_FromString("OEM-specific"); - else if(code>=192) data = PyString_FromString("Product-specific"); - else data = OUT_OF_SPEC; - return data; -} - -/******************************************************************************* -** 3.3.34 64-bit Memory Error Information (Type 33) -*/ - -static PyObject *dmi_64bit_memory_error_address(u64 code) { - PyObject *data; - if(code.h==0x80000000 && code.l==0x00000000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("0x%08x%08x", code.h, code.l); - return data; -} - -/******************************************************************************* -** 3.3.35 Management Device (Type 34) -*/ - -static PyObject *dmi_management_device_type(u8 code) { - /* 3.3.35.1 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "LM75", - "LM78", - "LM79", - "LM80", - "LM81", - "ADM9240", - "DS1780", - "MAX1617", - "GL518SM", - "W83781D", - "HT82H791" /* 0x0D */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x0D) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_management_device_address_type(u8 code) { - /* 3.3.35.2 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "I/O Port", - "Memory", - "SMBus" /* 0x05 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x05) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -/******************************************************************************* -** 3.3.38 Memory Channel (Type 37) -*/ - -static PyObject *dmi_memory_channel_type(u8 code) { - /* 3.3.38.1 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "RamBus", - "SyncLink" /* 0x04 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x04) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_memory_channel_devices(u8 count, const u8 *p) { - PyObject *data = PyDict_New(); - PyObject *subdata, *val; - int i; - - for(i=1; i<=count; i++) { - subdata = PyList_New(2); - - val = PyString_FromFormat("Load: %i", p[3*i]); - PyList_SET_ITEM(subdata, 0, val); - Py_DECREF(val); - - val = PyString_FromFormat("Handle: 0x%04x", WORD(p+3*i+1)); - PyList_SET_ITEM(subdata, 1, val); - Py_DECREF(val); - - PyDict_SetItem(data, PyInt_FromLong(i), subdata); - Py_DECREF(subdata); - } - return data; -} - -/******************************************************************************* -** 3.3.39 IPMI Device Information (Type 38) -*/ - -static PyObject *dmi_ipmi_interface_type(u8 code) { - /* 3.3.39.1 and IPMI 2.0, appendix C1, table C1-2 */ - static const char *type[]={ - "Unknown", /* 0x00 */ - "KCS (Keyboard Control Style)", - "SMIC (Server Management Interface Chip)", - "BT (Block Transfer)", - "SSIF (SMBus System Interface)" /* 0x04 */ - }; - PyObject *data; - - if(code<=0x04) data = PyString_FromString(type[code]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_ipmi_base_address(u8 type, const u8 *p, u8 lsb) { - PyObject *data; - if(type==0x04) /* SSIF */ { - data = PyString_FromFormat("0x%02x (SMBus)", (*p)>>1); - } else { - u64 address=QWORD(p); - data = PyString_FromFormat("0x%08x%08x (%s)", address.h, (address.l&~1)|lsb, address.l&1?"I/O":"Memory-mapped"); - } - return data; -} - -static PyObject *dmi_ipmi_register_spacing(u8 code) { - /* IPMI 2.0, appendix C1, table C1-1 */ - static const char *spacing[]={ - "Successive Byte Boundaries", /* 0x00 */ - "32-bit Boundaries", - "16-byte Boundaries" /* 0x02 */ - }; - PyObject *data; - - if(code<=0x02) return data = PyString_FromString(spacing[code]); - return data = OUT_OF_SPEC; -} - -/******************************************************************************* -** 3.3.40 System Power Supply (Type 39) -*/ - -static PyObject *dmi_power_supply_power(u16 code) { - PyObject *data; - if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromFormat("%.3f W", (float)code/1000); - return data; -} - -static PyObject *dmi_power_supply_type(u8 code) { - /* 3.3.40.1 */ - static const char *type[]={ - "Other", /* 0x01 */ - "Unknown", - "Linear", - "Switching", - "Battery", - "UPS", - "Converter", - "Regulator" /* 0x08 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x08) data = PyString_FromString(type[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_power_supply_status(u8 code) { - /* 3.3.40.1 */ - static const char *status[]={ - "Other", /* 0x01 */ - "Unknown", - "OK", - "Non-critical", - "Critical" /* 0x05 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x05) data = PyString_FromString(status[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -static PyObject *dmi_power_supply_range_switching(u8 code) { - /* 3.3.40.1 */ - static const char *switching[]={ - "Other", /* 0x01 */ - "Unknown", - "Manual", - "Auto-switch", - "Wide Range", - "N/A" /* 0x06 */ - }; - PyObject *data; - - if(code>=0x01 && code<=0x06) data = PyString_FromString(switching[code-0x01]); - else data = OUT_OF_SPEC; - return data; -} - -/* -** 3.3.41 Additional Information (Type 40) -** -** Proper support of this entry type would require redesigning a large part of -** the code, so I am waiting to see actual implementations of it to decide -** whether it's worth the effort. -*/ - -static PyObject *dmi_additional_info(const struct dmi_header *h, const char *prefix) { - u8 *p = h->data + 4; - u8 count = *p++; - u8 length; - int i, offset = 5; - PyObject *data = PyList_New(count); - - for(i=0; ilength < offset + 1) break; - length = p[0x00]; - if (length < 0x05 || h->length < offset + length) break; - - PyDict_SetItemString(subdata, - "Referenced Handle", - PyString_FromFormat("0x%04x", WORD(p + 0x01)) - ); - - PyDict_SetItemString(subdata, - "Referenced Offset", - PyString_FromFormat("0x%02x", p[0x03]) - ); - - PyDict_SetItemString(subdata, - "String", - dmi_string_py(h, p[0x04]) - ); - - PyObject *_val; - switch (length - 0x05) { - case 1: - _val = PyString_FromFormat("0x%02x", p[0x05]); - break; - case 2: - _val = PyString_FromFormat("0x%04x", WORD(p + 0x05)); - break; - case 4: - _val = PyString_FromFormat("0x%08x", DWORD(p + 0x05)); - break; - default: - _val = PyString_FromString("Unexpected size"); - break; - } - PyDict_SetItemString(subdata, "Value", _val); - Py_DECREF(_val); - - p += length; - offset += length; - PyList_SET_ITEM(data, i, subdata); - } - return data; -} - -/******************************************************************************* -** Main -*/ - -PyObject* dmi_decode(struct dmi_header *h, u16 ver) { - - const u8 *data = h->data; - - //. 0xF1 --> 0xF100 - //int minor = h->type<<8; - char _[2048]; bzero(_, 2048); - //dmi_codes_major *dmiMajor = (dmi_codes_major *)&dmiCodesMajor[map_maj[h->type]]; - dmi_codes_major *dmiMajor = (dmi_codes_major *)&dmiCodesMajor[h->type]; - PyObject *pylist = PyDict_New(); - PyDict_SetItemString(pylist, "id", PyString_FromString(dmiMajor->id)); - PyDict_SetItemString(pylist, "desc", PyString_FromString(dmiMajor->desc)); - PyObject *_val; //. A Temporary pointer (value) - PyObject *_key; //. Another temporary pointer (key) - PyObject *caseData = PyDict_New(); - - switch(h->type) { - - case 0: /* 3.3.1 BIOS Information */ - - if(h->length<0x12) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Vendor", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x05]); - PyDict_SetItemString(caseData, "Version", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x08]); - PyDict_SetItemString(caseData, "Release Date", _val); - Py_DECREF(_val); - - /* - * On IA-64, the BIOS base address will read 0 because - * there is no BIOS. Skip the base address and the - * runtime size in this case. - */ - if(WORD(data+0x06)!=0) { - _val = PyString_FromFormat("0x%04x0", WORD(data+0x06)); - PyDict_SetItemString(caseData, "Address", _val); - Py_DECREF(_val); - - _val = dmi_bios_runtime_size((0x10000-WORD(data+0x06))<<4); - PyDict_SetItemString(caseData, "Runtime Size", _val); - Py_DECREF(_val); - } - - _val = PyString_FromFormat("%i kB", (data[0x09]+1)<<6); - PyDict_SetItemString(caseData, "ROM Size", _val); - Py_DECREF(_val); - - _val = dmi_bios_characteristics(QWORD(data+0x0A)); - PyDict_SetItemString(caseData, "Characteristics", _val); - Py_DECREF(_val); - - if(h->length<0x13) break; - _val = dmi_bios_characteristics_x1(data[0x12]); - PyDict_SetItemString(caseData, "Characteristics x1", _val); - Py_DECREF(_val); - - if(h->length<0x14) break; - _val = dmi_bios_characteristics_x2(data[0x13]); - PyDict_SetItemString(caseData, "Characteristics x2", _val); - Py_DECREF(_val); - - if(h->length<0x18) break; - - if(data[0x14]!=0xFF && data[0x15]!=0xFF) { - _val = PyString_FromFormat("%i.%i", data[0x14], data[0x15]); - PyDict_SetItemString(caseData, "BIOS Revision", _val); - Py_DECREF(_val); - } - - if(data[0x16]!=0xFF && data[0x17]!=0xFF) { - _val = PyString_FromFormat("%i.%i", data[0x16], data[0x17]); - PyDict_SetItemString(caseData, "Firmware Revision", _val); - Py_DECREF(_val); - } - - break; - - case 1: /* 3.3.2 System Information */ - - if(h->length<0x08) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Manufacturer", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x05]); - PyDict_SetItemString(caseData, "Product Name", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x06]); - PyDict_SetItemString(caseData, "Version", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x07]); - PyDict_SetItemString(caseData, "Serial Number", _val); - Py_DECREF(_val); - - if(h->length<0x19) break; - _val = dmi_system_uuid_py(data+0x08, ver); - PyDict_SetItemString(caseData, "UUID", _val); - Py_DECREF(_val); - - _val = dmi_system_wake_up_type(data[0x18]); - PyDict_SetItemString(caseData, "Wake-Up Type", _val); - Py_DECREF(_val); - - if(h->length<0x1B) break; - _val = dmi_string_py(h, data[0x19]); - PyDict_SetItemString(caseData, "SKU Number", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x1A]); - PyDict_SetItemString(caseData, "Family", _val); - Py_DECREF(_val); - break; - - case 2: /* 3.3.3 Base Board Information */ - - if(h->length<0x08) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Manufacturer", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x05]); - PyDict_SetItemString(caseData, "Product Name", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x06]); - PyDict_SetItemString(caseData, "Version", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x07]); - PyDict_SetItemString(caseData, "Serial Number", _val); - Py_DECREF(_val); - - if(h->length<0x0F) break; - _val = dmi_string_py(h, data[0x08]); - PyDict_SetItemString(caseData, "Asset Tag", _val); - Py_DECREF(_val); - - _val = dmi_base_board_features(data[0x09]); - PyDict_SetItemString(caseData, "Features", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x0A]); - PyDict_SetItemString(caseData, "Location In Chassis", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%04x", WORD(data+0x0B)); - PyDict_SetItemString(caseData, "Chassis Handle", _val); - Py_DECREF(_val); - - _val = dmi_base_board_type(data[0x0D]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - if(h->length<0x0F+data[0x0E]*sizeof(u16)) break; - _val = dmi_base_board_handles(data[0x0E], data+0x0F); - PyDict_SetItemString(caseData, "Type ???", _val); - Py_DECREF(_val); - break; - - case 3: /* 3.3.4 Chassis Information */ - - if(h->length<0x09) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Manufacturer", _val); - Py_DECREF(_val); - - _val = dmi_chassis_type_py(data[0x05]&0x7F); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_chassis_lock(data[0x05]>>7); - PyDict_SetItemString(caseData, "Lock", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x06]); - PyDict_SetItemString(caseData, "Version", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x07]); - PyDict_SetItemString(caseData, "Serial Number", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x08]); - PyDict_SetItemString(caseData, "Asset Tag", _val); - Py_DECREF(_val); - - if(h->length<0x0D) break; - _val = dmi_chassis_state(data[0x09]); - PyDict_SetItemString(caseData, "Boot-Up State", _val); - Py_DECREF(_val); - - _val = dmi_chassis_state(data[0x0A]); - PyDict_SetItemString(caseData, "Power Supply State", _val); - Py_DECREF(_val); - - _val = dmi_chassis_state(data[0x0B]); - PyDict_SetItemString(caseData, "Thermal State", _val); - Py_DECREF(_val); - - _val = PyString_FromString(dmi_chassis_security_status(data[0x0C])); - PyDict_SetItemString(caseData, "Security Status", _val); - Py_DECREF(_val); - - if(h->length<0x11) break; - _val = PyString_FromFormat("0x%08x", DWORD(data+0x0D)); - PyDict_SetItemString(caseData, "OEM Information", _val); - Py_DECREF(_val); - - if(h->length<0x13) break; - _val = dmi_chassis_height(data[0x11]); - PyDict_SetItemString(caseData, "Height", _val); - Py_DECREF(_val); - - _val = dmi_chassis_power_cords(data[0x12]); - PyDict_SetItemString(caseData, "Number Of Power Cords", _val); - Py_DECREF(_val); - - if(h->length < 0x15) break; - if(h->length<0x15+data[0x13]*data[0x14]) break; - _val = dmi_chassis_elements(data[0x13], data[0x14], data+0x15); - PyDict_SetItemString(caseData, "Elements", _val); - Py_DECREF(_val); - - break; - - - case 4: /* 3.3.5 Processor Information */ - - if(h->length<0x1A) break; - - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Socket Designation", _val); - Py_DECREF(_val); - - _val = dmi_processor_type(data[0x05]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = PyString_FromString(dmi_processor_family(h)); - PyDict_SetItemString(caseData, "Family", _val); - Py_DECREF(_val); - - _val = dmi_processor_id(data[0x06], data+8, dmi_string(h, data[0x10])); - PyDict_SetItemString(_val, "Vendor", dmi_string_py(h, data[0x07])); - PyDict_SetItemString(caseData, "Manufacturer", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x10]); - PyDict_SetItemString(caseData, "Version", _val); - Py_DECREF(_val); - - _val = dmi_processor_voltage(data[0x11]); - PyDict_SetItemString(caseData, "Voltage", _val); - Py_DECREF(_val); - - _val = dmi_processor_frequency_py(data+0x12); - PyDict_SetItemString(caseData, "External Clock", _val); - Py_DECREF(_val); - - _val = dmi_processor_frequency_py(data+0x14); - PyDict_SetItemString(caseData, "Max Speed", _val); - Py_DECREF(_val); - - _val = dmi_processor_frequency_py(data+0x16); - PyDict_SetItemString(caseData, "Current Speed", _val); - Py_DECREF(_val); - - if(data[0x18]&(1<<6)) { - _val = PyString_FromFormat("Populated:%s", dmi_processor_status(data[0x18]&0x07)); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - } else { - _val = PyString_FromString("Populated:No"); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - } - _val = dmi_processor_upgrade(data[0x19]); - PyDict_SetItemString(caseData, "Upgrade", _val); - Py_DECREF(_val); - - if(h->length<0x20) break; - _val = dmi_processor_cache(WORD(data+0x1A), "L1", ver); - PyDict_SetItemString(caseData, "L1 Cache Handle", _val); - Py_DECREF(_val); - - _val = dmi_processor_cache(WORD(data+0x1C), "L2", ver); - PyDict_SetItemString(caseData, "L2 Cache Handle", _val); - Py_DECREF(_val); - - _val = dmi_processor_cache(WORD(data+0x1E), "L3", ver); - PyDict_SetItemString(caseData, "L3 Cache Handle", _val); - Py_DECREF(_val); - - if(h->length<0x23) break; - _val = dmi_string_py(h, data[0x20]); - PyDict_SetItemString(caseData, "Serial Number", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x21]); - PyDict_SetItemString(caseData, "Asset Tag", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x22]); - PyDict_SetItemString(caseData, "Part Number", _val); - Py_DECREF(_val); - - if(h->length<0x28) break; - if(data[0x23]!=0) { - _val = PyString_FromFormat("%i", data[0x23]); - PyDict_SetItemString(caseData, "Core Count", _val); - Py_DECREF(_val); - } - - if(data[0x24]!=0) { - _val = PyString_FromFormat("%i", data[0x24]); - PyDict_SetItemString(caseData, "Core Enabled", _val); - Py_DECREF(_val); - } - - if(data[0x25]!=0) { - _val = PyString_FromFormat("%i", data[0x25]); - PyDict_SetItemString(caseData, "Thread Count", _val); - Py_DECREF(_val); - } - - _val = dmi_processor_characteristics(WORD(data+0x26)); - PyDict_SetItemString(caseData, "Characteristics", _val); - Py_DECREF(_val); - break; - - case 5: /* 3.3.6 Memory Controller Information */ - - PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); - - if(h->length<0x0F) break; - _val = dmi_memory_controller_ed_method(data[0x04]); - PyDict_SetItemString(caseData, "Error Detecting Method", _val); - Py_DECREF(_val); - - _val = dmi_memory_controller_ec_capabilities(data[0x05]); - PyDict_SetItemString(caseData, "Error Correcting Capabilities", _val); - Py_DECREF(_val); - - _val = dmi_memory_controller_interleave(data[0x06]); - PyDict_SetItemString(caseData, "Supported Interleave", _val); - Py_DECREF(_val); - - _val = dmi_memory_controller_interleave(data[0x07]); - PyDict_SetItemString(caseData, "Current Interleave", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i MB", 1<length<0x0F+data[0x0E]*sizeof(u16)) break; - _val = dmi_memory_controller_slots(data[0x0E], data+0x0F); - PyDict_SetItemString(caseData, "Associated Memory Sluts", _val); - Py_DECREF(_val); - - if(h->length<0x10+data[0x0E]*sizeof(u16)) break; - _val = dmi_memory_controller_ec_capabilities(data[0x0F+data[0x0E]*sizeof(u16)]); - PyDict_SetItemString(caseData, "Enabled Error Correcting Capabilities", _val); - Py_DECREF(_val); - break; - - case 6: /* 3.3.7 Memory Module Information */ - - PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); - - if(h->length<0x0C) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Socket Designation", _val); - Py_DECREF(_val); - - _val = dmi_memory_module_connections(data[0x05]); - PyDict_SetItemString(caseData, "Bank Connections", _val); - Py_DECREF(_val); - - _val = dmi_memory_module_speed(data[0x06]); - PyDict_SetItemString(caseData, "Current Speed", _val); - Py_DECREF(_val); - - _val = dmi_memory_module_types(WORD(data+0x07)); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_memory_module_size(data[0x09]); - PyDict_SetItemString(caseData, "Installed Size", _val); - Py_DECREF(_val); - - _val = dmi_memory_module_size(data[0x0A]); - PyDict_SetItemString(caseData, "Enabled Size", _val); - Py_DECREF(_val); - - _val = dmi_memory_module_error(data[0x0B]); - PyDict_SetItemString(caseData, "Error Status", _val); - Py_DECREF(_val); - break; - - case 7: /* 3.3.8 Cache Information */ - - PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); - - if(h->length<0x0F) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Socket Designation", _val); - Py_DECREF(_val); - - _val = PyDict_New(); - PyDict_SetItemString(_val, "Enabled", WORD(data+0x05)&0x0080?Py_True:Py_False); - PyDict_SetItemString(_val, "Socketed", WORD(data+0x05)&0x0008?Py_True:Py_False); - PyDict_SetItemString(_val, "Level", PyInt_FromLong((WORD(data+0x05)&0x0007)+1)); - PyDict_SetItemString(caseData, "Configuration" , _val); - Py_DECREF(_val); - - _val = dmi_cache_mode((WORD(data+0x05)>>8)&0x0003); - PyDict_SetItemString(caseData, "Operational Mode", _val); - Py_DECREF(_val); - - _val = dmi_cache_location((WORD(data+0x05)>>5)&0x0003); - PyDict_SetItemString(caseData, "Location", _val); - Py_DECREF(_val); - - _val = dmi_cache_size(WORD(data+0x09)); - PyDict_SetItemString(caseData, "Installed Size", _val); - Py_DECREF(_val); - - _val = dmi_cache_size(WORD(data+0x07)); - PyDict_SetItemString(caseData, "Maximum Size", _val); - Py_DECREF(_val); - - _val = dmi_cache_types(WORD(data+0x0B)); - PyDict_SetItemString(caseData, "Supported SRAM Types", _val); - Py_DECREF(_val); - - _val = dmi_cache_types(WORD(data+0x0D)); - PyDict_SetItemString(caseData, "Installed SRAM Type", _val); - Py_DECREF(_val); - - if(h->length<0x13) break; - _val = dmi_memory_module_speed(data[0x0F]); - PyDict_SetItemString(caseData, "Speed", _val); - Py_DECREF(_val); - - _val = dmi_cache_ec_type(data[0x10]); - PyDict_SetItemString(caseData, "Error Correction Type", _val); - Py_DECREF(_val); - - _val = dmi_cache_type(data[0x11]); - PyDict_SetItemString(caseData, "System Type", _val); - Py_DECREF(_val); - - _val = dmi_cache_associativity(data[0x12]); - PyDict_SetItemString(caseData, "Associativity", _val); - Py_DECREF(_val); - - break; - - case 8: /* 3.3.9 Port Connector Information */ - - PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); - - if(h->length<0x09) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Internal Reference Designator", _val); - Py_DECREF(_val); - - _val = dmi_port_connector_type(data[0x05]); - PyDict_SetItemString(caseData, "Internal Connector Type", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x06]); - PyDict_SetItemString(caseData, "External Reference Designator", _val); - Py_DECREF(_val); - - _val = dmi_port_connector_type(data[0x07]); - PyDict_SetItemString(caseData, "External Connector Type", _val); - Py_DECREF(_val); - - _val = dmi_port_type(data[0x08]); - PyDict_SetItemString(caseData, "Port Type", _val); - Py_DECREF(_val); - - break; - - case 9: /* 3.3.10 System Slots */ - - PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); - - if(h->length<0x0C) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Designation", _val); - Py_DECREF(_val); - - _val = dmi_slot_bus_width(data[0x06]); - PyDict_SetItemString(caseData, "Type:SlotBusWidth", _val); - Py_DECREF(_val); - _val = dmi_slot_type(data[0x05]); - PyDict_SetItemString(caseData, "Type:SlotType", _val); - Py_DECREF(_val); - - _val = dmi_slot_current_usage(data[0x07]); - PyDict_SetItemString(caseData, "Current Usage", _val); - Py_DECREF(_val); - - _val = dmi_slot_length(data[0x08]); - PyDict_SetItemString(caseData, "SlotLength", _val); - Py_DECREF(_val); - _val = dmi_slot_id(data[0x09], data[0x0A], data[0x05]); - PyDict_SetItemString(caseData, "SlotId", _val); - Py_DECREF(_val); - - _val = (h->length<0x0D)?dmi_slot_characteristics(data[0x0B], 0x00):dmi_slot_characteristics(data[0x0B], data[0x0C]); - PyDict_SetItemString(caseData, "Characteristics", _val); - Py_DECREF(_val); - break; - - case 10: /* 3.3.11 On Board Devices Information */ - - PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); - - break; - - case 11: /* 3.3.12 OEM Strings */ - - PyDict_SetItemString(caseData, "dmi_on_board_devices", dmi_on_board_devices(h)); - - if(h->length<0x05) break; - _val = dmi_oem_strings(h); - PyDict_SetItemString(caseData, "Strings", _val); - Py_DECREF(_val); - - break; - - case 12: /* 3.3.13 System Configuration Options */ - - if(h->length<0x05) break; - _val = dmi_system_configuration_options(h); - PyDict_SetItemString(caseData, "Options", _val); - Py_DECREF(_val); - - break; - - case 13: /* 3.3.14 BIOS Language Information */ - - if(h->length<0x16) break; - _val = PyString_FromFormat("%i", data[0x04]); - PyDict_SetItemString(caseData, "Installable Languages", _val); - Py_DECREF(_val); - - _val = dmi_bios_languages(h); - PyList_SET_ITEM(_val, 0, dmi_string_py(h, data[0x15])); - PyDict_SetItemString(caseData, "Currently Installed Language", _val); - Py_DECREF(_val); - - break; - - case 14: /* 3.3.15 Group Associations */ - - if(h->length<0x05) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Name", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i", (h->length-0x05)/3); - PyDict_SetItemString(caseData, "Items", _val); - Py_DECREF(_val); - - _val = dmi_group_associations_items((h->length-0x05)/3, data+0x05); - PyDict_SetItemString(caseData, "Items2", _val); //. FIXME: Title - Py_DECREF(_val); - break; - - case 15: /* 3.3.16 System Event Log */ - - if(h->length<0x14) break; - _val = PyString_FromFormat("%i bytes", WORD(data+0x04)); - PyDict_SetItemString(caseData, "Area Length", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%04x", WORD(data+0x06)); - PyDict_SetItemString(caseData, "Header Start Offset", _val); - Py_DECREF(_val); - - if(WORD(data+0x08)-WORD(data+0x06)) { - _val = PyString_FromFormat("%i byte%s", WORD(data+0x08)-WORD(data+0x06), WORD(data+0x08)-WORD(data+0x06)>1?"s":""); - PyDict_SetItemString(caseData, "Header Length", _val); - Py_DECREF(_val); - } - - _val = PyString_FromFormat("0x%04x", WORD(data+0x08)); - PyDict_SetItemString(caseData, "Data Start Offset", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%s", dmi_event_log_method(data[0x0A])); - PyDict_SetItemString(caseData, "Access Method", _val); - Py_DECREF(_val); - - _val = dmi_event_log_address_py(data[0x0A], data+0x10); - PyDict_SetItemString(caseData, "Access Address", _val); - Py_DECREF(_val); - - _val = dmi_event_log_status_py(data[0x0B]); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%08x", DWORD(data+0x0C)); - PyDict_SetItemString(caseData, "Change Token", _val); - Py_DECREF(_val); - - if(h->length<0x17) break; - _val = PyString_FromFormat("%s", dmi_event_log_header_type(data[0x14])); - PyDict_SetItemString(caseData, "Header Format", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i", data[0x15]); - PyDict_SetItemString(caseData, "Supported Log Type Descriptors", _val); - Py_DECREF(_val); - - if(h->length<0x17+data[0x15]*data[0x16]) break; - _val = dmi_event_log_descriptors(data[0x15], data[0x16], data+0x17); - PyDict_SetItemString(caseData, "DMI Event Log Descriptors", _val); - Py_DECREF(_val); - - break; - - case 16: /* 3.3.17 Physical Memory Array */ - - if(h->length<0x0F) break; - _val = dmi_memory_array_location(data[0x04]); - PyDict_SetItemString(caseData, "Location", _val); - Py_DECREF(_val); - - _val = dmi_memory_array_use(data[0x05]); - PyDict_SetItemString(caseData, "Use", _val); - Py_DECREF(_val); - - _val = dmi_memory_array_ec_type(data[0x06]); - PyDict_SetItemString(caseData, "Error Correction Type", _val); - Py_DECREF(_val); - - _val = dmi_memory_array_capacity(DWORD(data+0x07)); - PyDict_SetItemString(caseData, "Maximum Capacity", _val); - Py_DECREF(_val); - - _val = dmi_memory_array_error_handle(WORD(data+0x0B)); - PyDict_SetItemString(caseData, "Error Information Handle", _val); - Py_DECREF(_val); - - _val = PyInt_FromLong(WORD(data+0x0D)); - PyDict_SetItemString(caseData, "Number Of Devices", _val); - Py_DECREF(_val); - break; - - - case 17: /* 3.3.18 Memory Device */ - - if(h->length<0x15) break; - _val = PyString_FromFormat("0x%04x", WORD(data+0x04)); - PyDict_SetItemString(caseData, "Array Handle", _val); - Py_DECREF(_val); - - _val = dmi_memory_array_error_handle(WORD(data+0x06)); - PyDict_SetItemString(caseData, "Error Information Handle", _val); - Py_DECREF(_val); - - _val = dmi_memory_device_width(WORD(data+0x08)); - PyDict_SetItemString(caseData, "Total Width", _val); - Py_DECREF(_val); - - _val = dmi_memory_device_width(WORD(data+0x0A)); - PyDict_SetItemString(caseData, "Data Width", _val); - Py_DECREF(_val); - - _val = dmi_memory_device_size(WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Size", _val); - Py_DECREF(_val); - - _val = dmi_memory_device_form_factor(data[0x0E]); - PyDict_SetItemString(caseData, "Form Factor", _val); - Py_DECREF(_val); - - _val = dmi_memory_device_set(data[0x0F]); - PyDict_SetItemString(caseData, "Set", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x10]); - PyDict_SetItemString(caseData, "Locator", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x11]); - PyDict_SetItemString(caseData, "Bank Locator", _val); - Py_DECREF(_val); - - _val = dmi_memory_device_type(data[0x12]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_memory_device_type_detail(WORD(data+0x13)); - PyDict_SetItemString(caseData, "Type Detail", _val); - Py_DECREF(_val); - - if(h->length<0x17) break; - _val = dmi_memory_device_speed(WORD(data+0x15)); - PyDict_SetItemString(caseData, "Speed", _val); - Py_DECREF(_val); - - if(h->length<0x1B) break; - _val = dmi_string_py(h, data[0x17]); - PyDict_SetItemString(caseData, "Manufacturer", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x18]); - PyDict_SetItemString(caseData,"Serial Number" , _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x19]); - PyDict_SetItemString(caseData, "Asset Tag", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x1A]); - PyDict_SetItemString(caseData, "Part Number", _val); - Py_DECREF(_val); - break; - - case 18: /* 3.3.19 32-bit Memory Error Information */ - - if(h->length<0x17) break; - _val = dmi_memory_error_type(data[0x04]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_memory_error_granularity(data[0x05]); - PyDict_SetItemString(caseData, "Granularity", _val); - Py_DECREF(_val); - - _val = dmi_memory_error_operation(data[0x06]); - PyDict_SetItemString(caseData, "Operation", _val); - Py_DECREF(_val); - - _val = dmi_memory_error_syndrome(DWORD(data+0x07)); - PyDict_SetItemString(caseData, "Vendor Syndrome", _val); - Py_DECREF(_val); - - _val = dmi_32bit_memory_error_address(DWORD(data+0x0B)); - PyDict_SetItemString(caseData, "Memory Array Address", _val); - Py_DECREF(_val); - - _val = dmi_32bit_memory_error_address(DWORD(data+0x0F)); - PyDict_SetItemString(caseData, "Device Address", _val); - Py_DECREF(_val); - - _val = dmi_32bit_memory_error_address(DWORD(data+0x13)); - PyDict_SetItemString(caseData, "Resolution", _val); - Py_DECREF(_val); - break; - - case 19: /* 3.3.20 Memory Array Mapped Address */ - - if(h->length<0x0F) break; - _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x04)>>2, (DWORD(data+0x04)&0x3)<<10); - PyDict_SetItemString(caseData, "Starting Address", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x08)>>2, ((DWORD(data+0x08)&0x3)<<10)+0x3FF); - PyDict_SetItemString(caseData, "Ending Address", _val); - Py_DECREF(_val); - - _val = dmi_mapped_address_size(DWORD(data+0x08)-DWORD(data+0x04)+1); - PyDict_SetItemString(caseData, "Range Size", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%04x", WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Physical Array Handle", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i", data[0x0F]); - PyDict_SetItemString(caseData, "Partition Width", _val); - Py_DECREF(_val); - break; - - case 20: /* 3.3.21 Memory Device Mapped Address */ - - if(h->length<0x13) break; - _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x04)>>2, (DWORD(data+0x04)&0x3)<<10); - PyDict_SetItemString(caseData, "Starting Address", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%08x%03x", DWORD(data+0x08)>>2, ((DWORD(data+0x08)&0x3)<<10)+0x3FF); - PyDict_SetItemString(caseData, "Ending Address", _val); - Py_DECREF(_val); - - _val = dmi_mapped_address_size(DWORD(data+0x08)-DWORD(data+0x04)+1); - PyDict_SetItemString(caseData, "Range Size", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%04x", WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Physical Device Handle", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%04x", WORD(data+0x0E)); - PyDict_SetItemString(caseData, "Memory Array Mapped Address Handle", _val); - Py_DECREF(_val); - - _val = dmi_mapped_address_row_position(data[0x10]); - PyDict_SetItemString(caseData, "Partition Row Position", _val); - Py_DECREF(_val); - - _val = dmi_mapped_address_interleave_position(data[0x11]); - PyDict_SetItemString(caseData, ">>>", _val); - Py_DECREF(_val); - - _val = dmi_mapped_address_interleaved_data_depth(data[0x12]); - PyDict_SetItemString(caseData, ">>>", _val); - Py_DECREF(_val); - break; - - case 21: /* 3.3.22 Built-in Pointing Device */ - - if(h->length<0x07) break; - _val = dmi_pointing_device_type(data[0x04]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_pointing_device_interface(data[0x05]); - PyDict_SetItemString(caseData, "Interface", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i", data[0x06]); - PyDict_SetItemString(caseData, "Buttons", _val); - Py_DECREF(_val); - break; - - case 22: /* 3.3.23 Portable Battery */ - - if(h->length<0x10) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Location", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x05]); - PyDict_SetItemString(caseData, "Manufacturer", _val); - Py_DECREF(_val); - - if(data[0x06] || h->length<0x1A) { - _val = dmi_string_py(h, data[0x06]); - PyDict_SetItemString(caseData, "Manufacture Date", _val); - Py_DECREF(_val); - } - - if(data[0x07] || h->length<0x1A) { - _val = dmi_string_py(h, data[0x07]); - PyDict_SetItemString(caseData, "Serial Number", _val); - Py_DECREF(_val); - } - - _val = dmi_string_py(h, data[0x08]); - PyDict_SetItemString(caseData, "Name", _val); - Py_DECREF(_val); - - if(data[0x09]!=0x02 || h->length<0x1A) { - _val = dmi_battery_chemistry(data[0x09]); - PyDict_SetItemString(caseData, "Chemistry", _val); - Py_DECREF(_val); - } - _val = (h->length<0x1A)?dmi_battery_capacity(WORD(data+0x0A), 1):dmi_battery_capacity(WORD(data+0x0A), data[0x15]); - PyDict_SetItemString(caseData, "Design Capacity", _val); - Py_DECREF(_val); - - _val = dmi_battery_voltage(WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Design Voltage", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x0E]); - PyDict_SetItemString(caseData, "SBDS Version", _val); - Py_DECREF(_val); - - _val = dmi_battery_maximum_error(data[0x0F]); - PyDict_SetItemString(caseData, "Maximum Error", _val); - Py_DECREF(_val); - - if(h->length<0x1A) break; - if(data[0x07]==0) { - _val = PyString_FromFormat("%04x", WORD(data+0x10)); - PyDict_SetItemString(caseData, "SBDS Serial Number", _val); - Py_DECREF(_val); - } - if(data[0x06]==0) { - _val = PyString_FromFormat("%i-%02u-%02u", 1980+(WORD(data+0x12)>>9), (WORD(data+0x12)>>5)&0x0F, WORD(data+0x12)&0x1F); - PyDict_SetItemString(caseData, "SBDS Manufacture Date", _val); - Py_DECREF(_val); - } - if(data[0x09]==0x02) { - _val = dmi_string_py(h, data[0x14]); - PyDict_SetItemString(caseData, "SBDS Chemistry", _val); - Py_DECREF(_val); - } - - _val = PyString_FromFormat("0x%08x", DWORD(data+0x16)); - PyDict_SetItemString(caseData, "OEM-specific Information", _val); - Py_DECREF(_val); - break; - - case 23: /* 3.3.24 System Reset */ - - if(h->length<0x0D) break; - _val = PyString_FromFormat("%s", data[0x04]&(1<<0)?"Enabled":"Disabled"); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%s", data[0x04]&(1<<5)?"Present":"Not Present"); - PyDict_SetItemString(caseData, "Watchdog Timer", _val); - Py_DECREF(_val); - - if(!(data[0x04]&(1<<5))) break; - _val = dmi_system_reset_boot_option((data[0x04]>>1)&0x3); - PyDict_SetItemString(caseData, "Boot Option", _val); - Py_DECREF(_val); - - _val = dmi_system_reset_boot_option((data[0x04]>>3)&0x3); - PyDict_SetItemString(caseData, "Boot Option On Limit", _val); - Py_DECREF(_val); - - _val = dmi_system_reset_count(WORD(data+0x05)); - PyDict_SetItemString(caseData, "Reset Count", _val); - Py_DECREF(_val); - - _val = dmi_system_reset_count(WORD(data+0x07)); - PyDict_SetItemString(caseData, "Reset Limit", _val); - Py_DECREF(_val); - - _val = dmi_system_reset_timer(WORD(data+0x09)); - PyDict_SetItemString(caseData, "Timer Interval", _val); - Py_DECREF(_val); - - _val = dmi_system_reset_timer(WORD(data+0x0B)); - PyDict_SetItemString(caseData, "Timeout", _val); - Py_DECREF(_val); - - break; - - case 24: /* 3.3.25 Hardware Security */ - - if(h->length<0x05) break; - _val = dmi_hardware_security_status(data[0x04]>>6); - PyDict_SetItemString(caseData, "Power-On Password Status", _val); - Py_DECREF(_val); - - _val = dmi_hardware_security_status((data[0x04]>>4)&0x3); - PyDict_SetItemString(caseData, "Keyboard Password Status", _val); - Py_DECREF(_val); - - _val = dmi_hardware_security_status((data[0x04]>>2)&0x3); - PyDict_SetItemString(caseData, "Administrator Password Status", _val); - Py_DECREF(_val); - - _val = dmi_hardware_security_status(data[0x04]&0x3); - PyDict_SetItemString(caseData, "Front Panel Reset Status", _val); - Py_DECREF(_val); - - break; - - case 25: /* 3.3.26 System Power Controls */ - - if(h->length<0x09) break; - _val = dmi_power_controls_power_on(data+0x04); - PyDict_SetItemString(caseData, "Next Scheduled Power-on", _val); - Py_DECREF(_val); - - break; - - case 26: /* 3.3.27 Voltage Probe */ - - if(h->length<0x14) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Description", _val); - Py_DECREF(_val); - - _val = dmi_voltage_probe_location(data[0x05]&0x1f); - PyDict_SetItemString(caseData, "Location", _val); - Py_DECREF(_val); - - _val = dmi_probe_status(data[0x05]>>5); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - - _val = dmi_voltage_probe_value(WORD(data+0x06)); - PyDict_SetItemString(caseData, "Maximum Value", _val); - Py_DECREF(_val); - - _val = dmi_voltage_probe_value(WORD(data+0x08)); - PyDict_SetItemString(caseData, "Minimum Value", _val); - Py_DECREF(_val); - - _val = dmi_voltage_probe_resolution(WORD(data+0x0A)); - PyDict_SetItemString(caseData, "Resolution", _val); - Py_DECREF(_val); - - _val = dmi_voltage_probe_value(WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Tolerance", _val); - Py_DECREF(_val); - - _val = dmi_probe_accuracy(WORD(data+0x0E)); - PyDict_SetItemString(caseData, "Accuracy", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%08x", DWORD(data+0x10)); - PyDict_SetItemString(caseData, "OEM-specific Information", _val); - Py_DECREF(_val); - - if(h->length<0x16) break; - _val = dmi_voltage_probe_value(WORD(data+0x14)); - PyDict_SetItemString(caseData, "Nominal Value", _val); - Py_DECREF(_val); - - break; - - case 27: /* 3.3.28 Cooling Device */ - - if(h->length<0x0C) break; - if(WORD(data+0x04)!=0xFFFF) { - _val = PyString_FromFormat("0x%04x", WORD(data+0x04)); - PyDict_SetItemString(caseData, "Temperature Probe Handle", _val); - Py_DECREF(_val); - } - - _val = dmi_cooling_device_type(data[0x06]&0x1f); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_probe_status(data[0x06]>>5); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - - if(data[0x07]!=0x00) { - _val = PyString_FromFormat("%i", data[0x07]); - PyDict_SetItemString(caseData, "Cooling Unit Group", _val); - Py_DECREF(_val); - } - - _val = PyString_FromFormat("0x%08x", DWORD(data+0x08)); - PyDict_SetItemString(caseData, "OEM-specific Information", _val); - Py_DECREF(_val); - - if(h->length<0x0E) break; - _val = dmi_cooling_device_speed(WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Nominal Speed", _val); - Py_DECREF(_val); - - break; - - case 28: /* 3.3.29 Temperature Probe */ - - if(h->length<0x14) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Description", _val); - Py_DECREF(_val); - - _val = dmi_temperature_probe_location(data[0x05]&0x1F); - PyDict_SetItemString(caseData, "Location", _val); - Py_DECREF(_val); - - _val = dmi_probe_status(data[0x05]>>5); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - - _val = dmi_temperature_probe_value(WORD(data+0x06)); - PyDict_SetItemString(caseData, "Maximum Value", _val); - Py_DECREF(_val); - - _val = dmi_temperature_probe_value(WORD(data+0x08)); - PyDict_SetItemString(caseData, "Minimum Value", _val); - Py_DECREF(_val); - - _val = dmi_temperature_probe_resolution(WORD(data+0x0A)); - PyDict_SetItemString(caseData, "Resolution", _val); - Py_DECREF(_val); - - _val = dmi_temperature_probe_value(WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Tolerance", _val); - Py_DECREF(_val); - - _val = dmi_probe_accuracy(WORD(data+0x0E)); - PyDict_SetItemString(caseData, "Accuracy", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%08x", DWORD(data+0x10)); - PyDict_SetItemString(caseData, "OEM-specific Information", _val); - Py_DECREF(_val); - - if(h->length<0x16) break; - _val = dmi_temperature_probe_value(WORD(data+0x14)); - PyDict_SetItemString(caseData, "Nominal Value", _val); - Py_DECREF(_val); - - break; - - case 29: /* 3.3.30 Electrical Current Probe */ - - if(h->length<0x14) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Description", _val); - Py_DECREF(_val); - - _val = dmi_voltage_probe_location(data[5]&0x1F); - PyDict_SetItemString(caseData, "Location", _val); - Py_DECREF(_val); - - _val = dmi_probe_status(data[0x05]>>5); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - - _val = dmi_current_probe_value(WORD(data+0x06)); - PyDict_SetItemString(caseData, "Maximum Value", _val); - Py_DECREF(_val); - - _val = dmi_current_probe_value(WORD(data+0x08)); - PyDict_SetItemString(caseData, "Minimum Value", _val); - Py_DECREF(_val); - - _val = dmi_current_probe_resolution(WORD(data+0x0A)); - PyDict_SetItemString(caseData, "Resolution", _val); - Py_DECREF(_val); - - _val = dmi_current_probe_value(WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Tolerance", _val); - Py_DECREF(_val); - - _val = dmi_probe_accuracy(WORD(data+0x0E)); - PyDict_SetItemString(caseData, "Accuracy", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%08x", DWORD(data+0x10)); - PyDict_SetItemString(caseData, "OEM-specific Information", _val); - Py_DECREF(_val); - - if(h->length<0x16) break; - _val = dmi_current_probe_value(WORD(data+0x14)); - PyDict_SetItemString(caseData, "Nominal Value", _val); - Py_DECREF(_val); - - break; - - case 30: /* 3.3.31 Out-of-band Remote Access */ - - if(h->length<0x06) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Manufacturer Name", _val); - Py_DECREF(_val); - - _val = data[0x05]&(1<<0)?Py_True:Py_False; - PyDict_SetItemString(caseData, "Inbound Connection Enabled", _val); - Py_DECREF(_val); - - _val = data[0x05]&(1<<1)?Py_True:Py_False; - PyDict_SetItemString(caseData, "Outbound Connection Enabled", _val); - Py_DECREF(_val); - break; - - case 31: /* 3.3.32 Boot Integrity Services Entry Point */ - - break; - - case 32: /* 3.3.33 System Boot Information */ - - if(h->length<0x0B) break; - _val = dmi_system_boot_status(data[0x0A]); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - - break; - - case 33: /* 3.3.34 64-bit Memory Error Information */ - if(h->length<0x1F) break; - - _val = dmi_memory_error_type(data[0x04]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_memory_error_granularity(data[0x05]); - PyDict_SetItemString(caseData, "Granularity", _val); - Py_DECREF(_val); - - _val = dmi_memory_error_operation(data[0x06]); - PyDict_SetItemString(caseData, "Operation", _val); - Py_DECREF(_val); - - _val = dmi_memory_error_syndrome(DWORD(data+0x07)); - PyDict_SetItemString(caseData, "Vendor Syndrome", _val); - Py_DECREF(_val); - - _val = dmi_64bit_memory_error_address(QWORD(data+0x0B)); - PyDict_SetItemString(caseData, "Memory Array Address", _val); - Py_DECREF(_val); - - _val = dmi_64bit_memory_error_address(QWORD(data+0x13)); - PyDict_SetItemString(caseData, "Device Address", _val); - Py_DECREF(_val); - - _val = dmi_32bit_memory_error_address(DWORD(data+0x1B)); - PyDict_SetItemString(caseData, "Resolution", _val); - Py_DECREF(_val); - - break; - - case 34: /* 3.3.35 Management Device */ - - if(h->length<0x0B) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Description", _val); - Py_DECREF(_val); - - _val = dmi_management_device_type(data[0x05]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%08x", DWORD(data+0x06)); - PyDict_SetItemString(caseData, "Address", _val); - Py_DECREF(_val); - - _val = dmi_management_device_address_type(data[0x0A]); - PyDict_SetItemString(caseData, "Address Type", _val); - Py_DECREF(_val); - - break; - - case 35: /* 3.3.36 Management Device Component */ - - if(h->length<0x0B) break; - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(caseData, "Description", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%04x", WORD(data+0x05)); - PyDict_SetItemString(caseData, "Management Device Handle", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%04x", WORD(data+0x07)); - PyDict_SetItemString(caseData, "Component Handle", _val); - Py_DECREF(_val); - - if(WORD(data+0x09)!=0xFFFF) { - _val = PyString_FromFormat("0x%04x", WORD(data+0x09)); - PyDict_SetItemString(caseData, "Threshold Handle", _val); - Py_DECREF(_val); - } - - break; - - case 36: /* 3.3.37 Management Device Threshold Data */ - - if(h->length<0x10) break; - if(WORD(data+0x04)!=0x8000) { - _val = PyString_FromFormat("%d", (i16)WORD(data+0x04)); - PyDict_SetItemString(caseData, "Lower Non-critical Threshold", _val); - Py_DECREF(_val); - } - if(WORD(data+0x06)!=0x8000) { - _val = PyString_FromFormat("%d", (i16)WORD(data+0x06)); - PyDict_SetItemString(caseData, "Upper Non-critical Threshold", _val); - Py_DECREF(_val); - } - if(WORD(data+0x08)!=0x8000) { - _val = PyString_FromFormat("%d", (i16)WORD(data+0x08)); - PyDict_SetItemString(caseData, "Lower Critical Threshold", _val); - Py_DECREF(_val); - } - if(WORD(data+0x0A)!=0x8000) { - _val = PyString_FromFormat("%d", (i16)WORD(data+0x0A)); - PyDict_SetItemString(caseData, "Upper Critical Threshold", _val); - Py_DECREF(_val); - } - if(WORD(data+0x0C)!=0x8000) { - _val = PyString_FromFormat("%d", (i16)WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Lower Non-recoverable Threshold", _val); - Py_DECREF(_val); - } - if(WORD(data+0x0E)!=0x8000) { - _val = PyString_FromFormat("%d", (i16)WORD(data+0x0E)); - PyDict_SetItemString(caseData, "Upper Non-recoverable Threshold", _val); - Py_DECREF(_val); - } - - break; - - case 37: /* 3.3.38 Memory Channel */ - - if(h->length<0x07) break; - _val = dmi_memory_channel_type(data[0x04]); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i", data[0x05]); - PyDict_SetItemString(caseData, "Maximal Load", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i", data[0x06]); - PyDict_SetItemString(caseData, "Devices", _val); - Py_DECREF(_val); - - if(h->length<0x07+3*data[0x06]) break; - _val = dmi_memory_channel_devices(data[0x06], data+0x07); - PyDict_SetItemString(caseData, ">>>", _val); - Py_DECREF(_val); - - break; - - case 38: /* 3.3.39 IPMI Device Information */ - /* - * We use the word "Version" instead of "Revision", conforming to - * the IPMI specification. - */ - - if(h->length<0x10) break; - _val = dmi_ipmi_interface_type(data[0x04]); - PyDict_SetItemString(caseData, "Interface Type", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%i.%i", data[0x05]>>4, data[0x05]&0x0F); - PyDict_SetItemString(caseData, "Specification Version", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("0x%02x", data[0x06]>>1); - PyDict_SetItemString(caseData, "I2C Slave Address", _val); - Py_DECREF(_val); - - if(data[0x07]!=0xFF) { - _val = PyString_FromFormat("%i", data[0x07]); - PyDict_SetItemString(caseData, "NV Storage Device Address", _val); - Py_DECREF(_val); - } else { - _val = Py_None; - PyDict_SetItemString(caseData, "NV Storage Device: Not Present", _val); - Py_DECREF(_val); - } - - _val = dmi_ipmi_base_address(data[0x04], data+0x08, h->length<0x12?0:(data[0x10]>>5)&1); - PyDict_SetItemString(caseData, "Base Address", _val); - Py_DECREF(_val); - - if(h->length<0x12) break; - if(data[0x04]!=0x04) { - _val = dmi_ipmi_register_spacing(data[0x10]>>6); - PyDict_SetItemString(caseData, "Register Spacing", _val); - Py_DECREF(_val); - - if(data[0x10]&(1<<3)) { - _val = PyString_FromFormat("%s", data[0x10]&(1<<1)?"Active High":"Active Low"); - PyDict_SetItemString(caseData, "Interrupt Polarity", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%s", data[0x10]&(1<<0)?"Level":"Edge"); - PyDict_SetItemString(caseData, "Interrupt Trigger Mode", _val); - Py_DECREF(_val); - } - } - if(data[0x11]!=0x00) { - _val = PyString_FromFormat("%x", data[0x11]); - PyDict_SetItemString(caseData, "Interrupt Number", _val); - Py_DECREF(_val); - } - break; - - case 39: /* 3.3.40 System Power Supply */ - - if(h->length<0x10) break; - if(data[0x04]!=0x00) { - _val = PyString_FromFormat("%i", data[0x04]); - PyDict_SetItemString(caseData, "Power Unit Group", _val); - Py_DECREF(_val); - } - - _val = dmi_string_py(h, data[0x05]); - PyDict_SetItemString(caseData, "Location", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x06]); - PyDict_SetItemString(caseData, "Name", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x07]); - PyDict_SetItemString(caseData, "Manufacturer", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x08]); - PyDict_SetItemString(caseData, "Serial Numberr", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x09]); - PyDict_SetItemString(caseData, "Asset Tag", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x0A]); - PyDict_SetItemString(caseData, "Model Part Number", _val); - Py_DECREF(_val); - - _val = dmi_string_py(h, data[0x0B]); - PyDict_SetItemString(caseData, "Revision", _val); - Py_DECREF(_val); - - _val = dmi_power_supply_power(WORD(data+0x0C)); - PyDict_SetItemString(caseData, "Max Power Capacity", _val); - Py_DECREF(_val); - - if(WORD(data+0x0E)&(1<<1)) { - _val = dmi_power_supply_status((WORD(data+0x0E)>>7)&0x07); - PyDict_SetItemString(caseData, "Status Present", _val); - Py_DECREF(_val); - } else { - _val = PyString_FromString("Not Present"); - PyDict_SetItemString(caseData, "Status", _val); - Py_DECREF(_val); - } - _val = dmi_power_supply_type((WORD(data+0x0E)>>10)&0x0F); - PyDict_SetItemString(caseData, "Type", _val); - Py_DECREF(_val); - - _val = dmi_power_supply_range_switching((WORD(data+0x0E)>>3)&0x0F); - PyDict_SetItemString(caseData, "Input Voltage Range Switching", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%s", WORD(data+0x0E)&(1<<2)?"No":"Yes"); - PyDict_SetItemString(caseData, "Plugged", _val); - Py_DECREF(_val); - - _val = PyString_FromFormat("%s", WORD(data+0x0E)&(1<<0)?"Yes":"No"); - PyDict_SetItemString(caseData, "Hot Replaceable", _val); - Py_DECREF(_val); - - if(h->length<0x16) break; - if(WORD(data+0x10)!=0xFFFF) { - _val = PyString_FromFormat("0x%04x", WORD(data+0x10)); - PyDict_SetItemString(caseData, "Input Voltage Probe Handle", _val); - Py_DECREF(_val); - } - - if(WORD(data+0x12)!=0xFFFF) { - _val = PyString_FromFormat("0x%04x", WORD(data+0x12)); - PyDict_SetItemString(caseData, "Cooling Device Handle", _val); - Py_DECREF(_val); - } - - if(WORD(data+0x14)!=0xFFFF) { - _val = PyString_FromFormat("0x%04x", WORD(data+0x14)); - PyDict_SetItemString(caseData, "Input Current Probe Handle", _val); - Py_DECREF(_val); - } - - break; - - case 40: /* 3.3.41 Additional Information */ - if(h->length < 0x0B) break; - _key = PyString_FromFormat("Additional Information"); - _val = dmi_additional_info(h, ""); - PyDict_SetItem(caseData, _key, _val); - Py_DECREF(_key); - Py_DECREF(_val); - break; - - case 41: /* 3.3.42 Onboard Device Extended Information */ - if (h->length < 0x0B) break; - PyObject *subdata = PyDict_New(); - - _val = dmi_string_py(h, data[0x04]); - PyDict_SetItemString(subdata, "Reference Designation", _val); - Py_DECREF(_val); - - _val = PyString_FromString(dmi_on_board_devices_type(data[0x05] & 0x7F)); - PyDict_SetItemString(subdata, "Type", _val); - Py_DECREF(_val); - - _val = PyString_FromString(data[0x05]&0x80 ? "Enabled" : "Disabled"); - PyDict_SetItemString(subdata, "Status", _val); - Py_DECREF(_val); - - _val = PyInt_FromLong(data[0x06]); - PyDict_SetItemString(subdata, "Type Instance", _val); - Py_DECREF(_val); - - _val = dmi_slot_segment_bus_func(WORD(data + 0x07), data[0x09], data[0x0A]); - PyDict_SetItemString(subdata, "Bus Address", _val); - Py_DECREF(_val); - - PyDict_SetItemString(caseData, "Onboard Device", subdata); - Py_DECREF(subdata); - break; - - case 126: /* 3.3.43 Inactive */ - _val = Py_None; - PyDict_SetItemString(caseData, "Inactive", _val); - Py_DECREF(_val); - break; - - case 127: /* 3.3.44 End Of Table */ - _val = Py_None; - PyDict_SetItemString(caseData, "End Of Table", _val); - Py_DECREF(_val); - break; - - default: - if(dmi_decode_oem(h)) break; - _key = PyString_FromFormat("%s Type", h->type>=128?"OEM-specific":"Unknown"); - _val = dmi_dump(h); - PyDict_SetItem(caseData, _key, _val); - Py_DECREF(_key); - Py_DECREF(_val); - } - - Py_INCREF(caseData); - return caseData; -} - -void to_dmi_header(struct dmi_header *h, u8 *data) { - h->type=data[0]; - h->length=data[1]; - h->handle=WORD(data+2); - h->data=data; -} - -static void dmi_table_string_py(const struct dmi_header *h, const u8 *data, PyObject *hDict, u16 ver) { - int key; - u8 offset = opt.string->offset; - - if (offset >= h->length) return; - - //. TODO: These should have more meaningful dictionary names - key = (opt.string->type << 8) | offset; - PyObject *_val; - switch(key) { - case 0x108: - _val = dmi_system_uuid_py(data+offset, ver); - PyDict_SetItemString(hDict, "0x108", _val); - break; - case 0x305: - _val = dmi_chassis_type_py(data[offset]); - PyDict_SetItemString(hDict, "0x305", _val); - case 0x406: - _val = PyString_FromString(dmi_processor_family(h)); - PyDict_SetItemString(hDict, "0x406", _val); - break; - case 0x416: - _val = dmi_processor_frequency_py((u8 *)data + offset); - PyDict_SetItemString(hDict, "0x416", _val); - break; - default: - _val = dmi_string_py(h, data[offset]); - PyDict_SetItemString(hDict, "0x???", _val); - } - Py_DECREF(_val); -} - -/* -static void dmi_table_dump(u32 base, u16 len, const char *devmem) -{ - u8 *buf; - - if ((buf = mem_chunk(base, len, devmem)) == NULL) - { - fprintf(stderr, "Failed to read table, sorry.\n"); - return; - } - - printf("# Writing %d bytes to %s.\n", len, PyString_AS_STRING(opt.dumpfile)); - write_dump(32, len, buf, PyString_AS_STRING(opt.dumpfile), 0); - free(buf); -} -*/ - -/* - * Build a crafted entry point with table address hard-coded to 32, - * as this is where we will put it in the output file. We adjust the - * DMI checksum appropriately. The SMBIOS checksum needs no adjustment. - */ -static void overwrite_dmi_address(u8 *buf) { - buf[0x05] += buf[0x08] + buf[0x09] + buf[0x0A] + buf[0x0B] - 32; - buf[0x08] = 32; - buf[0x09] = 0; - buf[0x0A] = 0; - buf[0x0B] = 0; -} - - -#define NON_LEGACY 0 -#define LEGACY 1 -int dumpling(u8 *buf, const char *dumpfile, u8 mode) { - u32 base; - u16 len; - if(mode == NON_LEGACY) { - if(!checksum(buf, buf[0x05]) || !memcmp(buf+0x10, "_DMI_", 5)==0 || !checksum(buf+0x10, 0x0F)) return 0; - base = DWORD(buf+0x18); - len = WORD(buf+0x16); - } else { - if(!checksum(buf, 0x0F)) return 0; - base = DWORD(buf+0x08); - len = WORD(buf+0x06); - } - - u8 *buff; - if((buff = mem_chunk(base, len, DEFAULT_MEM_DEV)) != NULL) { - //. Part 1. - printf("# Writing %d bytes to %s.\n", len, dumpfile); - write_dump(32, len, buff, dumpfile, 0); - free(buff); - - //. Part 2. - if(mode != LEGACY) { - u8 crafted[32]; - memcpy(crafted, buf, 32); - overwrite_dmi_address(crafted+0x10); - printf("# Writing %d bytes to %s.\n", crafted[0x05], dumpfile); - write_dump(0, crafted[0x05], crafted, dumpfile, 1); - } else { - u8 crafted[16]; - memcpy(crafted, buf, 16); - overwrite_dmi_address(crafted); - printf("# Writing %d bytes to %s.\n", 0x0F, dumpfile); - write_dump(0, 0x0F, crafted, dumpfile, 1); - } - } else { - fprintf(stderr, "Failed to read table, sorry.\n"); - } - - //. TODO: Cleanup - return 1; -} - -int dump(const char *dumpfile) { - /* On success, return found, otherwise return -1 */ - int ret=0; - int found=0; - size_t fp; - int efi; - u8 *buf; - - /* First try EFI (ia64, Intel-based Mac) */ - efi = address_from_efi(&fp); - if(efi == EFI_NOT_FOUND) { - /* Fallback to memory scan (x86, x86_64) */ - if((buf=mem_chunk(0xF0000, 0x10000, DEFAULT_MEM_DEV))!=NULL) { - for(fp=0; fp<=0xFFF0; fp+=16) { - if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) { - if(dumpling(buf+fp, dumpfile, NON_LEGACY)) found++; - fp+=16; - } else if(memcmp(buf+fp, "_DMI_", 5)==0) { - if(dumpling(buf+fp, dumpfile, LEGACY)) found++; - } - } - } else ret = -1; - } else if(efi == EFI_NO_SMBIOS) { - ret = -1; - } else { - if((buf=mem_chunk(fp, 0x20, DEFAULT_MEM_DEV))==NULL) ret = -1; - else if(dumpling(buf, dumpfile, NON_LEGACY)) found++; - } - - if(ret==0) { - free(buf); - - //. TODO: Exception - //dmiSetItem(pydata, "detect", "No SMBIOS nor DMI entry point found, sorry G."); - if(!found) ret = -1; - } - - return ret==0?found:ret; -} - - - -static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, PyObject *pydata) { - u8 *buf; - u8 *data; - int i=0; - - if(opt.type==NULL) { - dmiSetItem(pydata, "dmi_table_size", "%i structures occupying %i bytes", num, len); - /* TODO DUMP - if (!(opt.flags & FLAG_FROM_DUMP)) - dmiSetItem(pydata, "dmi_table_base", "Table at 0x%08x", base); - */ - dmiSetItem(pydata, "dmi_table_base", "Table at 0x%08x", base); - } - - if((buf=mem_chunk(base, len, devmem))==NULL) { - fprintf(stderr, "Table is unreachable, sorry." -#ifndef USE_MMAP - "Try compiling dmidecode with -DUSE_MMAP."; -#endif - "\n"); - return; - } - - data=buf; - while(i39 && h.type<=127) - && !opt.string); - - /* - ** If a short entry is found (less than 4 bytes), not only it - ** is invalid, but we cannot reliably locate the next entry. - ** Better stop at this point, and let the user know his/her - ** table is broken. - */ - if(h.length<4) { - fprintf(stderr, "Invalid entry length (%i). DMI table is broken! Stop.", (unsigned int)h.length); - break; - } - - /* In quiet mode (FLAG_QUIET - removed for python-dmidecode all together), stop decoding at end of table marker */ - - char hid[7]; - sprintf(hid, "0x%04x", h.handle); - PyObject *hDict = PyDict_New(); - dmiSetItem(hDict, "dmi_handle", hid); - dmiSetItem(hDict, "dmi_type", "%d", h.type); - dmiSetItem(hDict, "dmi_size", "%d", h.length); - - /* assign vendor for vendor-specific decodes later */ - if(h.type==0 && h.length>=5) - dmi_set_vendor(dmi_string(&h, data[0x04])); - - /* look for the next handle */ - next=data+h.length; - while(next-buf+1"); - } else if(opt.string!=NULL && opt.string->type==h.type) { - dmi_table_string_py(&h, data, hDict, ver); - } - - data=next; - i++; - } - - if(i!=num) - fprintf(stderr, "Wrong DMI structures count: %d announced, only %d decoded.\n", num, i); - if(data-buf!=len) - fprintf(stderr, "Wrong DMI structures length: %d bytes announced, structures occupy %d bytes.\n", - len, (unsigned int)(data-buf)); - - free(buf); -} - - - - -int _smbios_decode_check(u8 *buf) { - int check = (!checksum(buf, buf[0x05]) || memcmp(buf + 0x10, "_DMI_", 5)!=0 || !checksum(buf+0x10, 0x0F)) ? 0 : 1; - return check; -} -int smbios_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata) { - int check = _smbios_decode_check(buf); - char vbuf[64]; bzero(vbuf, 64); - if(check == 1) { - u16 ver = (buf[0x06] << 8) + buf[0x07]; - /* Some BIOS report weird SMBIOS version, fix that up */ - int _m, _M; - _m = 0; - _M = 0; - switch(ver) { - case 0x021F: - _m = 31; - _M = 3; - ver = 0x0203; - break; - case 0x0233: - _m = 51; - _M = 6; - ver = 0x0206; - break; - } - if(_m || _M) sprintf(vbuf, "SMBIOS %i.%i present (Version fixup 2.%d -> 2.%d)", ver>>8, ver&0xFF, _m, _M); - else sprintf(vbuf, "SMBIOS %i.%i present", ver>>8, ver&0xFF); - } else if(check == 0) { - sprintf(vbuf, "No SMBIOS nor DMI entry point found"); - } - if(check == 1) { - if(*pydata) { Py_DECREF(*pydata); } - *pydata = PyString_FromString(vbuf); - Py_INCREF(*pydata); - } - return check; -} -int smbios_decode(u8 *buf, const char *devmem, PyObject* pydata) { - int check = _smbios_decode_check(buf); - if(check == 1) { - u16 ver = (buf[0x06] << 8) + buf[0x07]; - switch(ver) { - case 0x021F: - ver = 0x0203; - break; - case 0x0233: - ver = 0x0206; - break; - } - //printf(">>%d @ %d, %d<<\n", DWORD(buf+0x18), WORD(buf+0x16), WORD(buf+0x1C)); - dmi_table(DWORD(buf+0x18), WORD(buf+0x16), WORD(buf+0x1C), ver, devmem, pydata); - } - return check; -} - - - - -int _legacy_decode_check(u8 *buf) { - int check; - if(!checksum(buf, 0x0F)) check = 0; //. Bad - else check = 1; //. Good - return check; -} -int legacy_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata) { - int check = _legacy_decode_check(buf); - char vbuf[64]; bzero(vbuf, 64); - if(check == 1) { - sprintf(vbuf, "Legacy DMI %i.%i present", buf[0x0E]>>4, buf[0x0E]&0x0F); - } else if(check == 0) { - sprintf(vbuf, "No SMBIOS nor DMI entry point found"); - } - if(check == 1) { - if(*pydata) { Py_DECREF(*pydata); } - *pydata = PyString_FromString(vbuf); - Py_INCREF(*pydata); - } - return check; -} -int legacy_decode(u8 *buf, const char *devmem, PyObject* pydata) { - int check = _legacy_decode_check(buf); - if(check == 1) - dmi_table(DWORD(buf+0x08), WORD(buf+0x06), WORD(buf+0x0C), ((buf[0x0E]&0xF0)<<4)+(buf[0x0E]&0x0F), devmem, pydata); - return check; -} - - - - -/******************************************************************************* -** Probe for EFI interface -*/ -int address_from_efi(size_t *address) { - FILE *efi_systab; - const char *filename; - char linebuf[64]; - int ret; - - *address = 0; /* Prevent compiler warning */ - - /* - ** Linux <= 2.6.6: /proc/efi/systab - ** Linux >= 2.6.7: /sys/firmware/efi/systab - */ - if((efi_systab=fopen(filename="/sys/firmware/efi/systab", "r"))==NULL - && (efi_systab=fopen(filename="/proc/efi/systab", "r"))==NULL) { - /* No EFI interface, fallback to memory scan */ - return EFI_NOT_FOUND; - } - ret=EFI_NO_SMBIOS; - while((fgets(linebuf, sizeof(linebuf)-1, efi_systab))!=NULL) { - char *addrp=strchr(linebuf, '='); - *(addrp++)='\0'; - if(strcmp(linebuf, "SMBIOS")==0) { - *address=strtoul(addrp, NULL, 0); - printf("# SMBIOS entry point at 0x%08lx\n", (unsigned long)*address); - ret=0; - break; - } - } - if(fclose(efi_systab)!=0) - perror(filename); - - if(ret==EFI_NO_SMBIOS) - fprintf(stderr, "%s: SMBIOS entry point missing\n", filename); - - return ret; -} diff --git a/trunk/src/dmidecode.h b/trunk/src/dmidecode.h deleted file mode 100644 index 7e99faa..0000000 --- a/trunk/src/dmidecode.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of the dmidecode project. - * - * (C) 2005-2007 Jean Delvare - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include - -struct dmi_header { - u8 type; - u8 length; - u16 handle; - u8 *data; -}; - -PyObject *dmi_dump(struct dmi_header *h); -PyObject* dmi_decode(struct dmi_header *h, u16 ver); -int address_from_efi(size_t *address); -void to_dmi_header(struct dmi_header *h, u8 *data); -int smbios_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); -int smbios_decode(u8 *buf, const char *devmem, PyObject* pydata); -int legacy_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); -int legacy_decode(u8 *buf, const char *devmem, PyObject* pydata); - -const char *dmi_string(const struct dmi_header *dm, u8 s); -const char *dmi_system_uuid(u8 *p); -PyObject *dmi_system_uuid_py(const u8 *p, u16 ver); -const char *dmi_chassis_type(u8 code); -int dmi_processor_frequency(const u8 *p); - -int dump(const char *dumpfile); -int dumpling(u8 *buf, const char *devmem, u8 mode); diff --git a/trunk/src/dmidecodemodule.c b/trunk/src/dmidecodemodule.c deleted file mode 100644 index 345b151..0000000 --- a/trunk/src/dmidecodemodule.c +++ /dev/null @@ -1,305 +0,0 @@ -#include "dmidecodemodule.h" -#include - -options opt; -static void init(void) { - /* sanity check */ - if(sizeof(u8)!=1 || sizeof(u16)!=2 || sizeof(u32)!=4 || '\0'!=0) - fprintf(stderr, "%s: compiler incompatibility\n", "dmidecodemodule"); - - opt.devmem = DEFAULT_MEM_DEV; - opt.dumpfile = NULL; - opt.flags=0; - opt.type = NULL; -} - - -u8 *parse_opt_type(u8 *p, const char *arg) { - - /* Allocate memory on first call only */ - if(p == NULL) { - if(!(p = (u8 *)calloc(256, sizeof(u8)))) { - perror("calloc"); - return NULL; - } - } - - unsigned int i, j; - /* First try as a keyword */ - for(i = 0; i < ARRAY_SIZE(opt_type_keyword); i++) { - if(!strcasecmp(arg, opt_type_keyword[i].keyword)) { - j = 0; - while(opt_type_keyword[i].type[j] != 255) - p[opt_type_keyword[i].type[j++]] = 1; - return p; - } - } - - /* Else try as a number */ - while(*arg != '\0') { - unsigned long val; - char *next; - - val = strtoul(arg, &next, 0); - if(next == arg) { - fprintf(stderr, "Invalid type keyword: %s\n", arg); - free(p); - return NULL; - } - if (val > 0xff) { - fprintf(stderr, "Invalid type number: %lu\n", val); - free(p); - return NULL; - } - - p[val] = 1; - arg = next; - while(*arg == ',' || *arg == ' ') - arg++; - } - - return p; -} - - -static int dmidecode_set_version(PyObject** pydata) { - int ret=0; - int found=0; - size_t fp; - int efi; - u8 *buf; - - /* Set default option values */ - opt.devmem = DEFAULT_MEM_DEV; - - /***********************************/ - /* Read from dump if so instructed */ - if(opt.dumpfile != NULL) { - const char *dumpfile = PyString_AS_STRING(opt.dumpfile); - //. printf("Reading SMBIOS/DMI data from file %s.\n", dumpfile); - if((buf = mem_chunk(0, 0x20, dumpfile))!=NULL) { - if(memcmp(buf, "_SM_", 4)==0) { - if(smbios_decode_set_version(buf, dumpfile, pydata)) found++; - } else if (memcmp(buf, "_DMI_", 5)==0) { - if(legacy_decode_set_version(buf, dumpfile, pydata)) found++; - } - } else ret = 1; - } else { /* Read from /dev/mem */ - /* First try EFI (ia64, Intel-based Mac) */ - efi = address_from_efi(&fp); - if(efi == EFI_NOT_FOUND) { - /* Fallback to memory scan (x86, x86_64) */ - if((buf=mem_chunk(0xF0000, 0x10000, opt.devmem))!=NULL) { - for(fp=0; fp<=0xFFF0; fp+=16) { - if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) { - if(smbios_decode_set_version(buf+fp, opt.devmem, pydata)) found++; - fp+=16; - } else if(memcmp(buf+fp, "_DMI_", 5)==0) { - if(legacy_decode_set_version(buf+fp, opt.devmem, pydata)) found++; - } - } - } else ret = 1; - } else if(efi == EFI_NO_SMBIOS) { - ret = 1; - } else { - if((buf=mem_chunk(fp, 0x20, opt.devmem))==NULL) ret = 1; - else if(smbios_decode_set_version(buf, opt.devmem, pydata)) found++; - //. TODO: dmiSetItem(pydata, "efi_address", efiAddress); - } - } - - if(ret==0) { - free(buf); - if(!found) { - fprintf(stderr, "No SMBIOS nor DMI entry point found, sorry G."); - } - } - free(opt.type); - return ret; -} - - -static PyObject* dmidecode_get(PyObject *self, const char* section) { - //mtrace(); - - int ret=0; - int found=0; - size_t fp; - int efi; - u8 *buf; - - /* Set default option values */ - opt.devmem = DEFAULT_MEM_DEV; - opt.flags = 0; - opt.type = NULL; - opt.type = parse_opt_type(opt.type, section); - if(opt.type==NULL) return NULL; - - const char *f = opt.dumpfile ? PyString_AsString(opt.dumpfile) : opt.devmem; - if(access(f, R_OK) < 0) - PyErr_SetString(PyExc_IOError, "Permission denied to memory file/device"); - - PyObject* pydata = PyDict_New(); - - /***********************************/ - /* Read from dump if so instructed */ - if(opt.dumpfile != NULL) { - const char *dumpfile = PyString_AS_STRING(opt.dumpfile); - //. printf("Reading SMBIOS/DMI data from file %s.\n", dumpfile); - if((buf = mem_chunk(0, 0x20, dumpfile))!=NULL) { - if(memcmp(buf, "_SM_", 4)==0) { - if(smbios_decode(buf, dumpfile, pydata)) found++; - } else if (memcmp(buf, "_DMI_", 5)==0) { - if(legacy_decode(buf, dumpfile, pydata)) found++; - } - } else ret = 1; - } else { /* Read from /dev/mem */ - /* First try EFI (ia64, Intel-based Mac) */ - efi = address_from_efi(&fp); - if(efi == EFI_NOT_FOUND) { - /* Fallback to memory scan (x86, x86_64) */ - if((buf=mem_chunk(0xF0000, 0x10000, opt.devmem))!=NULL) { - for(fp=0; fp<=0xFFF0; fp+=16) { - if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) { - if(smbios_decode(buf+fp, opt.devmem, pydata)) { - found++; - fp+=16; - } - } else if(memcmp(buf+fp, "_DMI_", 5)==0) { - if(legacy_decode(buf+fp, opt.devmem, pydata)) found++; - } - } - } else ret = 1; - } else if(efi == EFI_NO_SMBIOS) { - ret = 1; - } else { - if((buf=mem_chunk(fp, 0x20, opt.devmem))==NULL) ret = 1; - else if(smbios_decode(buf, opt.devmem, pydata)) found++; - //. TODO: dmiSetItem(pydata, "efi_address", efiAddress); - } - } - - free(opt.type); - if(ret==0) { - free(buf); - } else { - Py_DECREF(pydata); - pydata = NULL; - } - - //muntrace(); - return pydata; -} - -static PyObject* dmidecode_get_bios(PyObject *self, PyObject *args) { return dmidecode_get(self, "bios"); } -static PyObject* dmidecode_get_system(PyObject *self, PyObject *args) { return dmidecode_get(self, "system"); } -static PyObject* dmidecode_get_baseboard(PyObject *self, PyObject *args) { return dmidecode_get(self, "baseboard"); } -static PyObject* dmidecode_get_chassis(PyObject *self, PyObject *args) { return dmidecode_get(self, "chassis"); } -static PyObject* dmidecode_get_processor(PyObject *self, PyObject *args) { return dmidecode_get(self, "processor"); } -static PyObject* dmidecode_get_memory(PyObject *self, PyObject *args) { return dmidecode_get(self, "memory"); } -static PyObject* dmidecode_get_cache(PyObject *self, PyObject *args) { return dmidecode_get(self, "cache"); } -static PyObject* dmidecode_get_connector(PyObject *self, PyObject *args) { return dmidecode_get(self, "connector"); } -static PyObject* dmidecode_get_slot(PyObject *self, PyObject *args) { return dmidecode_get(self, "slot"); } -static PyObject* dmidecode_get_type(PyObject *self, PyObject *args) { - long unsigned int lu; - if(PyArg_ParseTuple(args, (char *)"i", &lu)) { - if(lu < 256) { - char s[8]; - sprintf(s, "%lu", lu); - return dmidecode_get(self, s); - } - return Py_False; - } - return Py_None; -} - -static PyObject* dmidecode_dump(PyObject *self, PyObject *null) { - const char *f; - f = opt.dumpfile ? PyString_AsString(opt.dumpfile) : opt.devmem; - struct stat _buf; - stat(f, &_buf); - - if((access(f, F_OK) != 0) || ((access(f, W_OK) == 0) && S_ISREG(_buf.st_mode))) - if(dump(PyString_AS_STRING(opt.dumpfile))) - Py_RETURN_TRUE; - Py_RETURN_FALSE; -} - -static PyObject* dmidecode_get_dev(PyObject *self, PyObject *null) { - PyObject *dev; - if(opt.dumpfile != NULL) dev = opt.dumpfile; - else dev = PyString_FromString(opt.devmem); - Py_INCREF(dev); - return dev; -} - -static PyObject* dmidecode_set_dev(PyObject *self, PyObject *arg) { - if(PyString_Check(arg)) { - if(opt.dumpfile == arg) Py_RETURN_TRUE; - - struct stat buf; - char *f = PyString_AsString(arg); - stat(f, &buf); - if(opt.dumpfile) { Py_DECREF(opt.dumpfile); } - - if(S_ISCHR(buf.st_mode)) { - if(memcmp(PyString_AsString(arg), "/dev/mem", 8)==0) { - opt.dumpfile = NULL; - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } else if(!S_ISDIR(buf.st_mode)) { - opt.dumpfile = arg; - Py_INCREF(opt.dumpfile); - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - //PyErr_Occurred(); -} - -/* -typedef struct { - PyObject_HEAD char *version; -} ivars; - -static PyMemberDef DMIDataMembers[] = { - { (char *)"fred", T_STRING, offsetof(ivars, version), 0, "2.10" }, - { NULL } -}; -*/ - -static PyMethodDef DMIDataMethods[] = { - { (char *)"dump", dmidecode_dump, METH_NOARGS, (char *)"Dump dmidata to set file" }, - { (char *)"get_dev", dmidecode_get_dev, METH_NOARGS, (char *)"Get an alternative memory device file" }, - { (char *)"set_dev", dmidecode_set_dev, METH_O, (char *)"Set an alternative memory device file" }, - - { (char *)"bios", dmidecode_get_bios, METH_VARARGS, (char *)"BIOS Data" }, - { (char *)"system", dmidecode_get_system, METH_VARARGS, (char *)"System Data" }, - { (char *)"baseboard", dmidecode_get_baseboard, METH_VARARGS, (char *)"Baseboard Data" }, - { (char *)"chassis", dmidecode_get_chassis, METH_VARARGS, (char *)"Chassis Data" }, - { (char *)"processor", dmidecode_get_processor, METH_VARARGS, (char *)"Processor Data" }, - { (char *)"memory", dmidecode_get_memory, METH_VARARGS, (char *)"Memory Data" }, - { (char *)"cache", dmidecode_get_cache, METH_VARARGS, (char *)"Cache Data" }, - { (char *)"connector", dmidecode_get_connector, METH_VARARGS, (char *)"Connector Data" }, - { (char *)"slot", dmidecode_get_slot, METH_VARARGS, (char *)"Slot Data" }, - - { (char *)"type", dmidecode_get_type, METH_VARARGS, (char *)"By Type" }, - - { NULL, NULL, 0, NULL } -}; - -PyMODINIT_FUNC initdmidecode(void) { - init(); - - PyObject *module = Py_InitModule3((char *)"dmidecode", DMIDataMethods, "Python extension module for dmidecode"); - - PyObject *version = PyString_FromString("2.10"); - Py_INCREF(version); - PyModule_AddObject(module, "version", version); - - PyObject *dmi_version = NULL; - dmidecode_set_version(&dmi_version); - PyModule_AddObject(module, "dmi", dmi_version?dmi_version:Py_None); -} diff --git a/trunk/src/dmidecodemodule.h b/trunk/src/dmidecodemodule.h deleted file mode 100644 index cf1e5f4..0000000 --- a/trunk/src/dmidecodemodule.h +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "version.h" -#include "config.h" -#include "types.h" -#include "util.h" -#include "dmidecode.h" -#include "dmioem.h" - -#define EFI_NOT_FOUND (-1) -#define EFI_NO_SMBIOS (-2) - -#include "dmihelper.h" - -//extern void dmi_decode(struct dmi_header *h, u16 ver, PyObject* pydata); -extern PyObject *dmi_dump(struct dmi_header *h); -extern PyObject* dmi_decode(struct dmi_header *h, u16 ver); -extern int address_from_efi(size_t *address); -extern void to_dmi_header(struct dmi_header *h, u8 *data); -extern void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem); -extern int smbios_decode(u8 *buf, const char *devmem, PyObject* pydata); -extern int legacy_decode(u8 *buf, const char *devmem, PyObject* pydata); -extern int smbios_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); -extern int legacy_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); -extern void *mem_chunk(size_t base, size_t len, const char *devmem); - -extern u8 *parse_opt_type(u8 *p, const char *arg); -static const u8 opt_type_bios[] = { 0, 13, 255 }; -static const u8 opt_type_system[] = { 1, 12, 15, 23, 32, 255 }; -static const u8 opt_type_baseboard[] = { 2, 10, 255 }; -static const u8 opt_type_chassis[] = { 3, 255 }; -static const u8 opt_type_processor[] = { 4, 255 }; -static const u8 opt_type_memory[] = { 5, 6, 16, 17, 255 }; -static const u8 opt_type_cache[] = { 7, 255 }; -static const u8 opt_type_connector[] = { 8, 255 }; -static const u8 opt_type_slot[] = { 9, 255 }; -struct type_keyword { - const char *keyword; - const u8 *type; -}; - -static const struct type_keyword opt_type_keyword[] = { - { "bios", opt_type_bios }, - { "system", opt_type_system }, - { "baseboard", opt_type_baseboard }, - { "chassis", opt_type_chassis }, - { "processor", opt_type_processor }, - { "memory", opt_type_memory }, - { "cache", opt_type_cache }, - { "connector", opt_type_connector }, - { "slot", opt_type_slot }, -}; - -PyMODINIT_FUNC initdmidecode(void); diff --git a/trunk/src/dmihelper.c b/trunk/src/dmihelper.c deleted file mode 100644 index 6d52e04..0000000 --- a/trunk/src/dmihelper.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include - -#include "dmihelper.h" - -/* -dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...) { - static dmi_minor* last = NULL; - - //. int minor = code&0x00FF; - //. int major = code>>8; - - va_list arg; - va_start(arg, format); - - dmi_minor *o = (dmi_minor *)malloc(sizeof(dmi_minor)); - o->next = last; - o->id = code; - o->major = (dmi_codes_major *)&dmiCodesMajor[map_maj[code>>8]]; - o->key = (char *)key; - - if((format != NULL)&&(vsnprintf(o->value, MAXVAL-1, format, arg) > MAXVAL)) { - free(o); - o = NULL; - //. TODO: Make this a python exception. - printf("dmidecode: Internal (python module) error; Value too long.\n"); - } - - last = o; - va_end(arg); // cleanup - - return o; -} -*/ - -int dmiSetItem(PyObject* dict, const char *key, const char *format, ...) { - va_list arg; - va_start(arg, format); - char buffer[2048]; - vsprintf(buffer, format, arg); - va_end(arg); - //printf("DEBUG: Setting k:%s, f:%s s:%s...", key, format, buffer); - PyDict_SetItem(dict, PyString_FromString(key), PyString_FromString(buffer)); - //printf("Done.\n"); - return 0; -} - - -/* NOTE: Decomissioned helper function... -void dmiAppendData(PyObject *pydata, const int count) { - dmi_minor* last = dmiAppendObject(count, "JUNK", "NODATA"); - - const char *id = last->major->id; - PyObject *_key, *_val; - - PyObject *pymajor = PyDict_New(); - - _key = PyString_FromString("code"); - _val = PyInt_FromLong((long)last->major->code); - PyDict_SetItem(pymajor, _key, _val); - Py_DECREF(_key); - Py_DECREF(_val); - - _key = PyString_FromString("id"); - _val = PyString_FromString(last->major->id); - PyDict_SetItem(pymajor, _key, _val); - Py_DECREF(_key); - Py_DECREF(_val); - - _key = PyString_FromString("name"); - _val = PyString_FromString(last->major->desc); - PyDict_SetItem(pymajor, _key, _val); - Py_DECREF(_key); - Py_DECREF(_val); - - PyObject *pyminor = PyDict_New(); - while((last = last->next)) { - //printf("%d:<%s, %s> | %ld:[%s => %s]\n", last->major->code, last->major->id, last->major->desc, last->id, last->key, last->value); - _key = PyString_FromString(last->key); - _val = PyString_FromString(last->value); - PyDict_SetItem(pyminor, _key, _val); - Py_DECREF(_key); - Py_DECREF(_val); - } - _key = PyString_FromString("data"); - PyDict_SetItem(pymajor, _key, pyminor); - Py_DECREF(_key); - Py_DECREF(pyminor); - - _key = PyString_FromString(id); - PyDict_SetItem(pydata, _key, pymajor); - Py_DECREF(_key); - Py_DECREF(pymajor); -} -*/ - -/* NOTE: Decomissioned helper function... -int catsprintf(char *buf, const char *format, ...) { - if(format == NULL) { - bzero(buf, strlen(buf)); - return 0; - } - - va_list arg; // will point to each unnamed argument in turn - va_start(arg, format); // point to first element after fmt - - char b[8192]; - int c = vsprintf (b, format, arg); - - strcat(buf, b); - va_end(arg); // cleanp - - return c; -} -*/ diff --git a/trunk/src/dmihelper.h b/trunk/src/dmihelper.h deleted file mode 100644 index a056eb2..0000000 --- a/trunk/src/dmihelper.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef HELPER -#define HELPER 1 - -#include - -#include -#include -#include -#include -#include - -#include "types.h" - -#define MAXVAL 1024 - -static const int map_maj[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, -}; - -typedef struct _dmi_codes_major { - const unsigned short code; - const char *id; - const char *desc; -} dmi_codes_major; - -static const dmi_codes_major dmiCodesMajor[] = { - { 0, "3.3.1", "BIOS Information" }, - { 1, "3.3.2", "System Information" }, - { 2, "3.3.3", "Base Board Information" }, - { 3, "3.3.4", "Chassis Information" }, - { 4, "3.3.5", "Processor Information" }, - { 5, "3.3.6", "Memory Controller Information" }, - { 6, "3.3.7", "Memory Module Information" }, - { 7, "3.3.8", "Cache Information" }, - { 8, "3.3.9", "Port Connector Information" }, - { 9, "3.3.10", "System Slots" }, - { 10, "3.3.11", "On Board Devices Information" }, - { 11, "3.3.12", "OEM Strings" }, - { 12, "3.3.13", "System Configuration Options" }, - { 13, "3.3.14", "BIOS Language Information" }, - { 14, "3.3.15", "Group Associations" }, - { 15, "3.3.16", "System Event Log" }, - { 16, "3.3.17", "Physical Memory Array" }, - { 17, "3.3.18", "Memory Device" }, - { 18, "3.3.19", "32-bit Memory Error Information" }, - { 19, "3.3.20", "Memory Array Mapped Address" }, - { 20, "3.3.21", "Memory Device Mapped Address" }, - { 21, "3.3.22", "Built-in Pointing Device" }, - { 22, "3.3.23", "Portable Battery" }, - { 23, "3.3.24", "System Reset" }, - { 24, "3.3.25", "Hardware Security" }, - { 25, "3.3.26", "System Power Controls" }, - { 26, "3.3.27", "Voltage Probe" }, - { 27, "3.3.28", "Cooling Device" }, - { 28, "3.3.29", "Temperature Probe" }, - { 29, "3.3.30", "Electrical Current Probe" }, - { 30, "3.3.31", "Out-of-band Remote Access" }, - { 31, "3.3.32", "Boot Integrity Services Entry Point" }, - { 32, "3.3.33", "System Boot Information" }, - { 33, "3.3.34", "64-bit Memory Error Information" }, - { 34, "3.3.35", "Management Device" }, - { 35, "3.3.36", "Management Device Component" }, - { 36, "3.3.37", "Management Device Threshold Data" }, - { 37, "3.3.38", "Memory Channel" }, - { 38, "3.3.39", "IPMI Device Information" }, - { 39, "3.3.40", "System Power Supply" }, - { 40, "3.3.41", "-------------------" }, - { 41, "3.3.42", "-------------------" }, - { 126, "3.3.41", "Inactive" }, - { 127, "3.3.42", "End Of Table" }, -}; - -typedef struct _dmi_minor { - long id; - dmi_codes_major* major; - char *key; - char value[MAXVAL]; - struct _dmi_minor* next; -} dmi_minor; - -void dmiAppendData(PyObject *pydata, const int count); -int dmiSetItem(PyObject* dict, const char *key, const char *format, ...); -//dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...); - -/*** dmiopt.h ***/ -struct string_keyword { - const char *keyword; - u8 type; - u8 offset; -}; - -/*** dmiopt.h ***/ -typedef struct _options { - const char *devmem; - unsigned int flags; - u8 *type; - const struct string_keyword *string; - PyObject *dumpfile; -} options; -extern options opt; - -#endif diff --git a/trunk/src/dmioem.c b/trunk/src/dmioem.c deleted file mode 100644 index a2fd2a2..0000000 --- a/trunk/src/dmioem.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Decoding of OEM-specific entries - * This file is part of the dmidecode project. - * - * (C) 2007 Jean Delvare - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -#include "types.h" -#include "dmidecode.h" -#include "dmioem.h" - -/* - * Globals for vendor-specific decodes - */ - -enum DMI_VENDORS { VENDOR_UNKNOWN, VENDOR_HP }; - -static enum DMI_VENDORS dmi_vendor=VENDOR_UNKNOWN; - -/* - * Remember the system vendor for later use. We only actually store the - * value if we know how to decode at least one specific entry type for - * that vendor. - */ -void dmi_set_vendor(const char *s) -{ - if(strcmp(s, "HP")==0) - dmi_vendor=VENDOR_HP; -} - -/* - * HP-specific data structures are decoded here. - * - * Code contributed by John Cagle. - */ - -static int dmi_decode_hp(struct dmi_header *h) -{ - u8 *data=h->data; - int nic, ptr; - - switch(h->type) - { - case 204: - /* - * Vendor Specific: HP ProLiant System/Rack Locator - */ - printf("HP ProLiant System/Rack Locator\n"); - if(h->length<0x0B) break; - printf("\tRack Name: %s\n", dmi_string(h, data[0x04])); - printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05])); - printf("\tEnclosure Model: %s\n", dmi_string(h, data[0x06])); - printf("\tEnclosure Serial: %s\n", dmi_string(h, data[0x0A])); - printf("\tEnclosure Bays: %d\n", data[0x08]); - printf("\tServer Bay: %s\n", dmi_string(h, data[0x07])); - printf("\tBays Filled: %d\n", data[0x09]); - break; - - case 209: - case 221: - /* - * Vendor Specific: HP ProLiant NIC MAC Information - * - * This prints the BIOS NIC number, - * PCI bus/device/function, and MAC address - */ - printf(h->type==221? - "HP BIOS iSCSI NIC PCI and MAC Information\n": - "HP BIOS NIC PCI and MAC Information\n"); - nic=1; - ptr=4; - while(h->length>=ptr+8) - { - if(data[ptr]==0x00 && data[ptr+1]==0x00) - printf("\tNIC %d: Disabled\n", nic); - else if(data[ptr]==0xFF && data[ptr+1]==0xFF) - printf("\tNIC %d: Not Installed\n", nic); - else - { - printf("\tNIC %d: PCI device %02x:%02x.%x, " - "MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", - nic, data[ptr+1], data[ptr]>>3, data[ptr]&7, - data[ptr+2], data[ptr+3], - data[ptr+4], data[ptr+5], - data[ptr+6], data[ptr+7]); - } - nic++; - ptr+=8; - } - break; - - default: - return 0; - } - return 1; -} - -/* - * Dispatch vendor-specific entries decoding - * Return 1 if decoding was successful, 0 otherwise - */ -int dmi_decode_oem(struct dmi_header *h) -{ - switch(dmi_vendor) - { - case VENDOR_HP: - return dmi_decode_hp(h); - default: - return 0; - } -} diff --git a/trunk/src/dmioem.h b/trunk/src/dmioem.h deleted file mode 100644 index 00483f2..0000000 --- a/trunk/src/dmioem.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Decoding of OEM-specific entries - * This file is part of the dmidecode project. - * - * (C) 2007 Jean Delvare - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -struct dmi_header; - -void dmi_set_vendor(const char *s); -int dmi_decode_oem(struct dmi_header *h); diff --git a/trunk/src/setup-dbg.py b/trunk/src/setup-dbg.py deleted file mode 100644 index 1a23240..0000000 --- a/trunk/src/setup-dbg.py +++ /dev/null @@ -1,25 +0,0 @@ -from distutils.core import setup, Extension - -setup( - name = "python-dmidecode-dbg", - version = "2.10.3", - description = "Python extension module for dmidecode", - author = "Nima Talebi", - author_email = "nima@autonomy.net.au", - url = "http://projects.autonomy.net.au/dmidecode/", - ext_modules = [ - Extension( - "dmidecode", - sources = [ - "src/dmidecodemodule.c", - "src/dmihelper.c", - "src/util.c", - "src/dmioem.c", - "src/dmidecode.c" - ], - library_dirs = [ "/home/nima/dev-room/projects/dmidecode" ], - libraries = [ "util" ], - #libraries = [ "util", "efence" ], - ) - ] -) diff --git a/trunk/src/setup.py b/trunk/src/setup.py deleted file mode 100644 index b0999b5..0000000 --- a/trunk/src/setup.py +++ /dev/null @@ -1,25 +0,0 @@ -from distutils.core import setup, Extension - -setup( - name = "python-dmidecode", - version = "2.10.3", - description = "Python extension module for dmidecode", - author = "Nima Talebi", - author_email = "nima@autonomy.net.au", - url = "http://projects.autonomy.net.au/dmidecode/", - ext_modules = [ - Extension( - "dmidecode", - sources = [ - "src/dmidecodemodule.c", - "src/dmihelper.c", - "src/util.c", - "src/dmioem.c", - "src/dmidecode.c" - ], - library_dirs = [ "/home/nima/dev-room/projects/dmidecode" ], - libraries = [ "util" ], - #libraries = [ "util", "efence" ], - ) - ] -) diff --git a/trunk/src/types.h b/trunk/src/types.h deleted file mode 100644 index b124ecf..0000000 --- a/trunk/src/types.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -#include "config.h" - -typedef unsigned char u8; -typedef unsigned short u16; -typedef signed short i16; -typedef unsigned int u32; - -/* - * You may use the following defines to adjust the type definitions - * depending on the architecture: - * - Define BIGENDIAN on big-endian systems. Untested, as all target - * systems to date are little-endian. - * - Define ALIGNMENT_WORKAROUND if your system doesn't support - * non-aligned memory access. In this case, we use a slower, but safer, - * memory access method. This should be done automatically in config.h - * for architectures which need it. - */ - -#ifdef BIGENDIAN -typedef struct { - u32 h; - u32 l; -} u64; -#else -typedef struct { - u32 l; - u32 h; -} u64; -#endif - -#ifdef ALIGNMENT_WORKAROUND -static inline u64 U64(u32 low, u32 high) -{ - u64 self; - - self.l=low; - self.h=high; - - return self; -} -#endif - -#ifdef ALIGNMENT_WORKAROUND -# ifdef BIGENDIAN -# define WORD(x) (u16)((x)[1]+((x)[0]<<8)) -# define DWORD(x) (u32)((x)[3]+((x)[2]<<8)+((x)[1]<<16)+((x)[0]<<24)) -# define QWORD(x) (U64(DWORD(x+4), DWORD(x))) -# else /* BIGENDIAN */ -# define WORD(x) (u16)((x)[0]+((x)[1]<<8)) -# define DWORD(x) (u32)((x)[0]+((x)[1]<<8)+((x)[2]<<16)+((x)[3]<<24)) -# define QWORD(x) (U64(DWORD(x), DWORD(x+4))) -# endif /* BIGENDIAN */ -#else /* ALIGNMENT_WORKAROUND */ -#define WORD(x) (u16)(*(const u16 *)(x)) -#define DWORD(x) (u32)(*(const u32 *)(x)) -#define QWORD(x) (*(const u64 *)(x)) -#endif /* ALIGNMENT_WORKAROUND */ - -#endif diff --git a/trunk/src/util.c b/trunk/src/util.c deleted file mode 100644 index 15d24a7..0000000 --- a/trunk/src/util.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Common "util" functions - * This file is part of the dmidecode project. - * - * Copyright (C) 2002-2008 Jean Delvare - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For the avoidance of doubt the "preferred form" of this code is one which - * is in an open unpatent encumbered format. Where cryptographic key signing - * forms part of the process of creating an executable the information - * including keys needed to generate an equivalently functional executable - * are deemed to be part of the source code. - */ - -#include -#include - -#include "config.h" - -#ifdef USE_MMAP -#include -#ifndef MAP_FAILED -#define MAP_FAILED ((void *) -1) -#endif /* !MAP_FAILED */ -#endif /* USE MMAP */ - -#include -#include -#include -#include -#include -#include - -#include "types.h" -#include "util.h" - -#ifndef USE_MMAP -static int myread(int fd, u8 *buf, size_t count, const char *prefix) -{ - ssize_t r = 1; - size_t r2 = 0; - - while (r2 != count && r != 0) - { - r = read(fd, buf + r2, count - r2); - if (r == -1) - { - if (errno != EINTR) - { - close(fd); - perror(prefix); - return -1; - } - } - else - r2 += r; - } - - if (r2 != count) - { - close(fd); - fprintf(stderr, "%s: Unexpected end of file\n", prefix); - return -1; - } - - return 0; -} -#endif - -int checksum(const u8 *buf, size_t len) -{ - u8 sum = 0; - size_t a; - - for (a = 0; a < len; a++) - sum += buf[a]; - return (sum == 0); -} - -/* - * Copy a physical memory chunk into a memory buffer. - * This function allocates memory. - */ -void *mem_chunk(size_t base, size_t len, const char *devmem) -{ - void *p; - int fd; -#ifdef USE_MMAP - size_t mmoffset; - void *mmp; -#endif - - if ((fd = open(devmem, O_RDONLY)) == -1) - { - perror(devmem); - return NULL; - } - - if ((p = malloc(len)) == NULL) - { - perror("malloc"); - return NULL; - } - -#ifdef USE_MMAP -#ifdef _SC_PAGESIZE - mmoffset = base % sysconf(_SC_PAGESIZE); -#else - mmoffset = base % getpagesize(); -#endif /* _SC_PAGESIZE */ - /* - * Please note that we don't use mmap() for performance reasons here, - * but to workaround problems many people encountered when trying - * to read from /dev/mem using regular read() calls. - */ - mmp = mmap(0, mmoffset + len, PROT_READ, MAP_SHARED, fd, base - mmoffset); - if (mmp == MAP_FAILED) - { - fprintf(stderr, "%s: ", devmem); - perror("mmap"); - free(p); - return NULL; - } - - memcpy(p, (u8 *)mmp + mmoffset, len); - - if (munmap(mmp, mmoffset + len) == -1) - { - fprintf(stderr, "%s: ", devmem); - perror("munmap"); - } -#else /* USE_MMAP */ - if (lseek(fd, base, SEEK_SET) == -1) - { - fprintf(stderr, "%s: ", devmem); - perror("lseek"); - free(p); - return NULL; - } - - if (myread(fd, p, len, devmem) == -1) - { - free(p); - return NULL; - } -#endif /* USE_MMAP */ - - if (close(fd) == -1) - perror(devmem); - - return p; -} - -int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add) -{ - FILE *f; - - f = fopen(dumpfile, add ? "r+b" : "wb"); - if (!f) - { - fprintf(stderr, "%s: ", dumpfile); - perror("fopen"); - return -1; - } - - if (fseek(f, base, SEEK_SET) != 0) - { - fprintf(stderr, "%s: ", dumpfile); - perror("fseek"); - goto err_close; - } - - if (fwrite(data, len, 1, f) != 1) - { - fprintf(stderr, "%s: ", dumpfile); - perror("fwrite"); - goto err_close; - } - - if (fclose(f)) - { - fprintf(stderr, "%s: ", dumpfile); - perror("fclose"); - return -1; - } - - return 0; - -err_close: - fclose(f); - return -1; -} diff --git a/trunk/src/util.h b/trunk/src/util.h deleted file mode 100644 index 894bd2f..0000000 --- a/trunk/src/util.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of the dmidecode project. - * - * Copyright (C) 2003-2008 Jean Delvare - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "types.h" - -#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) - -int checksum(const u8 *buf, size_t len); -void *mem_chunk(size_t base, size_t len, const char *devmem); -int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add); diff --git a/trunk/src/version.h b/trunk/src/version.h deleted file mode 100644 index 050cf7a..0000000 --- a/trunk/src/version.h +++ /dev/null @@ -1 +0,0 @@ -#define VERSION "2.9" -- cgit