summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dmidecode.c4
-rw-r--r--dmidecodemodule.c5
-rwxr-xr-xexample.py9
3 files changed, 15 insertions, 3 deletions
diff --git a/dmidecode.c b/dmidecode.c
index 3200d63..e10b931 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -1024,8 +1024,8 @@ static PyObject *dmi_processor_voltage(u8 code) {
const char *dmi_processor_frequency(u8 *p, char *_) {
u16 code = WORD(p);
- if(code) catsprintf(_, "%u MHz", code);
- else catsprintf(_, "Unknown");
+ if(code) sprintf(_, "%u MHz", code);
+ else sprintf(_, "Unknown");
return _;
}
static PyObject *dmi_processor_frequency_py(u8 *p, char *_) {
diff --git a/dmidecodemodule.c b/dmidecodemodule.c
index 5b6f63a..6e9cfe5 100644
--- a/dmidecodemodule.c
+++ b/dmidecodemodule.c
@@ -120,6 +120,10 @@ static PyObject* dmidecode_get_memory(PyObject *self, PyObject *args) { return d
static PyObject* dmidecode_get_cache(PyObject *self, PyObject *args) { return dmidecode_get(self, "cache"); }
static PyObject* dmidecode_get_connector(PyObject *self, PyObject *args) { return dmidecode_get(self, "connector"); }
static PyObject* dmidecode_get_slot(PyObject *self, PyObject *args) { return dmidecode_get(self, "slot"); }
+static PyObject* dmidecode_get_type(PyObject *self, PyObject *args) {
+ fprintf(stderr, "%s\n", PyString_AsString(args));
+ return dmidecode_get(self, PyString_AsString(args));
+}
PyMethodDef DMIDataMethods[] = {
{ "bios", dmidecode_get_bios, METH_VARARGS, "BIOS Data" },
@@ -131,6 +135,7 @@ PyMethodDef DMIDataMethods[] = {
{ "cache", dmidecode_get_cache, METH_VARARGS, "Cache Data" },
{ "connector", dmidecode_get_connector, METH_VARARGS, "Connector Data" },
{ "slot", dmidecode_get_slot, METH_VARARGS, "Slot Data" },
+ { "type", dmidecode_get_type, METH_VARARGS, "By Type" },
{ NULL, NULL, 0, NULL }
};
diff --git a/example.py b/example.py
index f7370bd..bfea140 100755
--- a/example.py
+++ b/example.py
@@ -2,7 +2,7 @@
import dmidecode
import sys
from pprint import pprint
-print "*** bios ***"; pprint(dmidecode.bios())
+#print "*** bios ***"; pprint(dmidecode.bios())
#print "*** system ***\n", pprint(dmidecode.system())
#print "*** baseboard ***\n"; pprint(dmidecode.baseboard())
#print "*** chassis ***\n"; pprint(dmidecode.chassis())
@@ -11,3 +11,10 @@ print "*** bios ***"; pprint(dmidecode.bios())
#print "*** cache ***\n"; pprint(dmidecode.cache())
#print "*** connector ***\n"; pprint(dmidecode.connector())
#print "*** slot ***\n"; pprint(dmidecode.slot())
+#
+#for v in dmidecode.memory().values():
+# if type(v) == dict and v['dmi_type'] == 17:
+# print v['data']['Size'],
+#print ""
+
+print dmidecode.type('17')