FreeBSD kernel usb device Code
atp.c File Reference
#include <sys/cdefs.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/selinfo.h>
#include <sys/poll.h>
#include <dev/hid/hid.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usbhid.h>
#include "usbdevs.h"
#include <dev/usb/usb_debug.h>
#include <sys/mouse.h>
Include dependency graph for atp.c:

Go to the source code of this file.

Data Structures

struct  fg_pspan
 
struct  wsp_finger_sensor_data
 
struct  wsp_finger
 
struct  fg_dev_params
 
struct  wsp_dev_params
 
struct  fg_stroke_component
 
struct  atp_stroke
 
struct  atp_softc
 

Macros

#define USB_DEBUG_VAR   atp_debug
 
#define ATP_DRIVER_NAME   "atp"
 
#define ATP_SCALE_FACTOR   16
 
#define ATP_SMALL_MOVEMENT_THRESHOLD   30
 
#define ATP_FAST_MOVEMENT_TRESHOLD   150
 
#define ATP_TOUCH_TIMEOUT   125000
 
#define ATP_IDLENESS_THRESHOLD   10
 
#define FG_SENSOR_NOISE_THRESHOLD   2
 
#define ATP_DOUBLE_TAP_N_DRAG_THRESHOLD   200000
 
#define ATP_ZOMBIE_STROKE_REAP_INTERVAL   (hz / 20) /* 50 ms */
 
#define FG_SCALE_FACTOR   380
 
#define FG_MAX_DELTA_MICKEYS   ((3 * (FG_SCALE_FACTOR)) >> 1)
 
#define WSP_MAX_ALLOWED_MATCH_DISTANCE_SQ   1000000
 
#define FG_PSPAN_MIN_CUM_PRESSURE   10
 
#define FG_PSPAN_MAX_WIDTH   4
 
#define N_PROD_BITS   8 /* Number of bits used to encode product */
 
#define ENCODE_DRIVER_INFO(FAMILY, PROD)    (((FAMILY) << N_PROD_BITS) | (PROD))
 
#define DECODE_FAMILY_FROM_DRIVER_INFO(INFO)   ((INFO) >> N_PROD_BITS)
 
#define DECODE_PRODUCT_FROM_DRIVER_INFO(INFO)    ((INFO) & ((1 << N_PROD_BITS) - 1))
 
#define FG_DRIVER_INFO(PRODUCT)    ENCODE_DRIVER_INFO(TRACKPAD_FAMILY_FOUNTAIN_GEYSER, PRODUCT)
 
#define WELLSPRING_DRIVER_INFO(PRODUCT)    ENCODE_DRIVER_INFO(TRACKPAD_FAMILY_WELLSPRING, PRODUCT)
 
#define FG_MAX_PSPANS_PER_AXIS   3
 
#define FG_MAX_STROKES   (2 * FG_MAX_PSPANS_PER_AXIS)
 
#define WELLSPRING_INTERFACE_INDEX   1
 
#define WSP_TYPE1_FINGER_DATA_OFFSET   (13 * 2)
 
#define WSP_TYPE2_FINGER_DATA_OFFSET   (15 * 2)
 
#define WSP_TYPE3_FINGER_DATA_OFFSET   (19 * 2)
 
#define WSP_TYPE2_BUTTON_DATA_OFFSET   15
 
#define WSP_TYPE3_BUTTON_DATA_OFFSET   23
 
#define HAS_INTEGRATED_BUTTON   1
 
#define WSP_MAX_FINGERS   16
 
#define WSP_SIZEOF_FINGER_SENSOR_DATA   sizeof(struct wsp_finger_sensor_data)
 
#define WSP_SIZEOF_ALL_FINGER_DATA
 
#define WSP_MAX_FINGER_ORIENTATION   16384
 
#define ATP_SENSOR_DATA_BUF_MAX   1024
 
#define ATP_MAX_STROKES   MAX(WSP_MAX_FINGERS, FG_MAX_STROKES)
 
#define FG_MAX_XSENSORS   26
 
#define FG_MAX_YSENSORS   16
 
#define ATP_DEV(v, p, i)   { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
 
#define ATP_FIFO_BUF_SIZE   8 /* bytes */
 
#define ATP_FIFO_QUEUE_MAXLEN   50 /* units */
 
#define ATSF_ZOMBIE   0x1
 
#define MODE_LENGTH   8
 
#define ATP_ENABLED   0x01
 
#define ATP_ZOMBIES_EXIST   0x02
 
#define ATP_DOUBLE_TAP_DRAG   0x04
 
#define ATP_VALID   0x08
 
#define UPDATE_INSTANTANEOUS_AND_PENDING(I, P)
 

Typedefs

typedef enum atp_trackpad_family trackpad_family_t
 
typedef struct fg_pspan fg_pspan
 
typedef struct wsp_finger wsp_finger_t
 
typedef enum atp_stroke_type atp_stroke_type
 
typedef enum atp_axis atp_axis
 
typedef struct fg_stroke_component fg_stroke_component_t
 
typedef struct atp_stroke atp_stroke_t
 
typedef void(* sensor_data_interpreter_t) (struct atp_softc *sc, u_int len)
 
typedef enum interface_mode interface_mode
 

Enumerations

enum  atp_trackpad_family { TRACKPAD_FAMILY_FOUNTAIN_GEYSER , TRACKPAD_FAMILY_WELLSPRING , TRACKPAD_FAMILY_MAX }
 
enum  fountain_geyser_product {
  FOUNTAIN , GEYSER1 , GEYSER1_17inch , GEYSER2 ,
  GEYSER3 , GEYSER4 , FOUNTAIN_GEYSER_PRODUCT_MAX
}
 
