linux/drivers/hid/hid-multitouch.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  HID driver for multitouch panels
 *
 *  Copyright (c) 2010-2012 Stephane Chatty <[email protected]>
 *  Copyright (c) 2010-2013 Benjamin Tissoires <[email protected]>
 *  Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France
 *  Copyright (c) 2012-2013 Red Hat, Inc
 *
 *  This code is partly based on hid-egalax.c:
 *
 *  Copyright (c) 2010 Stephane Chatty <[email protected]>
 *  Copyright (c) 2010 Henrik Rydberg <[email protected]>
 *  Copyright (c) 2010 Canonical, Ltd.
 *
 *  This code is partly based on hid-3m-pct.c:
 *
 *  Copyright (c) 2009-2010 Stephane Chatty <[email protected]>
 *  Copyright (c) 2010      Henrik Rydberg <[email protected]>
 *  Copyright (c) 2010      Canonical, Ltd.
 */

/*
 */

/*
 * This driver is regularly tested thanks to the test suite in hid-tools[1].
 * Please run these regression tests before patching this module so that
 * your patch won't break existing known devices.
 *
 * [1] https://gitlab.freedesktop.org/libevdev/hid-tools
 */

#include <linux/device.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/input/mt.h>
#include <linux/jiffies.h>
#include <linux/string.h>
#include <linux/timer.h>


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

#include "hid-ids.h"

/* quirks to control the device */
#define MT_QUIRK_NOT_SEEN_MEANS_UP
#define MT_QUIRK_SLOT_IS_CONTACTID
#define MT_QUIRK_CYPRESS
#define MT_QUIRK_SLOT_IS_CONTACTNUMBER
#define MT_QUIRK_ALWAYS_VALID
#define MT_QUIRK_VALID_IS_INRANGE
#define MT_QUIRK_VALID_IS_CONFIDENCE
#define MT_QUIRK_CONFIDENCE
#define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE
#define MT_QUIRK_NO_AREA
#define MT_QUIRK_IGNORE_DUPLICATES
#define MT_QUIRK_HOVERING
#define MT_QUIRK_CONTACT_CNT_ACCURATE
#define MT_QUIRK_FORCE_GET_FEATURE
#define MT_QUIRK_FIX_CONST_CONTACT_ID
#define MT_QUIRK_TOUCH_SIZE_SCALING
#define MT_QUIRK_STICKY_FINGERS
#define MT_QUIRK_ASUS_CUSTOM_UP
#define MT_QUIRK_WIN8_PTP_BUTTONS
#define MT_QUIRK_SEPARATE_APP_REPORT
#define MT_QUIRK_FORCE_MULTI_INPUT
#define MT_QUIRK_DISABLE_WAKEUP
#define MT_QUIRK_ORIENTATION_INVERT

#define MT_INPUTMODE_TOUCHSCREEN
#define MT_INPUTMODE_TOUCHPAD

#define MT_BUTTONTYPE_CLICKPAD

enum latency_mode {};

#define MT_IO_FLAGS_RUNNING
#define MT_IO_FLAGS_ACTIVE_SLOTS
#define MT_IO_FLAGS_PENDING_SLOTS

static const bool mtrue =;		/* default for true */
static const bool mfalse;		/* default for false */
static const __s32 mzero;		/* default for 0 */

#define DEFAULT_TRUE
#define DEFAULT_FALSE
#define DEFAULT_ZERO

struct mt_usages {};

struct mt_application {};

struct mt_class {};

struct mt_report_data {};

struct mt_device {};

static void mt_post_parse_default_settings(struct mt_device *td,
					   struct mt_application *app);
static void mt_post_parse(struct mt_device *td, struct mt_application *app);

/* classes of device behavior */
#define MT_CLS_DEFAULT

#define MT_CLS_SERIAL
#define MT_CLS_CONFIDENCE
#define MT_CLS_CONFIDENCE_CONTACT_ID
#define MT_CLS_CONFIDENCE_MINUS_ONE
#define MT_CLS_DUAL_INRANGE_CONTACTID
#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER
/* reserved					0x0008 */
#define MT_CLS_INRANGE_CONTACTNUMBER
#define MT_CLS_NSMU
/* reserved					0x0010 */
/* reserved					0x0011 */
#define MT_CLS_WIN_8
#define MT_CLS_EXPORT_ALL_INPUTS
/* reserved					0x0014 */
#define MT_CLS_WIN_8_FORCE_MULTI_INPUT
#define MT_CLS_WIN_8_DISABLE_WAKEUP
#define MT_CLS_WIN_8_NO_STICKY_FINGERS
#define MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU

/* vendor specific classes */
#define MT_CLS_3M
/* reserved					0x0102 */
#define MT_CLS_EGALAX
#define MT_CLS_EGALAX_SERIAL
#define MT_CLS_TOPSEED
#define MT_CLS_PANASONIC
#define MT_CLS_FLATFROG
#define MT_CLS_GENERALTOUCH_TWOFINGERS
#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS
#define MT_CLS_LG
#define MT_CLS_ASUS
#define MT_CLS_VTL
#define MT_CLS_GOOGLE
#define MT_CLS_RAZER_BLADE_STEALTH
#define MT_CLS_SMART_TECH

