Create a new udev file
sudo vi /etc/udev/rules.d/95-ads7846.rules
and then, add this lines and save it
SUBSYSTEM=="input", ATTRS{name}=="ADS7846 Touchscreen", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
Load SPI and TS drivers.
sudo modprobe spicc sudo modprobe -r ads7846 sudo modprobe ads7846
Now you can see this node.
ls /dev/input/touchscreen
Install the event test and touchscreen library sudo apt-get install evtest libts-bin Install the event test and touchscreen library
sudo apt-get install evtest
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.
sudo evtest /dev/input/touchscreen
==== TSLIB Calibration ====
Run startx
sudo startx &
Run ts_calibrate on /dev/fb2
sudo TSLIB_FBDEVICE=/dev/fb2 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate
Follow the directions on the screen, touching each point.
Then, you can run following command.
sudo TSLIB_FBDEVICE=/dev/fb2 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test
1. The xinput-calibrator pakage download
sudo apt-get install xinput-calibrator
2. Remove old calibration data.
sudo rm /etc/X11/xorg.conf.d/99-calibration.conf
3. Run calibrator
You need to check DISPLAY=:N.0
sudo FRAMEBUFFER=/dev/fb2 startx & sudo DISPLAY=:0.0 xinput_calibrator
Follow the directions on your screen.
then, you will get something like
Copy to “/etc/X11/xorg.conf.d/99-calibration.conf”
sudo mkdir /etc/X11/xorg.conf.d/ sudo vi /etc/X11/xorg.conf.d/99-calibration.conf
4. Reboot
sudo reboot