From 5bd76821fca3d6422a586b691436583224158b01 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 16 Nov 2010 14:25:19 +0100 Subject: Experimental mainline MT support This patchset is in flux, and a cooperative effort between Takashi Iwai, Chase Douglas, Chris Bagwell and myself. Signed-off-by: Henrik Rydberg --- usr/src/dkms_source_tree/input-mt.h | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 usr/src/dkms_source_tree/input-mt.h (limited to 'usr/src/dkms_source_tree/input-mt.h') diff --git a/usr/src/dkms_source_tree/input-mt.h b/usr/src/dkms_source_tree/input-mt.h new file mode 100644 index 0000000..fdee06e --- /dev/null +++ b/usr/src/dkms_source_tree/input-mt.h @@ -0,0 +1,56 @@ +#ifndef _INPUT_MT_H +#define _INPUT_MT_H + +/* + * Input Multitouch Library + * + * Copyright (c) 2010 Henrik Rydberg + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include + +/** + * struct trk_coord - contact coordinate + * @x: horizontal coordinate + * @y: vertical coordinate + */ +struct trk_coord { + int x; + int y; +}; + +int input_mt_create_slots_new(struct input_dev *dev, unsigned int num_slots); + +int input_mt_assign_slots_by_coord(struct input_dev *dev, int *slots, + const struct trk_coord *coords, + int num_coords); + +void input_mt_sync_slot_complement(struct input_dev *dev, + const int *slots, int num_slots); + +void input_mt_report_state(struct input_dev *dev, bool active); +void input_mt_report_emulation(struct input_dev *dev); + +static inline int input_mt_get_value(const struct input_mt_slot *slot, + unsigned code) +{ + return slot->abs[code - ABS_MT_FIRST]; +} + +static inline bool input_mt_get_state(struct input_dev *dev, int slot) +{ + return dev->mt && + input_mt_get_value(&dev->mt[slot], ABS_MT_TRACKING_ID) >= 0; +} + +static inline void input_abs_set_res(struct input_dev *dev, + unsigned int axis, int val) +{ + dev->absres[axis] = val; +} + +#endif -- cgit v1.2.3