summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dmidecodemodule.c11
-rw-r--r--src/dmihelper.h4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c
index 82f2de7..db780f3 100644
--- a/src/dmidecodemodule.c
+++ b/src/dmidecodemodule.c
@@ -61,8 +61,10 @@ static void init(void)
opt.flags = 0;
opt.type = NULL;
opt.mappingxml = NULL;
+ opt.typemappingxml = NULL;
opt.dmiversion_n = 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)
@@ -296,7 +298,14 @@ static PyObject *dmidecode_get(PyObject *self, const char *section)
assert( opt.mappingxml != NULL );
}
- mapping = dmiMAP_ParseMappingXML(opt.mappingxml, section);
+ 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);
if( mapping == NULL ) {
return NULL;
}
diff --git a/src/dmihelper.h b/src/dmihelper.h
index 33da699..57ad7ab 100644
--- a/src/dmihelper.h
+++ b/src/dmihelper.h
@@ -113,9 +113,11 @@ 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;
- char *python_xml_map;
} options;
extern options opt;