Kivy app display on 4DPI-35 without X Window

Running Kivy on 4DPI-35 without X

I ordered the Official Raspberry Pi 7″ touch screen from RS online. As usual, the order require 1 month to delivery.

Since I have a couple 4DPI-35, I thought I could develop the GUI first. Then deploy to the 7″ touch screen immediately once I received it a month later.

Google a bit and thought I should give Kivy a try. And it was good. Very easy for developing GUI application. It works great running under Windows.

Kivy app under Win32

Kivy app under Win32

I copied the py script to Pi with 4DPI-35 installed. It won’t work, of course. Tried a lot of solution found on web but none works. I almost give up, suddenly the solution was found here.

Below were my exact steps being recorded.

First thing first, backup the sdcard using Win32DiskImager. In case anything went wrong, we have the backup.

Install and setup KIVY

$ sudo su
# cd
# apt-get update 
# apt-get upgrade
# apt-get -y install pkg-config libgl1-mesa-dev libgles2-mesa-dev python-pygame python-setuptools libgstreamer1.0-dev git-core gstreamer1.0-plugins-{bad,base,good,ugly} gstreamer1.0-{omx,alsa} python-dev
# wget https://bootstrap.pypa.io/get-pip.py
# python get-pip.py
# pip install cython pygments docutils
# git clone https://github.com/kivy/kivy
# cd kivy
# python setup.py build
# python setup.py install

run example in order to generate default Kivy configuration file.

python ~/kivy/examples/demo/pictures/main.py

Once the sample is running, press Ctrl-C to stop the sample.

Edit the config.ini

# vi ~/.kivy/config.ini

Looks for the [input] section, make it like the following

[input]
mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput

Kivy setup is done.

Install Raspberry Pi Framebuffer Copy

# sudo su
# apt-get install cmake
# cd
# mkdir fbcp
# cd fbcp
# wget https://github.com/tasanakorn/rpi-fbcp/archive/master.zip
# unzip master.zip
# cd rpi-fbcp-master
# mkdir build
# cd build
# cmake ..
# make

Now connect the pi with a keyboard and the 4DPi-35. Using the keyboard to login as pi.

$ sudo su
# /root/fbcp/rpi-fbcp-master/build/fbcp

Now fbcp is running on 4DPi-35.

Run KIVY App

SSH to the raspberry pi as pi.

$ sudo su
# python your-kivy-app.py

Now your kivy app will display on 4DPi-35!! Yes, you execute the command on SSH terminal, and the app is being displayed on the 4DPi-35 tiny screen.



Leave a Reply

Your email address will not be published. Required fields are marked *