diff options
author | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-08-06 07:23:35 +0000 |
---|---|---|
committer | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-08-06 07:23:35 +0000 |
commit | 8eb77f162256ae17a1ab1d36d32aa33f8d69647e (patch) | |
tree | 54f28c952f24f2afa0941a651c3d7206f855f829 /dmidecode.c | |
parent | ea79c3b4226de0671d67bc2a178a21c116ee9e99 (diff) | |
download | python-dmidecode-8eb77f162256ae17a1ab1d36d32aa33f8d69647e.tar.gz python-dmidecode-8eb77f162256ae17a1ab1d36d32aa33f8d69647e.tar.xz python-dmidecode-8eb77f162256ae17a1ab1d36d32aa33f8d69647e.zip |
Completed functions for `case 27', and fixed error in last commit for `case 26'.
git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@49 abc39116-655e-4be6-ad55-d661dc543056
Diffstat (limited to 'dmidecode.c')
-rw-r--r-- | dmidecode.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/dmidecode.c b/dmidecode.c index 74c2c27..e46fb24 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -2457,7 +2457,7 @@ static PyObject *dmi_voltage_probe_resolution(u16 code) { static PyObject *dmi_probe_accuracy(u16 code) { PyObject *data; if(code==0x8000) data = PyString_FromString("Unknown"); - else data = PyString_FromString("%.2f%%", (float)code/100); + else data = PyString_FromFormat("%.2f%%", (float)code/100); return data; } @@ -2465,7 +2465,7 @@ static PyObject *dmi_probe_accuracy(u16 code) { ** 3.3.28 Cooling Device (Type 27) */ -static const char *dmi_cooling_device_type(u8 code) { +static PyObject *dmi_cooling_device_type(u8 code) { /* 3.3.28.1 */ static const char *type[]={ "Other", /* 0x01 */ @@ -2482,18 +2482,19 @@ static const char *dmi_cooling_device_type(u8 code) { "Active Cooling", /* 0x10, master.mif says 32 */ "Passive Cooling" /* 0x11, master.mif says 33 */ }; + PyObject *data; - if(code>=0x01 && code<=0x09) - return type[code-0x01]; - if(code>=0x10 && code<=0x11) - return type_0x10[code-0x10]; - return out_of_spec; + if(code>=0x01 && code<=0x09) data = PyString_FromString(type[code-0x01]); + else if(code>=0x10 && code<=0x11) data = PyString_FromString(type_0x10[code-0x10]); + else data = PyString_FromString(out_of_spec); + return data; } -static const char *dmi_cooling_device_speed(u16 code, char *_) { - if(code==0x8000) sprintf(_, "Unknown Or Non-rotating"); - else sprintf(_, "%u rpm", code); - return _; +static PyObject *dmi_cooling_device_speed(u16 code) { + PyObject *data; + if(code==0x8000) data = PyString_FromString("Unknown Or Non-rotating"); + else data = PyString_FromFormat("%u rpm", code); + return data; } /******************************************************************************* |