Skip to content

Commit

Permalink
nabboot: handle system LED name change in kernel 6.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
f-laurens committed Oct 17, 2023
1 parent 39e29c2 commit b2866d2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions nabboot/nabboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ def set_system_led(shutdown):
if shutdown:
return

with open("/sys/class/leds/led0/trigger", "w") as f:
f.write("none")

kernel_version = platform.release()
matchObj = re.match(r"[0-9]+", kernel_version)
if matchObj:
major_version = int(matchObj.group())
with open("/sys/class/leds/led0/brightness", "w") as f:
if major_version >= 6:
act_led="ACT"
else:
act_led="led0"

with open(f"/sys/class/leds/{act_led}/trigger", "w") as f:
f.write("none")

with open(f"/sys/class/leds/{act_led}/brightness", "w") as f:
if major_version >= 5:
f.write("0")
else:
Expand Down

0 comments on commit b2866d2

Please sign in to comment.