#define MT_DEFAULT_MAXCONTACT
#define MT_MAX_MAXCONTACT

/*
 * Resync device and local timestamps after that many microseconds without
 * receiving data.
 */
#define MAX_TIMESTAMP_INTERVAL

#define MT_USB_DEVICE(v, p)
#define MT_BT_DEVICE(v, p)

/*
 * these device-dependent functions determine what slot corresponds
 * to a valid contact that was just read.
 */

static int cypress_compute_slot(struct mt_application *application,
				struct mt_usages *slot)
{}

static const struct mt_class mt_classes[] =;

static ssize_t mt_show_quirks(struct device *dev,
			   struct device_attribute *attr,
			   char *buf)
{}

static ssize_t mt_set_quirks(struct device *dev,
			  struct device_attribute *attr,
			  const char *buf, size_t count)
{}

static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);

static struct attribute *sysfs_attrs[] =;

static const struct attribute_group mt_attribute_group =;

static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
{}

static void mt_feature_mapping(struct hid_device *hdev,
		struct hid_field *field, struct hid_usage *usage)
{}

static void set_abs(struct input_dev *input, unsigned int code,
		struct hid_field *field, int snratio)
{}

static struct mt_usages *mt_allocate_usage(struct hid_device *hdev,
					   struct mt_application *application)
{}

static struct mt_application *mt_allocate_application(struct mt_device *td,
						      struct hid_report *report)
{}

static struct mt_application *mt_find_application(struct mt_device *td,
						  struct hid_report *report)
{}

static struct mt_report_data *mt_allocate_report_data(struct mt_device *td,
						      struct hid_report *report)
{}

static struct mt_report_data *mt_find_report_data(struct mt_device *td,
						  struct hid_report *report)
{}

static void mt_store_field(struct hid_device *hdev,
			   struct mt_application *application,
			   __s32 *value,
			   size_t offset)
{}

#define MT_STORE_FIELD(__name)

static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max, struct mt_application *app)
{}

static int mt_compute_slot(struct mt_device *td, struct mt_application *app,
			   struct mt_usages *slot,
			   struct input_dev *input)
{}

static void mt_release_pending_palms(struct mt_device *td,
				     struct mt_application *app,
				     struct input_dev *input)
{}

/*
 * this function is called when a whole packet has been received and processed,
 * so that it can decide what to send to the input layer.
 */
static void mt_sync_frame(struct mt_device *td, struct mt_application *app,
			  struct input_dev *input)
{}

static int mt_compute_timestamp(struct mt_application *app, __s32 value)
{}

static int mt_touch_event(struct hid_device *hid, struct hid_field *field,
				struct hid_usage *usage, __s32 value)
{}

static int mt_process_slot(struct mt_device *td, struct input_dev *input,
			    struct mt_application *app,
			    struct mt_usages *slot)
{}

static void mt_process_mt_event(struct hid_device *hid,
				struct mt_application *app,
				struct hid_field *field,
				struct hid_usage *usage,
				__s32 value,
				bool first_packet)
{}

static void mt_touch_report(struct hid_device *hid,
			    struct mt_report_data *rdata)
{}

static int mt_touch_input_configured(struct hid_device *hdev,
				     struct hid_input *hi,
				     struct mt_application *app)
{}

#define mt_map_key_clear(c)
static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{}

static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{}

static int mt_event(struct hid_device *hid, struct hid_field *field,
				struct hid_usage *usage, __s32 value)
{}

static void mt_report(struct hid_device *hid, struct hid_report *report)
{}

static bool mt_need_to_apply_feature(struct hid_device *hdev,
				     struct hid_field *field,
				     struct hid_usage *usage,
				     enum latency_mode latency,
				     bool surface_switch,
				     bool button_switch,
				     bool *inputmode_found)
{}

static void mt_set_modes(struct hid_device *hdev, enum latency_mode latency,
			 bool surface_switch, bool button_switch)
{}

static void mt_post_parse_default_settings(struct mt_device *td,
					   struct mt_application *app)
{}

static void mt_post_parse(struct mt_device *td, struct mt_application *app)
{}

static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
{}

static void mt_fix_const_field(struct hid_field *field, unsigned int usage)
{}

static void mt_fix_const_fields(struct hid_device *hdev, unsigned int usage)
{}

static void mt_release_contacts(struct hid_device *hid)
{}

static void mt_expired_timeout(struct timer_list *t)
{}

static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
{}

static int mt_suspend(struct hid_device *hdev, pm_message_t state)
{}

static int mt_reset_resume(struct hid_device *hdev)
{}

static int mt_resume(struct hid_device *hdev)
{}

static void mt_remove(struct hid_device *hdev)
{}

/*
 * This list contains only:
 * - VID/PID of products not working with the default multitouch handling
 * - 2 generic rules.
 * So there is no point in adding here any device with MT_CLS_DEFAULT.
 */
static const struct hid_device_id mt_devices[] =;
MODULE_DEVICE_TABLE(hid, mt_devices);

static const struct hid_usage_id mt_grabbed_usages[] =;

static struct hid_driver mt_driver =;
module_hid_driver();