enum  wellspring_product {
  WELLSPRING1 , WELLSPRING2 , WELLSPRING3 , WELLSPRING4 ,
  WELLSPRING4A , WELLSPRING5 , WELLSPRING6A , WELLSPRING6 ,
  WELLSPRING5A , WELLSPRING7 , WELLSPRING7A , WELLSPRING8 ,
  WELLSPRING_PRODUCT_MAX
}
 
enum  fountain_geyser_trackpad_type { FG_TRACKPAD_TYPE_GEYSER1 , FG_TRACKPAD_TYPE_GEYSER2 , FG_TRACKPAD_TYPE_GEYSER3 , FG_TRACKPAD_TYPE_GEYSER4 }
 
enum  wellspring_trackpad_type { WSP_TRACKPAD_TYPE1 , WSP_TRACKPAD_TYPE2 , WSP_TRACKPAD_TYPE3 }
 
enum  atp_stroke_type { ATP_STROKE_TOUCH , ATP_STROKE_SLIDE }
 
enum  atp_axis { X = 0 , Y = 1 , NUM_AXES }
 
enum  { ATP_INTR_DT , ATP_RESET , ATP_N_TRANSFER }
 
enum  geyser34_status_bits { FG_STATUS_BUTTON = (uint8_t)0x01 , FG_STATUS_BASE_UPDATE = (uint8_t)0x04 }
 
enum  interface_mode { RAW_SENSOR_MODE = (uint8_t)0x01 , HID_MODE = (uint8_t)0x08 }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static SYSCTL_NODE (_hw_usb, OID_AUTO, atp, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB ATP")
 
 SYSCTL_UINT (_hw_usb_atp, OID_AUTO, touch_timeout, CTLFLAG_RWTUN, &atp_touch_timeout, 125000, "age threshold in microseconds for a touch")
 
 SYSCTL_UINT (_hw_usb_atp, OID_AUTO, double_tap_threshold, CTLFLAG_RWTUN, &atp_double_tap_threshold, ATP_DOUBLE_TAP_N_DRAG_THRESHOLD, "maximum time in microseconds to allow association between a double-tap and " "drag gesture")
 
static int atp_sysctl_scale_factor_handler (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_hw_usb_atp, OID_AUTO, scale_factor, CTLTYPE_UINT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, &atp_mickeys_scale_factor, sizeof(atp_mickeys_scale_factor), atp_sysctl_scale_factor_handler, "IU", "movement scale factor")
 
 SYSCTL_UINT (_hw_usb_atp, OID_AUTO, small_movement, CTLFLAG_RWTUN, &atp_small_movement_threshold, ATP_SMALL_MOVEMENT_THRESHOLD, "the small movement black-hole for filtering noise")
 
 SYSCTL_UINT (_hw_usb_atp, OID_AUTO, tap_minimum, CTLFLAG_RWTUN, &atp_tap_minimum, 1, "Minimum number of taps before detection")
 
 SYSCTL_UINT (_hw_usb_atp, OID_AUTO, slide_min_movement, CTLFLAG_RWTUN, &atp_slide_min_movement, 2 *ATP_SMALL_MOVEMENT_THRESHOLD, "strokes with at least this amt. of movement are considered slides")
 
 SYSCTL_UINT (_hw_usb_atp, OID_AUTO, stroke_maturity_threshold, CTLFLAG_RWTUN, &atp_stroke_maturity_threshold, 4, "the minimum age of a stroke for it to be considered mature")
 
static usb_error_t atp_set_device_mode (struct atp_softc *, interface_mode)
 
static void atp_reset_callback (struct usb_xfer *, usb_error_t)
 
static int atp_enable (struct atp_softc *)
 
static void atp_disable (struct atp_softc *)
 
static void fg_interpret_sensor_data (struct atp_softc *, u_int)
 
static void fg_extract_sensor_data (const int8_t *, u_int, atp_axis, int *, enum fountain_geyser_trackpad_type)
 
static void fg_get_pressures (int *, const int *, const int *, int)
 
static void fg_detect_pspans (int *, u_int, u_int, fg_pspan *, u_int *)
 
static void wsp_interpret_sensor_data (struct atp_softc *, u_int)
 
static boolean_t fg_match_stroke_component (fg_stroke_component_t *, const fg_pspan *, atp_stroke_type)
 
static void fg_match_strokes_against_pspans (struct atp_softc *, atp_axis, fg_pspan *, u_int, u_int)
 
static boolean_t wsp_match_strokes_against_fingers (struct atp_softc *, wsp_finger_t *, u_int)
 
static boolean_t fg_update_strokes (struct atp_softc *, fg_pspan *, u_int, fg_pspan *, u_int)
 
static boolean_t wsp_update_strokes (struct atp_softc *, wsp_finger_t[WSP_MAX_FINGERS], u_int)
 
static void fg_add_stroke (struct atp_softc *, const fg_pspan *, const fg_pspan *)
 
static void fg_add_new_strokes (struct atp_softc *, fg_pspan *, u_int, fg_pspan *, u_int)
 
static void wsp_add_stroke (struct atp_softc *, const wsp_finger_t *)
 
static void atp_advance_stroke_state (struct atp_softc *, atp_stroke_t *, boolean_t *)
 
static boolean_t atp_stroke_has_small_movement (const atp_stroke_t *)
 
static void atp_update_pending_mickeys (atp_stroke_t *)
 
static boolean_t atp_compute_stroke_movement (atp_stroke_t *)
 
static void atp_terminate_stroke (struct atp_softc *, atp_stroke_t *)
 
static boolean_t atp_is_horizontal_scroll (const atp_stroke_t *)
 
static boolean_t atp_is_vertical_scroll (const atp_stroke_t *)
 
static void atp_reap_sibling_zombies (void *)
 
static void atp_convert_to_slide (struct atp_softc *, atp_stroke_t *)
 
static void atp_reset_buf (struct atp_softc *)
 
static void atp_add_to_queue (struct atp_softc *, int, int, int, uint32_t)
 
static atp_stroke_tatp_alloc_stroke (struct atp_softc *sc)
 
static void atp_free_stroke (struct atp_softc *sc, atp_stroke_t *pstroke)
 
static void atp_init_stroke_pool (struct atp_softc *sc)
 
static boolean_t wsp_update_strokes (struct atp_softc *sc, wsp_finger_t *fingers, u_int n_fingers)
 
static int atp_probe (device_t self)
 
static int atp_attach (device_t dev)
 
static int atp_detach (device_t dev)
 
static void atp_intr (struct usb_xfer *xfer, usb_error_t error)
 
static void atp_start_read (struct usb_fifo *fifo)
 
static void atp_stop_read (struct usb_fifo *fifo)
 
static int atp_open (struct usb_fifo *fifo, int fflags)
 
static void atp_close (struct usb_fifo *fifo, int fflags)
 
static int atp_ioctl (struct usb_fifo *fifo, u_long cmd, void *addr, int fflags)
 
 DRIVER_MODULE (atp, uhub, atp_driver, atp_devclass, NULL, 0)
 
 MODULE_DEPEND (atp, usb, 1, 1, 1)
 
 MODULE_DEPEND (atp, hid, 1, 1, 1)
 
 MODULE_VERSION (atp, 1)
 
 USB_PNP_HOST_INFO (fg_devs)
 
 USB_PNP_HOST_INFO (wsp_devs)
 

Variables

static u_int atp_touch_timeout = ATP_TOUCH_TIMEOUT
 
static u_int atp_double_tap_threshold = ATP_DOUBLE_TAP_N_DRAG_THRESHOLD
 
static u_int atp_mickeys_scale_factor = ATP_SCALE_FACTOR
 
static u_int atp_small_movement_threshold = ATP_SMALL_MOVEMENT_THRESHOLD
 
static u_int atp_tap_minimum = 1
 
static u_int atp_slide_min_movement = 2 * ATP_SMALL_MOVEMENT_THRESHOLD
 
static u_int atp_stroke_maturity_threshold = 4
 
struct wsp_finger_sensor_data __packed
 
static const struct fg_dev_params fg_dev_params [FOUNTAIN_GEYSER_PRODUCT_MAX]
 
static const STRUCT_USB_HOST_ID fg_devs []
 
static const struct wsp_dev_params wsp_dev_params [WELLSPRING_PRODUCT_MAX]
 
static const struct usb_device_id wsp_devs []
 
static usb_fifo_cmd_t atp_start_read
 
static usb_fifo_cmd_t atp_stop_read
 
static usb_fifo_open_t atp_open
 
static usb_fifo_close_t atp_close
 
static usb_fifo_ioctl_t atp_ioctl
 
static struct usb_fifo_methods atp_fifo_methods
 
static device_probe_t atp_probe
 
static device_attach_t atp_attach
 
static device_detach_t atp_detach
 
static usb_callback_t atp_intr
 
static const struct usb_config atp_xfer_config [ATP_N_TRANSFER]
 
static devclass_t atp_devclass
 
static device_method_t atp_methods []
 
static driver_t atp_driver
 

Macro Definition Documentation

◆ ATP_DEV

#define ATP_DEV (   v,
  p,
 
)    { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }

