File tree 1 file changed +10
-3
lines changed 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 39
39
)
40
40
CPUS = os .cpu_count ()
41
41
42
+ # ignore these devices under /sys/class/power_supply/
43
+ POWER_SUPPLY_IGNORELIST = ["hidpp_battery" ]
44
+
42
45
# Note:
43
46
# "load1m" & "cpuload" can't be global vars and to in order to show correct data must be
44
47
# decraled where their execution takes place
@@ -194,6 +197,8 @@ def charging():
194
197
"""
195
198
power_supply_path = "/sys/class/power_supply/"
196
199
power_supplies = os .listdir (Path (power_supply_path ))
200
+ # sort it so AC is 'always' first
201
+ power_supplies = sorted (power_supplies )
197
202
198
203
# check if we found power supplies. on a desktop these are not found
199
204
# and we assume we are on a powercable.
@@ -203,10 +208,12 @@ def charging():
203
208
# we found some power supplies, lets check their state
204
209
else :
205
210
for supply in power_supplies :
206
- # skip battery of hid devices
207
- # see issue #321
208
- if "hid" in supply .lower ():
211
+ # Check if supply is in ignore list
212
+ ignore_supply = any (item in supply for item in POWER_SUPPLY_IGNORELIST )
213
+ # If found in ignore list, skip it.
214
+ if ignore_supply :
209
215
continue
216
+
210
217
try :
211
218
with open (Path (power_supply_path + supply + "/type" )) as f :
212
219
supply_type = f .read ()[:- 1 ]
You can’t perform that action at this time.
0 commit comments