diff options
author | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-07-29 01:31:21 +0000 |
---|---|---|
committer | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-07-29 01:31:21 +0000 |
commit | e60c33b99aeb6293662c3c0cfe29311660a1561f (patch) | |
tree | 520415a2d387e839294cdc04b153580fe19cd969 | |
parent | 3db9a258855f62caf5b923e6ec6cbcdad00fda5b (diff) | |
download | python-dmidecode-e60c33b99aeb6293662c3c0cfe29311660a1561f.tar.gz python-dmidecode-e60c33b99aeb6293662c3c0cfe29311660a1561f.tar.xz python-dmidecode-e60c33b99aeb6293662c3c0cfe29311660a1561f.zip |
Completed `case 11'.
git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@30 abc39116-655e-4be6-ad55-d661dc543056
-rw-r--r-- | dmidecode.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/dmidecode.c b/dmidecode.c index 1419108..c6eaedc 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -1683,15 +1683,21 @@ static PyObject *dmi_on_board_devices(struct dmi_header *h) { * 3.3.12 OEM Strings (Type 11) */ -static const char *dmi_oem_strings(struct dmi_header *h, char *_) { +static PyObject *dmi_oem_strings(struct dmi_header *h) { u8 *p=h->data+4; u8 count=p[0x00]; int i; - catsprintf(_, NULL); - for(i=1; i<=count; i++) - catsprintf(_, "String %d: %s|", i, dmi_string(h, i)); - return _; + PyObject *data = PyDict_New(); + PyObject *val; + + for(i=1; i<=count; i++) { + val = dmi_string_py(h, i); + PyDict_SetItem(data, PyInt_FromLong(i), val); + Py_DECREF(val); + } + + return data; } /******************************************************************************* @@ -3139,9 +3145,14 @@ void dmi_decode(struct dmi_header *h, u16 ver, PyObject* pydata) { break; case 11: /* 3.3.12 OEM Strings */ - dmiAppendObject(++minor, "OEM Strings", NULL); + NEW_METHOD = 1; + caseData = dmi_on_board_devices(h); + if(h->length<0x05) break; - dmiAppendObject(++minor, ">>>", dmi_oem_strings(h, _)); + _val = dmi_oem_strings(h); + PyDict_SetItemString(caseData, "Strings", _val); + Py_DECREF(_val); + break; case 12: /* 3.3.13 System Configuration Options */ |