linux/drivers/input/mouse/appletouch.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Apple USB Touchpad (for post-February 2005 PowerBooks and MacBooks) driver
 *
 * Copyright (C) 2001-2004 Greg Kroah-Hartman ([email protected])
 * Copyright (C) 2005-2008 Johannes Berg ([email protected])
 * Copyright (C) 2005-2008 Stelian Pop ([email protected])
 * Copyright (C) 2005      Frank Arnold ([email protected])
 * Copyright (C) 2005      Peter Osterlund ([email protected])
 * Copyright (C) 2005      Michael Hanselmann ([email protected])
 * Copyright (C) 2006      Nicolas Boichat ([email protected])
 * Copyright (C) 2007-2008 Sven Anders ([email protected])
 *
 * Thanks to Alex Harper <[email protected]> for his inputs.
 */

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

/*
 * Note: We try to keep the touchpad aspect ratio while still doing only
 * simple arithmetics:
 *	0 <= x <= (xsensors - 1) * xfact
 *	0 <= y <= (ysensors - 1) * yfact
 */
struct atp_info {};

static void atp_complete_geyser_1_2(struct urb *urb);
static void atp_complete_geyser_3_4(struct urb *urb);

static const struct atp_info fountain_info =;

static const struct atp_info geyser1_info =;

static const struct atp_info geyser2_info =;

static const struct atp_info geyser3_info =;

static const struct atp_info geyser4_info =;

#define ATP_DEVICE(prod, info)

/*
 * Table of devices (Product IDs) that work with this driver.
 * (The names come from Info.plist in AppleUSBTrackpad.kext,
 *  According to Info.plist Geyser IV is the same as Geyser III.)
 */

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

/* maximum number of sensors */
#define ATP_XSENSORS
#define ATP_YSENSORS

/*
 * The largest possible bank of sensors with additional buffer of 4 extra values
 * on either side, for an array of smoothed sensor values.
 */
#define ATP_SMOOTHSIZE

/* maximum pressure this driver will report */
#define ATP_PRESSURE

/*
 * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
 * ignored.
 */
#define ATP_THRESHOLD

/*
 * How far we'll bitshift our sensor values before averaging them. Mitigates
 * rounding errors.
 */
#define ATP_SCALE

/* Geyser initialization constants */
#define ATP_GEYSER_MODE_READ_REQUEST_ID
#define ATP_GEYSER_MODE_WRITE_REQUEST_ID
#define ATP_GEYSER_MODE_REQUEST_VALUE
#define ATP_GEYSER_MODE_REQUEST_INDEX
#define ATP_GEYSER_MODE_VENDOR_VALUE

/**
 * enum atp_status_bits - status bit meanings
 *
 * These constants represent the meaning of the status bits.
 * (only Geyser 3/4)
 *
 * @ATP_STATUS_BUTTON: The button was pressed
 * @ATP_STATUS_BASE_UPDATE: Update of the base values (untouched pad)
 * @ATP_STATUS_FROM_RESET: Reset previously performed
 */
enum atp_status_bits {};

/* Structure to hold all of our device specific stuff */
struct atp {};

#define dbg_dump(msg, tab)

#define dprintk(format, a...)

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

/*
 * Make the threshold a module parameter
 */
static int threshold =;
module_param(threshold, int, 0644);
MODULE_PARM_DESC();

static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC();

/*
 * By default newer Geyser devices send standard USB HID mouse
 * packets (Report ID 2). This code changes device mode, so it
 * sends raw sensor reports (Report ID 5).
 */
static int atp_geyser_init(struct atp *dev)
{}

/*
 * Reinitialise the device. This usually stops stream of empty packets
 * coming from it.
 */
static void atp_reinit(struct work_struct *work)
{}

static int atp_calculate_abs(struct atp *dev, int offset, int nb_sensors,
			     int fact, int *z, int *fingers)
{}

static inline void atp_report_fingers(struct input_dev *input, int fingers)
{}

/* Check URB status and for correct length of data package */

#define ATP_URB_STATUS_SUCCESS
#define ATP_URB_STATUS_ERROR
#define ATP_URB_STATUS_ERROR_FATAL

static int atp_status_check(struct urb *urb)
{}

static void atp_detect_size(struct atp *dev)
{}

/*
 * USB interrupt callback functions
 */

/* Interrupt function for older touchpads: FOUNTAIN/GEYSER1/GEYSER2 */

static void atp_complete_geyser_1_2(struct urb *urb)
{}

/* Interrupt function for older touchpads: GEYSER3/GEYSER4 */

static void atp_complete_geyser_3_4(struct urb *urb)
{}

static int atp_open(struct input_dev *input)
{}

static void atp_close(struct input_dev *input)
{}

static int atp_handle_geyser(struct atp *dev)
{}

static int atp_probe(struct usb_interface *iface,
		     const struct usb_device_id *id)
{}

static void atp_disconnect(struct usb_interface *iface)
{}

static int atp_recover(struct atp *dev)
{}

static int atp_suspend(struct usb_interface *iface, pm_message_t message)
{}

static int atp_resume(struct usb_interface *iface)
{}

static int atp_reset_resume(struct usb_interface *iface)
{}

static struct usb_driver atp_driver =;

module_usb_driver();