* your mileage may vary

Saturday, 9 January 2016

Jessie, Pygame and TFT touch screens (Raspberry Pi) and Calibration

It has been raining a lot so I tried to update my Pi-radio project.  It doesn't work and I'd been better off standing outside in the rain.  The calibration is way-off and the touch screen is unusable at best.  I suspect a lot of people will be in this situation.
This works ok, but programs written in Pygame are not working
sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 /usr/bin/ts_test
You can read about it here
A lot of people will be in the same boat as you (and me) and right now there are a couple of options.
    1. revert to Wheezy, but this will only be safe for so-long
    2. find an alternative to Pygame (requires some investigation and coding)
    3. follow this solution (it work for me), but it is only a temporary measure as I think the future of SDL in Pygame for the TFT is in question.
I tried to compile from source but gave up .....

From Adafruit Site:
#enable wheezy package sources
echo "deb http://archive.raspbian.org/raspbian wheezy main
" > /etc/apt/sources.list.d/wheezy.list

#set stable as default package source (currently jessie)
echo "APT::Default-release \"stable\";
" > /etc/apt/apt.conf.d/10defaultRelease

#set the priority for libsdl from wheezy higher then the jessie package
echo "Package: libsdl1.2debian
Pin: release n=jessie
Pin-Priority: -10
Package: libsdl1.2debian
Pin: release n=wheezy
Pin-Priority: 900
" > /etc/apt/preferences.d/libsdl

apt-get update
apt-get -y --force-yes install libsdl1.2debian/wheezy


  1. This don't fix the problem, returned coordinates are false.
    Raspi2 with official 7" TFT.

  2. ok - good to know. This worked for me with a TFT screen. I don't have the official RPI screen