linux/drivers/input/touchscreen/usbtouchscreen.c

// SPDX-License-Identifier: GPL-2.0-or-later
/******************************************************************************
 * 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
 *  - NEXIO/iNexio
 *  - Elo TouchSystems 2700 IntelliTouch
 *  - EasyTouch USB Dual/Multi touch controller from Data Modul
 *
 * Copyright (C) 2004-2007 by Daniel Ritz <[email protected]>
 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
 *
 * 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/usb.h>
#include <linux/usb/input.h>
#include <linux/hid.h>
#include <linux/mutex.h>

static bool swap_xy;
module_param(swap_xy, bool, 0644);
MODULE_PARM_DESC();

static bool hwcalib_xy;
module_param(hwcalib_xy, bool, 0644);
MODULE_PARM_DESC();

/* device specifc data/functions */
struct usbtouch_usb;
struct usbtouch_device_info {};

/* a usbtouch device */
struct usbtouch_usb {};


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

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

static int e2i_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info e2i_dev_info =;
#endif


/*****************************************************************************
 * eGalax part
 */

#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX

#ifndef MULTI_PACKET
#define MULTI_PACKET
#endif

#define EGALAX_PKT_TYPE_MASK
#define EGALAX_PKT_TYPE_REPT
#define EGALAX_PKT_TYPE_DIAG

static int egalax_init(struct usbtouch_usb *usbtouch)
{}

static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static int egalax_get_pkt_len(unsigned char *buf, int len)
{}

static const struct usbtouch_device_info egalax_dev_info =;
#endif

/*****************************************************************************
 * EasyTouch part
 */

#ifdef CONFIG_TOUCHSCREEN_USB_EASYTOUCH

#ifndef MULTI_PACKET
#define MULTI_PACKET
#endif

#define ETOUCH_PKT_TYPE_MASK
#define ETOUCH_PKT_TYPE_REPT
#define ETOUCH_PKT_TYPE_REPT2
#define ETOUCH_PKT_TYPE_DIAG

static int etouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static int etouch_get_pkt_len(unsigned char *buf, int len)
{}

static const struct usbtouch_device_info etouch_dev_info =;
#endif

/*****************************************************************************
 * PanJit Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info panjit_dev_info =;
#endif


/*****************************************************************************
 * 3M/Microtouch Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_3M

#define MTOUCHUSB_ASYNC_REPORT
#define MTOUCHUSB_RESET
#define MTOUCHUSB_REQ_CTRLLR_ID

#define MTOUCHUSB_REQ_CTRLLR_ID_LEN

static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

struct mtouch_priv {};

static int mtouch_get_fw_revision(struct usbtouch_usb *usbtouch)
{}

static int mtouch_alloc(struct usbtouch_usb *usbtouch)
{}

static int mtouch_init(struct usbtouch_usb *usbtouch)
{}

static void mtouch_exit(struct usbtouch_usb *usbtouch)
{}

static struct usbtouch_device_info mtouch_dev_info =;

static ssize_t mtouch_firmware_rev_show(struct device *dev,
				struct device_attribute *attr, char *output)
{}
static DEVICE_ATTR(firmware_rev, 0444, mtouch_firmware_rev_show, NULL);

static struct attribute *mtouch_attrs[] =;

static bool mtouch_group_visible(struct kobject *kobj)
{}

DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(mtouch);

static const struct attribute_group mtouch_attr_group =;
#endif


/*****************************************************************************
 * ITM Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_ITM
static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info itm_dev_info =;
#endif


/*****************************************************************************
 * eTurboTouch part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
#ifndef MULTI_PACKET
#define MULTI_PACKET
#endif
static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static int eturbo_get_pkt_len(unsigned char *buf, int len)
{}

static const struct usbtouch_device_info eturbo_dev_info =;
#endif


/*****************************************************************************
 * Gunze part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info gunze_dev_info =;
#endif

/*****************************************************************************
 * DMC TSC-10/25 Part
 *
 * Documentation about the controller and it's protocol can be found at
 *   http://www.dmccoltd.com/files/controler/tsc10usb_pi_e.pdf
 *   http://www.dmccoltd.com/files/controler/tsc25_usb_e.pdf
 */
