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

Commit b4adbbef authored by Henrik Rydberg's avatar Henrik Rydberg
Browse files

Input: MT - Add flags to input_mt_init_slots()



Preparing to move more repeated code into the mt core, add a flags
argument to the input_mt_slots_init() function.

Reviewed-and-tested-by: default avatarBenjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: default avatarPing Cheng <pingc@wacom.com>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarHenrik Rydberg <rydberg@euromail.se>
parent a274ac15
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -392,7 +392,7 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd


	__set_bit(EV_ABS, input->evbit);
	__set_bit(EV_ABS, input->evbit);


	error = input_mt_init_slots(input, 16);
	error = input_mt_init_slots(input, 16, 0);
	if (error)
	if (error)
		return error;
		return error;
	input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
	input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
+1 −1
Original line number Original line Diff line number Diff line
@@ -390,7 +390,7 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		case HID_DG_CONTACTID:
		case HID_DG_CONTACTID:
			if (!td->maxcontacts)
			if (!td->maxcontacts)
				td->maxcontacts = MT_DEFAULT_MAXCONTACT;
				td->maxcontacts = MT_DEFAULT_MAXCONTACT;
			input_mt_init_slots(hi->input, td->maxcontacts);
			input_mt_init_slots(hi->input, td->maxcontacts, 0);
			mt_store_field(usage, td, hi);
			mt_store_field(usage, td, hi);
			td->last_field_index = field->index;
			td->last_field_index = field->index;
			td->touches_by_report++;
			td->touches_by_report++;
+3 −1
Original line number Original line Diff line number Diff line
@@ -25,7 +25,8 @@
 * May be called repeatedly. Returns -EINVAL if attempting to
 * May be called repeatedly. Returns -EINVAL if attempting to
 * reinitialize with a different number of slots.
 * reinitialize with a different number of slots.
 */
 */
int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots)
int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
			unsigned int flags)
{
{
	struct input_mt *mt = dev->mt;
	struct input_mt *mt = dev->mt;
	int i;
	int i;
@@ -40,6 +41,7 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots)
		return -ENOMEM;
		return -ENOMEM;


	mt->num_slots = num_slots;
	mt->num_slots = num_slots;
	mt->flags = flags;
	input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
	input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
	input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0);
	input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0);


+1 −1
Original line number Original line Diff line number Diff line
@@ -405,7 +405,7 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu
			goto exit;
			goto exit;
		if (test_bit(ABS_MT_SLOT, dev->absbit)) {
		if (test_bit(ABS_MT_SLOT, dev->absbit)) {
			int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
			int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
			input_mt_init_slots(dev, nslot);
			input_mt_init_slots(dev, nslot, 0);
		} else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
		} else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
			input_set_events_per_packet(dev, 60);
			input_set_events_per_packet(dev, 60);
		}
		}
+1 −1
Original line number Original line Diff line number Diff line
@@ -1620,7 +1620,7 @@ int alps_init(struct psmouse *psmouse)
	case ALPS_PROTO_V3:
	case ALPS_PROTO_V3:
	case ALPS_PROTO_V4:
	case ALPS_PROTO_V4:
		set_bit(INPUT_PROP_SEMI_MT, dev1->propbit);
		set_bit(INPUT_PROP_SEMI_MT, dev1->propbit);
		input_mt_init_slots(dev1, 2);
		input_mt_init_slots(dev1, 2, 0);
		input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0);
		input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0);
		input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, ALPS_V3_Y_MAX, 0, 0);
		input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, ALPS_V3_Y_MAX, 0, 0);


Loading