mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-07-09 00:32:04 +08:00
brightnessd: ignore some panels (#135)
Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Description=Limit display brightness with uptime
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
Restart=on-failure
|
||||
ExecStart=/usr/local/pyenv/shims/python -u /usr/comma/brightnessd.py
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -12,6 +12,10 @@ MAX_PERCENT = 90
|
||||
MIN_PERCENT = 30
|
||||
HOURLY_PERC_DECREASE = 5
|
||||
|
||||
IGNORED_PANELS = [
|
||||
"dsi_mate10_lite_video_display",
|
||||
]
|
||||
|
||||
def read(path: str) -> int:
|
||||
try:
|
||||
with open(path) as f:
|
||||
@@ -22,9 +26,19 @@ def read(path: str) -> int:
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# detect panel type
|
||||
with open("/sys/module/msm_drm/parameters/dsi_display0") as f:
|
||||
d = f.read().strip()
|
||||
panel = d.split(":")[0]
|
||||
|
||||
print(f"Detected panel '{panel}'")
|
||||
if panel in IGNORED_PANELS:
|
||||
print("panel is ignored, exiting")
|
||||
exit(0)
|
||||
|
||||
# brightness loop
|
||||
last_perc = None
|
||||
last_off_ts = time.monotonic()
|
||||
|
||||
while True:
|
||||
try:
|
||||
# sample brightness and backlight power
|
||||
|
||||
Reference in New Issue
Block a user