summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNima Talebi <nima@autonomy.net.au>2009-05-27 00:11:54 +1000
committerNima Talebi <nima@autonomy.net.au>2009-05-27 00:11:54 +1000
commit13ff9d7e48ab1574b36473f75701cc7f7c1e461a (patch)
tree3e82c88b2c484170ed365e4f7fbbd269f451cbf9
parent3e7b0632d6522ff8e57dd685176d138eb16265e1 (diff)
downloadpython-dmidecode-13ff9d7e48ab1574b36473f75701cc7f7c1e461a.tar.gz
python-dmidecode-13ff9d7e48ab1574b36473f75701cc7f7c1e461a.tar.xz
python-dmidecode-13ff9d7e48ab1574b36473f75701cc7f7c1e461a.zip
WIP commit
Merged the two XML files into one, and amended relevant code. I still want to modify the XML tag names, but not yet. The calls to dmidecode.type() not function as expected, but the others are broken - this is next.
-rw-r--r--src/config.h6
-rw-r--r--src/dmidecodemodule.c69
-rw-r--r--src/dmihelper.h2
-rw-r--r--src/py-map.xml54
-rw-r--r--src/py-typemap.xml441
-rw-r--r--src/pymap.xml495
-rw-r--r--src/setup-dbg.py2
-rw-r--r--src/setup.py2
-rw-r--r--src/xmlpythonizer.c70
-rw-r--r--src/xmlpythonizer.h2
10 files changed, 563 insertions, 580 deletions
diff --git a/src/config.h b/src/config.h
index 4fd5f41..add77cc 100644
--- a/src/config.h
+++ b/src/config.h
@@ -24,11 +24,7 @@
#endif
#ifndef PYTHON_XML_MAP
-#define PYTHON_XML_MAP "/usr/share/python-dmidecode/py-map.xml"
-#endif
-
-#ifndef PYTHON_XML_TYPEMAP
-#define PYTHON_XML_TYPEMAP "/usr/share/python-dmidecode/py-typemap.xml"
+#define PYTHON_XML_MAP "/usr/share/python-dmidecode/pymap.xml"
#endif
#endif
diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c
index db780f3..1b18f47 100644
--- a/src/dmidecodemodule.c
+++ b/src/dmidecodemodule.c
@@ -1,6 +1,6 @@
/*. ******* coding:utf-8 AUTOHEADER START v1.1 *******
- *. vim: fileencoding=utf-8 syntax=c sw=2 ts=2 et
+ *. vim: fileencoding=utf-8 syntax=c sw=8 ts=8 et
*.
*. © 2007-2009 Nima Talebi <nima@autonomy.net.au>
*. © 2009 David Sommerseth <davids@redhat.com>
@@ -60,11 +60,9 @@ static void init(void)
opt.dumpfile = NULL;
opt.flags = 0;
opt.type = NULL;
- opt.mappingxml = NULL;
- opt.typemappingxml = NULL;
opt.dmiversion_n = NULL;
+ opt.mappingxml = NULL;
opt.python_xml_map = strdup(PYTHON_XML_MAP);
- opt.python_xml_typemap = strdup(PYTHON_XML_TYPEMAP);
}
u8 *parse_opt_type(u8 * p, const char *arg)
@@ -191,8 +189,12 @@ xmlNode *dmidecode_set_version()
return ver_n;
}
-xmlNode *dmidecode_get_xml(PyObject *self, const char *section)
+int dmidecode_get_xml(xmlNode* dmixml_n)
{
+ assert(dmixml_n != NULL);
+ if(dmixml_n == NULL) {
+ return 0;
+ }
//mtrace();
int ret = 0;
@@ -201,16 +203,7 @@ xmlNode *dmidecode_get_xml(PyObject *self, const char *section)
int efi;
u8 *buf;
- xmlNode *dmixml_n = xmlNewNode(NULL, (xmlChar *) "dmidecode");
- assert( dmixml_n != NULL );
-
- // Append DMI version info
- if( opt.dmiversion_n != NULL ) {
- xmlAddChild(dmixml_n, xmlCopyNode(opt.dmiversion_n, 1));
- }
-
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");
@@ -263,16 +256,16 @@ xmlNode *dmidecode_get_xml(PyObject *self, const char *section)
free(opt.type);
if(ret == 0) {
free(buf);
- } else {
+ } /* else { TODO: Review this and if correctly commented out, then just delete it...
xmlFreeNode(dmixml_n);
dmixml_n = NULL;
- }
+ }*/
//muntrace();
- return dmixml_n;
+ return ret;
}
-static PyObject *dmidecode_get(PyObject *self, const char *section)
+static PyObject *dmidecode_get(const char *section)
{
PyObject *pydata = NULL;
xmlNode *dmixml_n = NULL;
@@ -287,8 +280,14 @@ static PyObject *dmidecode_get(PyObject *self, const char *section)
return NULL;
}
- dmixml_n = dmidecode_get_xml(self, section);
- if( dmixml_n != NULL ) {
+ dmixml_n = xmlNewNode(NULL, (xmlChar *) "dmidecode");
+ assert( dmixml_n != NULL );
+ // Append DMI version info
+ if( opt.dmiversion_n != NULL ) {
+ xmlAddChild(dmixml_n, xmlCopyNode(opt.dmiversion_n, 1));
+ }
+
+ if(dmidecode_get_xml(dmixml_n) == 0) {
ptzMAP *mapping = NULL;
// Convert the retrieved XML nodes to Python dicts
@@ -298,14 +297,7 @@ static PyObject *dmidecode_get(PyObject *self, const char *section)
assert( opt.mappingxml != NULL );
}
- if( opt.typemappingxml == NULL ) {
- // Load mapping into memory
- opt.typemappingxml = xmlReadFile(opt.python_xml_typemap, NULL, 0);
- assert( opt.typemappingxml != NULL );
- }
-
-
- mapping = dmiMAP_ParseMappingXML(opt.mappingxml, opt.typemappingxml, section);
+ mapping = dmiMAP_ParseMappingXML(opt.mappingxml, section);
if( mapping == NULL ) {
return NULL;
}
@@ -332,39 +324,39 @@ static PyObject *dmidecode_get(PyObject *self, const char *section)
static PyObject *dmidecode_get_bios(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "bios");
+ return dmidecode_get("bios");
}
static PyObject *dmidecode_get_system(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "system");
+ return dmidecode_get("system");
}
static PyObject *dmidecode_get_baseboard(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "baseboard");
+ return dmidecode_get("baseboard");
}
static PyObject *dmidecode_get_chassis(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "chassis");
+ return dmidecode_get("chassis");
}
static PyObject *dmidecode_get_processor(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "processor");
+ return dmidecode_get("processor");
}
static PyObject *dmidecode_get_memory(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "memory");
+ return dmidecode_get("memory");
}
static PyObject *dmidecode_get_cache(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "cache");
+ return dmidecode_get("cache");
}
static PyObject *dmidecode_get_connector(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "connector");
+ return dmidecode_get("connector");
}
static PyObject *dmidecode_get_slot(PyObject * self, PyObject * args)
{
- return dmidecode_get(self, "slot");
+ return dmidecode_get("slot");
}
static PyObject *dmidecode_get_type(PyObject * self, PyObject * args)
{
@@ -375,9 +367,8 @@ static PyObject *dmidecode_get_type(PyObject * self, PyObject * args)
if(PyArg_ParseTuple(args, (char *)"i", &lu)) {
if(lu < 256) {
char s[8];
-
sprintf(s, "%lu", lu);
- return dmidecode_get(self, s);
+ return dmidecode_get(s);
}
e = 1;
//return Py_False;
diff --git a/src/dmihelper.h b/src/dmihelper.h
index 57ad7ab..82a936d 100644
--- a/src/dmihelper.h
+++ b/src/dmihelper.h
@@ -113,9 +113,7 @@ typedef struct _options {
u8 *type;
const struct string_keyword *string;
xmlDoc *mappingxml;
- xmlDoc *typemappingxml;
char *python_xml_map;
- char *python_xml_typemap;
xmlNode *dmiversion_n;
PyObject *dumpfile;
} options;
diff --git a/src/py-map.xml b/src/py-map.xml
deleted file mode 100644
index fce89fc..0000000
--- a/src/py-map.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dmidecode_fieldmap version="1">
-
- <!-- Mapping setup for BIOS DMI data -->
- <Mapping name="bios">
- <TypeMap id="0x00" />
- <TypeMap id="0x0D" />
- </Mapping>
-
- <!-- Mapping setup for processor info -->
- <Mapping name="processor">
- <TypeMap id="0x04" />
- </Mapping>
-
- <!-- Mapping setup for chassis info -->
- <Mapping name="chassis">
- <TypeMap id="0x03" />
- </Mapping>
-
- <!-- Mapping setup for memory info -->
- <Mapping name="memory">
- <TypeMap id="0x10" />
- <TypeMap id="0x11" />
- </Mapping>
-
- <!-- Mapping setup for cache info -->
- <Mapping name="cache">
- <TypeMap id="0x07" />
- </Mapping>
-
- <!-- Mapping setup for system info -->
- <Mapping name="system">
- <TypeMap id="0x01" />
- <TypeMap id="0x0C" />
- <TypeMap id="0x20" />
- </Mapping>
-
- <!-- Mapping setup for baseboard info -->
- <Mapping name="baseboard">
- <TypeMap id="0x02" />
- <TypeMap id="0x0A" />
- </Mapping>
-
- <!-- Mapping setup for slot info -->
- <Mapping name="slot">
- <TypeMap id="0x09" />
- </Mapping>
-
- <!-- Mapping setup for connector info -->
- <Mapping name="connector">
- <TypeMap id="0x08" />
- </Mapping>
-
-</dmidecode_fieldmap>
diff --git a/src/py-typemap.xml b/src/py-typemap.xml
deleted file mode 100644
index b695948..0000000
--- a/src/py-typemap.xml
+++ /dev/null
@@ -1,441 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dmidecode_typemap version="1">
-
-<!--
- TODO: To discuss the following with dazo...
- TODO: 1. Merge the parent `Map' container with `TypeMap', i.e.
- TODO: <TypeMap id="0x00" rootpath="/dmidecode/BIOSinfo" keytype="string" key="@handle" valuetype="dict">
- TODO: 2. Naming convention - sit on this or can we do better? For example some
- TODO: root-paths have an appended `Info', and some don't (going from doc/README.types).
- TODO: 3. We currently have `rootpath="/dmidecode/StuffInfo"', how about also supporting it by type?
- TODO: e.g. `rootpath="/dmidecode/Type/0x20"' ...or something like that?
--->
-
- <!-- Type 00 : BIOS -->
- <TypeMap id="0x00">
- <Map rootpath="/dmidecode/BIOSinfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Vendor" valuetype="string" value="Vendor"/>
- <Map keytype="constant" key="Characteristics" valuetype="dict">
- <Map keytype="string" key="Characteristics/flags/flag[../../@level = '0']"
- valuetype="boolean" value="Characteristics/flags/flag/@enabled"/>
- </Map>
- <Map keytype="constant" key="Characteristic x1" valuetype="dict">
- <Map keytype="string" key="Characteristics/characteristic[../@level = 'x1']"
- valuetype="boolean" value="Characteristics/characteristic/@enabled"/>
- </Map>
- <Map keytype="constant" key="Characteristic x2" valuetype="dict">
- <Map keytype="string" key="Characteristics/characteristic[../@level = 'x2']"
- valuetype="boolean" value="Characteristics/characteristic/@enabled"/>
- </Map>
- <Map keytype="constant" key="Runtime Size" valuetype="string"
- value="concat(RuntimeSize,' ',RuntimeSize/@unit)"/>
- <Map keytype="constant" key="BIOS Revision"
- valuetype="string" value="BIOSrevision"/>
- <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
- <Map keytype="constant" key="ROM Size" valuetype="string"
- value="concat(ROMsize,' ',ROMsize/@unit)"/>
- <Map keytype="constant" key="Address" valuetype="string" value="Address"/>
- <Map keytype="constant" key="Relase Date" valuetype="string" value="ReleaseDate"/>
- </Map>
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- </Map>
- </TypeMap>
-
- <!-- Type 01 : System -->
- <TypeMap id="0x01">
- <Map rootpath="/dmidecode/SystemInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="SKU Number" valuetype="string" value="SKUnumber"/>
- <Map keytype="constant" key="UUID" valuetype="string" value="SystemUUID"/>
- <Map keytype="constant" key="Family" valuetype="string" value="Family"/>
- <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
- <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
- <Map keytype="constant" key="Product Name" valuetype="string" value="ProductName"/>
- <Map keytype="constant" key="Wake-Up Type" valuetype="string" value="SystemWakeUpType"/>
- <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 02 : Base Board -->
- <TypeMap id="0x02">
- <Map rootpath="/dmidecode/BaseBoardInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
- <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
- <Map keytype="constant" key="Product Name" valuetype="string" value="ProductName"/>
- <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 03 : Chassis -->
- <TypeMap id="0x03">
- <Map rootpath="/dmidecode/ChassisInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Boot-Up State" valuetype="string" value="ChassisStates/BootUp"/>
- <Map keytype="constant" key="Power Supply State" valuetype="string" value="ChassisStates/PowerSupply"/>
- <Map keytype="constant" key="Thermal State" valuetype="string" value="ChassisStates/Thermal"/>
- <Map keytype="constant" key="Lock" valuetype="string" value="ChassisLock"/>
- <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
- <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
- <Map keytype="constant" key="Asset Tag" valuetype="string" value="AssetTag"/>
- <Map keytype="constant" key="Security Status" valuetype="string" value="SecurityStatus"/>
- <Map keytype="constant" key="Type" valuetype="string" value="ChassisType"/>
- <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 04 : Processor -->
- <TypeMap id="0x04">
- <Map rootpath="/dmidecode/ProcessorInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Status" valuetype="string" value="concat('Populated:', Populated)"/>
- <Map keytype="constant" key="Part Number" valuetype="string" value="PartNumber"/>
- <Map keytype="constant" key="Upgrade" valuetype="string" value="Upgrade"/>
- <Map keytype="constant" key="Socket Designation" valuetype="string" value="SocketDesignation"/>
- <Map keytype="constant" key="Family" valuetype="string" value="Family"/>
- <Map keytype="constant" key="Characteristics" valuetype="list:string" value="Cores/Characteristics/Flag"/>
- <Map keytype="constant" key="Current Speed" valuetype="integer" value="Frequencies/CurrentSpeed"/>
- <Map keytype="constant" key="Thread Count" valuetype="integer" value="Cores/ThreadCount"/>
- <Map keytype="constant" key="External Clock" valuetype="integer" value="Frequencies/ExternalClock"/>
- <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
- <Map keytype="constant" key="Version" valuetype="string" value="Manufacturer/Version"/>
- <Map keytype="constant" key="Voltage" valuetype="string" value="concat(Voltages/Voltage, ' ', Voltages/Voltage/@unit)"/>
- <Map keytype="constant" key="Max Speed" valuetype="integer" value="Frequencies/MaxSpeed"/>
- <Map keytype="constant" key="Asset Tag" valuetype="string" value="AssetTag"/>
- <Map keytype="constant" key="Core Enabled" valuetype="integer" value="Cores/CoresEnabled"/>
- <Map keytype="constant" key="Type" valuetype="string" value="Type"/>
- <Map keytype="constant" key="Core Count" valuetype="integer" value="Cores/CoreCount"/>
- <Map keytype="constant" key="Manufacturer" valuetype="dict">
- <Map keytype="constant" key="Vendor" valuetype="string" value="Manufacturer/Vendor"/>
- <Map keytype="constant" key="Flags" valuetype="dict">
- <Map keytype="string" key="CPUCore/cpu_flags/flag"
- valuetype="boolean" value="CPUCore/cpu_flags/flag/@available"/>
- </Map>
- <Map keytype="constant" key="ID" valuetype="string" value="CPUCore/ID"/>
- <Map keytype="constant" key="Signature" valuetype="string" value="CPUCore/Signature"/>
- </Map>
- <Map keytype="constant" key="L1 Cache Handle"
- valuetype="string" value="Cache/Level[@level = '1']/@handle"/>
- <Map keytype="constant" key="L2 Cache Handle"
- valuetype="string" value="Cache/Level[@level = '2']/@handle"/>
- <Map keytype="constant" key="L3 Cache Handle"
- valuetype="string" value="Cache/Level[@level = '3']/@handle"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- FIXME : Type 05 : Memory Controller -->
- <TypeMap id="0x05">
- </TypeMap>
-
- <!-- FIXME : Type 06 : Memory Module -->
- <TypeMap id="0x06">
- </TypeMap>
-
- <!-- Type 07 : Cache -->
- <TypeMap id="0x07">
- <Map rootpath="/dmidecode/CacheInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="System Type" valuetype="string" value="SystemType"/>
- <Map keytype="constant" key="Socket Designation" valuetype="string" value="SocketDesignation"/>
- <Map keytype="constant" key="Installed SRAM Type"
- valuetype="list:string" value="InstalledSRAMtypes/CacheType" fixedsize="7" index_attr="index"/>
- <Map keytype="constant" key="Supported SRAM Type"
- valuetype="list:string" value="SupportedSRAMtypes/CacheType" fixedsize="7" index_attr="index"/>
- <Map keytype="constant" key="Associativity" valuetype="string" value="Associativity"/>
- <Map keytype="constant" key="Maximum Size" valuetype="string"
- value="concat(MaximumSize,' ',MaximumSize/@unit)"/>
- <Map keytype="constant" key="Installed Size" valuetype="string"
- value="concat(InstalledSize,' ',InstalledSize/@unit)"/>
- <Map keytype="constant" key="Location" valuetype="string" value="CacheLocation"/>
- <Map keytype="constant" key="Error Correction Type" valuetype="string" value="ErrorCorrectionType"/>
- <Map keytype="constant" key="Speed" valuetype="string" value="Speed" emptyValue="Unknown"/>
- <Map keytype="constant" key="Operational Mode" valuetype="string" value="OperationalMode"/>
- <Map keytype="constant" key="Configuration" valuetype="dict">
- <Map keytype="constant" key="Socketed" valuetype="boolean" value="@Socketed"/>
- <Map keytype="constant" key="Enabled" valuetype="boolean" value="@Enabled"/>
- <Map keytype="constant" key="Level" valuetype="integer" value="@Level"/>
- </Map>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 08 : Port Connector -->
- <TypeMap id="0x08">
- <Map rootpath="/dmidecode/PortConnectorInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="External Reference Designator"
- valuetype="string" value="DesignatorRef[@type='external']"/>
- <Map keytype="constant" key="Port Type" valuetype="string" value="PortType"/>
- <Map keytype="constant" key="External Connector Type"
- valuetype="string" value="Connector[@type='external']"/>
- <Map keytype="constant" key="Internal Reference Designator"
- valuetype="string" value="DesignatorRef[@type='internal']"/>
- <Map keytype="constant" key="Internal Connector Type"
- valuetype="string" value="Connector[@type='internal']"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 09 : System Slots -->
- <TypeMap id="0x09">
- <Map rootpath="/dmidecode/SystemSlots" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Designation" valuetype="string" value="Designation"/>
- <Map keytype="constant" key="Current Usage" valuetype="string" value="CurrentUsage"/>
- <Map keytype="constant" key="Characteristics"
- valuetype="list:string" value="SlotCharacteristics/Characteristic"
- fixedsize="10" index_attr="index"/>
- <Map keytype="constant" key="SlotLength" valuetype="string" value="SlotLength"/>
- <Map keytype="constant" key="SlotId" valuetype="string" value="SlotID/@id"/>
- <Map keytype="constant" key="Type:SlotBusWidth" valuetype="string" value="SlotWidth"/>
- <Map keytype="constant" key="Type:SlotType" valuetype="string" value="SlotType"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 10 : On-Board Devices -->
- <TypeMap id="0x0A">
- <Map rootpath="/dmidecode/OnBoardDevicesInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="dmi_on_board_devices" valuetype="list:dict" value="dmi_on_board_devices">
- <Map keytype="constant" key="Enabled" valuetype="boolean" value="Device/@Enabled"/>
- <Map keytype="constant" key="Type" valuetype="string" value="Device/Type"/>
- <Map keytype="constant" key="Description" valuetype="string" value="Device/Description"/>
- </Map>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- FIXME : Type 11 : OEM Strings -->
- <TypeMap id="0x0B">
- </TypeMap>
-
- <!-- FIXME : Type 12 : System Configuration Options -->
- <TypeMap id="0x0C">
- </TypeMap>
-
- <!-- Type 13 : BIOS Language -->
- <TypeMap id="0x0D">
- <Map rootpath="/dmidecode/BIOSlanguage" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Currently Installed Language"
- valuetype="list:string" value="Installed/Language"/>
- <Map keytype="constant" key="Installed Languages"
- valuetype="integer" value="@installable_languages"/>
- </Map>
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- </Map>
- </TypeMap>
-
- <!-- FIXME : Type 14 : Group Associations -->
- <TypeMap id="0x0E">
- </TypeMap>
-
- <!-- Type 15 : System Event Log -->
- <TypeMap id="0x0F">
- <Map rootpath="/dmidecode/SysEventLog" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Status"
- valuetype="string" value="concat(Status/@Valid, ', ', Status/@Full)"/>
- <Map keytype="constant" key="Access Method" valuetype="string" value="Access/AccessMethod"/>
- <Map keytype="constant" key="Header Format" valuetype="string" value="Access/Header/Format"/>
- <Map keytype="constant" key="Supported Log Type Descriptors" valuetype="string" value="LogTypes/@count"/>
- <Map keytype="constant" key="Header Start Offset" valuetype="string" value="Access/Header/OffsetStart"/>
- <Map keytype="constant" key="Change Token" valuetype="string" value="Access/Header/ChangeToken"/>
- <Map keytype="constant" key="Header Length" valuetype="string" value="Access/Header/Length"/>
- <Map keytype="constant" key="Access Address" valuetype="string" value="Access/Address/@Data"/>
- <Map keytype="constant" key="Area Length" valuetype="string" value="Access/@AreaLength"/>
- <Map keytype="constant" key="Data Start Offset" valuetype="string" value="Access/Header/DataOffset"/>
- <Map keytype="constant" key="DMI Event Log Descriptors" valuetype="list:dict" value="LogTypes/LogType">
- <Map keytype="constant" key="Descriptor" valuetype="string" value="Descriptor"/>
- <Map keytype="constant" key="Data Format" valuetype="string" value="Format"/>
- </Map>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 16 : Physical Memory Array -->
- <TypeMap id="0x10">
- <Map rootpath="/dmidecode/PhysicalMemoryArray" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Maximum Capacity"
- valuetype="string" value="concat(MaxCapacity, ' ', MaxCapacity/@unit)"/>
- <Map keytype="constant" key="Number Of Devices" valuetype="integer" value="@NumDevices"/>
- <Map keytype="constant" key="Use" valuetype="string" value="Use"/>
- <Map keytype="constant" key="Error Information Handle"
- valuetype="string" value="ErrorInfoHandle" emptyValue="Not Provided"/>
- <Map keytype="constant" key="Error Correction Type" valuetype="string" value="ErrorCorrectionType"/>
- <Map keytype="constant" key="Location" valuetype="string" value="Location"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- Type 17 : Memory Device -->
- <TypeMap id="0x11">
- <Map rootpath="/dmidecode/MemoryDevice" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
- <Map keytype="constant" key="Set" valuetype="integer" value="Set" emptyIsNone="1"/>
- <Map keytype="constant" key="Data Width"
- valuetype="string" value="concat(DataWidth, ' ', DataWidth/@unit)"/>
- <Map keytype="constant" key="Part Number" valuetype="string" value="PartNumber"/>
- <Map keytype="constant" key="Type" valuetype="string" value="Type"/>
- <Map keytype="constant" key="Bank Locator" valuetype="string" value="BankLocator"/>
- <Map keytype="constant" key="Speed"
- valuetype="string" value="concat(Speed, ' ', Speed/@unit, ' (',Speed/@speed_ns,'ns)')"/>
- <Map keytype="constant" key="Error Information Handle"
- valuetype="string" value="ErrorInfoHandle" emptyValue="No Error"/>
- <Map keytype="constant" key="Locator" valuetype="string" value="Locator"/>
- <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
- <Map keytype="constant" key="Total Width"
- valuetype="string" value="concat(TotalWidth, ' ', TotalWidth/@unit)"/>
- <Map keytype="constant" key="AssetTag" valuetype="string" value="AssetTag"/>
- <Map keytype="constant" key="Type Detail" valuetype="list:string" value="TypeDetails/flag"
- fixedsize="12" index_attr="index"/>
- <Map keytype="constant" key="Array Handle" valuetype="string" value="@ArrayHandle"/>
- <Map keytype="constant" key="Form Factor" valuetype="string" value="FormFactor"/>
- <Map keytype="constant" key="Size"
- valuetype="string" value="concat(Size, ' ', Size/@unit)" emptyIsNone="1"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- FIXME : Type 18 : 32-bit Memory Error -->
- <TypeMap id="0x12">
- </TypeMap>
-
- <!-- FIXME : Type 19 : Memory Array Mapped Address -->
- <TypeMap id="0x13">
- </TypeMap>
-
- <!-- FIXME : Type 20 : Memory Device Mapped Address -->
- <TypeMap id="0x14">
- </TypeMap>
-
- <!-- FIXME : Type 21 : Built-in Pointing Device -->
- <TypeMap id="0x15">
- </TypeMap>
-
- <!-- FIXME : Type 22 : Portable Battery -->
- <TypeMap id="0x16">
- </TypeMap>
-
- <!-- FIXME : Type 23 : System Reset -->
- <TypeMap id="0x17">
- </TypeMap>
-
- <!-- FIXME : Type 24 : Hardware Security -->
- <TypeMap id="0x18">
- </TypeMap>
-
- <!-- FIXME : Type 25 : System Power Controls -->
- <TypeMap id="0x19">
- </TypeMap>
-
- <!-- FIXME : Type 26 : Voltage Probe -->
- <TypeMap id="0x1A">
- </TypeMap>
-
- <!-- FIXME : Type 27 : Cooling Device -->
- <TypeMap id="0x1B">
- </TypeMap>
-
- <!-- FIXME : Type 28 : Temperature Probe -->
- <TypeMap id="0x1C">
- </TypeMap>
-
- <!-- FIXME : Type 29 : Electrical Current Probe -->
- <TypeMap id="0x1D">
- </TypeMap>
-
- <!-- FIXME : Type 30 : Out-of-band Remote Access -->
- <TypeMap id="0x1E">
- </TypeMap>
-
- <!-- FIXME : Type 31 : Boot Integrity Services -->
- <TypeMap id="0x1F">
- </TypeMap>
-
- <!-- Type 32 : System Boot -->
- <TypeMap id="0x20">
- <Map rootpath="/dmidecode/SystemBootInfo" keytype="string" key="@handle" valuetype="dict">
- <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
- <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
- <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
- <Map keytype="constant" key="data" valuetype="dict">
- <Map keytype="constant" key="Status" valuetype="string" value="Status"/>
- </Map>
- </Map>
- </TypeMap>
-
- <!-- FIXME : Type 33 : 64-bit Memory Error -->
- <TypeMap id="0x21">
- </TypeMap>
-
- <!-- FIXME : Type 34 : Management Device -->
- <TypeMap id="0x22">
- </TypeMap>
-
- <!-- FIXME : Type 35 : Management Device Component -->
- <TypeMap id="0x23">
- </TypeMap>
-
- <!-- FIXME : Type 36 : Management Device Threshold Data -->
- <TypeMap id="0x24">
- </TypeMap>
-
- <!-- FIXME : Type 37 : Memory Channel -->
- <TypeMap id="0x25">
- </TypeMap>
-
- <!-- FIXME : Type 38 : IPMI Device -->
- <TypeMap id="0x26">
- </TypeMap>
-
- <!-- FIXME : Type 39 : Power Supply -->
- <TypeMap id="0x27">
- </TypeMap>
-
-</dmidecode_typemap>
diff --git a/src/pymap.xml b/src/pymap.xml
new file mode 100644
index 0000000..8619211
--- /dev/null
+++ b/src/pymap.xml
@@ -0,0 +1,495 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dmidecode_mapping version="1">
+
+<!--
+ TODO: To discuss the following with dazo...
+ TODO: 1. Merge the parent `Map' container with `TypeMap', i.e.
+ TODO: <TypeMap id="0x00" rootpath="/dmidecode/BIOSinfo" keytype="string" key="@handle" valuetype="dict">
+ TODO: 2. Naming convention - sit on this or can we do better? For example some
+ TODO: root-paths have an appended `Info', and some don't (going from doc/README.types).
+ TODO: 3. We currently have `rootpath="/dmidecode/StuffInfo"', how about also supporting it by type?
+ TODO: e.g. `rootpath="/dmidecode/Type/0x20"' ...or something like that?
+-->
+
+ <TypeMapping>
+ <!-- Type 00 : BIOS -->
+ <TypeMap id="0x00">
+ <Map rootpath="/dmidecode/BIOSinfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Vendor" valuetype="string" value="Vendor"/>
+ <Map keytype="constant" key="Characteristics" valuetype="dict">
+ <Map keytype="string" key="Characteristics/flags/flag[../../@level = '0']"
+ valuetype="boolean" value="Characteristics/flags/flag/@enabled"/>
+ </Map>
+ <Map keytype="constant" key="Characteristic x1" valuetype="dict">
+ <Map keytype="string" key="Characteristics/characteristic[../@level = 'x1']"
+ valuetype="boolean" value="Characteristics/characteristic/@enabled"/>
+ </Map>
+ <Map keytype="constant" key="Characteristic x2" valuetype="dict">
+ <Map keytype="string" key="Characteristics/characteristic[../@level = 'x2']"
+ valuetype="boolean" value="Characteristics/characteristic/@enabled"/>
+ </Map>
+ <Map keytype="constant" key="Runtime Size" valuetype="string"
+ value="concat(RuntimeSize,' ',RuntimeSize/@unit)"/>
+ <Map keytype="constant" key="BIOS Revision"
+ valuetype="string" value="BIOSrevision"/>
+ <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
+ <Map keytype="constant" key="ROM Size" valuetype="string"
+ value="concat(ROMsize,' ',ROMsize/@unit)"/>
+ <Map keytype="constant" key="Address" valuetype="string" value="Address"/>
+ <Map keytype="constant" key="Relase Date" valuetype="string" value="ReleaseDate"/>
+ </Map>
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 01 : System -->
+ <TypeMap id="0x01">
+ <Map rootpath="/dmidecode/SystemInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="SKU Number" valuetype="string" value="SKUnumber"/>
+ <Map keytype="constant" key="UUID" valuetype="string" value="SystemUUID"/>
+ <Map keytype="constant" key="Family" valuetype="string" value="Family"/>
+ <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
+ <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
+ <Map keytype="constant" key="Product Name" valuetype="string" value="ProductName"/>
+ <Map keytype="constant" key="Wake-Up Type" valuetype="string" value="SystemWakeUpType"/>
+ <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 02 : Base Board -->
+ <TypeMap id="0x02">
+ <Map rootpath="/dmidecode/BaseBoardInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
+ <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
+ <Map keytype="constant" key="Product Name" valuetype="string" value="ProductName"/>
+ <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 03 : Chassis -->
+ <TypeMap id="0x03">
+ <Map rootpath="/dmidecode/ChassisInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Boot-Up State" valuetype="string" value="ChassisStates/BootUp"/>
+ <Map keytype="constant" key="Power Supply State" valuetype="string" value="ChassisStates/PowerSupply"/>
+ <Map keytype="constant" key="Thermal State" valuetype="string" value="ChassisStates/Thermal"/>
+ <Map keytype="constant" key="Lock" valuetype="string" value="ChassisLock"/>
+ <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
+ <Map keytype="constant" key="Version" valuetype="string" value="Version"/>
+ <Map keytype="constant" key="Asset Tag" valuetype="string" value="AssetTag"/>
+ <Map keytype="constant" key="Security Status" valuetype="string" value="SecurityStatus"/>
+ <Map keytype="constant" key="Type" valuetype="string" value="ChassisType"/>
+ <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 04 : Processor -->
+ <TypeMap id="0x04">
+ <Map rootpath="/dmidecode/ProcessorInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Status" valuetype="string" value="concat('Populated:', Populated)"/>
+ <Map keytype="constant" key="Part Number" valuetype="string" value="PartNumber"/>
+ <Map keytype="constant" key="Upgrade" valuetype="string" value="Upgrade"/>
+ <Map keytype="constant" key="Socket Designation" valuetype="string" value="SocketDesignation"/>
+ <Map keytype="constant" key="Family" valuetype="string" value="Family"/>
+ <Map keytype="constant" key="Characteristics" valuetype="list:string" value="Cores/Characteristics/Flag"/>
+ <Map keytype="constant" key="Current Speed" valuetype="integer" value="Frequencies/CurrentSpeed"/>
+ <Map keytype="constant" key="Thread Count" valuetype="integer" value="Cores/ThreadCount"/>
+ <Map keytype="constant" key="External Clock" valuetype="integer" value="Frequencies/ExternalClock"/>
+ <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
+ <Map keytype="constant" key="Version" valuetype="string" value="Manufacturer/Version"/>
+ <Map keytype="constant" key="Voltage" valuetype="string" value="concat(Voltages/Voltage, ' ', Voltages/Voltage/@unit)"/>
+ <Map keytype="constant" key="Max Speed" valuetype="integer" value="Frequencies/MaxSpeed"/>
+ <Map keytype="constant" key="Asset Tag" valuetype="string" value="AssetTag"/>
+ <Map keytype="constant" key="Core Enabled" valuetype="integer" value="Cores/CoresEnabled"/>
+ <Map keytype="constant" key="Type" valuetype="string" value="Type"/>
+ <Map keytype="constant" key="Core Count" valuetype="integer" value="Cores/CoreCount"/>
+ <Map keytype="constant" key="Manufacturer" valuetype="dict">
+ <Map keytype="constant" key="Vendor" valuetype="string" value="Manufacturer/Vendor"/>
+ <Map keytype="constant" key="Flags" valuetype="dict">
+ <Map keytype="string" key="CPUCore/cpu_flags/flag"
+ valuetype="boolean" value="CPUCore/cpu_flags/flag/@available"/>
+ </Map>
+ <Map keytype="constant" key="ID" valuetype="string" value="CPUCore/ID"/>
+ <Map keytype="constant" key="Signature" valuetype="string" value="CPUCore/Signature"/>
+ </Map>
+ <Map keytype="constant" key="L1 Cache Handle"
+ valuetype="string" value="Cache/Level[@level = '1']/@handle"/>
+ <Map keytype="constant" key="L2 Cache Handle"
+ valuetype="string" value="Cache/Level[@level = '2']/@handle"/>
+ <Map keytype="constant" key="L3 Cache Handle"
+ valuetype="string" value="Cache/Level[@level = '3']/@handle"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- FIXME : Type 05 : Memory Controller -->
+ <TypeMap id="0x05">
+ </TypeMap>
+
+ <!-- FIXME : Type 06 : Memory Module -->
+ <TypeMap id="0x06">
+ </TypeMap>
+
+ <!-- Type 07 : Cache -->
+ <TypeMap id="0x07">
+ <Map rootpath="/dmidecode/CacheInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="System Type" valuetype="string" value="SystemType"/>
+ <Map keytype="constant" key="Socket Designation" valuetype="string" value="SocketDesignation"/>
+ <Map keytype="constant" key="Installed SRAM Type"
+ valuetype="list:string" value="InstalledSRAMtypes/CacheType" fixedsize="7" index_attr="index"/>
+ <Map keytype="constant" key="Supported SRAM Type"
+ valuetype="list:string" value="SupportedSRAMtypes/CacheType" fixedsize="7" index_attr="index"/>
+ <Map keytype="constant" key="Associativity" valuetype="string" value="Associativity"/>
+ <Map keytype="constant" key="Maximum Size" valuetype="string"
+ value="concat(MaximumSize,' ',MaximumSize/@unit)"/>
+ <Map keytype="constant" key="Installed Size" valuetype="string"
+ value="concat(InstalledSize,' ',InstalledSize/@unit)"/>
+ <Map keytype="constant" key="Location" valuetype="string" value="CacheLocation"/>
+ <Map keytype="constant" key="Error Correction Type" valuetype="string" value="ErrorCorrectionType"/>
+ <Map keytype="constant" key="Speed" valuetype="string" value="Speed" emptyValue="Unknown"/>
+ <Map keytype="constant" key="Operational Mode" valuetype="string" value="OperationalMode"/>
+ <Map keytype="constant" key="Configuration" valuetype="dict">
+ <Map keytype="constant" key="Socketed" valuetype="boolean" value="@Socketed"/>
+ <Map keytype="constant" key="Enabled" valuetype="boolean" value="@Enabled"/>
+ <Map keytype="constant" key="Level" valuetype="integer" value="@Level"/>
+ </Map>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 08 : Port Connector -->
+ <TypeMap id="0x08">
+ <Map rootpath="/dmidecode/PortConnectorInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="External Reference Designator"
+ valuetype="string" value="DesignatorRef[@type='external']"/>
+ <Map keytype="constant" key="Port Type" valuetype="string" value="PortType"/>
+ <Map keytype="constant" key="External Connector Type"
+ valuetype="string" value="Connector[@type='external']"/>
+ <Map keytype="constant" key="Internal Reference Designator"
+ valuetype="string" value="DesignatorRef[@type='internal']"/>
+ <Map keytype="constant" key="Internal Connector Type"
+ valuetype="string" value="Connector[@type='internal']"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 09 : System Slots -->
+ <TypeMap id="0x09">
+ <Map rootpath="/dmidecode/SystemSlots" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Designation" valuetype="string" value="Designation"/>
+ <Map keytype="constant" key="Current Usage" valuetype="string" value="CurrentUsage"/>
+ <Map keytype="constant" key="Characteristics"
+ valuetype="list:string" value="SlotCharacteristics/Characteristic"
+ fixedsize="10" index_attr="index"/>
+ <Map keytype="constant" key="SlotLength" valuetype="string" value="SlotLength"/>
+ <Map keytype="constant" key="SlotId" valuetype="string" value="SlotID/@id"/>
+ <Map keytype="constant" key="Type:SlotBusWidth" valuetype="string" value="SlotWidth"/>
+ <Map keytype="constant" key="Type:SlotType" valuetype="string" value="SlotType"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 10 : On-Board Devices -->
+ <TypeMap id="0x0A">
+ <Map rootpath="/dmidecode/OnBoardDevicesInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="dmi_on_board_devices" valuetype="list:dict" value="dmi_on_board_devices">
+ <Map keytype="constant" key="Enabled" valuetype="boolean" value="Device/@Enabled"/>
+ <Map keytype="constant" key="Type" valuetype="string" value="Device/Type"/>
+ <Map keytype="constant" key="Description" valuetype="string" value="Device/Description"/>
+ </Map>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- FIXME : Type 11 : OEM Strings -->
+ <TypeMap id="0x0B">
+ </TypeMap>
+
+ <!-- FIXME : Type 12 : System Configuration Options -->
+ <TypeMap id="0x0C">
+ </TypeMap>
+
+ <!-- Type 13 : BIOS Language -->
+ <TypeMap id="0x0D">
+ <Map rootpath="/dmidecode/BIOSlanguage" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Currently Installed Language"
+ valuetype="list:string" value="Installed/Language"/>
+ <Map keytype="constant" key="Installed Languages"
+ valuetype="integer" value="@installable_languages"/>
+ </Map>
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ </Map>
+ </TypeMap>
+
+ <!-- FIXME : Type 14 : Group Associations -->
+ <TypeMap id="0x0E">
+ </TypeMap>
+
+ <!-- Type 15 : System Event Log -->
+ <TypeMap id="0x0F">
+ <Map rootpath="/dmidecode/SysEventLog" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Status"
+ valuetype="string" value="concat(Status/@Valid, ', ', Status/@Full)"/>
+ <Map keytype="constant" key="Access Method" valuetype="string" value="Access/AccessMethod"/>
+ <Map keytype="constant" key="Header Format" valuetype="string" value="Access/Header/Format"/>
+ <Map keytype="constant" key="Supported Log Type Descriptors" valuetype="string" value="LogTypes/@count"/>
+ <Map keytype="constant" key="Header Start Offset" valuetype="string" value="Access/Header/OffsetStart"/>
+ <Map keytype="constant" key="Change Token" valuetype="string" value="Access/Header/ChangeToken"/>
+ <Map keytype="constant" key="Header Length" valuetype="string" value="Access/Header/Length"/>
+ <Map keytype="constant" key="Access Address" valuetype="string" value="Access/Address/@Data"/>
+ <Map keytype="constant" key="Area Length" valuetype="string" value="Access/@AreaLength"/>
+ <Map keytype="constant" key="Data Start Offset" valuetype="string" value="Access/Header/DataOffset"/>
+ <Map keytype="constant" key="DMI Event Log Descriptors" valuetype="list:dict" value="LogTypes/LogType">
+ <Map keytype="constant" key="Descriptor" valuetype="string" value="Descriptor"/>
+ <Map keytype="constant" key="Data Format" valuetype="string" value="Format"/>
+ </Map>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 16 : Physical Memory Array -->
+ <TypeMap id="0x10">
+ <Map rootpath="/dmidecode/PhysicalMemoryArray" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Maximum Capacity"
+ valuetype="string" value="concat(MaxCapacity, ' ', MaxCapacity/@unit)"/>
+ <Map keytype="constant" key="Number Of Devices" valuetype="integer" value="@NumDevices"/>
+ <Map keytype="constant" key="Use" valuetype="string" value="Use"/>
+ <Map keytype="constant" key="Error Information Handle"
+ valuetype="string" value="ErrorInfoHandle" emptyValue="Not Provided"/>
+ <Map keytype="constant" key="Error Correction Type" valuetype="string" value="ErrorCorrectionType"/>
+ <Map keytype="constant" key="Location" valuetype="string" value="Location"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- Type 17 : Memory Device -->
+ <TypeMap id="0x11">
+ <Map rootpath="/dmidecode/MemoryDevice" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Manufacturer" valuetype="string" value="Manufacturer"/>
+ <Map keytype="constant" key="Set" valuetype="integer" value="Set" emptyIsNone="1"/>
+ <Map keytype="constant" key="Data Width"
+ valuetype="string" value="concat(DataWidth, ' ', DataWidth/@unit)"/>
+ <Map keytype="constant" key="Part Number" valuetype="string" value="PartNumber"/>
+ <Map keytype="constant" key="Type" valuetype="string" value="Type"/>
+ <Map keytype="constant" key="Bank Locator" valuetype="string" value="BankLocator"/>
+ <Map keytype="constant" key="Speed"
+ valuetype="string" value="concat(Speed, ' ', Speed/@unit, ' (',Speed/@speed_ns,'ns)')"/>
+ <Map keytype="constant" key="Error Information Handle"
+ valuetype="string" value="ErrorInfoHandle" emptyValue="No Error"/>
+ <Map keytype="constant" key="Locator" valuetype="string" value="Locator"/>
+ <Map keytype="constant" key="Serial Number" valuetype="string" value="SerialNumber"/>
+ <Map keytype="constant" key="Total Width"
+ valuetype="string" value="concat(TotalWidth, ' ', TotalWidth/@unit)"/>
+ <Map keytype="constant" key="AssetTag" valuetype="string" value="AssetTag"/>
+ <Map keytype="constant" key="Type Detail" valuetype="list:string" value="TypeDetails/flag"
+ fixedsize="12" index_attr="index"/>
+ <Map keytype="constant" key="Array Handle" valuetype="string" value="@ArrayHandle"/>
+ <Map keytype="constant" key="Form Factor" valuetype="string" value="FormFactor"/>
+ <Map keytype="constant" key="Size"
+ valuetype="string" value="concat(Size, ' ', Size/@unit)" emptyIsNone="1"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- FIXME : Type 18 : 32-bit Memory Error -->
+ <TypeMap id="0x12">
+ </TypeMap>
+
+ <!-- FIXME : Type 19 : Memory Array Mapped Address -->
+ <TypeMap id="0x13">
+ </TypeMap>
+
+ <!-- FIXME : Type 20 : Memory Device Mapped Address -->
+ <TypeMap id="0x14">
+ </TypeMap>
+
+ <!-- FIXME : Type 21 : Built-in Pointing Device -->
+ <TypeMap id="0x15">
+ </TypeMap>
+
+ <!-- FIXME : Type 22 : Portable Battery -->
+ <TypeMap id="0x16">
+ </TypeMap>
+
+ <!-- FIXME : Type 23 : System Reset -->
+ <TypeMap id="0x17">
+ </TypeMap>
+
+ <!-- FIXME : Type 24 : Hardware Security -->
+ <TypeMap id="0x18">
+ </TypeMap>
+
+ <!-- FIXME : Type 25 : System Power Controls -->
+ <TypeMap id="0x19">
+ </TypeMap>
+
+ <!-- FIXME : Type 26 : Voltage Probe -->
+ <TypeMap id="0x1A">
+ </TypeMap>
+
+ <!-- FIXME : Type 27 : Cooling Device -->
+ <TypeMap id="0x1B">
+ </TypeMap>
+
+ <!-- FIXME : Type 28 : Temperature Probe -->
+ <TypeMap id="0x1C">
+ </TypeMap>
+
+ <!-- FIXME : Type 29 : Electrical Current Probe -->
+ <TypeMap id="0x1D">
+ </TypeMap>
+
+ <!-- FIXME : Type 30 : Out-of-band Remote Access -->
+ <TypeMap id="0x1E">
+ </TypeMap>
+
+ <!-- FIXME : Type 31 : Boot Integrity Services -->
+ <TypeMap id="0x1F">
+ </TypeMap>
+
+ <!-- Type 32 : System Boot -->
+ <TypeMap id="0x20">
+ <Map rootpath="/dmidecode/SystemBootInfo" keytype="string" key="@handle" valuetype="dict">
+ <Map keytype="constant" key="dmi_type" valuetype="integer" value="@type"/>
+ <Map keytype="constant" key="dmi_handle" valuetype="string" value="@handle"/>
+ <Map keytype="constant" key="dmi_size" valuetype="integer" value="@size"/>
+ <Map keytype="constant" key="data" valuetype="dict">
+ <Map keytype="constant" key="Status" valuetype="string" value="Status"/>
+ </Map>
+ </Map>
+ </TypeMap>
+
+ <!-- FIXME : Type 33 : 64-bit Memory Error -->
+ <TypeMap id="0x21">
+ </TypeMap>
+
+ <!-- FIXME : Type 34 : Management Device -->
+ <TypeMap id="0x22">
+ </TypeMap>
+
+ <!-- FIXME : Type 35 : Management Device Component -->
+ <TypeMap id="0x23">
+ </TypeMap>
+
+ <!-- FIXME : Type 36 : Management Device Threshold Data -->
+ <TypeMap id="0x24">
+ </TypeMap>
+
+ <!-- FIXME : Type 37 : Memory Channel -->
+ <TypeMap id="0x25">
+ </TypeMap>
+
+ <!-- FIXME : Type 38 : IPMI Device -->
+ <TypeMap id="0x26">
+ </TypeMap>
+
+ <!-- FIXME : Type 39 : Power Supply -->
+ <TypeMap id="0x27">
+ </TypeMap>
+ </TypeMapping>
+
+ <GroupMapping>
+ <!-- Mapping setup for BIOS DMI data -->
+ <Mapping name="bios">
+ <TypeMap id="0x00" />
+ <TypeMap id="0x0D" />
+ </Mapping>
+
+ <!-- Mapping setup for processor info -->
+ <Mapping name="processor">
+ <TypeMap id="0x04" />
+ </Mapping>
+
+ <!-- Mapping setup for chassis info -->
+ <Mapping name="chassis">
+ <TypeMap id="0x03" />
+ </Mapping>
+
+ <!-- Mapping setup for memory info -->
+ <Mapping name="memory">
+ <TypeMap id="0x10" />
+ <TypeMap id="0x11" />
+ </Mapping>
+
+ <!-- Mapping setup for cache info -->
+ <Mapping name="cache">
+ <TypeMap id="0x07" />
+ </Mapping>
+
+ <!-- Mapping setup for system info -->
+ <Mapping name="system">
+ <TypeMap id="0x01" />
+ <TypeMap id="0x0C" />
+ <TypeMap id="0x20" />
+ </Mapping>
+
+ <!-- Mapping setup for baseboard info -->
+ <Mapping name="baseboard">
+ <TypeMap id="0x02" />
+ <TypeMap id="0x0A" />
+ </Mapping>
+
+ <!-- Mapping setup for slot info -->
+ <Mapping name="slot">
+ <TypeMap id="0x09" />
+ </Mapping>
+
+ <!-- Mapping setup for connector info -->
+ <Mapping name="connector">
+ <TypeMap id="0x08" />
+ </Mapping>
+ </GroupMapping>
+
+</dmidecode_mapping>
diff --git a/src/setup-dbg.py b/src/setup-dbg.py
index 988c3f3..e0a2358 100644
--- a/src/setup-dbg.py
+++ b/src/setup-dbg.py
@@ -8,7 +8,7 @@ setup(
author = "Nima Talebi & David Sommerseth",
author_email = "nima@it.net.au, davids@redhat.com",
url = "http://projects.autonomy.net.au/python-dmidecode/",
- data_files = [ ('share/python-dmidecode-dbg', ['src/py-map.xml', 'src/py-typemap.xml']) ],
+ data_files = [ ('share/python-dmidecode-dbg', ['src/pymap.xml']) ],
ext_modules = [
Extension(
"dmidecode",
diff --git a/src/setup.py b/src/setup.py
index dde35eb..bb79a14 100644
--- a/src/setup.py
+++ b/src/setup.py
@@ -8,7 +8,7 @@ setup(
author = "Nima Talebi & David Sommerseth",
author_email = "nima@it.net.au, davids@redhat.com",
url = "http://projects.autonomy.net.au/python-dmidecode/",
- data_files = [ ('share/python-dmidecode', ['src/py-map.xml', 'src/py-typemap.xml']) ],
+ data_files = [ ('share/python-dmidecode', ['src/pymap.xml']) ],
ext_modules = [
Extension(
"dmidecode",
diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c
index 3099e5d..86bbb69 100644
--- a/src/xmlpythonizer.c
+++ b/src/xmlpythonizer.c
@@ -353,8 +353,9 @@ ptzMAP *_do_dmitypemap_parsing(xmlNode *node) {
}
// Internal parser - Mapper (Groups of Types)
-ptzMAP *_do_dmimap_parsing(xmlNode *node, xmlDoc *xmlmap, xmlDoc *xmltypemap) {
+ptzMAP *_do_dmimap_parsing(xmlNode *node, xmlDoc *xmlmap) {
ptzMAP *retmap = NULL;
+ ptzMAP *tmp = NULL;
xmlNode *ptr_n = NULL, *map_n = NULL;;
// Go to the next XML_ELEMENT_NODE
@@ -376,14 +377,21 @@ ptzMAP *_do_dmimap_parsing(xmlNode *node, xmlDoc *xmlmap, xmlDoc *xmltypemap) {
}
// Loop through it's children
- xmlNode *typemap = xmlDocGetRootElement(xmltypemap);
+ xmlNode *typemap = xmlDocGetRootElement(xmlmap);
assert( typemap != NULL );
+
for( ptr_n = map_n ; ptr_n != NULL; ptr_n = ptr_n->next ) {
char *type_id = NULL;
+
type_id = dmixml_GetAttrValue(ptr_n, "id");
map_n = dmixml_FindNodeByAttr(typemap, "id", type_id);
- retmap = _do_dmitypemap_parsing(map_n);
- break;
+ if( tmp != NULL) {
+ tmp->next = _do_dmitypemap_parsing(map_n);
+ tmp = tmp->next;
+ } else {
+ tmp = _do_dmitypemap_parsing(map_n);
+ retmap = tmp;
+ }
}
return retmap;
}
@@ -391,50 +399,40 @@ ptzMAP *_do_dmimap_parsing(xmlNode *node, xmlDoc *xmlmap, xmlDoc *xmltypemap) {
// Main parser function for the mapping XML
-ptzMAP *dmiMAP_ParseMappingXML(xmlDoc *xmlmap, xmlDoc *xmltypemap, const char *mapname) {
+ptzMAP *dmiMAP_ParseMappingXML(xmlDoc *xmlmap, const char *mapname) {
ptzMAP *map = NULL;
xmlNode *node = NULL;
int type_id = is_int(mapname);
- if(type_id > -1) {
- // Find the root tag and locate our mapping
- node = xmlDocGetRootElement(xmltypemap);
- assert( node != NULL );
- // Verify that the root node got the right name
- if( (node == NULL)
- || (xmlStrcmp(node->name, (xmlChar *) "dmidecode_typemap") != 0 )) {
- PyErr_SetString(PyExc_IOError, "Invalid XML-Python mapping file");
- return NULL;
- }
+ // Find the root tag and locate our mapping
+ node = xmlDocGetRootElement(xmlmap);
+ assert( node != NULL );
- // Verify that it's of a version we support
- if( strcmp(dmixml_GetAttrValue(node, "version"), "1") != 0 ) {
- PyErr_SetString(PyExc_IOError, "Unsupported XML-Python mapping file format");
- return NULL;
- }
+ // Verify that the root node got the right name
+ if( (node == NULL)
+ || (xmlStrcmp(node->name, (xmlChar *) "dmidecode_mapping") != 0 )) {
+ PyErr_SetString(PyExc_IOError, "Invalid XML-Python mapping file");
+ return NULL;
+ }
+
+ // Verify that it's of a version we support
+ if( strcmp(dmixml_GetAttrValue(node, "version"), "1") != 0 ) {
+ PyErr_SetString(PyExc_IOError, "Unsupported XML-Python mapping file format");
+ return NULL;
+ }
+
+ if(type_id > -1) {
+ node = dmixml_FindNode(node, "TypeMapping");
+ assert( node != NULL );
char type_id_hex[5];
snprintf(type_id_hex, 5, "0x%02x", type_id);
node = dmixml_FindNodeByAttr(node, "id", type_id_hex);
} else {
- // Find the root tag and locate our mapping
- node = xmlDocGetRootElement(xmlmap);
+ node = dmixml_FindNode(node, "GroupMapping");
assert( node != NULL );
- // Verify that the root node got the right name
- if( (node == NULL)
- || (xmlStrcmp(node->name, (xmlChar *) "dmidecode_fieldmap") != 0 )) {
- PyErr_SetString(PyExc_IOError, "Invalid XML-Python mapping file");
- return NULL;
- }
-
- // Verify that it's of a version we support
- if( strcmp(dmixml_GetAttrValue(node, "version"), "1") != 0 ) {
- PyErr_SetString(PyExc_IOError, "Unsupported XML-Python mapping file format");
- return NULL;
- }
-
// Find the <Mapping> section matching our request (mapname)
for( node = node->children->next; node != NULL; node = node->next ) {
if( xmlStrcmp(node->name, (xmlChar *) "Mapping") == 0) {
@@ -455,7 +453,7 @@ ptzMAP *dmiMAP_ParseMappingXML(xmlDoc *xmlmap, xmlDoc *xmltypemap, const char *m
}
// Start creating an internal map structure based on the mapping XML.
- map = (type_id == -1) ? _do_dmimap_parsing(node, xmlmap, xmltypemap) : _do_dmitypemap_parsing(node);
+ map = (type_id == -1) ? _do_dmimap_parsing(node, xmlmap) : _do_dmitypemap_parsing(node);
return map;
}
diff --git a/src/xmlpythonizer.h b/src/xmlpythonizer.h
index 2f71dc8..e659340 100644
--- a/src/xmlpythonizer.h
+++ b/src/xmlpythonizer.h
@@ -48,7 +48,7 @@ typedef struct ptzMAP_s {
} ptzMAP;
-ptzMAP *dmiMAP_ParseMappingXML(xmlDoc *xmlmap, xmlDoc *xmltypemap, const char *mapname);
+ptzMAP *dmiMAP_ParseMappingXML(xmlDoc *xmlmap, const char *mapname);
#define ptzmap_Free(ptr) { ptzmap_Free_func(ptr); ptr = NULL; }
void ptzmap_Free_func(ptzMAP *ptr);