Hey there,
Controlling the backlight of the official raspberry pi screen is easy enough on raspbian, but it looks like it's different on openplotter.
The file and folder to use in the link do not even exist and you don't have write permission:
https://raspberrypi.stackexchange.com/qu...en-display
Same with the python code.
Anybody figured it out?
(2018-10-31, 05:00 PM)NaturalBornCamper Wrote: [ -> ]Hey there,
Controlling the backlight of the official raspberry pi screen is ready enough on raspbian, but it looks like it's different on openplotter.
The file and folder to use in the link do not even exist and you don't have write permission:
https://raspberrypi.stackexchange.com/qu...en-display
Same with the python code.
Anybody figured it out?
Hi,
controlling the backlight is very easy:
https://github.com/linusg/rpi-backlight
Open Terminal, type:
sudo nano /etc/udev/rules.d/backlight-permissions.rules
Add this to make access permanent:
SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power"
Install backlight-lib:
sudo pip install rpi_backlight
From now you can run 'sudo rpi-backlight' and it will ask for the brighness.
Or 'sudo rpi-backlight-gui' to get a graphical slider.
I am using an IR remote control and have changed the key-binding to call
the rpi-backlight-gui. Works very nice!
Type:
sudo nano ~/.config/openbox/lxde-pi-rc.xml
Insert after <!--keybindings for LXPanel -->:
<keybind key="your keyboard key here">
<action name="Execute">
<command>sudo ripi-backlight-gui</command>
</action>
</keybind>
To find out the Scancodes of your keyboard/RC, type:
xev
Use strg+c to quit xev.
Cheers,
Chris
Hey there, thanks for the answer!
I have seen that python project repo on the same link I sent, but it's not working for me, I suppose for the same reason that the file in the first answer is missing. OpenPlotter seems to be set differently.
Here's some error output when trying rpi-backlight:
Code:
pi@openplotter:~ $ sudo rpi-backlight --power
Traceback (most recent call last):
File "/usr/local/bin/rpi-backlight", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/rpi_backlight.py", line 160, in cli
print(get_power())
File "/usr/local/lib/python2.7/dist-packages/rpi_backlight.py", line 72, in get_power
return not int(_get_value("bl_power"))
TypeError: int() argument must be a string or a number, not 'NoneType'
Code:
pi@openplotter:~ $ sudo rpi-backlight --brightness 100
Traceback (most recent call last):
File "/usr/local/bin/rpi-backlight", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/rpi_backlight.py", line 151, in cli
set_brightness(args.brightness, args.smooth, args.duration)
File "/usr/local/lib/python2.7/dist-packages/rpi_backlight.py", line 83, in set_brightness
max_value = get_max_brightness()
File "/usr/local/lib/python2.7/dist-packages/rpi_backlight.py", line 62, in get_max_brightness
return int(_get_value("max_brightness"))
TypeError: int() argument must be a string or a number, not 'NoneType'
Code:
pi@openplotter:~ $ sudo rpi-backlight-gui
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
Segmentation fault