Start a new topic

pi-top with latest Raspbian and screen working at full brightness !!!

Hi everyone.



below is what I've came up trying to use latest raspbian version with pi-top forcing the screen to full brightness.


I've been trying to use the latest raspbian version but was unable to force screen brightness to full value until...


inside /home/pi/.pi-top/sys/ there's a python script hub_controller.py that manages comunication with pi-top HUB .


it manages:

-screen brightness increment/decrement ( and expilcit values between 1 and 10 )

-screen blank / unblank

-system shutdown ( when requested, the HUB must be shutdown also...)


by executing

ps ax | grep hub

you will see that script in execution...


Now you can bring the sys directory with you and boot in the latest raspbian .



once in raspbian, the display should be not so bright...


*) put sys directory where you wish.


*) hub_controller.py uses another executable to check screen status:

It calls the execution of xscreensaver-command .

But raspbian hasn't it installed by default .

so we can open a text editor and edit sys/hub_controller.py


around line 171 there is

 

print "Reading screen state"
try:

 

must change in

print "Reading screen state"
'''
try:

 

( we started a multi line comment )



then, around line 184 there is

else:
# Incorrect log from command - take value from hub and presume correct
screen_off = resp_bin_str[6]

if isValid(resp_bin_str, screen_off):
 print "Valid response"

 

should became

else:
# Incorrect log from command - take value from hub and presume correct
screen_off = resp_bin_str[6]
'''
screen_off = "0"
if True: #isValid(resp_bin_str, screen_off):
 print "Valid response"

 

( we ended the multilline comment, set screen_off to a default value and changed the if condition to be always true )


*) now. you need to enable SPI interface in raspbian:

execute sudo raspi-config and in advanced options enable SPI interface by default and answer yes when asked for enable automatic kernel-module load.


reboot

if screen is flickering, reboot by shutdown raspbian and unplugging/plugging the AC power.


*) now you need SPI python module ( by default rasbpian has not, pi-top has it ) .



in a terminal ( be aware of spaces in https addresses to be removed before executing the instructions )

mkdir python-spi
cd python-spi

wget https : / / raw.github.com / doceme / py-spidev / master / setup.py'
wget https : / / raw.github.com / doceme/py-spidev / master / spidev_module.c
wget https : / / raw.github.com / doceme/py-spidev / master / README.md
wget https : / / raw.github.com / doceme/py-spidev / master /CHANGELOG.md

sudo apt-get install python-dev
sudo python setup.py install

 

now create some empty file. in a terminal

cd sys

touch ./brightness_signal
touch ./shutdown_signal
touch ./screen_signal

 


now you can execute the script ( and let it run )

sudo python ./hub_controller.py


*) the funny part:


 

#to increase brightness
echo "increment" > ./brightness_signal

#to decrease brightness
echo "decrement" > ./brightness_signal

#to set brightness to a explicit value ( between 1 and 10 )
echo "10" > ./brightness_signal
#to blank the screen ( not tested, but should go )
echo "blank" > ./screen_signal

#to unblank the screen ( not tested, but should go )
echo "unblank" > ./screen_signal

#to shutdown ( not tested, but should go )
echo "shutdown" > ./shutdown_signal

 


*) ok.

now we can say that this approach is not the better one, but for my need it's ok. A good idea to start could be binding keystrokes to above commands to manage brightness from keyboard ( but another good idea should be implement a better python script than the ugly editing I've done above, which is not reliable... )


have fun!! :)



please note!!


the above solution is not well written, not well tested and should be understood by the reader...


follow the instructions at you own risk!!  ;)


it's no more than an hint!!

stanoc,


Thank you for the instruction.

I have used them to get battery statistics and brightness 



Hi Mark,

my battery pack never worked ( i'm waiting for a replacement... maybe... )
so I don't know how battery is managed in pi-top...

How did you obtained battery statistics on raspbian?
thanks,

stanoc

 


1 person likes this

I started debian from scratch and I am missing .pi-top directory.


Can you please provide me internet location of these files?


.pi-top directory is located in your home directory in pi-top OS

 

Hi stanoc


I replied to you already but my response is missing ?



Hi,
I also replied and my reply is missing! Strange things happening over here!
I said that I dont have any spare SD to write pi-top OS and I was asking if anyone can supply me .pi-top directory.
Otherwise I have to do this approach:
- buy new SD card
- download pi-top OS
- write to SD card
- run the system
- connect to internet
- upload .pi-top directory to OneDrive
- download to my tweaked OS

I'd really appreciate if anyone supply me with that directory... thanks..

 


1 person likes this

I read somewhere that you can do
sudo apt-get install pi-topOS.zip
by writing the flavor(overlay) over top of Raspbian.
I read that's all there is to PiTop OS..

You can manage brightness using PiTop overlay. It is possible to program settings at certain times in Terminal.

I tried this with a Raspberry Pi 3 and the 3/18/2016 version of Raspbian.

Instead of disabling the part of the python code that used screensaver, I did "apt-get install xscreensaver".

I enabled SPI support with raspi-config.

I did not need to install the python SPI stuff.  Apparently it's now part of the current raspbian.

I just copied the .pi-top/sys directory from the SD card that came with my PiTop to my home directory, cd'd into it, and ran "python ./hub_controller.py >/dev/null 2>&1 &".  Raspbian doesn't seem to require sudo to access SPI anymore.

After that, "echo "10" > brightness_signal" turned up the brightness.

So good news, this procedure still works, and it's easier.  Bad news is that on the SD that came with my Pi 3, there was no .pi-top/sys directory.  It looks like it was moved to /opt/pt-hub-controller.

 

Code to check the battery is a shell script on the Pi 3 version of the PiTop OS at /usr/bin/pt-battery.
Had to "apt-get install python-smbus" and "apt-get install bc" to get the script to work.

Once running, it reports:

State: Discharging
Remaining time: 312 mins
Capacity: 43%

 

On the SD card that came with my PiTop, /usr/bin/pt-battery is in /usr/local/bin/battery.

 

thanks a lot for these updates!!!

thank you, thank you!!! 
;)

 



try /usr/bin/pt-brightness 7
default I found was 3 allowed up to 10

 

/home/pi/.pi-top/sys/ Had moved... It's not there? Does anyone know where I could find this directory? Thanks
Login or Signup to post a comment