Definition at line 516 of file atp.c.

◆ ATP_DOUBLE_TAP_DRAG

#define ATP_DOUBLE_TAP_DRAG   0x04

Definition at line 679 of file atp.c.

◆ ATP_DOUBLE_TAP_N_DRAG_THRESHOLD

#define ATP_DOUBLE_TAP_N_DRAG_THRESHOLD   200000

Definition at line 142 of file atp.c.

◆ ATP_DRIVER_NAME

#define ATP_DRIVER_NAME   "atp"

Definition at line 96 of file atp.c.

◆ ATP_ENABLED

#define ATP_ENABLED   0x01

Definition at line 677 of file atp.c.

◆ ATP_FAST_MOVEMENT_TRESHOLD

#define ATP_FAST_MOVEMENT_TRESHOLD   150

Definition at line 115 of file atp.c.

◆ ATP_FIFO_BUF_SIZE

#define ATP_FIFO_BUF_SIZE   8 /* bytes */

Definition at line 593 of file atp.c.

◆ ATP_FIFO_QUEUE_MAXLEN

#define ATP_FIFO_QUEUE_MAXLEN   50 /* units */

Definition at line 594 of file atp.c.

◆ ATP_IDLENESS_THRESHOLD

#define ATP_IDLENESS_THRESHOLD   10

Definition at line 127 of file atp.c.

◆ ATP_MAX_STROKES

#define ATP_MAX_STROKES   MAX(WSP_MAX_FINGERS, FG_MAX_STROKES)

Definition at line 365 of file atp.c.

◆ ATP_SCALE_FACTOR

#define ATP_SCALE_FACTOR   16

Definition at line 105 of file atp.c.

◆ ATP_SENSOR_DATA_BUF_MAX

#define ATP_SENSOR_DATA_BUF_MAX   1024

Definition at line 358 of file atp.c.

◆ ATP_SMALL_MOVEMENT_THRESHOLD

#define ATP_SMALL_MOVEMENT_THRESHOLD   30

Definition at line 110 of file atp.c.

◆ ATP_TOUCH_TIMEOUT

#define ATP_TOUCH_TIMEOUT   125000

Definition at line 123 of file atp.c.

◆ ATP_VALID

#define ATP_VALID   0x08

Definition at line 680 of file atp.c.

◆ ATP_ZOMBIE_STROKE_REAP_INTERVAL

#define ATP_ZOMBIE_STROKE_REAP_INTERVAL   (hz / 20) /* 50 ms */

