[Unit]
Description=reTerminal DM screen brightness daemon (ambient + buzzer)
Documentation=https://wiki.seeedstudio.com/reterminal-dm/
After=multi-user.target
# Wait for the IIO light sensor and backlight sysfs nodes to be available
After=systemd-udev-settle.service

[Service]
Type=simple
# Ensure brightness starts in auto (ambient) mode on every boot
ExecStartPre=/bin/sh -c 'mkdir -p /run/screen-brightness && echo auto > /run/screen-brightness/override'
ExecStart=/usr/local/bin/screen-brightness.py
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5
# Needs root to write to /sys/class/backlight and /sys/class/leds
User=root
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
