Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67b989a0 authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files
Conflicts:
	drivers/input/Makefile
parents 56a8bd6d 69479f8d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -303,6 +303,10 @@ X!Idrivers/video/console/fonts.c
!Edrivers/input/input.c
!Edrivers/input/ff-core.c
!Edrivers/input/ff-memless.c
     </sect1>
     <sect1><title>Multitouch Library</title>
!Iinclude/linux/input/mt.h
!Edrivers/input/input-mt.c
     </sect1>
     <sect1><title>Polled input devices</title>
!Iinclude/linux/input-polldev.h
+8 −1
Original line number Diff line number Diff line
@@ -161,7 +161,8 @@ against the glass. The inner region will increase, and in general, the
ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR, which is always smaller than
unity, is related to the contact pressure. For pressure-based devices,
ABS_MT_PRESSURE may be used to provide the pressure on the contact area
instead.
instead. Devices capable of contact hovering can use ABS_MT_DISTANCE to
indicate the distance between the contact and the surface.

In addition to the MAJOR parameters, the oval shape of the contact can be
described by adding the MINOR parameters, such that MAJOR and MINOR are the
@@ -213,6 +214,12 @@ The pressure, in arbitrary units, on the contact area. May be used instead
of TOUCH and WIDTH for pressure-based devices or any device with a spatial
signal intensity distribution.

ABS_MT_DISTANCE

The distance, in surface units, between the contact and the surface. Zero
distance means the contact is touching the surface. A positive number means
the contact is hovering above the surface.

ABS_MT_ORIENTATION

The orientation of the ellipse. The value should describe a signed quarter
+2 −0
Original line number Diff line number Diff line
@@ -3020,8 +3020,10 @@ F: drivers/input/
INPUT MULTITOUCH (MT) PROTOCOL
M:	Henrik Rydberg <rydberg@euromail.se>
L:	linux-input@vger.kernel.org
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt.git
S:	Maintained
F:	Documentation/input/multi-touch-protocol.txt
F:	drivers/input/input-mt.c
K:	\b(ABS|SYN)_MT_

INTEL IDLE DRIVER
+2 −1
Original line number Diff line number Diff line
@@ -154,7 +154,8 @@ config HID_EGALAX
	tristate "eGalax multi-touch panel"
	depends on USB_HID
	---help---
	Support for the eGalax dual-touch panel.
	Support for the eGalax dual-touch panels, including the
	Joojoo and Wetab tablets.

config HID_ELECOM
	tristate "ELECOM BM084 bluetooth mouse"
+4 −32
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/input/mt.h>

MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
MODULE_DESCRIPTION("3M PCT multitouch panels");
@@ -27,8 +28,6 @@ MODULE_LICENSE("GPL");
#include "hid-ids.h"

#define MAX_SLOTS		60
#define MAX_TRKID		USHRT_MAX
#define MAX_EVENTS		360

/* estimated signal-to-noise ratios */
#define SN_MOVE			2048
@@ -36,14 +35,11 @@ MODULE_LICENSE("GPL");

struct mmm_finger {
	__s32 x, y, w, h;
	__u16 id;
	bool prev_touch;
	bool touch, valid;
};

struct mmm_data {
	struct mmm_finger f[MAX_SLOTS];
	__u16 id;
	__u8 curid;
	__u8 nexp, nreal;
	bool touch, valid;
@@ -117,14 +113,7 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
					0, 1, 0, 0);
			return 1;
		case HID_DG_CONTACTID:
			field->logical_maximum = MAX_TRKID;
			hid_map_usage(hi, usage, bit, max,
					EV_ABS, ABS_MT_TRACKING_ID);
			input_set_abs_params(hi->input, ABS_MT_TRACKING_ID,
					     0, MAX_TRKID, 0, 0);
			if (!hi->input->mt)
				input_mt_create_slots(hi->input, MAX_SLOTS);
			input_set_events_per_packet(hi->input, MAX_EVENTS);
			input_mt_init_slots(hi->input, MAX_SLOTS);
			return 1;
		}
		/* let hid-input decide for the others */
@@ -154,7 +143,6 @@ static int mmm_input_mapped(struct hid_device *hdev, struct hid_input *hi,
 */
static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
{
	struct mmm_finger *oldest = 0;
	int i;
	for (i = 0; i < MAX_SLOTS; ++i) {
		struct mmm_finger *f = &md->f[i];
@@ -163,6 +151,7 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
			continue;
		}
		input_mt_slot(input, i);
		input_mt_report_slot_state(input, MT_TOOL_FINGER, f->touch);
		if (f->touch) {
			/* this finger is on the screen */
			int wide = (f->w > f->h);
@@ -170,33 +159,16 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
			int major = max(f->w, f->h) >> 1;
			int minor = min(f->w, f->h) >> 1;

			if (!f->prev_touch)
				f->id = md->id++;
			input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id);
			input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
			input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
			input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
			input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
			input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
			/* touchscreen emulation: pick the oldest contact */
			if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1)))
				oldest = f;
		} else {
			/* this finger took off the screen */
			input_event(input, EV_ABS, ABS_MT_TRACKING_ID, -1);
		}
		f->prev_touch = f->touch;
		f->valid = 0;
	}

	/* touchscreen emulation */
	if (oldest) {
		input_event(input, EV_KEY, BTN_TOUCH, 1);
		input_event(input, EV_ABS, ABS_X, oldest->x);
		input_event(input, EV_ABS, ABS_Y, oldest->y);
	} else {
		input_event(input, EV_KEY, BTN_TOUCH, 0);
	}
	input_mt_report_pointer_emulation(input, true);
	input_sync(input);
}

Loading