Definition at line 149 of file atp.c.

◆ ATP_ZOMBIES_EXIST

#define ATP_ZOMBIES_EXIST   0x02

Definition at line 678 of file atp.c.

◆ ATSF_ZOMBIE

#define ATSF_ZOMBIE   0x1

◆ DECODE_FAMILY_FROM_DRIVER_INFO

#define DECODE_FAMILY_FROM_DRIVER_INFO (   INFO)    ((INFO) >> N_PROD_BITS)

Definition at line 288 of file atp.c.

◆ DECODE_PRODUCT_FROM_DRIVER_INFO

#define DECODE_PRODUCT_FROM_DRIVER_INFO (   INFO)     ((INFO) & ((1 << N_PROD_BITS) - 1))

Definition at line 289 of file atp.c.

◆ ENCODE_DRIVER_INFO

#define ENCODE_DRIVER_INFO (   FAMILY,
  PROD 
)     (((FAMILY) << N_PROD_BITS) | (PROD))

Definition at line 286 of file atp.c.

◆ FG_DRIVER_INFO

#define FG_DRIVER_INFO (   PRODUCT)     ENCODE_DRIVER_INFO(TRACKPAD_FAMILY_FOUNTAIN_GEYSER, PRODUCT)

Definition at line 292 of file atp.c.

◆ FG_MAX_DELTA_MICKEYS

#define FG_MAX_DELTA_MICKEYS   ((3 * (FG_SCALE_FACTOR)) >> 1)

Definition at line 159 of file atp.c.

◆ FG_MAX_PSPANS_PER_AXIS

#define FG_MAX_PSPANS_PER_AXIS   3

Definition at line 310 of file atp.c.

◆ FG_MAX_STROKES

#define FG_MAX_STROKES   (2 * FG_MAX_PSPANS_PER_AXIS)

Definition at line 311 of file atp.c.

◆ FG_MAX_XSENSORS

#define FG_MAX_XSENSORS   26

Definition at line 367 of file atp.c.

◆ FG_MAX_YSENSORS

#define FG_MAX_YSENSORS   16

Definition at line 368 of file atp.c.

◆ FG_PSPAN_MAX_WIDTH

#define FG_PSPAN_MAX_WIDTH   4

Definition at line 170 of file atp.c.

◆ FG_PSPAN_MIN_CUM_PRESSURE

#define FG_PSPAN_MIN_CUM_PRESSURE   10

Definition at line 167 of file atp.c.

◆ FG_SCALE_FACTOR

#define FG_SCALE_FACTOR   380

Definition at line 152 of file atp.c.

◆ FG_SENSOR_NOISE_THRESHOLD

#define FG_SENSOR_NOISE_THRESHOLD   2

Definition at line 131 of file atp.c.

◆ HAS_INTEGRATED_BUTTON

#define HAS_INTEGRATED_BUTTON   1

Definition at line 325 of file atp.c.

◆ MODE_LENGTH

#define MODE_LENGTH   8

Definition at line 665 of file atp.c.

◆ N_PROD_BITS

#define N_PROD_BITS   8 /* Number of bits used to encode product */

Definition at line 285 of file atp.c.

◆ UPDATE_INSTANTANEOUS_AND_PENDING

#define UPDATE_INSTANTANEOUS_AND_PENDING (   I,
 
)

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   atp_debug

Definition at line 91 of file atp.c.

◆ WELLSPRING_DRIVER_INFO

#define WELLSPRING_DRIVER_INFO (   PRODUCT)     ENCODE_DRIVER_INFO(TRACKPAD_FAMILY_WELLSPRING, PRODUCT)

Definition at line 294 of file atp.c.

◆ WELLSPRING_INTERFACE_INDEX

#define WELLSPRING_INTERFACE_INDEX   1

Definition at line 313 of file atp.c.

◆ WSP_MAX_ALLOWED_MATCH_DISTANCE_SQ

#define WSP_MAX_ALLOWED_MATCH_DISTANCE_SQ   1000000

Definition at line 163 of file atp.c.

◆ WSP_MAX_FINGER_ORIENTATION

#define WSP_MAX_FINGER_ORIENTATION   16384

Definition at line 356 of file atp.c.

◆ WSP_MAX_FINGERS

#define WSP_MAX_FINGERS   16

Definition at line 352 of file atp.c.

◆ WSP_SIZEOF_ALL_FINGER_DATA

#define WSP_SIZEOF_ALL_FINGER_DATA
Value:
WSP_SIZEOF_FINGER_SENSOR_DATA)
#define WSP_MAX_FINGERS
Definition: atp.c:352

Definition at line 354 of file atp.c.

◆ WSP_SIZEOF_FINGER_SENSOR_DATA

#define WSP_SIZEOF_FINGER_SENSOR_DATA   sizeof(struct wsp_finger_sensor_data)

Definition at line 353 of file atp.c.

◆ WSP_TYPE1_FINGER_DATA_OFFSET

#define WSP_TYPE1_FINGER_DATA_OFFSET   (13 * 2)

Definition at line 316 of file atp.c.

◆ WSP_TYPE2_BUTTON_DATA_OFFSET

#define WSP_TYPE2_BUTTON_DATA_OFFSET   15

Definition at line 321 of file atp.c.

◆ WSP_TYPE2_FINGER_DATA_OFFSET

#define WSP_TYPE2_FINGER_DATA_OFFSET   (15 * 2)

Definition at line 317 of file atp.c.

◆ WSP_TYPE3_BUTTON_DATA_OFFSET

#define WSP_TYPE3_BUTTON_DATA_OFFSET   23

Definition at line 322 of file atp.c.

◆ WSP_TYPE3_FINGER_DATA_OFFSET

#define WSP_TYPE3_FINGER_DATA_OFFSET   (19 * 2)