#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10

/* supported data rates. currently using 130 */
#define TSC10_RATE_POINT
#define TSC10_RATE_30
#define TSC10_RATE_50
#define TSC10_RATE_80
#define TSC10_RATE_100
#define TSC10_RATE_130
#define TSC10_RATE_150

/* commands */
#define TSC10_CMD_RESET
#define TSC10_CMD_RATE
#define TSC10_CMD_DATA1

static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
{}

static int dmc_tsc10_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info dmc_tsc10_dev_info =;
#endif


/*****************************************************************************
 * IRTOUCH Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info irtouch_dev_info =;

static const struct usbtouch_device_info irtouch_hires_dev_info =;
#endif

/*****************************************************************************
 * ET&T TC5UH/TC4UM part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC45USB
static int tc45usb_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info tc45usb_dev_info =;
#endif

/*****************************************************************************
 * IdealTEK URTC1000 Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
#ifndef MULTI_PACKET
#define MULTI_PACKET
#endif
static int idealtek_get_pkt_len(unsigned char *buf, int len)
{}

static int idealtek_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info idealtek_dev_info =;
#endif

/*****************************************************************************
 * General Touch Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
static int general_touch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info general_touch_dev_info =;
#endif

/*****************************************************************************
 * GoTop Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_GOTOP
static int gotop_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info gotop_dev_info =;
#endif

/*****************************************************************************
 * JASTEC Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_JASTEC
static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info jastec_dev_info =;
#endif

/*****************************************************************************
 * Zytronic Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info zytronic_dev_info =;
#endif

/*****************************************************************************
 * NEXIO Part
 */
#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO

#define NEXIO_TIMEOUT
#define NEXIO_BUFSIZE
#define NEXIO_THRESHOLD

struct nexio_priv {};

struct nexio_touch_packet {} __attribute__ ((packed));

static unsigned char nexio_ack_pkt[2] =;
static unsigned char nexio_init_pkt[4] =;

static void nexio_ack_complete(struct urb *urb)
{}

static int nexio_alloc(struct usbtouch_usb *usbtouch)
{}

static int nexio_init(struct usbtouch_usb *usbtouch)
{}

static void nexio_exit(struct usbtouch_usb *usbtouch)
{}

static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
{}

static const struct usbtouch_device_info nexio_dev_info =;
#endif


/*****************************************************************************
 * ELO part
 */

#ifdef CONFIG_TOUCHSCREEN_USB_ELO

static int elo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{}

static const struct usbtouch_device_info elo_dev_info =;
#endif


/*****************************************************************************
 * Generic Part
 */
static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
                                 unsigned char *pkt, int len)
{}


#ifdef MULTI_PACKET
static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
                                   unsigned char *pkt, int len)
{}
#else
static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
                                   unsigned char *pkt, int len)
{
	dev_WARN_ONCE(&usbtouch->interface->dev, 1,
		      "Protocol has ->get_pkt_len() without #define MULTI_PACKET");
}
#endif

static void usbtouch_irq(struct urb *urb)
{}

static int usbtouch_start_io(struct usbtouch_usb *usbtouch)
{}

static int usbtouch_open(struct input_dev *input)
{}

static void usbtouch_close(struct input_dev *input)
{}

static int usbtouch_suspend(struct usb_interface *intf, pm_message_t message)
{}

static int usbtouch_resume(struct usb_interface *intf)
{}

static int usbtouch_reset_resume(struct usb_interface *intf)
{}

static void usbtouch_free_buffers(struct usb_device *udev,
				  struct usbtouch_usb *usbtouch)
{}

static struct usb_endpoint_descriptor *
usbtouch_get_input_endpoint(struct usb_host_interface *interface)
{}

static int usbtouch_probe(struct usb_interface *intf,
			  const struct usb_device_id *id)
{}

static void usbtouch_disconnect(struct usb_interface *intf)
{}

static const struct attribute_group *usbtouch_groups[] =;

static const struct usb_device_id usbtouch_devices[] =;
MODULE_DEVICE_TABLE(usb, usbtouch_devices);

static struct usb_driver usbtouch_driver =;

module_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

MODULE_ALIAS();
MODULE_ALIAS();
MODULE_ALIAS();