summaryrefslogtreecommitdiffstats
path: root/src/dmidecodemodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix failing dmidecode.pythonmap() on Python 3David Sommerseth2015-02-031-3/+8
| | | | | | | | | | Python 3 uses the Unicode type for strings but it did only support the Bytes type. So the loading of XML-to-Python-dict-map would fail. This patch preserves the Bytes type support while adding Unicode support, which is what is done other places in the code as well. Signed-off-by: David Sommerseth <davids@redhat.com>
* Port to Python 3 while maintaining compatibility with Python >= 2.6Slavek Kabrda2015-02-031-12/+63
| | | | Signed-off-by: David Sommerseth <davids@redhat.com>
* Removed not needed \n from log_append() entriesDavid Sommerseth2010-02-051-3/+3
|
* Added logging flag to log_append() to change log behaviourDavid Sommerseth2010-02-051-5/+8
| | | | | | | | | | | | | | Valid flags are: * LOGFL_NORMAL Log all messages to the log context, and send log message to stderr on errors * LOGFL_NODUPS Log only unique messages. Duplicated messages will be removed * LOGFL_NOSTDERR Don't write to stderr, even if errors occur
* Ported fprintf() -> log_append() on XML functionsDavid Sommerseth2010-01-081-5/+5
|
* Implement a global log buffer and start porting fprint() -> log_append()David Sommerseth2010-01-081-24/+73
|
* Improved set_dev() functionDavid Sommerseth2009-12-171-5/+17
| | | | | | | | | This function would often fail during the unit test. Most probably because the complete error checking was a bit odd. Rewritten the error checks to be a bit more sane. Also improved error situations, where it will now throw an exception with an error message instead of just returning False.
* Fixed issue with unterminated list in dmidecode_xmlapi()David Sommerseth2009-06-181-1/+1
| | | | This caused an exception on Python2.3
* Splitted out SMBIOS/DMI dump functions from dmidecode.c to separate filesDavid Sommerseth2009-06-181-1/+2
|
* Fixed error in dumping DMI/SMBIOS data to diskDavid Sommerseth2009-06-121-2/+4
|
* Pick the version info from version.hDavid Sommerseth2009-06-111-1/+2
|
* Implemented new dmidecode function - QueryTypeId(...)David Sommerseth2009-06-111-0/+4
| | | | | | This function shadows the dmidecode.type() function. This is to clarify more what the function does and to unify the API against the dmidecodeXML API.
* Implemented new dmidecode function - QuerySection(...)David Sommerseth2009-06-111-0/+16
| | | | | | | This is a more dynamic function than the static functions like dmidecode.bios(). The equivalent will be dmidecode.QuerySection('bios') This is to unify the dmidecode API and the dmidecodeXML API
* Discovered another issue with Python and importsDavid Sommerseth2009-06-101-2/+2
| | | | | | | | | | | | | | | | | | The shard library got renamed to dmidecodemodule.so, and this was not clever. When you do 'import dmidecode' in Python, it will look for files in this order: dmidecode dmidecode.so dmidecodemodule.so dmidecode.py dmidecode.pyc This is of course a problem when the wrapper introduced in commit 65c9384ec9b6e265aba11227ffa37ae7a6a787d1 is called dmidecode.py, and Python attempts to load dmidecodemodule.so before dmidecode.py. To solve this, dmidecodemodule.so is now renamed to dmidecodemod.so.
* Fixed import issues with dmidecodeDavid Sommerseth2009-06-101-2/+2
| | | | | | | | | | | | | | | | As we now include libxml2 and the required libxml2mod (which is used to wrap xmlDoc and xmlNode data into Python objects), importing only dmidecode caused a failure. If adding import libxml2 first, everything would work out fine. To avoid this issue, due to backwards compatibility, a tiny dmidecode wrapper is implemted as well. The dmidecode.so module is now renamed to dmidecodemodule.so, and the wrapper is now called dmidecode.py. To simplify things, the dmidecodeXML module introduced in commit b25b2ca548508cd2beb26f465b7bc5a296592461 is not merged into the new dmidecode.py The constants mentioned are now called dmidecode.DMIXML_NODE and dmidecode.DMIXML_DOC and to instantiate the dmidecodeXML class, dmidecode.dmidecodeXML() is used.
* Implemented native libxml2 XML API for dmidecodeDavid Sommerseth2009-06-101-14/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To use this API, you need to import dmidecodeXML. This is a wrapper class for the internal XML API which has been implemented. In addition, you might also want to import libxml2 as well. dmidecodeXML::QuerySection(<string>) Valid section strings can be found in the pymap.xml file, in the <GroupMapping> tag section. dmidecodeXML::TypeId(<integer between 0-255>) Valid values should match the DMI/SMBIOS specification. dmidecodeXML::SetResultType(resultType) Result type can be either dmidecodeXML.DMIXML_NODE or dmidecodeXML.DMIXML_DOC ---------------------------------------------------------- import libxml2 import dmidecodeXML dmixml = dmidecodeXML.dmidecodeXML() section_nodes = dmixml.QuerySection('processor') dmixml.SetResultType(dmidecodeXML.DMIXML_DOC) typeid_doc = dmixml.QueryTypeId(0x10) dmixml.SetResultType(dmidecodeXML.DMIXML_NODE) typeid_doc.saveFormatFileEnc("-", "UTF-8", 1) ----------------------------------------------------------
* Improved error handling and fixed last unit-test failuresDavid Sommerseth2009-06-091-64/+33
|
* Fixed SEGV when setting new devive fileDavid Sommerseth2009-06-091-2/+4
|
* Implemented dmidecode.type(int) function properlyDavid Sommerseth2009-06-091-19/+66
|
* Big rewrite again, simplified the usage of opt->typeDavid Sommerseth2009-06-091-74/+124
| | | | | | Instead of building up an u8 array with 255 cells where we only use one cell at the time now, just pass the type id value as an int the whole way through.
* Further removal of deprecated functionsNima Talebi2009-06-051-5/+5
| | | | | | | Removed the `dmi_table_string' function, and `const struct string_keyword *string' from the `options' struct. Also modified the function calls that are now free of this, namely, `legacy_decode' and `smbios_decode'.
* Avoid passing the option struct to dmidecode.c functionsDavid Sommerseth2009-06-041-5/+5
|
* Moved options global_options to a more suitable place. Added a commentDavid Sommerseth2009-06-041-2/+4
|
* Rewrote bigger parts to avoid global variables as much as possibleDavid Sommerseth2009-06-031-87/+118
|
* Renamed *_set_version() functions to a more proper *_get_version() function ↵David Sommerseth2009-06-031-8/+8
| | | | | | | | names Also changed dmiMAP_ParseMappingXML(...) to dmiMAP_ParseMappingXML_GroupName(...). In the dmidecode_get(...) function. This is just a quick fix for making it compile. It's also needed to implement usage of dmiMAP_ParseMappingXML_TypeID(...) as well.
* Removed unneeded section (already commented out)David Sommerseth2009-05-271-5/+1
|
* WIP commitNima Talebi2009-05-271-39/+30
| | | | | | | | 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.
* Loading in the new the new `type' XML fileNima Talebi2009-05-241-1/+10
|
* Completed preliminary reimplementation of type()Nima Talebi2009-05-241-2/+12
| | | | | | | Updated test unit to match. Throw an exception instead of returning None/False in some functions.
* More cleanupNima Talebi2009-05-231-1/+1
| | | | | | | | | Don't write to stdout unless in debug mode (with respect to writing to memory devices. Added the xml datafile to setup (distutils). Updated test case (incorporating color and cleaning up tests).
* Reversioned, relicensed, and rejiggedNima Talebi2009-05-221-10/+40
| | | | | | | | | | | The version is of now, v3.10.6. The version major field has been upped due to the newly added XML functionality. The version has been reverted to GPLv2. Some headers have been cleaned up, copyright notices added etc. Credits given where due.
* Update copyright noticeNima Talebi2009-05-221-0/+11
|
* Improved error handling when parsing mapping XMLDavid Sommerseth2009-05-041-1/+3
|
* Improved setting of pythonmap.xmlDavid Sommerseth2009-04-301-1/+26
| | | | | | The default file is now set to /usr/share/python-dmidecode/pythonmap.xml (defined in config.h) and can be overridden with the dmidecode.pythonmap() function in Python.
* Fixed a bug causing segvDavid Sommerseth2009-04-301-2/+2
| | | | | | | | When calling dmidecode_get_xml(...) several times could cause a crash due to the opt.dmiversion_n pointer being freed by a mistake when the generated dmixml_n got freed later on in the function. Also fixed an assertion typo
* Began completing the rewrite of needed dmidecodemodule changesDavid Sommerseth2009-04-301-67/+114
|
* Removed all Python dependencies in dmidecode.[ch]David Sommerseth2009-04-291-0/+1
|
* Made it compileDavid Sommerseth2009-04-291-9/+14
|
* Added indenting tool for C code and reindented *.[ch] filesDavid Sommerseth2009-04-291-251/+323
|
* Reverting recent (pointless) change.nima2009-03-311-0/+305
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@180 abc39116-655e-4be6-ad55-d661dc543056
* Preparing to migrate to GIT.nima2009-03-311-305/+0
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@179 abc39116-655e-4be6-ad55-d661dc543056
* Cleaned up the fix for type(127).nima2008-12-221-2/+4
| | | | | | | | | Added the second type of stuffed bios (upstream). Integrated dmidecode the binary into the test case for a more objective result. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@163 abc39116-655e-4be6-ad55-d661dc543056
* Handle cases where user does not have appropriate permission to access thenima2008-12-211-6/+15
| | | | | | | memory file or device. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@155 abc39116-655e-4be6-ad55-d661dc543056
* Cleanup.nima2008-12-201-1/+1
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@137 abc39116-655e-4be6-ad55-d661dc543056
* Handle cases where user asks for invalid types.nima2008-12-201-3/+6
| | | | | | | Updated test cases to test for this too. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@136 abc39116-655e-4be6-ad55-d661dc543056
* Version information now set once during init().nima2008-12-201-29/+76
| | | | | | | | | Bettered test cases. Case 127 magically fixed. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@135 abc39116-655e-4be6-ad55-d661dc543056
* Removed "detected" from appearing in every single function call. TODO: An ivarnima2008-12-201-13/+33
| | | | | | | | | | | | 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. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@133 abc39116-655e-4be6-ad55-d661dc543056
* More testing and fixes.nima2008-12-191-3/+7
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@127 abc39116-655e-4be6-ad55-d661dc543056
* Removed a printf() comment.nima2008-12-191-1/+1
| | | | git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@125 abc39116-655e-4be6-ad55-d661dc543056
* Check that the path given with set_dev() is writeable.nima2008-12-191-9/+22
| | | | | | | | | Don't crash when writing to a read-only file, return False instead. Missing an INCREF in get_dev() fixed. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@124 abc39116-655e-4be6-ad55-d661dc543056