New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to disable backlight when shutdown? #3
Comments
It's possible you could pull this pin using a technique similar to the one here: https://github.com/pimoroni/clean-shutdown/blob/master/daemon/lib/systemd/system-shutdown/gpio-poweroff This drops a script into systemd that runs upon shutdown and asserts a GPIO pin. |
New, easier, method, add the following to
|
Can I turn the screen off using software when the pi is still turned on? i.e. on timeout turn the screen off then turn it back on when someone walks in front of the screen? |
I have similar project going on. I have the touch version, and would like tap the screen to wake it up and turn of with a timer. |
It seems that there is a supporting device tree function built in in the pi4 branch, but the overlay is not loaded. Running
|
I stand corrected, the above error happens possibly, because loading of overlays is a new thing. The debug log After installing the python module for the official 7" display, I quickly verified that the control works:
I don't know why this device is not responding to xset dkms commands, and what should be done to make it work, but this resolves to control issue for now. Next step is to hook it up to the screensaver functionality. |
This was working for a long time: But now I've installed the newest Raspbian Lite (aka Raspberry Pi OS, August 2020) on the same RPi4 and the screen will stay black on boot :-(. When I remove the line it will start as usual but the backlight won't turn off at shutdown (obviously). I've tried to put different things in a shutdown script located at
But at the very last stage the backlight turns on again. Any known issues with the latest RPi OS? Any solutions? |
The latest RPi OS - or rather the latest Linux kernel - seems rather more forceful about pins being mutually exclusive so I'm not surprised it's hit the backlight too. The previous and rather contrived method of using a script in Hacking on the script I linked above, something like this will work: #! /bin/sh
# file: /lib/systemd/system-shutdown/gpio-poweroff
# $1 will be either "halt", "poweroff", "reboot" or "kexec"
poweroff_pin="19"
case "$1" in
poweroff)
/bin/echo "Using power off pin $poweroff_pin"
/bin/echo $poweroff_pin > /sys/class/gpio/export
/bin/echo out > /sys/class/gpio/gpio$poweroff_pin/direction
/bin/echo 0 > /sys/class/gpio/gpio$poweroff_pin/value
/bin/sleep 0.5
;;
esac
: In the meantime I'll see if there's a way to get the dtoverlays playing nice together. |
Thanks for the info. I've created the script and put it into
Did I miss something? Do I have to install anything to make this script work? |
Okay upon further investigation the backlight should be turning off with no additional changes since there's a service in It appears to shut down the backlight... but then it comes right back on again at the last stage. I'm guessing this is the point at which the The only solution I can find is to hot-swap the module that owns the GPIO pin-
This seems to allow the backlight to turn off and stay off. I'll try and throw together a systemd unit for this. |
This is pretty clunky, but create the following as
And then run |
This pretty much sums what I had puzzled together I guess in a technically more precise way 😅 Its working with the |
I wrote a holiday project hyperpixel4-blu and embedded @Gadgetoid 's systemd service to be part of if. The package monitors XScreenSaver events and toggles the backlight on and off accordingly. You can find the .deb from the releases. |
This disables my backlight control in /etc/rc.local: Any way to dim the light with this service? |
@fhb – using those commands worked great for me as part of a bash script too, thanks so much! Edit: nope, both the service and the gpio commands still have the screen coming back on about three seconds after shutdown |
Same here, still comes back on after 3 seconds. |
Same here. I encountered this issue today. Have you been able to solve it? |
When the Raspberry Pi is shutdown, but still connected to power, the backlight remains on. Is this behaviour configurable? Or should it be possible to toggle the backlight off by pulling the backlight GPIO high/low during the shutdown process?
Any documentation that we can refer to?
The text was updated successfully, but these errors were encountered: