erpalma / throttled

Workaround for Intel throttling issues in Linux.
MIT License
2.68k stars 166 forks source link

No valid power detection methods found. Assuming that the system is running on battery power #303

Closed sandpython closed 2 years ago

sandpython commented 2 years ago

Hi,

I ran into the "No valid power detection" issue, as did some others. In my case I had to add "pending-charge" as status to make it work.

best regards, Michael

try: out = subprocess.check_output(('upower', '-i', '/org/freedesktop/UPower/devices/battery_BAT0')) res = re.search(rb'state:\s+(.+)', out).group(1).decode().strip() if res == 'discharging': return True elif res == 'pending-charge': return False elif res in ('fully-charged', 'charging'): return False except: pass

warning('No valid power detection methods found. Assuming that the system is running on battery power.')
return True