Raspberry pi 7 inch touch screen calibration

eGalax  7 inch touch screen calibration can be made using xinput calibrator on Raspberry Pi.

If you are using the latest version of the operating system, there is no need for recompiling the kernel because the eGalax driver is now included in the kernel.
I tested it on Raspberry Pi 3 with Raspbian Jessie installed and it works flawlessly.

How do I know what kind of touch screen I’ve got ?

Boot up the Raspberry Pi and test if the 7-inch touch screen gets recognized correctly:

dmesg | grep usb
#Search for "input: eGalax Inc. Touch " in the output of the command.

#Run this command to find where your input devices are linked to:
ls -al /dev/input/by-id

To run a 7-inch touch screen calibration, you will have to follow these steps:

1. Raspberry Pi 7 inch display setup

If your display resolution is not supported by Raspberry Pi, you will have to make some configurations before using it. Check this page and look for your resolution.
If your 7-inch touch screen resolution is not supported, and you will try to connect it to your Raspberry Pi, you will probably see the message “not supported” on the screen.
In this case, you will have to make the following settings:

  1. First, connect your raspberry pi to another screen that works (pc monitor will be fine).
  2. Power on your raspberry pi and open terminal run this command:
    sudo nano /boot/config.txt
  3. Go at the bottom of the file and paste these settings:
    hdmi_cvt=800 480 60 3 0 0 0
  4. Power off and connect your Raspberry Pi to your new 7-inch touch screen display

2. Raspberry pi 7-inch touch screen calibration

Before calibrating your 7-inch touch screen, you will have to install some dependencies:

sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev

Download xinput_calibrator somewhere in the Raspberry PI’s folder structure from HERE .wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz
Go to the folder where you downloaded xinput calibrator and run this command:

tar -zxvf file.tar.gz
After you unpacked xinput calibrator, navigate to the unpacked folder and then install it using:
sudo make install
Now you can run xinput calibrator from the terminal by typing :

xinput_calibrator and hit Enter.
When xinput calibrator is running, it will ask you to touch some points on the 7-inch touchscreen. If it fails to receive some touch events,  the touch screen calibration will start over again.
It is better to use a stylus because it has a sharper tip.

When the touch screen calibration is done, you will receive a message like this :

Section "InputClass"
Identifier "calibration"
MatchProduct "eGalax Inc. USB TouchController"
Option "Calibration" "121 1917 317 1741"
Option "SwapAxes" "1"

You will need to copy that information and put it into a config file:


First, we will check if that folder exists:

ls /etc/X11/xorg.conf.d

create folder if it not exists:

sudo mkdir /etc/X11/xorg.conf.d

create a file called 99-calibration.conf in that folder and edit it:

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

After saving the file (press CTRL + X , Y), reboot and then test your 7-inch touch screen calibration.

You can repeat these steps later if the calibration wasn’t enough precise.

3. Troubleshooting the Raspberry pi 7-inch touch screen calibration

If your y-axis or y-axis  is inverted, modify the settings file to look like this:

Section "InputClass"
Identifier "calibration"
MatchProduct "eGalax Inc. USB TouchController"
Option "Calibration" "121 1917 317 1741"
Option "SwapAxes" "1"
Option "InvertY" "true"
Option "InvertX" "true"


Check these resources too: