0

Solution for Adafruit PITFT and Pygame on Raspbian Buster
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Solution for Adafruit PITFT and Pygame on Raspbian Buster

by hifi on Tue Aug 27, 2019 1:09 am

The current version of the Pygame library leverages libsdl1.2. The version of the libsdl1.2 on Raspbian Buster OS has the issues with touchscreens. One of the solutions is to build that library with proper touchscreen support. This solution was suggested by Gerhard the author of NewtronRadio https://forum-raspberrypi.de/forum/thread/19020-newtron-radio-aufloesungsunabhaengiges-tron-radio On his behalf I'm creating this post hoping that it will be also helpful for other developers.

You can either download the patched libsdl1.2 package from the Gerhard's Dropbox account:
https://www.dropbox.com/s/0tkdym8ojhcmbu2/libsdl1.2debian_1.2.15+veloci1-1_armhf.deb
and then install the package by running the following command:
Code: Select all | TOGGLE FULL SIZE
sudo dpkg -i libsdl1.2debian_1.2.15+veloci1-1_armhf.deb

Or you can build that library yourself by following these steps:
1. Install libts-dev
Code: Select all | TOGGLE FULL SIZE
sudo apt install libts-dev

2. Get the required packages
Code: Select all | TOGGLE FULL SIZE
wget http://deb.debian.org/debian/pool/main/libs/libsdl1.2/libsdl1.2_1.2.15+dfsg2.orig.tar.gz
wget http://deb.debian.org/debian/pool/main/libs/libsdl1.2/libsdl1.2_1.2.15+dfsg2-4.debian.tar.xz

3. Extract the packages
Code: Select all | TOGGLE FULL SIZE
tar xvzf libsdl1.2_1.2.15+dfsg2.orig.tar.gz
cd SDL-1.2.15
tar xvfJ ../libsdl1.2_1.2.15+dfsg2-4.debian.tar.xz

4. Install libSDL dependencies (can be found in debian/control)
Code: Select all | TOGGLE FULL SIZE
sudo apt install libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libpulse-dev libgl1-mesa-dev libasound2-dev libcaca-dev libglu1-mesa-dev

5. Install packages for building .deb-packages
Code: Select all | TOGGLE FULL SIZE
sudo apt install build-essential debhelper

6. Add libts-dev to the "Build-Depends:"-section and to the "Depends:"-section for "Package: libsdl1.2-dev" in /home/pi/SDL-1.2.15/debian/control
7. Remove the "opts="-line in /home/pi/SDL-1.2.15/debian/watch so that it looks like this:
Code: Select all | TOGGLE FULL SIZE
# run "uscan --report" to check or "gpb import-orig --uscan" to update
version=4
https://www.libsdl.org/release/SDL-([\d.]+)\.tar\.(?:gz|bz2|xz|lzma)

8. Edit /home/pi/SDL-1.2.15/debian/changelog (add to top)
Code: Select all | TOGGLE FULL SIZE
libsdl1.2 (1.2.15+veloci1-1) unstable; urgency=medium

  * re-add support for libts
 
 -- veloci <veloci@gmx.de>  Thu, 11 Jul 2019 11:12:13 +0200
 

9. Rename libsdl1.2_1.2.15+dfsg2.orig.tar.gz to libsdl1.2_1.2.15+veloci1.orig.tar.gz
Code: Select all | TOGGLE FULL SIZE
mv /home/pi/SDL-1.2.15/libsdl1.2_1.2.15+dfsg2.orig.tar.gz /home/pi/SDL-1.2.15/libsdl1.2_1.2.15+veloci1.orig.tar.gz

10. Build the whole thing (in folder /home/pi/SDL-1.2.15)
Code: Select all | TOGGLE FULL SIZE
debian/rules clean
dpkg-source -b .
debian/rules build

11. Create the packages (in folder /home/pi/SDL-1.2.15)
Code: Select all | TOGGLE FULL SIZE
fakeroot debian/rules binary

12. Install new package
Code: Select all | TOGGLE FULL SIZE
cd ..
sudo dpkg -i libsdl1.2debian_1.2.15+veloci1-1_armhf.deb


Many thanks to Gerhard for the suggested solution!

hifi
 
Posts: 26
Joined: Sat Nov 29, 2014 1:32 am

Re: Solution for Adafruit PITFT and Pygame on Raspbian Buste

by SuperNinjaFat64 on Sat Oct 19, 2019 1:23 pm

Thank you for posting this fix! I used it a month ago and it worked like a charm!

However, today I found that the link on Gerhard's Dropbox account (https://www.dropbox.com/s/0tkdym8ojhcmbu2/libsdl1.2debian_1.2.15+veloci1-1_armhf.deb) doesn't work anymore.
I also followed your instructions on building the library myself and I ran into errors at step 10, specifically:
Code: Select all | TOGGLE FULL SIZE
dpkg-source -b .

returns as:
Code: Select all | TOGGLE FULL SIZE
dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../libsdl1.2_1.2.15+veloci1.orig.tar.{bz2,gz,lzma,xz}


**** EDIT *** Fixed. Initially, I accidentally rewrote the filename as "veloci1" with an "l" instead of a "1".

Thanks!
-Super

SuperNinjaFat64
 
Posts: 1
Joined: Sat Oct 19, 2019 1:17 pm

Please be positive and constructive with your questions and comments.