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

Go to the source code of this file.

Macros

#define TRKID_SGN   ((TRKID_MAX + 1) >> 1)
 

Functions

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

Macro Definition Documentation

#define TRKID_SGN   ((TRKID_MAX + 1) >> 1)

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

Function Documentation

EXPORT_SYMBOL ( input_mt_init_slots  )
EXPORT_SYMBOL ( input_mt_destroy_slots  )
EXPORT_SYMBOL ( input_mt_report_slot_state  )
EXPORT_SYMBOL ( input_mt_report_finger_count  )
EXPORT_SYMBOL ( input_mt_report_pointer_emulation  )
EXPORT_SYMBOL ( input_mt_sync_frame  )
EXPORT_SYMBOL ( input_mt_assign_slots  )
EXPORT_SYMBOL ( input_mt_get_slot_by_key  )
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.