pcduino 触屏 支持

来源:互联网 发布:win10搭建java环境 编辑:程序博客网 时间:2024/06/06 08:29
声明:转载请注明出处 http://blog.csdn.net/laotie1015
前提:pc已经配置好交叉编译器
  如果没有配置,参考http://www.oschina.net/question/1174645_120733

一、购买的触屏
地址:http://item.taobao.com/item.htm?id=18527409945


把触摸屏安装好。

二、编译pcduino内核,触屏驱动打开
Linux对触摸屏的驱动已经很完善,购买的触摸屏也是linux支持的,但是pcduino内核没有打开这一项,所以我们要将内核中触屏打开并重新编译内核。步骤如下:
1、先切换到准备存放内核源代码的目录,从Github下载kernel源代码文件:
$ git clone https://github.com/pcduino/kernel.git
如果没有安装git,先安装git:
sudo apt-get install git
注意:
    此步骤只下载了搭建环境。
    其他子模块可在这里下载:https://github.com/linux-sunxi/.
    第一次在kernel/ directory 下运行“make”的时候,子模块的源文件将被下载(如果在运行“make”之前子模块没有被下载的话)。

2、编译Kernel 镜像
(1)make
如果没有安装ncurses库的,先安装
sudo apt-get install libncurses5-dev
在kernel/ directory 下运行“make” ( 不要在kernel/linux-sunxi directory 编译源文件).


    1)、$ cd kernel/
    2)、$ make
注意:
A) 此时如果没有下载其他模块会自动下载
B) 如果出现No package 'libusb-1.0' found,安装一下
sudo apt-get install libusb-1.0
配置内核
make  linux-config

进入Device Drivers ---》

进入Input device support --->

进入Touchscreens --->

使用空格键 将USB Touchscreen Driver打上 * 号,我们用的驱动是eGalax, eTurboTouch CT-410/510/700 device support如上图,然后退出保存

拷贝.config
cp build/sun4i_defconfig-linux/.config patch/linux-sunxi/arch/arm/configs/sun4i_defconfig
编译 make linux
等待编译完成

三、给pcduino换内核
1、编译出uImage拷贝到pcduino上
2、挂在/dev/nanda:
      mount /dev/nanda /boot
3、备份uImage
      cp /boot/uImage /home/uImage.old
4、将新内核放入/dev/nanda
      cp /**/uImage /boot/uImage
重启 reboot

四、校准触摸屏
到现在pcduino已经支持这块触摸屏了,我们可以试一试在屏幕上点击几下,鼠标会不会有反应,有则驱动成功了,如果没有请检查中间那个步骤做错了。
每一块触摸屏不是拿来就能正常使用的,需要校准,我们使用的工具是xinput_calibrator

1、安装触屏校准工具 xinput_calibrator步骤:
    a、下载源码
            http://www.freedesktop.org/wiki/Software/xinput_calibrator/
    b、安装 pkg-config和xorg-dev,不然不能成功配置编译
apt-get install pkg-config
apt-get install xorg-dev
    c、配置 ./configure
    d、make
    e、将编译出来的程序拷贝到/usr/bin目录下
cp /你的路径/xinput_calibrator-0.7.5/src/xinput_calibrator /usr/bin/

2、修改/etc/X11/xorg.conf中
    Section "Screen"
        Identifier      "Mali Screen"
        Device          "Mali FBDEV"
        Monitor         "Monitor0"
        SubSection "Display"
                Depth   24
                Modes "800x600-60"   ——》原来是1280x720
        EndSubSection
EndSection

3、运行xinput_calibrator校准
校准完会有以下提示
Calibrating EVDEV driver for "eGalax Inc. USB TouchController" id=7
    current calibration values (from XInput): min_x=96, max_x=1946 and min_y=1610, max_y=166

Doing dynamic recalibration:
    Setting new calibration data: 99, 1941, 1617, 169

--> 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"    "96 1947 1612 163"
EndSection
拷贝
Section "InputClass"
    Identifier    "calibration"
    MatchProduct    "eGalax Inc. USB TouchController"
    Option    "Calibration"    "96 1947 1612 163"
EndSection

添加到/etc/X11/xorg.conf中,这样就保存了触屏的配置了

0 0