From cf468c3ceaf268da0ba17286bef85e4bdafcbc7e Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Sun, 24 May 2009 03:45:10 +1000 Subject: Loading in the new the new `type' XML file --- src/dmidecodemodule.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/dmidecodemodule.c') 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; } -- cgit