mtdev-mapping.h | mtdev-mapping.h | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||
* DEALINGS IN THE SOFTWARE. | * DEALINGS IN THE SOFTWARE. | |||
* | * | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
/* Tables are automatically generated by mtdev-mapgen */ | /* Tables are automatically generated by mtdev-mapgen */ | |||
#ifndef _MTDEV_MAPPING_H | #ifndef _MTDEV_MAPPING_H | |||
#define _MTDEV_MAPPING_H | #define _MTDEV_MAPPING_H | |||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
#include <mtdev.h> | #include <mtdev.h> | |||
#ifndef MTDEV_NO_LEGACY_API | ||||
#define MTDEV_TOUCH_MAJOR 0 | #define MTDEV_TOUCH_MAJOR 0 | |||
#define MTDEV_TOUCH_MINOR 1 | #define MTDEV_TOUCH_MINOR 1 | |||
#define MTDEV_WIDTH_MAJOR 2 | #define MTDEV_WIDTH_MAJOR 2 | |||
#define MTDEV_WIDTH_MINOR 3 | #define MTDEV_WIDTH_MINOR 3 | |||
#define MTDEV_ORIENTATION 4 | #define MTDEV_ORIENTATION 4 | |||
#define MTDEV_POSITION_X 5 | #define MTDEV_POSITION_X 5 | |||
#define MTDEV_POSITION_Y 6 | #define MTDEV_POSITION_Y 6 | |||
#define MTDEV_TOOL_TYPE 7 | #define MTDEV_TOOL_TYPE 7 | |||
#define MTDEV_BLOB_ID 8 | #define MTDEV_BLOB_ID 8 | |||
#define MTDEV_TRACKING_ID 9 | #define MTDEV_TRACKING_ID 9 | |||
skipping to change at line 80 | skipping to change at line 86 | |||
{ | { | |||
return mtdev_map_abs2mt[code] - 1; | return mtdev_map_abs2mt[code] - 1; | |||
} | } | |||
static inline unsigned int mtdev_mt2abs(unsigned int mtcode) | static inline unsigned int mtdev_mt2abs(unsigned int mtcode) | |||
{ | { | |||
return mtdev_map_mt2abs[mtcode]; | return mtdev_map_mt2abs[mtcode]; | |||
} | } | |||
#endif | #endif | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#endif | ||||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 6 lines changed or added | |||
mtdev-plumbing.h | mtdev-plumbing.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH ER | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH ER | |||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||
* DEALINGS IN THE SOFTWARE. | * DEALINGS IN THE SOFTWARE. | |||
* | * | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
#ifndef _MTDEV_PLUMBING_H | #ifndef _MTDEV_PLUMBING_H | |||
#define _MTDEV_PLUMBING_H | #define _MTDEV_PLUMBING_H | |||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
#include <mtdev.h> | #include <mtdev.h> | |||
/** | /** | |||
* mtdev_new - allocate a new mtdev | ||||
* | ||||
* Allocate a new mtdev. | ||||
* | ||||
* Returns zero in case of memory allocation failure. | ||||
*/ | ||||
struct mtdev *mtdev_new(void); | ||||
/** | ||||
* mtdev_init - initialize mtdev converter | * mtdev_init - initialize mtdev converter | |||
* @dev: the mtdev to initialize | * @dev: the mtdev to initialize | |||
* | * | |||
* Sets up the internal data structures. | * Sets up the internal data structures. | |||
* | * | |||
* Returns zero on success, negative error number otherwise. | * Returns zero on success, negative error number otherwise. | |||
*/ | */ | |||
int mtdev_init(struct mtdev *dev); | int mtdev_init(struct mtdev *dev); | |||
/** | /** | |||
* mtdev_set_mt_event - set event type | ||||
* @dev: the mtdev in use | ||||
* @code: the ABS_MT code to set | ||||
* @value: boolean value | ||||
* | ||||
* Returns true if the given event code is present. | ||||
*/ | ||||
void mtdev_set_mt_event(struct mtdev *dev, int code, int value); | ||||
/** | ||||
* mtdev_set_abs_<property> - set abs event property | ||||
* @dev: the mtdev in use | ||||
* @code: the ABS_MT code to set | ||||
*/ | ||||
void mtdev_set_abs_minimum(struct mtdev *dev, int code, int value); | ||||
void mtdev_set_abs_maximum(struct mtdev *dev, int code, int value); | ||||
void mtdev_set_abs_fuzz(struct mtdev *dev, int code, int value); | ||||
void mtdev_set_abs_resolution(struct mtdev *dev, int code, int value); | ||||
/** | ||||
* mtdev_configure - configure the mtdev converter | * mtdev_configure - configure the mtdev converter | |||
* @dev: the mtdev to configure | * @dev: the mtdev to configure | |||
* @fd: file descriptor of the kernel device | * @fd: file descriptor of the kernel device | |||
* | * | |||
* Reads the device properties to set up the protocol capabilities. | * Reads the device properties to set up the protocol capabilities. | |||
* If preferred, this can be done by hand, omitting this call. | * If preferred, this can be done by hand, omitting this call. | |||
* | * | |||
* Returns zero on success, negative error number otherwise. | * Returns zero on success, negative error number otherwise. | |||
*/ | */ | |||
int mtdev_configure(struct mtdev *dev, int fd); | int mtdev_configure(struct mtdev *dev, int fd); | |||
skipping to change at line 105 | skipping to change at line 138 | |||
* @dev: the mtdev in use | * @dev: the mtdev in use | |||
* @ev: the input event to fill | * @ev: the input event to fill | |||
* | * | |||
* Get a processed event from mtdev. The events appear as if they came | * Get a processed event from mtdev. The events appear as if they came | |||
* from a type B device emitting MT slot events. | * from a type B device emitting MT slot events. | |||
* | * | |||
* The queue must be non-empty before calling this function. | * The queue must be non-empty before calling this function. | |||
*/ | */ | |||
void mtdev_get_event(struct mtdev *dev, struct input_event* ev); | void mtdev_get_event(struct mtdev *dev, struct input_event* ev); | |||
/** | ||||
* mtdev_delete - free a previously allocated mtdev | ||||
* | ||||
* Frees the memory associated with the mtdev and invalidates the | ||||
* mtdev pointer. | ||||
*/ | ||||
void mtdev_delete(struct mtdev *dev); | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 45 lines changed or added | |||
mtdev.h | mtdev.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH ER | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH ER | |||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||
* DEALINGS IN THE SOFTWARE. | * DEALINGS IN THE SOFTWARE. | |||
* | * | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
#ifndef _MTDEV_H | #ifndef _MTDEV_H | |||
#define _MTDEV_H | #define _MTDEV_H | |||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
#include <linux/input.h> | #include <linux/input.h> | |||
/* includes available in 2.6.30-rc5 */ | /* includes available in 2.6.30-rc5 */ | |||
#ifndef BTN_TOOL_QUADTAP | #ifndef BTN_TOOL_QUADTAP | |||
#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ | #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ | |||
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | |||
#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | |||
#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | |||
#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ | #define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ | |||
#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ | #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ | |||
skipping to change at line 61 | skipping to change at line 65 | |||
/* includes available in 2.6.33 */ | /* includes available in 2.6.33 */ | |||
#ifndef ABS_MT_PRESSURE | #ifndef ABS_MT_PRESSURE | |||
#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | |||
#endif | #endif | |||
/* includes available in 2.6.36 */ | /* includes available in 2.6.36 */ | |||
#ifndef ABS_MT_SLOT | #ifndef ABS_MT_SLOT | |||
#define ABS_MT_SLOT 0x2f /* MT slot being modified */ | #define ABS_MT_SLOT 0x2f /* MT slot being modified */ | |||
#endif | #endif | |||
#ifndef MT_SLOT_ABS_EVENTS | ||||
#define MT_SLOT_ABS_EVENTS { \ | ||||
ABS_MT_TOUCH_MAJOR, \ | ||||
ABS_MT_TOUCH_MINOR, \ | ||||
ABS_MT_WIDTH_MAJOR, \ | ||||
ABS_MT_WIDTH_MINOR, \ | ||||
ABS_MT_ORIENTATION, \ | ||||
ABS_MT_POSITION_X, \ | ||||
ABS_MT_POSITION_Y, \ | ||||
ABS_MT_TOOL_TYPE, \ | ||||
ABS_MT_BLOB_ID, \ | ||||
ABS_MT_TRACKING_ID, \ | ||||
ABS_MT_PRESSURE, \ | ||||
} | ||||
#endif | ||||
#define MT_ABS_SIZE 11 | /* includes available in 2.6.38 */ | |||
#ifndef ABS_MT_DISTANCE | ||||
#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ | ||||
#endif | ||||
#define MT_ID_NULL (-1) | #define MT_ID_NULL (-1) | |||
#define MT_ID_MIN 0 | #define MT_ID_MIN 0 | |||
#define MT_ID_MAX 65535 | #define MT_ID_MAX 65535 | |||
/** | /** | |||
* struct mt_caps - protocol capabilities of kernel device | * mtdev_new_open - create and open a new mtdev | |||
* @has_mtdata: true if the device has MT capabilities | * @fd: file descriptor of the kernel device | |||
* @has_slot: true if the device sends MT slots | ||||
* @slot: slot event properties | ||||
* @abs: ABS_MT event properties | ||||
*/ | ||||
struct mtdev_caps { | ||||
int has_mtdata; | ||||
int has_slot; | ||||
int has_abs[MT_ABS_SIZE]; | ||||
struct input_absinfo slot; | ||||
struct input_absinfo abs[MT_ABS_SIZE]; | ||||
}; | ||||
/** | ||||
* struct mtdev - represents an input MT device | ||||
* @caps: the kernel device protocol capabilities | ||||
* @state: internal mtdev parsing state | ||||
* | * | |||
* The mtdev structure represents a kernel MT device type B, emitting | * Create a new mtdev and open the conversion. | |||
* MT slot events. The events put into mtdev may be from any MT | * | |||
* device, specifically type A without contact tracking, type A with | * Returns zero in case of failure. | |||
* contact tracking, or type B with contact tracking. See the kernel | ||||
* documentation for further details. | ||||
* | * | |||
* This call combines the plumbing functions mtdev_new() and | ||||
* mtdev_open(). | ||||
*/ | */ | |||
struct mtdev { | struct mtdev *mtdev_new_open(int fd); | |||
struct mtdev_caps caps; | ||||
struct mtdev_state *state; | ||||
}; | ||||
/** | /** | |||
* mtdev_open - open an mtdev converter | * mtdev_open - open an mtdev converter | |||
* @dev: the mtdev to open | * @dev: the mtdev to open | |||
* @fd: file descriptor of the kernel device | * @fd: file descriptor of the kernel device | |||
* | * | |||
* Initialize the mtdev structure and configure it by reading | * Initialize the mtdev structure and configure it by reading | |||
* the protocol capabilities through the file descriptor. | * the protocol capabilities through the file descriptor. | |||
* | * | |||
* Returns zero on success, negative error number otherwise. | * Returns zero on success, negative error number otherwise. | |||
* | * | |||
* This call combines the plumbing functions mtdev_init() and | * This call combines the plumbing functions mtdev_init() and | |||
* mtdev_configure(). | * mtdev_configure(). | |||
*/ | */ | |||
int mtdev_open(struct mtdev *dev, int fd); | int mtdev_open(struct mtdev *dev, int fd); | |||
/** | /** | |||
* mtdev_has_mt_event - check for event type | ||||
* @dev: the mtdev in use | ||||
* @code: the ABS_MT code to look for | ||||
* | ||||
* Returns true if the given event code is present. | ||||
*/ | ||||
int mtdev_has_mt_event(const struct mtdev *dev, int code); | ||||
/** | ||||
* mtdev_get_abs_<property> - get abs event property | ||||
* @dev: the mtdev in use | ||||
* @code: the ABS_MT code to look for | ||||
* | ||||
* Returns NULL if code is not a valid ABS_MT code. | ||||
*/ | ||||
int mtdev_get_abs_minimum(const struct mtdev *dev, int code); | ||||
int mtdev_get_abs_maximum(const struct mtdev *dev, int code); | ||||
int mtdev_get_abs_fuzz(const struct mtdev *dev, int code); | ||||
int mtdev_get_abs_resolution(const struct mtdev *dev, int code); | ||||
/** | ||||
* mtdev_idle - check state of kernel device | * mtdev_idle - check state of kernel device | |||
* @dev: the mtdev in use | * @dev: the mtdev in use | |||
* @fd: file descriptor of the kernel device | * @fd: file descriptor of the kernel device | |||
* @ms: number of milliseconds to wait for activity | * @ms: number of milliseconds to wait for activity | |||
* | * | |||
* Returns true if the device is idle, i.e., there are no fetched | * Returns true if the device is idle, i.e., there are no fetched | |||
* events in the pipe and there is nothing to fetch from the device. | * events in the pipe and there is nothing to fetch from the device. | |||
*/ | */ | |||
int mtdev_idle(struct mtdev *dev, int fd, int ms); | int mtdev_idle(struct mtdev *dev, int fd, int ms); | |||
skipping to change at line 172 | skipping to change at line 166 | |||
/** | /** | |||
* mtdev_close - close the mtdev converter | * mtdev_close - close the mtdev converter | |||
* @dev: the mtdev to close | * @dev: the mtdev to close | |||
* | * | |||
* Deallocates all memory associated with mtdev, and clears the mtdev | * Deallocates all memory associated with mtdev, and clears the mtdev | |||
* structure. | * structure. | |||
*/ | */ | |||
void mtdev_close(struct mtdev *dev); | void mtdev_close(struct mtdev *dev); | |||
/** | ||||
* mtdev_close_delete - close conversion and delete mtdev | ||||
* @dev: the mtdev in use | ||||
* | ||||
* Flush pending buffers and deallocate all memory associated with | ||||
* mtdev. The device pointer is invalidated. This call combines the | ||||
* plumbing functions mtdev_close() and mtdev_delete(). | ||||
*/ | ||||
void mtdev_close_delete(struct mtdev *dev); | ||||
#ifndef MTDEV_NO_LEGACY_API | ||||
#define MT_ABS_SIZE 11 | ||||
#ifndef MT_SLOT_ABS_EVENTS | ||||
#define MT_SLOT_ABS_EVENTS { \ | ||||
ABS_MT_TOUCH_MAJOR, \ | ||||
ABS_MT_TOUCH_MINOR, \ | ||||
ABS_MT_WIDTH_MAJOR, \ | ||||
ABS_MT_WIDTH_MINOR, \ | ||||
ABS_MT_ORIENTATION, \ | ||||
ABS_MT_POSITION_X, \ | ||||
ABS_MT_POSITION_Y, \ | ||||
ABS_MT_TOOL_TYPE, \ | ||||
ABS_MT_BLOB_ID, \ | ||||
ABS_MT_TRACKING_ID, \ | ||||
ABS_MT_PRESSURE, \ | ||||
} | ||||
#endif | ||||
struct mtdev_caps { | ||||
int has_mtdata; | ||||
int has_slot; | ||||
int has_abs[MT_ABS_SIZE]; | ||||
struct input_absinfo slot; | ||||
struct input_absinfo abs[MT_ABS_SIZE]; | ||||
}; | ||||
struct mtdev { | ||||
struct mtdev_caps caps; | ||||
struct mtdev_state *state; | ||||
}; | ||||
#endif | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
43 lines changed or deleted | 85 lines changed or added | |||