diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-18 10:20:59 -0700 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-18 10:20:59 -0700 |
commit | 4a327a6183ac2d5d8a812357f239a244f16f8211 (patch) | |
tree | 51b2d3a29f79cc5e19d4c5295409b251d5fa95cb /psutil/_psutil_windows.c | |
parent | efd7ed3d2c4aca57226572b2a81e5d7ebb9f3b8b (diff) | |
download | psutil-4a327a6183ac2d5d8a812357f239a244f16f8211.tar.gz |
Windows / refact: new sensors.c file
Diffstat (limited to 'psutil/_psutil_windows.c')
-rw-r--r-- | psutil/_psutil_windows.c | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 8e51c0bd..d7ffbfe3 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -35,6 +35,7 @@ #include "arch/windows/cpu.h" #include "arch/windows/mem.h" #include "arch/windows/net.h" +#include "arch/windows/sensors.h" #include "arch/windows/services.h" #include "arch/windows/socks.h" #include "arch/windows/wmi.h" @@ -1417,31 +1418,6 @@ error: } -/* - * Return battery usage stats. - */ -static PyObject * -psutil_sensors_battery(PyObject *self, PyObject *args) { - SYSTEM_POWER_STATUS sps; - - if (GetSystemPowerStatus(&sps) == 0) { - PyErr_SetFromWindowsErr(0); - return NULL; - } - return Py_BuildValue( - "iiiI", - sps.ACLineStatus, // whether AC is connected: 0=no, 1=yes, 255=unknown - // status flag: - // 1, 2, 4 = high, low, critical - // 8 = charging - // 128 = no battery - sps.BatteryFlag, - sps.BatteryLifePercent, // percent - sps.BatteryLifeTime // remaining secs - ); -} - - // ------------------------ Python init --------------------------- static PyMethodDef |