Enable X windows on PiScreen
There are two things that need to be done before we can use X on PiScreen.
- Remove the hard coding to /dev/fb0 in one of the framebuffer driver config file
- Calibrate the touchscreen for X.
We will install a xinput_calibrator and a script to load the calibration data each time X starts.
The first time you run X, you will be presented with a calibration screen. This will only run once, and you will be asked to touch the touchscreen a few times.
The calibration program will create a file which stores the calibration data(
To perform calibration again, just delete
/etc/pointercal.xinput and restart X. You will be presented again with the calibration program once X starts.
1. Disable framebuffer driver option for /dev/fb0
Open up the framebuffer conf file;
Comment out the line of text below;
Option "fbdev" "/dev/fb0"
This can be done by adding a hash (#) at the beginning of line.
#Option "fbdev" "/dev/fb0"
If the above file is empty, copy in the text below;
Section "Device" Identifier "PiSCreen" Driver "fbturbo" Option "fbdev" "/dev/fb1" EndSection
2. Install all the prerequisites required for calibration
3. Download and install xinput_calibrator
pi@raspberrypi ~ $ cd xinput_calibrator/
pi@raspberrypi ~ $ ./autogen.sh
pi@raspberrypi ~ $ make
pi@raspberrypi ~ $ sudo make install
4. Download and setup the calibration script
pi@raspberrypi ~ $ wget http://ozzmaker.com/piscreen/xinput_calibrator_pointercal.sh
pi@raspberrypi ~ $ sudo cp ~/xinput_calibrator_pointercal.sh /etc/X11/Xsession.d/xinput_calibrator_pointercal.sh
pi@raspberrypi ~ $ sudo chmod +x /etc/X11/Xsession.d/xinput_calibrator_pointercal.sh
We now want the script to run everytime X starts. This can be done by opening X autostart ;
Add the text below to the bottom of the file;
sudo /bin/sh /etc/X11/Xsession.d/xinput_calibrator_pointercal.sh
With the latest Raspbian Jessie images, X is configured to start automatically on boot.
Disable Screen Blanking
By default, X will blank out the screen after 10 minutes of no activity. Once you start using it again, the display will come back on.
If you want to disable this or increase the timeout, you will need to create a small script to disable power saving and disable screensaver which then gets loaded when X starts.
Disable X blanking
1. Install X server utilities, they will most likely already be installed.
2. Create a small script which is used to change the screen saver settings.
3. Add these three lines.
xset s off # don't activate screensaver xset -dpms # disable DPMS (Energy Star) features. xset s noblank # don't blank the video device
4. Change the permissions on the file.
5. Force the file to run when X starts
Or /etc/xdg/lxsession/LXDE/autostart on older version of Raspbian
And add this line to the bottom;