omap3530上移植AMT 6000 系列USB型触摸屏+tslib

本文档详细介绍了如何在omap3530平台上移植AMT 6000系列USB触摸屏驱动,并结合tslib进行校准和处理。首先,通过修改内核中的usbtouchscreen.c驱动来支持AMT 6000设备,然后介绍了下载和编译tslib的步骤,以及配置环境变量和ts.conf文件的过程。
摘要由CSDN通过智能技术生成

一、omap3530上移植AMT 6000系列USB型驱动

         这个移植主要是在内核usb型触摸屏驱动的框架上添加AMT 6000系列的触摸屏,这个修改应该不只对omap3530有效。具体修改的文件为:driver/input/touchscreen/usbtouchscreen.c

        修改完的文件如下:

/******************************************************************************
 * usbtouchscreen.c
 * Driver for USB Touchscreens, supporting those devices:
 *  - eGalax Touchkit
 *    includes eTurboTouch CT-410/510/700
 *  - 3M/Microtouch  EX II series
 *  - ITM
 *  - PanJit TouchSet
 *  - eTurboTouch
 *  - Gunze AHL61
 *  - DMC TSC-10/25
 *  - IRTOUCHSYSTEMS/UNITOP
 *  - IdealTEK URTC1000
 *  - General Touch
 *  - GoTop Super_Q2/GogoPen/PenPower tablets
 *  - JASTEC USB touch controller/DigiTech DTR-02U
 *  - Zytronic capacitive touchscreen
 *
 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * Driver is based on touchkitusb.c
 * - ITM parts are from itmtouch.c
 * - 3M parts are from mtouchusb.c
 * - PanJit parts are from an unmerged driver by Lanslott Gish
 * - DMC TSC 10/25 are from Holger Schurig, with ideas from an unmerged
 *   driver from Marius Vollmer
 *
 *****************************************************************************/

//#define DEBUG

#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/usb.h>
#include <linux/usb/input.h>
#include <linux/hid.h>


#define DRIVER_VERSION        "v0.6"
#define DRIVER_AUTHOR        "Daniel Ritz <daniel.ritz@gmx.ch>"
#define DRIVER_DESC        "USB Touchscreen Driver"

static int swap_xy;
module_param(swap_xy, bool, 0644);
MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");

static int hwcalib_xy;
module_param(hwcalib_xy, bool, 0644);
MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");

/* device specifc data/functions */
struct usbtouch_usb;
struct usbtouch_device_info {
    int min_xc, max_xc;
    int min_yc, max_yc;
    int min_press, max_press;
    int rept_size;

    /*
     * Always service the USB devices irq not just when the input device is
     * open. This is useful when devices have a watchdog which prevents us
     * from periodically polling the device. Leave this unset unless your
     * touchscreen device requires it, as it does consume more of the USB
     * bandwidth.
     */
    bool irq_always;

    void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);

    /*
     * used to get the packet len. possible return values:
     * > 0: packet len
     * = 0: skip one byte
     * < 0: -return value more bytes needed
     */
    int  (*get_pkt_len) (unsigned char *pkt, int len);

    int  (*read_data)   (struct usbtouch_usb *usbtouch, unsigned char *pkt);
    int  (*init)        (struct usbtouch_usb *usbtouch);
};

/* a usbtouch device */
struct usbtouch_usb {
    unsigned char *data;
    dma_addr_t data_dma;
    unsigned char *buffer;
    int buf_len;
    struct urb *irq;
    struct usb_device *udev;
    struct input_dev *input;
    struct usbtouch_device_info *type;
    char name[128];
    char phys[64];

    int x, y;
    int touch, press;
};


/* device types */
enum {
    DEVTYPE_IGNORE = -1,
    DEVTYPE_EGALAX,
    DEVTYPE_PANJIT,
    DEVTYPE_3M,
    DEVTYPE_ITM,
    DEVTYPE_ETURBO,
    DEVTYPE_GUNZE,
    DEVTYPE_DMC_TSC10,
    DEVTYPE_IRTOUCH,
    DEVTYPE_IDEALTEK,
    DEVTYPE_GENERAL_TOUCH,
    DEVTYPE_GOTOP,
    DEVTYPE_JASTEC,
    DEVTYPE_E2I,
    DEVTYPE_ZYTRONIC,
    DEVTYPE_TC5UH,
    /********************************************/
    /*add by willow 2011.4.13*/
    DEVTYPE_AMT_6000,
    /********************************************/

};

#define USB_DEVICE_HID_CLASS(vend, prod) /
    .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS /
        | USB_DEVICE_ID_MATCH_INT_PROTOCOL /
        | USB_DEVICE_ID_MATCH_DEVICE, /
    .idVendor = (vend), /
    .idProduct = (prod), /
    .bInterfaceClass = USB_INTERFACE_CLASS_HID, /
    .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE

static struct usb_device_id usbtouch_devices[] = {
#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
    /* ignore the HID capable devices, handled by usbhid */
    {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE},
    {USB_DEVICE_HID_CLASS(0x0eef, 0x0002), .driver_info = DEVTYPE_IGNORE},

    /* normal device IDs */
    {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX},
    {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX},
    {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX},
    {USB_DEVICE(0x0eef, 0x0001), .driver_info = DEVTYPE_EGALAX},
    {USB_DEVICE(0x0eef, 0x0002), .driver_info = DEVTYPE_EGALAX},
    {USB_DEVICE(0x1234, 0x0001), .driver_info = DEVTYPE_EGALAX},
    {USB_DEVICE(0x1234, 0x0002), .driver_info = DEVTYPE_EGALAX},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
    {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT},
    {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT},
    {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT},
    {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_3M
    {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_ITM
    {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
    {USB_DEVICE(0x1234, 0x5678), .driver_info = DEVTYPE_ETURBO},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
    {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
    {USB_DEVICE(0x0afa, 0x03e8), .driver_info = DEVTYPE_DMC_TSC10},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
    {USB_DEVICE(0x595a, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
    {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
    {USB_DEVICE(0x1391, 0x1000), .driver_info = DEVTYPE_IDEALTEK},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
    {USB_DEVICE(0x0dfc, 0x0001), .driver_info = DEVTYPE_GENERAL_TOUCH},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_GOTOP
    {USB_DEVICE(0x08f2, 0x007f), .driver_info = DEVTYPE_GOTOP},
    {USB_DEVICE(0x08f2, 0x00ce), .driver_info = DEVTYPE_GOTOP},
    {USB_DEVICE(0x08f2, 0x00f4), .driver_info = DEVTYPE_GOTOP},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_JASTEC
    {USB_DEVICE(0x0f92, 0x0001), .driver_info = DEVTYPE_JASTEC},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_E2I
    {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
    {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC},
#endif

#ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH
    {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH},
#endif

/***********************************************************************
*add by willow 2011.4.13
*/
#ifdef CONFIG_TOUCHSCREEN_USB_AMT_6000
    {USB_DEVICE(0x14e1, 0x6000), .driver_info = DEVTYPE_AMT_6000},
#endif
/************************************************************************/

    {}
};


/*****************************************************************************
 * e2i Part
 */

#ifdef CONFIG_TOUCHSCREEN_USB_E2I
static int e2i_init(struct usbtouch_usb *usbtouch)
{
    int ret;

    ret &

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值