Definition at line 318 of file atp.c.

Typedef Documentation

◆ atp_axis

typedef enum atp_axis atp_axis

◆ atp_stroke_t

typedef struct atp_stroke atp_stroke_t

◆ atp_stroke_type

◆ fg_pspan

typedef struct fg_pspan fg_pspan

◆ fg_stroke_component_t

◆ interface_mode

◆ sensor_data_interpreter_t

typedef void(* sensor_data_interpreter_t) (struct atp_softc *sc, u_int len)

Definition at line 657 of file atp.c.

◆ trackpad_family_t

◆ wsp_finger_t

typedef struct wsp_finger wsp_finger_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ATP_INTR_DT 
ATP_RESET 
ATP_N_TRANSFER 

Definition at line 596 of file atp.c.

◆ atp_axis

enum atp_axis
Enumerator
NUM_AXES 

Definition at line 587 of file atp.c.

◆ atp_stroke_type

Enumerator
ATP_STROKE_TOUCH 
ATP_STROKE_SLIDE 

Definition at line 582 of file atp.c.

◆ atp_trackpad_family

Enumerator
TRACKPAD_FAMILY_FOUNTAIN_GEYSER 
TRACKPAD_FAMILY_WELLSPRING 
TRACKPAD_FAMILY_MAX 

Definition at line 236 of file atp.c.

◆ fountain_geyser_product

Enumerator
FOUNTAIN 
GEYSER1 
GEYSER1_17inch 
GEYSER2 
GEYSER3 
GEYSER4 
FOUNTAIN_GEYSER_PRODUCT_MAX 

Definition at line 242 of file atp.c.

◆ fountain_geyser_trackpad_type

Enumerator
FG_TRACKPAD_TYPE_GEYSER1 
FG_TRACKPAD_TYPE_GEYSER2 
FG_TRACKPAD_TYPE_GEYSER3 
FG_TRACKPAD_TYPE_GEYSER4 

Definition at line 269 of file atp.c.

◆ geyser34_status_bits

Enumerator
FG_STATUS_BUTTON 
FG_STATUS_BASE_UPDATE 

Definition at line 729 of file atp.c.

◆ interface_mode

Enumerator
RAW_SENSOR_MODE 
HID_MODE 

Definition at line 734 of file atp.c.

◆ wellspring_product

Enumerator
WELLSPRING1 
WELLSPRING2 
WELLSPRING3 
WELLSPRING4 
WELLSPRING4A 
WELLSPRING5 
WELLSPRING6A 
WELLSPRING6 
WELLSPRING5A 
WELLSPRING7 
WELLSPRING7A 
WELLSPRING8 
WELLSPRING_PRODUCT_MAX 

Definition at line 252 of file atp.c.

◆ wellspring_trackpad_type

Enumerator
WSP_TRACKPAD_TYPE1 
WSP_TRACKPAD_TYPE2 
WSP_TRACKPAD_TYPE3 

Definition at line 275 of file atp.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ atp_add_to_queue()

static void atp_add_to_queue ( struct atp_softc sc,
int  dx,
int  dy,
int  dz,
uint32_t  buttons_in 
)
static

Definition at line 2101 of file atp.c.

References atp_double_tap_threshold.

◆ atp_advance_stroke_state()

static void atp_advance_stroke_state ( struct atp_softc sc,
atp_stroke_t strokep,
boolean_t *  movementp 
)
static

Definition at line 1805 of file atp.c.

References atp_compute_stroke_movement(), atp_convert_to_slide(), atp_slide_min_movement, atp_stroke_maturity_threshold, ATP_STROKE_TOUCH, atp_touch_timeout, and ATSF_ZOMBIE.

Referenced by fg_update_strokes(), and wsp_match_strokes_against_fingers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atp_alloc_stroke()

static atp_stroke_t * atp_alloc_stroke ( struct atp_softc sc)
static

Definition at line 832 of file atp.c.

Referenced by fg_add_stroke(), and wsp_add_stroke().

Here is the caller graph for this function:

◆ atp_attach()

static int atp_attach ( device_t  dev)
static

Definition at line 2168 of file atp.c.

◆ atp_close()

static void atp_close ( struct usb_fifo fifo,
int  fflags 
)
static

Definition at line 2472 of file atp.c.

References atp_enable().

Here is the call graph for this function:

◆ atp_compute_stroke_movement()

static boolean_t atp_compute_stroke_movement ( atp_stroke_t strokep)
static

Definition at line 1905 of file atp.c.

Referenced by atp_advance_stroke_state().

Here is the caller graph for this function:

◆ atp_convert_to_slide()

static void atp_convert_to_slide ( struct atp_softc sc,
atp_stroke_t strokep 
)
static

Definition at line 2072 of file atp.c.

Referenced by atp_advance_stroke_state().

Here is the caller graph for this function:

◆ atp_detach()

static int atp_detach ( device_t  dev)
static

Definition at line 2283 of file atp.c.

◆ atp_disable()

static void atp_disable ( struct atp_softc sc)
static

Definition at line 977 of file atp.c.

References ATP_ENABLED, ATP_VALID, and atp_softc::sc_state.

◆ atp_enable()

static int atp_enable ( struct atp_softc sc)
static

Definition at line 960 of file atp.c.

References ATP_ENABLED, atp_init_stroke_pool(), atp_softc::sc_state, and atp_softc::sc_status.

Referenced by atp_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atp_free_stroke()

static void atp_free_stroke ( struct atp_softc sc,
atp_stroke_t pstroke 
)
static

Definition at line 850 of file atp.c.

Referenced by atp_is_horizontal_scroll().

Here is the caller graph for this function:

◆ atp_init_stroke_pool()

static void atp_init_stroke_pool ( struct atp_softc sc)
static

