Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
mt.h File Reference
#include <linux/input.h>

Go to the source code of this file.

Data Structures

struct  input_mt_slot
 
struct  input_mt
 
struct  input_mt_pos
 

Macros

#define TRKID_MAX   0xffff
 
#define INPUT_MT_POINTER   0x0001 /* pointer device, e.g. trackpad */
 
#define INPUT_MT_DIRECT   0x0002 /* direct device, e.g. touchscreen */
 
#define INPUT_MT_DROP_UNUSED   0x0004 /* drop contacts not seen in frame */
 
#define INPUT_MT_TRACK   0x0008 /* use in-kernel tracking */
 

Functions

int input_mt_init_slots (struct input_dev *dev, unsigned int num_slots, unsigned int flags)
 
void input_mt_destroy_slots (struct input_dev *dev)
 
void input_mt_report_slot_state (struct input_dev *dev, unsigned int tool_type, bool active)
 
void input_mt_report_finger_count (struct input_dev *dev, int count)
 
void input_mt_report_pointer_emulation (struct input_dev *dev, bool use_count)
 
void input_mt_sync_frame (struct input_dev *dev)
 
int input_mt_assign_slots (struct input_dev *dev, int *slots, const struct input_mt_pos *pos, int num_pos)
 
int input_mt_get_slot_by_key (struct input_dev *dev, int key)
 

Macro Definition Documentation

#define INPUT_MT_DIRECT   0x0002 /* direct device, e.g. touchscreen */

Definition at line 19 of file mt.h.

#define INPUT_MT_DROP_UNUSED   0x0004 /* drop contacts not seen in frame */

Definition at line 20 of file mt.h.

#define INPUT_MT_POINTER   0x0001 /* pointer device, e.g. trackpad */

Definition at line 18 of file mt.h.

#define INPUT_MT_TRACK   0x0008 /* use in-kernel tracking */

Definition at line 21 of file mt.h.

#define TRKID_MAX   0xffff

Definition at line 16 of file mt.h.

Function Documentation

int input_mt_assign_slots ( struct input_dev *  dev,
int slots,
const struct input_mt_pos pos,
int  num_pos 
)

input_mt_assign_slots() - perform a best-match assignment : input device with allocated MT slots : the slot assignment to be filled : the position array to match : number of positions

Performs a best match against the current contacts and returns the slot assignment list. New contacts are assigned to unused slots.

Returns zero on success, or negative error in case of failure.

Definition at line 374 of file input-mt.c.

void input_mt_destroy_slots ( struct input_dev *  dev)

input_mt_destroy_slots() - frees the MT slots of the input device : input device with allocated MT slots

This function is only needed in error path as the input core will automatically free the MT slots when the device is destroyed.

Definition at line 107 of file input-mt.c.

int input_mt_get_slot_by_key ( struct input_dev *  dev,
int  key 
)

input_mt_get_slot_by_key() - return slot matching key : input device with allocated MT slots : the key of the sought slot

Returns the slot of the given key, if it exists, otherwise set the key on the first unused slot and return.

If no available slot can be found, -1 is returned.

Definition at line 405 of file input-mt.c.

int input_mt_init_slots ( struct input_dev *  dev,
unsigned int  num_slots,
unsigned int  flags 
)

input_mt_init_slots() - initialize MT input slots : input device supporting MT events and finger tracking : number of slots used by the device : mt tasks to handle in core

This function allocates all necessary memory for MT slot handling in the input device, prepares the ABS_MT_SLOT and ABS_MT_TRACKING_ID events for use and sets up appropriate buffers. Depending on the flags set, it also performs pointer emulation and frame synchronization.

May be called repeatedly. Returns -EINVAL if attempting to reinitialize with a different number of slots.

Definition at line 40 of file input-mt.c.

void input_mt_report_finger_count ( struct input_dev *  dev,
int  count 
)

input_mt_report_finger_count() - report contact count : input device with allocated MT slots : the number of contacts

Reports the contact count via BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP, BTN_TOOL_TRIPLETAP and BTN_TOOL_QUADTAP.

The input core ensures only the KEY events already setup for this device will produce output.

Definition at line 167 of file input-mt.c.

void input_mt_report_pointer_emulation ( struct input_dev *  dev,
bool  use_count 
)

input_mt_report_pointer_emulation() - common pointer emulation : input device with allocated MT slots : report number of active contacts as finger count

Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y and ABS_PRESSURE. Touchpad finger count is emulated if use_count is true.

The input core ensures only the KEY and ABS axes already setup for this device will produce output.

Definition at line 188 of file input-mt.c.

void input_mt_report_slot_state ( struct input_dev *  dev,
unsigned int  tool_type,
bool  active 
)

input_mt_report_slot_state() - report contact state : input device with allocated MT slots : the tool type to use in this slot : true if contact is active, false otherwise

Reports a contact via ABS_MT_TRACKING_ID, and optionally ABS_MT_TOOL_TYPE. If active is true and the slot is currently inactive, or if the tool type is changed, a new tracking id is assigned to the slot. The tool type is only reported if the corresponding absbit field is set.

Definition at line 129 of file input-mt.c.

void input_mt_sync_frame ( struct input_dev *  dev)

input_mt_sync_frame() - synchronize mt frame : input device with allocated MT slots

Close the frame and prepare the internal state for a new one. Depending on the flags, marks unused slots as inactive and performs pointer emulation.

Definition at line 244 of file input-mt.c.