FreeBSD kernel usb device Code
|
#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>
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 |
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 |
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_t * | atp_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) | |
#define ATP_DEV | ( | v, | |
p, | |||
i | |||
) | { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } |
#define ATP_MAX_STROKES MAX(WSP_MAX_FINGERS, FG_MAX_STROKES) |
#define ATSF_ZOMBIE 0x1 |
#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 ENCODE_DRIVER_INFO | ( | FAMILY, | |
PROD | |||
) | (((FAMILY) << N_PROD_BITS) | (PROD)) |
#define FG_DRIVER_INFO | ( | PRODUCT | ) | ENCODE_DRIVER_INFO(TRACKPAD_FAMILY_FOUNTAIN_GEYSER, PRODUCT) |
#define FG_MAX_DELTA_MICKEYS ((3 * (FG_SCALE_FACTOR)) >> 1) |
#define FG_MAX_STROKES (2 * FG_MAX_PSPANS_PER_AXIS) |
#define N_PROD_BITS 8 /* Number of bits used to encode product */ |
#define UPDATE_INSTANTANEOUS_AND_PENDING | ( | I, | |
P | |||
) |
#define WELLSPRING_DRIVER_INFO | ( | PRODUCT | ) | ENCODE_DRIVER_INFO(TRACKPAD_FAMILY_WELLSPRING, PRODUCT) |
#define WSP_SIZEOF_ALL_FINGER_DATA |
#define WSP_SIZEOF_FINGER_SENSOR_DATA sizeof(struct wsp_finger_sensor_data) |
typedef struct atp_stroke atp_stroke_t |
typedef enum atp_stroke_type atp_stroke_type |
typedef struct fg_stroke_component fg_stroke_component_t |
typedef enum interface_mode interface_mode |
typedef enum atp_trackpad_family trackpad_family_t |
typedef struct wsp_finger wsp_finger_t |
enum atp_stroke_type |
enum atp_trackpad_family |
enum geyser34_status_bits |
enum interface_mode |
enum wellspring_product |
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 2101 of file atp.c.
References atp_double_tap_threshold.
|
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().
|
static |
Definition at line 832 of file atp.c.
Referenced by fg_add_stroke(), and wsp_add_stroke().
|
static |
Definition at line 2472 of file atp.c.
References atp_enable().
|
static |
Definition at line 1905 of file atp.c.
Referenced by atp_advance_stroke_state().
|
static |
Definition at line 2072 of file atp.c.
Referenced by atp_advance_stroke_state().
|
static |
Definition at line 977 of file atp.c.
References ATP_ENABLED, ATP_VALID, and atp_softc::sc_state.
|
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().
|
static |
Definition at line 850 of file atp.c.
Referenced by atp_is_horizontal_scroll().
|
static |
Definition at line 862 of file atp.c.
References ATP_MAX_STROKES, and atp_softc::sc_strokes_data.
Referenced by atp_enable().
|
static |
|
static |
|
static |
Definition at line 1972 of file atp.c.
References atp_free_stroke().
|
static |
|
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().
|
static |
Definition at line 1992 of file atp.c.
References atp_slide_min_movement.
|
static |
Definition at line 920 of file atp.c.
References MODE_LENGTH, RAW_SENSOR_MODE, req, atp_softc::sc_family, atp_softc::sc_mode_bytes, TRACKPAD_FAMILY_FOUNTAIN_GEYSER, UR_SET_REPORT, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_in(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_frames(), usbd_xfer_softc(), USETW, USETW2, and UT_WRITE_CLASS_INTERFACE.
|
static |
Definition at line 880 of file atp.c.
References DPRINTF, HID_MODE, RAW_SENSOR_MODE, atp_softc::sc_family, atp_softc::sc_mode_bytes, atp_softc::sc_usb_device, TRACKPAD_FAMILY_FOUNTAIN_GEYSER, USB_ERR_INVAL, USB_ERR_NORMAL_COMPLETION, usbd_req_get_report(), and usbd_req_set_report().
|
static |
Definition at line 2414 of file atp.c.
References usbd_transfer_submit(), and usbd_xfer_set_frame_len().
|
static |
Definition at line 1845 of file atp.c.
References atp_small_movement_threshold.
|
static |
|
static |
Definition at line 1946 of file atp.c.
Referenced by fg_update_strokes(), and wsp_update_strokes().
|
static |
DRIVER_MODULE | ( | atp | , |
uhub | , | ||
atp_driver | , | ||
atp_devclass | , | ||
NULL | , | ||
0 | |||
) |
|
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().
|
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().
|
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().
|
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().
|
static |
Definition at line 1138 of file atp.c.
References FG_SENSOR_NOISE_THRESHOLD, and n.
Referenced by fg_interpret_sensor_data().
|
static |
Definition at line 984 of file atp.c.
References ATP_IDLENESS_THRESHOLD, ATP_RESET, ATP_VALID, fg_dev_params::data_len, fg_detect_pspans(), fg_extract_sensor_data(), fg_get_pressures(), FG_MAX_PSPANS_PER_AXIS, FG_STATUS_BASE_UPDATE, FG_STATUS_BUTTON, FG_TRACKPAD_TYPE_GEYSER3, FG_TRACKPAD_TYPE_GEYSER4, fg_update_strokes(), fg_dev_params::n_xsensors, fg_dev_params::n_ysensors, fg_dev_params::prot, atp_softc::sc_params, atp_softc::sc_state, atp_softc::sc_status, atp_softc::sc_xfer, usbd_transfer_start(), X, and Y.
|
static |
Definition at line 1348 of file atp.c.
References ATP_STROKE_TOUCH, fg_pspan::cum, fg_stroke_component::cum_pressure, fg_stroke_component::delta_mickeys, FG_MAX_DELTA_MICKEYS, fg_pspan::loc, fg_stroke_component::loc, and fg_stroke_component::max_cum_pressure.
Referenced by fg_match_strokes_against_pspans().
|
static |
Definition at line 1393 of file atp.c.
References fg_match_stroke_component(), and fg_pspan::matched.
Referenced by fg_update_strokes().
|
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().
MODULE_DEPEND | ( | atp | , |
hid | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | atp | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | atp | , |
1 | |||
) |
|
static |
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 | , | ||
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 | ( | _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 | , | ||
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 | , | ||
stroke_maturity_threshold | , | ||
CTLFLAG_RWTUN | , | ||
& | atp_stroke_maturity_threshold, | ||
4 | , | ||
"the minimum age of a stroke for it to be considered mature" | |||
) |
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 | , | ||
touch_timeout | , | ||
CTLFLAG_RWTUN | , | ||
& | atp_touch_timeout, | ||
125000 | , | ||
"age threshold in microseconds for a touch" | |||
) |
USB_PNP_HOST_INFO | ( | fg_devs | ) |
USB_PNP_HOST_INFO | ( | wsp_devs | ) |
References atp_attach, atp_detach, and atp_probe.
|
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().
|
static |
Definition at line 1270 of file atp.c.
References wsp_finger_sensor_data::abs_x, wsp_finger_sensor_data::abs_y, wsp_dev_params::finger_data_offset, wsp_finger::matched, wsp_finger_sensor_data::multi, wsp_finger_sensor_data::orientation, wsp_finger_sensor_data::origin, wsp_finger_sensor_data::rel_x, wsp_finger_sensor_data::rel_y, atp_softc::sc_params, atp_softc::sc_status, wsp_finger_sensor_data::tool_major, wsp_finger_sensor_data::tool_minor, wsp_finger_sensor_data::touch_major, wsp_finger_sensor_data::touch_minor, wsp_dev_params::tp_type, WSP_MAX_FINGERS, WSP_SIZEOF_FINGER_SENSOR_DATA, WSP_TRACKPAD_TYPE2, WSP_TRACKPAD_TYPE3, WSP_TYPE2_BUTTON_DATA_OFFSET, WSP_TYPE3_BUTTON_DATA_OFFSET, wsp_update_strokes(), wsp_finger::x, and wsp_finger::y.
|
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().
|
static |
|
static |
Definition at line 1638 of file atp.c.
References atp_terminate_stroke(), wsp_add_stroke(), and wsp_match_strokes_against_fingers().
struct wsp_finger_sensor_data __packed |
|
static |
Definition at line 805 of file atp.c.
Referenced by USB_PNP_HOST_INFO().
|
static |
|
static |
Definition at line 806 of file atp.c.
Referenced by USB_PNP_HOST_INFO().
|
static |
Definition at line 194 of file atp.c.
Referenced by atp_add_to_queue().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 804 of file atp.c.
Referenced by USB_PNP_HOST_INFO().
|
static |
Definition at line 222 of file atp.c.
Referenced by atp_advance_stroke_state(), and atp_reap_sibling_zombies().
|
static |
Definition at line 208 of file atp.c.
Referenced by atp_stroke_has_small_movement().
|
static |
|
static |
|
static |
Definition at line 231 of file atp.c.
Referenced by atp_advance_stroke_state().
|
static |
Definition at line 190 of file atp.c.
Referenced by atp_advance_stroke_state().
|
static |
|
static |
|
static |
|
static |
|
static |