Definition at line 862 of file atp.c.

References ATP_MAX_STROKES, and atp_softc::sc_strokes_data.

Referenced by atp_enable().

Here is the caller graph for this function:

◆ atp_intr()

static void atp_intr ( struct usb_xfer xfer,
usb_error_t  error 
)
static

Definition at line 2306 of file atp.c.

◆ atp_ioctl()

static int atp_ioctl ( struct usb_fifo fifo,
u_long  cmd,
void *  addr,
int  fflags 
)
static

Definition at line 2485 of file atp.c.

◆ atp_is_horizontal_scroll()

static boolean_t atp_is_horizontal_scroll ( const atp_stroke_t strokep)
static

Definition at line 1972 of file atp.c.

References atp_free_stroke().

Here is the call graph for this function:

◆ atp_is_vertical_scroll()

static boolean_t atp_is_vertical_scroll ( const atp_stroke_t strokep)
static

Definition at line 1982 of file atp.c.

◆ atp_open()

static int atp_open ( struct usb_fifo fifo,
int  fflags 
)
static

Definition at line 2445 of file atp.c.

References ATP_INTR_DT, atp_softc::sc_pollrate, atp_softc::sc_xfer, usbd_transfer_stop(), and usbd_xfer_set_interval().

Here is the call graph for this function:

◆ atp_probe()

static int atp_probe ( device_t  self)
static

Definition at line 2141 of file atp.c.

◆ atp_reap_sibling_zombies()

static void atp_reap_sibling_zombies ( void *  arg)
static

Definition at line 1992 of file atp.c.

References atp_slide_min_movement.

◆ atp_reset_buf()

static void atp_reset_buf ( struct atp_softc sc)
static

Definition at line 2094 of file atp.c.

◆ atp_reset_callback()

◆ atp_set_device_mode()

static usb_error_t atp_set_device_mode ( struct atp_softc sc,
interface_mode  newMode 
)
static

◆ atp_start_read()

static void atp_start_read ( struct usb_fifo fifo)
static

Definition at line 2414 of file atp.c.

References usbd_transfer_submit(), and usbd_xfer_set_frame_len().

Here is the call graph for this function:

◆ atp_stop_read()

static void atp_stop_read ( struct usb_fifo fifo)
static

Definition at line 2438 of file atp.c.

◆ atp_stroke_has_small_movement()

static boolean_t atp_stroke_has_small_movement ( const atp_stroke_t strokep)
static

Definition at line 1845 of file atp.c.

References atp_small_movement_threshold.

◆ atp_sysctl_scale_factor_handler()

static int atp_sysctl_scale_factor_handler ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2578 of file atp.c.

◆ atp_terminate_stroke()

static void atp_terminate_stroke ( struct atp_softc sc,
atp_stroke_t strokep 
)
static

Definition at line 1946 of file atp.c.

Referenced by fg_update_strokes(), and wsp_update_strokes().

Here is the caller graph for this function:

◆ atp_update_pending_mickeys()

static void atp_update_pending_mickeys ( atp_stroke_t strokep)
static

Definition at line 1859 of file atp.c.

◆ DRIVER_MODULE()

DRIVER_MODULE ( atp  ,
uhub  ,
atp_driver  ,
atp_devclass  ,
NULL  ,
 
)

◆ fg_add_new_strokes()

static void fg_add_new_strokes ( struct atp_softc sc,
fg_pspan pspans_x,
u_int  n_xpspans,
fg_pspan pspans_y,
u_int  n_ypspans 
)
static

Definition at line 1713 of file atp.c.

References fg_pspan::cum, fg_add_stroke(), FG_MAX_PSPANS_PER_AXIS, X, and Y.

Referenced by fg_update_strokes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fg_add_stroke()

static void fg_add_stroke ( struct atp_softc sc,
const fg_pspan pspan_x,
const fg_pspan pspan_y 
)
static

Definition at line 1669 of file atp.c.

References atp_alloc_stroke(), ATP_STROKE_TOUCH, fg_pspan::cum, fg_pspan::loc, atp_softc::sc_state, X, and Y.

Referenced by fg_add_new_strokes(), and fg_update_strokes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fg_detect_pspans()

static void fg_detect_pspans ( int *  p,
u_int  num_sensors,
u_int  max_spans,
fg_pspan spans,
u_int *  nspans_p 
)
static

Definition at line 1164 of file atp.c.

References fg_pspan::cog, fg_pspan::cum, FG_PSPAN_MAX_WIDTH, FG_PSPAN_MIN_CUM_PRESSURE, FG_SCALE_FACTOR, fg_pspan::loc, fg_pspan::matched, state, and fg_pspan::width.

Referenced by fg_interpret_sensor_data().

Here is the caller graph for this function:

◆ fg_extract_sensor_data()

static void fg_extract_sensor_data ( const int8_t *  sensor_data,
u_int  num,
atp_axis  axis,
int *  arr,
enum fountain_geyser_trackpad_type  prot 
)
static

Definition at line 1097 of file atp.c.

References FG_TRACKPAD_TYPE_GEYSER1, FG_TRACKPAD_TYPE_GEYSER2, FG_TRACKPAD_TYPE_GEYSER3, FG_TRACKPAD_TYPE_GEYSER4, fg_dev_params::prot, X, and Y.

Referenced by fg_interpret_sensor_data().

Here is the caller graph for this function:

◆ fg_get_pressures()

static void fg_get_pressures ( int *  p,
const int *  cur,
const int *  base,
int  n 
)
static

Definition at line 1138 of file atp.c.

References FG_SENSOR_NOISE_THRESHOLD, and n.

Referenced by fg_interpret_sensor_data().

Here is the caller graph for this function:

◆ fg_interpret_sensor_data()

◆ fg_match_stroke_component()

