Solution for Adafruit PITFT and Pygame on Raspbian Buster

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
hifi
 
Posts: 26
Joined: Sat Nov 29, 2014 1:32 am

Solution for Adafruit PITFT and Pygame on Raspbian Buster

Post by hifi »

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 BANNED https://forum-raspberrypi.de/forum/thre ... 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/0tkdym8ojhcmb ... _armhf.deb
and then install the package by running the following command:

Code: Select all

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

sudo apt install libts-dev
2. Get the required packages

Code: Select all

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

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

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

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

# 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

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

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

debian/rules clean
dpkg-source -b .
debian/rules build
11. Create the packages (in folder /home/pi/SDL-1.2.15)

Code: Select all

fakeroot debian/rules binary
12. Install new package

Code: Select all

cd ..
sudo dpkg -i libsdl1.2debian_1.2.15+veloci1-1_armhf.deb
Many thanks to Gerhard for the suggested solution!

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

Re: Solution for Adafruit PITFT and Pygame on Raspbian Buste

Post by SuperNinjaFat64 »

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/0tkdym8ojhcmb ... _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

dpkg-source -b .
returns as:

Code: Select all

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

User avatar
bobthechemist
 
Posts: 25
Joined: Sat Aug 24, 2013 9:19 am

Re: Solution for Adafruit PITFT and Pygame on Raspbian Buste

Post by bobthechemist »

Thank you for this information. As of March 2020, the package install option is working wonderfully.

User avatar
jumpzero
 
Posts: 43
Joined: Thu Feb 21, 2013 8:32 pm

Re: Solution for Adafruit PITFT and Pygame on Raspbian Buste

Post by jumpzero »

Hi!

I can confim: it works. Thanks a lot for publishing that.

As of 01/April/2020 with Raspbian lite Buster and PiTFT 2.8” resistive on a Pi 1 Rev2

1st: adafruit easy-install script still works with Buster.
Download latest Raspbian lite, burn it on the SD, boot the Pi, apt update, apt upgrade, then run adafruit easy-install. At this stage the screen is working.

2nd: install pygame. As explained by hifi here above the touch part of the touchscreen isn’t working because of libsdl1.2. The solution given by hifi worked perfectly for me. I tried both, first: download the deb package from Dropbox and second: (because I like to do it myself) build the package. Both works.
However I would like to share my experience for others to avoid the traps while building the package:

Details for Step 6:
6.1 Add “libts-dev” to the "Build-Depends:"-section at the top of /home/pi/SDL-1.2.15/debian/control
6.2 Add “libts-dev” to the "Depends:"-section for "Package: libsdl1.2-dev" at the bottom of /home/pi/SDL-1.2.15/debian/control
But for both don't forget to put the comma (as I did) at the end of previous item in the list.
Part of the top after the modification:

Code: Select all

...
Build-Depends: debhelper (>= 11~),
               nasm [any-i386],
               libx11-dev, 
               libxext-dev,
               libxt-dev,
               libxv-dev,
               x11proto-core-dev,
               libpulse-dev,
               libgl1-mesa-dev,
               libasound2-dev [linux-any],
               libcaca-dev,
               libusbhid-dev [kfreebsd-any],
               libglu1-mesa-dev,
               libts-dev
Vcs-Git: https://salsa.debian.org/sdl-team/libsdl1.2.git
...
and part of the bottom after the modification:

Code: Select all

...
Package: libsdl1.2-dev
Architecture: any
Section: libdevel
Depends: ${misc:Depends},
         libsdl1.2debian (= ${binary:Version}),
         libasound2-dev [linux-any],
         libcaca-dev,
         libglu1-mesa-dev | libglu-dev,
         libpulse-dev,
         libusbhid-dev [kfreebsd-any],
         libx11-dev,
         libxext-dev,
         libts-dev
Replaces: libsdl-dev
...
I also found in step 9 the path is to correct:
replace:

Code: Select all

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
by:

Code: Select all

mv /home/pi/libsdl1.2_1.2.15+dfsg2.orig.tar.gz /home/pi/libsdl1.2_1.2.15+veloci1.orig.tar.gz
Thanks again for sharing
--
Jmp0

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”