Touchscreen backlight control on raspberry pi

“Official” 7" touchscreen backlight can be switched on/off using the following commands
echo 1 > /sys/class/backlight/rpi_backlight/bl_power
echo 0 > /sys/class/backlight/rpi_backlight/bl_power

This only seems to be true for Rasbian not OSMC

What I wanted to say is that this is the way that it is done on raspian. I was assuming that OSMC on the raspberry is raspbian+kodi+osmc-goodies in an easy installer. If all this is true then probably OSMC would need to upgrade to a newer raspian and would then also have the backlight on/off feature (at least for people that then use it in a programm). I would probably add backlight-off to one of the things that can be done in a “screensaver” or in the “switch off” options.

For OSMC, it seems we do need to wait for the latest update. In the mean time, I do have it working now in Raspbian running Kodi. There was a service addon for Kodi that lets you execute scripts on certain events. Screensaver on and off were there, works well. The only thing I had to do was disable the screensaver from lightdm. if both went off, I could not get the screen back.

I just installed the 3-3 release of OSMC on my RPi 2. I got through the initial installation problems where it gets stuck at the license page. I still can’t find support for the RPi touch display back light. Is it there but implemented differently than on Raspbian or still just missing? Black display with the back light still on does not cut it.Right now using Kodi on Raspbian is the lesser of the issues I have. OSMC has much better touch support but lacks back light control. Raspbian has back light control but poor touch support ( basically just mouse movement ). OSMC with real back light control would be the ticket.

Hi,

had the same problems.
I just copied the file
/boot/overlays/rpi-backlight-overlay.dtb from a raspbian installation to
/boot/overlays/rpi-backlight-overlay.dtb in OSMC.

After a reboot you can control the backlight of the touchscreen.

sudo su
echo 1 > /sys/class/backlight/rpi_backlight/bl_power #turns the light off
echo 0 > /sys/class/backlight/rpi_backlight/bl_power #turns the light on

sudo su
echo 80 > /sys/class/backlight/rpi_backlight/brightness #adjusts the brightness. 255 is full brightness, 0 is off

Brightness control is only available if your touchscreen is version 1.1

Max

Most excellent post thank you

What is needed is a slide bar adjustment setting (or even just a integer setting) in osmc’s settings area.

I will add the overlay in a future update

Thanks Max, I will try this.

A buddy of mine wanted to make a Kodi portable unit for his son for Christmas. I have not tried this since then but I have a little script that might help. I would ssh into OSMC and ran it.

I’ve created a screensaver PiTsOff that can switch the backlight off/on ( at least on my machine :slight_smile: ) running 2016-04.1
It’s on GitHub, with an installable zip file in the project releases

I got the head-start from pimon which does a similar thing for powering off/on an HDMI display.

2 Likes

So I tried PiTsOff and it did not turn the back light off for me. All I got was blank screen with back light still on.

Joel

I added a rule I used before to fix bl_power permission issues. I added this to OSMC and now PiTsOff works as expected. Still working through other issues.

The screensaver uses a sudo sh to echo the digit to the bl_power ‘file’, it worked with my install which was just an update to the latest release (no beta versions or custom permissions).

1 Like

Is there any “official” answer on this topic? My OSMC runs day & night, and while the screenblanker blackens the display, the backlight stays on which degrades life expectancy significantly.
There are several topics about this in this forum, some about trying to switch off back light power via command line callbacks when the blanker activates, but I would expect some native support in OSMC, given the Pi Touch Display must be amongst the most common displays for OSMC.

Is there a way to track this feature request?

You can open a ticket at github.

I added the overlay already quite some time ago

I want to know what is actually missing. Is a CONFIG_ option required?

Sorry if I miss the obvious: documentation.

My OSMC is working with a hifiberry so I already have a device tree overlay in place. Do you mean by “added the overlay” a dtoverlay? While I built some PI devices already and are using Linux as my primary OS, I am not too familiar with the OSMC terminology and technology environment. (Searching the internet quite a bit gave me no recent information, sorry if I missed it.)

My main issue is that I cannot decide which are early experiments by fellow forum members and which is an officially supported way (i.e. the overlay you implemented).

Thanks so much for the quick answers

Kay

There is already a DT overlay, yes.