static boolean_t fg_match_stroke_component ( fg_stroke_component_t component,
const fg_pspan pspan,
atp_stroke_type  stroke_type 
)
static

◆ fg_match_strokes_against_pspans()

static void fg_match_strokes_against_pspans ( struct atp_softc sc,
atp_axis  axis,
fg_pspan pspans,
u_int  n_pspans,
u_int  repeat_count 
)
static

Definition at line 1393 of file atp.c.

References fg_match_stroke_component(), and fg_pspan::matched.

Referenced by fg_update_strokes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fg_update_strokes()

static boolean_t fg_update_strokes ( struct atp_softc sc,
fg_pspan pspans_x,
u_int  n_xpspans,
fg_pspan pspans_y,
u_int  n_ypspans 
)
static

Definition at line 1494 of file atp.c.

References atp_advance_stroke_state(), ATP_STROKE_TOUCH, atp_terminate_stroke(), ATSF_ZOMBIE, fg_add_new_strokes(), fg_add_stroke(), fg_match_strokes_against_pspans(), X, and Y.

Referenced by fg_interpret_sensor_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( atp  ,
hid  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( atp  ,
usb  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( atp  ,
 
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _hw_usb  ,
OID_AUTO  ,
atp  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"USB ATP"   
)
static

◆ SYSCTL_PROC()

SYSCTL_PROC ( _hw_usb_atp  ,
OID_AUTO  ,
scale_factor  ,
CTLTYPE_UINT|CTLFLAG_RWTUN|  CTLFLAG_MPSAFE,
atp_mickeys_scale_factor,
sizeof(atp_mickeys_scale_factor ,
atp_sysctl_scale_factor_handler  ,
"IU"  ,
"movement scale factor"   
)

◆ SYSCTL_UINT() [1/6]

SYSCTL_UINT ( _hw_usb_atp  ,
OID_AUTO  ,
double_tap_threshold  ,
CTLFLAG_RWTUN  ,
atp_double_tap_threshold,
ATP_DOUBLE_TAP_N_DRAG_THRESHOLD  ,
"maximum time in microseconds to allow association between a double-tap and " "drag gesture"   
)

◆ SYSCTL_UINT() [2/6]

SYSCTL_UINT ( _hw_usb_atp  ,
OID_AUTO  ,
slide_min_movement  ,
CTLFLAG_RWTUN  ,
atp_slide_min_movement,
2 *  ATP_SMALL_MOVEMENT_THRESHOLD,
"strokes with at least this amt. of movement are considered slides"   
)

◆ SYSCTL_UINT() [3/6]

SYSCTL_UINT ( _hw_usb_atp  ,
OID_AUTO  ,
small_movement  ,
CTLFLAG_RWTUN  ,
atp_small_movement_threshold,
ATP_SMALL_MOVEMENT_THRESHOLD  ,
"the small movement black-hole for filtering noise"   
)

◆ SYSCTL_UINT() [4/6]

SYSCTL_UINT ( _hw_usb_atp  ,
OID_AUTO  ,
stroke_maturity_threshold  ,
CTLFLAG_RWTUN  ,
atp_stroke_maturity_threshold,
,
"the minimum age of a stroke for it to be considered mature"   
)

◆ SYSCTL_UINT() [5/6]

SYSCTL_UINT ( _hw_usb_atp  ,
OID_AUTO  ,
tap_minimum  ,
CTLFLAG_RWTUN  ,
atp_tap_minimum,
,
"Minimum number of taps before detection"   
)

◆ SYSCTL_UINT() [6/6]

SYSCTL_UINT ( _hw_usb_atp  ,
OID_AUTO  ,
touch_timeout  ,
CTLFLAG_RWTUN  ,
atp_touch_timeout,
125000  ,
"age threshold in microseconds for a touch"   
)

◆ USB_PNP_HOST_INFO() [1/2]

USB_PNP_HOST_INFO ( fg_devs  )

◆ USB_PNP_HOST_INFO() [2/2]

USB_PNP_HOST_INFO ( wsp_devs  )

References atp_attach, atp_detach, and atp_probe.

◆ wsp_add_stroke()

static void wsp_add_stroke ( struct atp_softc sc,
const wsp_finger_t fingerp 
)
static

Definition at line 1777 of file atp.c.

References atp_alloc_stroke(), ATP_STROKE_TOUCH, atp_softc::sc_state, wsp_finger::x, and wsp_finger::y.

Referenced by wsp_update_strokes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsp_interpret_sensor_data()

◆ wsp_match_strokes_against_fingers()

static boolean_t wsp_match_strokes_against_fingers ( struct atp_softc sc,
wsp_finger_t fingers,
u_int  n_fingers 
)
static

Definition at line 1435 of file atp.c.

References atp_advance_stroke_state(), wsp_finger::matched, WSP_MAX_ALLOWED_MATCH_DISTANCE_SQ, wsp_finger::x, and wsp_finger::y.

Referenced by wsp_update_strokes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsp_update_strokes() [1/2]

static boolean_t wsp_update_strokes ( struct atp_softc ,
wsp_finger_t  [WSP_MAX_FINGERS],
u_int   
)
static

Referenced by wsp_interpret_sensor_data().

Here is the caller graph for this function:

◆ wsp_update_strokes() [2/2]

static boolean_t wsp_update_strokes ( struct atp_softc sc,
wsp_finger_t fingers,
u_int  n_fingers 
)
static

Definition at line 1638 of file atp.c.

References atp_terminate_stroke(), wsp_add_stroke(), and wsp_match_strokes_against_fingers().

Here is the call graph for this function:

Variable Documentation

◆ __packed

◆ atp_attach

device_attach_t atp_attach
static

Definition at line 805 of file atp.c.

Referenced by USB_PNP_HOST_INFO().

◆ atp_close

usb_fifo_close_t atp_close
static

Definition at line 745 of file atp.c.

◆ atp_detach

device_detach_t atp_detach
static

Definition at line 806 of file atp.c.

Referenced by USB_PNP_HOST_INFO().

◆ atp_devclass

devclass_t atp_devclass
static

Definition at line 2600 of file atp.c.

◆ atp_double_tap_threshold

u_int atp_double_tap_threshold = ATP_DOUBLE_TAP_N_DRAG_THRESHOLD
static

Definition at line 194 of file atp.c.

Referenced by atp_add_to_queue().

◆ atp_driver

driver_t atp_driver
static
Initial value:
= {
.name = ATP_DRIVER_NAME,
.methods = atp_methods,
.size = sizeof(struct atp_softc)
}
static device_method_t atp_methods[]
Definition: atp.c:2602
#define ATP_DRIVER_NAME
Definition: atp.c:96
Definition: atp.c:659

Definition at line 2610 of file atp.c.

◆ atp_fifo_methods

struct usb_fifo_methods atp_fifo_methods
static
Initial value:
= {
.f_open = &atp_open,
.f_close = &atp_close,
.f_ioctl = &atp_ioctl,
.f_start_read = &atp_start_read,
.f_stop_read = &atp_stop_read,
.basename[0] = ATP_DRIVER_NAME,
}
static usb_fifo_close_t atp_close
Definition: atp.c:745
static usb_fifo_cmd_t atp_stop_read
Definition: atp.c:743
static usb_fifo_ioctl_t atp_ioctl
Definition: atp.c:746
static usb_fifo_cmd_t atp_start_read
Definition: atp.c:742
static usb_fifo_open_t atp_open
Definition: atp.c:744

Definition at line 748 of file atp.c.

◆ atp_intr

usb_callback_t atp_intr
static

Definition at line 807 of file atp.c.

◆ atp_ioctl

usb_fifo_ioctl_t atp_ioctl
static

Definition at line 746 of file atp.c.

◆ atp_methods

device_method_t atp_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, atp_probe),
DEVMETHOD(device_attach, atp_attach),
DEVMETHOD(device_detach, atp_detach),
DEVMETHOD_END
}
static device_detach_t atp_detach
Definition: atp.c:806
static device_attach_t atp_attach
Definition: atp.c:805
static device_probe_t atp_probe
Definition: atp.c:804

Definition at line 2602 of file atp.c.

◆ atp_mickeys_scale_factor

u_int atp_mickeys_scale_factor = ATP_SCALE_FACTOR
static

Definition at line 200 of file atp.c.

◆ atp_open

usb_fifo_open_t atp_open
static

Definition at line 744 of file atp.c.

◆ atp_probe

device_probe_t atp_probe
static

Definition at line 804 of file atp.c.

Referenced by USB_PNP_HOST_INFO().

◆ atp_slide_min_movement

u_int atp_slide_min_movement = 2 * ATP_SMALL_MOVEMENT_THRESHOLD
static

Definition at line 222 of file atp.c.

Referenced by atp_advance_stroke_state(), and atp_reap_sibling_zombies().

◆ atp_small_movement_threshold

u_int atp_small_movement_threshold = ATP_SMALL_MOVEMENT_THRESHOLD
static

Definition at line 208 of file atp.c.

Referenced by atp_stroke_has_small_movement().

◆ atp_start_read

usb_fifo_cmd_t atp_start_read
static

Definition at line 742 of file atp.c.

◆ atp_stop_read

usb_fifo_cmd_t atp_stop_read
static

Definition at line 743 of file atp.c.

◆ atp_stroke_maturity_threshold

u_int atp_stroke_maturity_threshold = 4
static

Definition at line 231 of file atp.c.

Referenced by atp_advance_stroke_state().

◆ atp_tap_minimum

u_int atp_tap_minimum = 1
static

Definition at line 213 of file atp.c.

◆ atp_touch_timeout

u_int atp_touch_timeout = ATP_TOUCH_TIMEOUT
static

Definition at line 190 of file atp.c.

Referenced by atp_advance_stroke_state().

◆ atp_xfer_config

const struct usb_config atp_xfer_config[ATP_N_TRANSFER]
static
Initial value:
= {
.type = UE_INTERRUPT,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.flags = {
.pipe_bof = 1,
.short_xfer_ok = 1,
},
.callback = &atp_intr,
},
[ATP_RESET] = {
.type = UE_CONTROL,
.endpoint = 0,
.direction = UE_DIR_ANY,
.bufsize = sizeof(struct usb_device_request) + MODE_LENGTH,
.callback = &atp_reset_callback,
.interval = 0,
},
}
@ ATP_INTR_DT
Definition: atp.c:597
@ ATP_RESET
Definition: atp.c:598
static usb_callback_t atp_intr
Definition: atp.c:807
#define MODE_LENGTH
Definition: atp.c:665
static void atp_reset_callback(struct usb_xfer *, usb_error_t)
Definition: atp.c:920
#define ATP_SENSOR_DATA_BUF_MAX
Definition: atp.c:358
#define UE_INTERRUPT
Definition: usb.h:544
#define UE_DIR_ANY
Definition: usb.h:535
#define UE_ADDR_ANY
Definition: usb.h:537
#define UE_DIR_IN
Definition: usb.h:531
#define UE_CONTROL
Definition: usb.h:541

Definition at line 809 of file atp.c.

◆ fg_dev_params

Definition at line 383 of file atp.c.

◆ fg_devs

const STRUCT_USB_HOST_ID fg_devs[]
static

Definition at line 422 of file atp.c.

◆ wsp_dev_params

Definition at line 454 of file atp.c.

◆ wsp_devs

const struct usb_device_id wsp_devs[]
static

Definition at line 519 of file atp.c.