diff options
author | David Sommerseth <davids@redhat.com> | 2009-06-11 11:26:07 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2009-06-11 11:26:07 +0200 |
commit | 42a61ee1bf81334fffb02d75cb04196862746cef (patch) | |
tree | 068f26c952279cc7c4fea29c69d1616582d6b526 /src | |
parent | ad581a625904993404878b06804106fe5d8caf67 (diff) | |
download | python-dmidecode-42a61ee1bf81334fffb02d75cb04196862746cef.tar.gz python-dmidecode-42a61ee1bf81334fffb02d75cb04196862746cef.tar.xz python-dmidecode-42a61ee1bf81334fffb02d75cb04196862746cef.zip |
Implemented new dmidecode function - QuerySection(...)
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
Diffstat (limited to 'src')
-rw-r--r-- | src/dmidecodemodule.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c index d0c7043..3bc54d0 100644 --- a/src/dmidecodemodule.c +++ b/src/dmidecodemodule.c @@ -455,6 +455,17 @@ static PyObject *dmidecode_get_slot(PyObject * self, PyObject * args) { return dmidecode_get_group(global_options, "slot"); } + +static PyObject *dmidecode_get_section(PyObject *self, PyObject *args) +{ + char *section = PyString_AsString(args); + + if( section != NULL ) { + return dmidecode_get_group(global_options, section); + } + PyReturnError(PyExc_RuntimeError, "No section name was given"); +} + static PyObject *dmidecode_get_type(PyObject * self, PyObject * args) { int typeid; @@ -637,6 +648,11 @@ static PyMethodDef DMIDataMethods[] = { {(char *)"connector", dmidecode_get_connector, METH_VARARGS, (char *)"Connector Data"}, {(char *)"slot", dmidecode_get_slot, METH_VARARGS, (char *)"Slot Data"}, + {(char *)"QuerySection", dmidecode_get_section, METH_O, + (char *) "Queries the DMI data structure for a given section name. A section" + "can often contain several DMI type elements" + }, + {(char *)"type", dmidecode_get_type, METH_VARARGS, (char *)"By Type"}, {(char *)"pythonmap", dmidecode_set_pythonxmlmap, METH_O, |