From 60eb9d480daa352d7af19ad67e410f384f0e9f74 Mon Sep 17 00:00:00 2001 From: nima Date: Thu, 3 Jul 2008 15:59:08 +0000 Subject: Major changes have been implemented, alas, untested, in hope to move towards a new version of dmi decode where rather than having data just printed to screen in functions, data is passed around, and some data structure is constructed, which is then used to construct the Python list/dicitonary objects. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@10 abc39116-655e-4be6-ad55-d661dc543056 --- dmidecodemodule.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'dmidecodemodule.c') diff --git a/dmidecodemodule.c b/dmidecodemodule.c index a36b811..36b4b04 100644 --- a/dmidecodemodule.c +++ b/dmidecodemodule.c @@ -1,6 +1,9 @@ #include "dmidecodemodule.h" +#include static PyObject* dmidecode_get(PyObject *self, char* section) { + mtrace(); + bzero(buffer, 50000); //Py_Initialize(); @@ -32,7 +35,7 @@ static PyObject* dmidecode_get(PyObject *self, char* section) { opt.flags=0; opt.type = NULL; opt.type=parse_opt_type(opt.type, section); - if(opt.type==NULL) return -1; + if(opt.type==NULL) return NULL; /* First try EFI (ia64, Intel-based Mac) */ efi = address_from_efi(&fp); @@ -50,7 +53,7 @@ static PyObject* dmidecode_get(PyObject *self, char* section) { goto exit_free; } - if(smbios_decode(buf, opt.devmem)) found++; + if(smbios_decode(buf, opt.devmem, NULL)) found++; goto done; @@ -63,10 +66,10 @@ memory_scan: for(fp=0; fp<=0xFFF0; fp+=16) { if(memcmp(buf+fp, "_SM_", 4)==0 && fp<=0xFFE0) { - if(smbios_decode(buf+fp, opt.devmem)) found++; + if(smbios_decode(buf+fp, opt.devmem, NULL)) found++; fp+=16; } else if(memcmp(buf+fp, "_DMI_", 5)==0) { - if(legacy_decode(buf+fp, opt.devmem)) found++; + if(legacy_decode(buf+fp, opt.devmem, NULL)) found++; } } @@ -113,6 +116,7 @@ exit_free: nextLine = strtok(NULL, "\n"); } + muntrace(); return data; } -- cgit