Différences entre versions de « RASP-PiTFT-Touch »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
(Page créée avec « {{RASP-PiTFT-NAV}} == Introduction == {{ADFImage|RASP-PiTFT-Soft-Touch-01.jpg|480px}} xxx {{RASP-PiTFT-TRAILER}} »)
 
Ligne 1 : Ligne 1 :
 
{{RASP-PiTFT-NAV}}
 
{{RASP-PiTFT-NAV}}
  
== Introduction ==
+
== Présentation ==
  
{{ADFImage|RASP-PiTFT-Soft-Touch-01.jpg|480px}}
+
{{ADFImage|RASP-PiTFT-01.jpg|480px}}
  
xxx
+
L'écran PiTFT est équipé d'un film résistif, ce qui permet de simuler le fonctionnement de la souris en touchant l'écran.
 +
 
 +
Il convient néanmoins d'installer le support logiciel nécessaire (pour bouger le pointeur de souris) et d'effectuer une calibration.
 +
 
 +
== Configurer la partie tactile ==
 +
Now that the screen is working nicely, we'll take care of the touchscreen. There's just a bit of calibration to do, but it isn't hard at all.
 +
 
 +
Before we start, we'll make a '''udev''' rule for the touchscreen. That's because the '''eventX''' name of the device will change a lot and its annoying to figure out what its called depending on whether you have a keyboard or other mouse installed.
 +
 
 +
Run
 +
 
 +
<nowiki>sudo nano /etc/udev/rules.d/95-stmpe.rules</nowiki>
 +
 
 +
to create a new '''udev''' file and copy & paste the following line in:
 +
 
 +
<nowiki>SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"</nowiki>
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-01.png|480px}}
 +
 
 +
Remove and re-install the touchscreen with
 +
 
 +
<nowiki>sudo rmmod stmpe_ts; sudo modprobe stmpe_ts</nowiki>
 +
 
 +
Then type '''ls -l /dev/input touchscreen'''
 +
 
 +
It should point to '''eventX''' where X is some number, that number will be different on different setups since other keyboards/mice/USB devices will take up an event slot
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-02.png|480px}}
 +
 
 +
There are some tools we can use to calibrate & debug the touchscreen. Install the "event test" and "touchscreen library" packages with
 +
 
 +
<nowiki>sudo apt-get install evtest tslib libts-bin</nowiki>
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-03.png|480px}}
 +
 
 +
Now you can use some tools such as sudo evtest '''/dev/input/touchscreen''' which will let you see touchscreen events in real time, press on the touchscreen to see the reports.
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-04a.png|480px}}
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-04b.png|480px}}
 +
 
 +
OK lets start the calibration process! You will want to calibrate the screen once but shouldn't have to do it more than that. We'll begin by calibrating on the command line by running
 +
 
 +
<nowiki>sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate</nowiki>
 +
 
 +
follow the directions on the screen, touching each point. Using a stylus is suggested so you get a precise touch. Don't use something metal, plastic only!
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-05a.png|480px}}
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-05b.png|480px}}
 +
 
 +
Next you can run sudo '''TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test''' which will let you draw-test the touch screen. Go back and re-calibrate if you feel the screen isn't precise enough!
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-06.png|480px}}
 +
 
 +
== Calibration X ==
 +
 
 +
You can also calibrate the X input system but you have to use a different program called '''xinput_calibrator'''
 +
 
 +
You can do this if the calibration on the screen isnt to your liking or any time you change the rotate=XX module settings for the screen. Since the screen and touch driver are completely separated, the touchscreen doesn't auto-rotate
 +
 
 +
Normally you'd have to compile it but we have a ready to go package for you so run:
 +
 
 +
<nowiki>wget http://adafruit-download.s3.amazonaws.com/xinput-calibrator_0.7.5-1_armhf.deb
 +
sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb</nowiki>
 +
 
 +
Before you start the xinput_calibrator you will need to delete the old calibration data so run
 +
 
 +
<nowiki>sudo rm /etc/X11/xorg.conf.d/99-calibration.conf</nowiki>
 +
 
 +
Before running '''startx''' and the calibrator - otherwise it gets really confused!
 +
 
 +
Now you'll have to run the xcalibrator while also running X. You can do this by startx and then opening up the terminal program and running the '''xinput_calibrator''' command OR you can do what we do which is run startx in a SSH/Terminal shell and then run the xinput_calibrator in the X window, which requires the following command order:
 +
 +
<nowiki>FRAMEBUFFER=/dev/fb1 startx &
 +
DISPLAY=:0.0 xinput_calibrator</nowiki>
 +
 
 +
Follow the directions on screen
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-10.png|480px}}
 +
 
 +
Once complete you'll get something like:
 +
 
 +
{{ADFImage|RASP-PiTFT-Soft-Touch-11.png|480px}}
 +
 
 +
Run '''sudo nano /etc/X11/xorg.conf.d/99-calibration.conf''' and copy the
 +
 
 +
<nowiki>Section "InputClass"
 +
    Identifier "calibration"
 +
    MatchProduct "stmpe-ts"
 +
    Option "Calibration" "119 3736 3850 174"
 +
    Option "SwapAxes" "1"
 +
EndSection</nowiki>
 +
 
 +
or whatever you got, into there. You can quit X if you want by typing '''fg''' to bring that command into the foreground, and then CONTROLE-C to quit.
 +
 
 +
Your touchscreen is now super calibrated, hurrah!
  
 
{{RASP-PiTFT-TRAILER}}
 
{{RASP-PiTFT-TRAILER}}

Version du 16 décembre 2013 à 15:17


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Présentation

RASP-PiTFT-01.jpg
Crédit: AdaFruit Industries www.adafruit.com

L'écran PiTFT est équipé d'un film résistif, ce qui permet de simuler le fonctionnement de la souris en touchant l'écran.

Il convient néanmoins d'installer le support logiciel nécessaire (pour bouger le pointeur de souris) et d'effectuer une calibration.

Configurer la partie tactile

Now that the screen is working nicely, we'll take care of the touchscreen. There's just a bit of calibration to do, but it isn't hard at all.

Before we start, we'll make a udev rule for the touchscreen. That's because the eventX name of the device will change a lot and its annoying to figure out what its called depending on whether you have a keyboard or other mouse installed.

Run

sudo nano /etc/udev/rules.d/95-stmpe.rules

to create a new udev file and copy & paste the following line in:

SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen" 

RASP-PiTFT-Soft-Touch-01.png
Crédit: AdaFruit Industries www.adafruit.com

Remove and re-install the touchscreen with

sudo rmmod stmpe_ts; sudo modprobe stmpe_ts

Then type ls -l /dev/input touchscreen

It should point to eventX where X is some number, that number will be different on different setups since other keyboards/mice/USB devices will take up an event slot

RASP-PiTFT-Soft-Touch-02.png
Crédit: AdaFruit Industries www.adafruit.com

There are some tools we can use to calibrate & debug the touchscreen. Install the "event test" and "touchscreen library" packages with

sudo apt-get install evtest tslib libts-bin

RASP-PiTFT-Soft-Touch-03.png
Crédit: AdaFruit Industries www.adafruit.com

Now you can use some tools such as sudo evtest /dev/input/touchscreen which will let you see touchscreen events in real time, press on the touchscreen to see the reports.

RASP-PiTFT-Soft-Touch-04a.png
Crédit: AdaFruit Industries www.adafruit.com

RASP-PiTFT-Soft-Touch-04b.png
Crédit: AdaFruit Industries www.adafruit.com

OK lets start the calibration process! You will want to calibrate the screen once but shouldn't have to do it more than that. We'll begin by calibrating on the command line by running

sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate

follow the directions on the screen, touching each point. Using a stylus is suggested so you get a precise touch. Don't use something metal, plastic only!

RASP-PiTFT-Soft-Touch-05a.png
Crédit: AdaFruit Industries www.adafruit.com

RASP-PiTFT-Soft-Touch-05b.png
Crédit: AdaFruit Industries www.adafruit.com

Next you can run sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test which will let you draw-test the touch screen. Go back and re-calibrate if you feel the screen isn't precise enough!

RASP-PiTFT-Soft-Touch-06.png
Crédit: AdaFruit Industries www.adafruit.com

Calibration X

You can also calibrate the X input system but you have to use a different program called xinput_calibrator

You can do this if the calibration on the screen isnt to your liking or any time you change the rotate=XX module settings for the screen. Since the screen and touch driver are completely separated, the touchscreen doesn't auto-rotate

Normally you'd have to compile it but we have a ready to go package for you so run:

wget http://adafruit-download.s3.amazonaws.com/xinput-calibrator_0.7.5-1_armhf.deb
sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb

Before you start the xinput_calibrator you will need to delete the old calibration data so run

sudo rm /etc/X11/xorg.conf.d/99-calibration.conf

Before running startx and the calibrator - otherwise it gets really confused!

Now you'll have to run the xcalibrator while also running X. You can do this by startx and then opening up the terminal program and running the xinput_calibrator command OR you can do what we do which is run startx in a SSH/Terminal shell and then run the xinput_calibrator in the X window, which requires the following command order:

FRAMEBUFFER=/dev/fb1 startx &
DISPLAY=:0.0 xinput_calibrator

Follow the directions on screen

RASP-PiTFT-Soft-Touch-10.png
Crédit: AdaFruit Industries www.adafruit.com

Once complete you'll get something like:

RASP-PiTFT-Soft-Touch-11.png
Crédit: AdaFruit Industries www.adafruit.com

Run sudo nano /etc/X11/xorg.conf.d/99-calibration.conf and copy the

Section "InputClass"
    Identifier "calibration"
    MatchProduct "stmpe-ts"
    Option "Calibration" "119 3736 3850 174"
    Option "SwapAxes" "1"
EndSection

or whatever you got, into there. You can quit X if you want by typing fg to bring that command into the foreground, and then CONTROLE-C to quit.

Your touchscreen is now super calibrated, hurrah!


Source: Adafruit PiTFT - 2.8" Touchscreen Display for Raspberry Pi
Créé par LadyAda pour AdaFruit Industries.
Augmenté par Meurisse D. pour MCHobby

Traduction réalisée par Meurisse D pour MCHobby.be.

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com