@@ -168,3 +168,35 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
}
}
EXPORT_SYMBOL(input_mt_report_pointer_emulation);
+
+/**
+ * input_mt_get_absinfo - retrieve MT state variables from a device slot
+ * @dev: input device which state is being queried
+ * @code: ABS code to retrieve
+ * @slot: slot to retrieve from
+ *
+ * Return the ABS state of the given MT slot. If code is not an MT
+ * event, the corresponding ABS event is returned.
+ *
+ * This function may be called by anyone interested in extracting the
+ * current MT state. Used by evdev handlers.
+ */
+struct input_absinfo input_mt_get_absinfo(struct input_dev *dev, unsigned int code, int slot)
+{
+ unsigned int mtmap = code > ABS_MT_FIRST ? code - ABS_MT_FIRST : 0;
+ unsigned long flags;
+ struct input_absinfo retval;
+
+ spin_lock_irqsave(&dev->event_lock, flags);
+ if (!mtmap)
+ retval = dev->absinfo[code];
+ else if (slot >= 0 && slot < dev->mtsize) {
+ retval = dev->absinfo[code];
+ retval.value = dev->mt[slot].abs[mtmap];
+ } else
+ retval.value = 0;
+ spin_unlock_irqrestore(&dev->event_lock, flags);
+
+ return retval;
+}
+EXPORT_SYMBOL(input_mt_get_absinfo);
@@ -54,4 +54,5 @@ void input_mt_report_slot_state(struct input_dev *dev,
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);
+struct input_absinfo input_mt_get_absinfo(struct input_dev *dev, unsigned int code, int slot);
#endif