So guys i finally find the solution!!!
My hardware configuration is Raspberry Pi Zero and this touchscreen (Ali: 3.5 inch 26P SPI TFT LCD Display Screen with Touch Panel 320*480 for RPi1/RPi2/raspberry pi3 Board V3 (Support Raspbian System))
I have installed the last RASPBIAN STRETCH LITE os.
For install the touch screen i follow this video (https://www.youtube.com/watch?v=gVK9MpPzK44) after all this steps i added this three additional command:
sudo apt-get install xserver-xorg-input-evdev
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
sudo reboot
After this step I try to lunch the control panel but with this issue:
pi@alcontpan:~ $ python /srv/main.py
Initting…
Setting Mouse invisible…
Traceback (most recent call last):
File “/srv/main.py”, line 119, in
ui = UI(‘images/bg.png’)
File “/srv/alarmpanel/ui.py”, line 25, in init
pygame.mouse.set_visible(False)
pygame.error: video system not initialized
To solve this we need first change the file /srv/alarmpanel/ui.py in this way:
sudo nano /srv/alarmpanel/ui.py
In this file we need to modify the line 16:
From this: os.putenv(‘SDL_MOUSEDEV’, ‘/dev/input/touchscreen’)
To this: os.putenv(‘SDL_MOUSEDEV’, ‘/dev/input/event0’)
If wee try now to lunch the Alarm Control Panel it works, but the touchscreen doesn’t react.
To solve this last issue we need to downgrade the SDL in stis way:
Make sure you do this command in su mode!
sudo su
nano fix.sh
Paste inside this script:
#enable wheezy package sources
echo "deb Index of /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
#install
apt-get update
apt-get -y --force-yes install libsdl1.2debian/wheezy
Chenge the file permission:
chmod +x fix.sh
And execute the script:
./fix.sh
After this we need to cheat the obsolete installation with:
apt autoremove
Now we can exit from su mode and reinstall the pygame:
exit
sudo apt-get install python-pygame
The last thing to do is calibrate the touchscreen in this way:
sudo su
aptitude install libts-bin
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_FBDEVICE=/dev/fb1
ts_calibrate
follow the procedure on the screen and finally all is done.
Now we can open the Alarm Control Panel:
python /srv/main.py
and everything should work correctly!
I hope this procedure can help you and solve your problem.