给树莓派装上触摸屏

准备设备:
1.树莓派1个
2.带触摸功能的液晶显示屏(在购买之前一定要确认触摸芯片是否是eGalax的芯片,我的芯片型号是XPT2046 )
操作步骤:
1.下载基于最新debain-02-09版本上编译的系统镜像(推荐用8G的卡导入镜像,部分4G卡会提示空间不足)
网盘地址:http://pan.baidu.com/s/1cKfZI
2.刷好系统启动树莓派,使用lsusb命令查看触摸屏是否识别:

pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 001 Device 005: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen

如果看到有eGalax,恭喜你的的触摸屏已经找到了,如果没找到请确认触摸屏的usb接口是否正确连接,确认触摸屏的芯片是否是eGalax的。
3.登录树莓派,进入图形界面,运行xinput_calibrator程序软件调校屏幕(镜像中已经安装了软件)
pi@raspberrypi ~ $ xinput_calibrator
屏幕会出现提示,让你去点击对角线的小叉,点击完后屏幕会提示一个调整信息,如下:

Calibrating EVDEV driver for “eGalax Inc. USB TouchController” id=8
current calibration values (from XInput): min_x=1938, max_x=114 and min_y=1745, max_y=341
Doing dynamic recalibration:
Setting new calibration data: 121, 1917, 317, 1741
–> Making the calibration permanent <–
copy the snippet below into ‘/etc/X11/xorg.conf.d/99-calibration.conf’
Section “InputClass”
Identifier “calibration”
MatchProduct “eGalax Inc. USB TouchController”
Option “Calibration” “121 1917 317 1741″
Option “SwapAxes” “1″
EndSection

4.按照提示将以下内容复制这部分内容

Section “InputClass”
Identifier “calibration”
MatchProduct “eGalax Inc. USB TouchController”
Option “Calibration” “121 1917 317 1741″
Option “SwapAxes” “1″
EndSection

5.编辑文件”/usr/share/X11/xorg.conf.d/01-input.conf“,将刚才复制的内容添加到文件的最后,并保存。
pi@raspberrypi ~ $sudo nano /usr/share/X11/xorg.conf.d/01-input.conf
6.重启树莓派,好好享受的你触摸屏吧!

标签: 树莓派教程