linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Some synaptics tweaks
@ 2011-06-10 19:55 Derek Foreman
  2011-06-10 19:55 ` [PATCH 1/4] Input: New property to indicate that a device's report rate may not be consistent Derek Foreman
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Derek Foreman @ 2011-06-10 19:55 UTC (permalink / raw)
  To: linux-input

Hello,

This patch series (against next) is intended to improve synaptics 
trackpad input by passing real two-finger data to userspace for newer 
devices that can do better than just a bounding box.

Some of these devices have variable report rates that can drop below the 
screen refresh rate when more than one finger is on the pad, so new 
behavior has been added to help userspace compensate for this.

Thanks,
Derek

Daniel Stone (1):
  Input: Synaptics: Some touchpads can sense the complete locations of
    two fingers rather than just the bounding box, so for these pads,
    report the co-ordinates directly.

Derek Foreman (3):
  Input: New property to indicate that a device's report rate may not
    be consistent
  Input: Report defuzzed event once before filtering for devices with
    the INCONSISTENT_RATE property
  Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property

 drivers/input/input.c           |   22 +++++++++++++++++++---
 drivers/input/mouse/synaptics.c |   39 ++++++++++++++++++++++++++++++---------
 drivers/input/mouse/synaptics.h |    2 ++
 include/linux/input.h           |    6 ++++++
 4 files changed, 57 insertions(+), 12 deletions(-)

-- 
1.7.5.3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] Input: New property to indicate that a device's report rate may not be consistent
  2011-06-10 19:55 [PATCH 0/4] Some synaptics tweaks Derek Foreman
@ 2011-06-10 19:55 ` Derek Foreman
  2011-06-10 20:49   ` Henrik Rydberg
  2011-06-10 19:55 ` [PATCH 2/4] Input: Report defuzzed event once before filtering for devices with the INCONSISTENT_RATE property Derek Foreman
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Derek Foreman @ 2011-06-10 19:55 UTC (permalink / raw)
  To: linux-input

Some (multi-touch) devices are capable of reporting 1 finger at 80Hz or 2 fingers at 40Hz.
This property allows a user space driver to know that this can happen, and perform extrapolation to present the illusion of fluidity.

Signed-off-by: Derek Foreman <derek.foreman@collabora.co.uk>
---
 drivers/input/mouse/synaptics.c |    1 +
 include/linux/input.h           |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index e06e045..40748e3 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -695,6 +695,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 	input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
 
 	if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
+		__set_bit(INPUT_PROP_INCONSISTENT_RATE, dev->propbit);
 		__set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
 		input_mt_init_slots(dev, 2);
 		input_set_abs_params(dev, ABS_MT_POSITION_X, XMIN_NOMINAL,
diff --git a/include/linux/input.h b/include/linux/input.h
index 771d6d8..f8a0c2d 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -137,6 +137,7 @@ struct input_keymap_entry {
 #define INPUT_PROP_DIRECT		0x01	/* direct input devices */
 #define INPUT_PROP_BUTTONPAD		0x02	/* has button(s) under pad */
 #define INPUT_PROP_SEMI_MT		0x03	/* touch rectangle only */
+#define INPUT_PROP_INCONSISTENT_RATE	0x05	/* device report rate changes */
 
 #define INPUT_PROP_MAX			0x1f
 #define INPUT_PROP_CNT			(INPUT_PROP_MAX + 1)
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] Input: Report defuzzed event once before filtering for devices with the INCONSISTENT_RATE property
  2011-06-10 19:55 [PATCH 0/4] Some synaptics tweaks Derek Foreman
  2011-06-10 19:55 ` [PATCH 1/4] Input: New property to indicate that a device's report rate may not be consistent Derek Foreman
@ 2011-06-10 19:55 ` Derek Foreman
  2011-06-10 20:56   ` Henrik Rydberg
  2011-06-10 19:55 ` [PATCH 3/4] Input: Synaptics: Some touchpads can sense the complete locations of two fingers rather than just the bounding box, so for these pads, report the co-ordinates directly Derek Foreman
  2011-06-10 19:55 ` [PATCH 4/4] Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property Derek Foreman
  3 siblings, 1 reply; 11+ messages in thread
From: Derek Foreman @ 2011-06-10 19:55 UTC (permalink / raw)
  To: linux-input

Some input devices have a non-uniform report rate, which can make it difficult for a userspace driver to distinguish between a lack of motion or a lack of new input.

With this patch, if multiple duplicate events (after defuzz) are received in a row, the first duplicate is posted to userspace.

Signed-off-by: Derek Foreman <derek.foreman@collabora.co.uk>
---
 drivers/input/input.c |   22 +++++++++++++++++++---
 include/linux/input.h |    4 ++++
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 75e11c7..5c7af82 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -198,8 +198,15 @@ static int input_handle_abs_event(struct input_dev *dev,
 	if (pold) {
 		*pval = input_defuzz_abs_event(*pval, *pold,
 						dev->absinfo[code].fuzz);
-		if (*pold == *pval)
-			return INPUT_IGNORE_EVENT;
+		if (*pold == *pval) {
+			if (!test_bit(INPUT_PROP_INCONSISTENT_RATE,
+				      dev->propbit)
+			    || dev->reposted[code])
+				return INPUT_IGNORE_EVENT;
+			else
+				dev->reposted[code] = 1;
+		} else
+			dev->reposted[code] = 0;
 
 		*pold = *pval;
 	}
@@ -405,6 +412,14 @@ void input_alloc_absinfo(struct input_dev *dev)
 					GFP_KERNEL);
 
 	WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__);
+
+	if (!dev->absinfo)
+		return;
+
+	if (!dev->reposted)
+		dev->reposted = kcalloc(ABS_CNT, sizeof(bool), GFP_KERNEL);
+
+	WARN(!dev->reposted, "%s(): kcalloc() failed?\n", __func__);
 }
 EXPORT_SYMBOL(input_alloc_absinfo);
 
@@ -414,7 +429,7 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
 	struct input_absinfo *absinfo;
 
 	input_alloc_absinfo(dev);
-	if (!dev->absinfo)
+	if (!dev->absinfo || !dev->reposted)
 		return;
 
 	absinfo = &dev->absinfo[axis];
@@ -1416,6 +1431,7 @@ static void input_dev_release(struct device *device)
 	input_ff_destroy(dev);
 	input_mt_destroy_slots(dev);
 	kfree(dev->absinfo);
+	kfree(dev->reposted);
 	kfree(dev);
 
 	module_put(THIS_MODULE);
diff --git a/include/linux/input.h b/include/linux/input.h
index f8a0c2d..388cdef 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1178,6 +1178,9 @@ struct ff_effect {
  * @absinfo: array of &struct input_absinfo elements holding information
  *	about absolute axes (current value, min, max, flat, fuzz,
  *	resolution)
+ * @reposted: boolean for each absinfo indicating whether the current
+ *	value has been posted a second time and the defuzz algorithm
+ *	can remove subsequent identical values
  * @key: reflects current state of device's keys/buttons
  * @led: reflects current state of device's LEDs
  * @snd: reflects current state of sound effects
@@ -1260,6 +1263,7 @@ struct input_dev {
 	int trkid;
 
 	struct input_absinfo *absinfo;
+	bool *reposted;
 
 	unsigned long key[BITS_TO_LONGS(KEY_CNT)];
 	unsigned long led[BITS_TO_LONGS(LED_CNT)];
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] Input: Synaptics: Some touchpads can sense the complete locations of two fingers rather than just the bounding box, so for these pads, report the co-ordinates directly.
  2011-06-10 19:55 [PATCH 0/4] Some synaptics tweaks Derek Foreman
  2011-06-10 19:55 ` [PATCH 1/4] Input: New property to indicate that a device's report rate may not be consistent Derek Foreman
  2011-06-10 19:55 ` [PATCH 2/4] Input: Report defuzzed event once before filtering for devices with the INCONSISTENT_RATE property Derek Foreman
@ 2011-06-10 19:55 ` Derek Foreman
  2011-06-10 21:07   ` Henrik Rydberg
  2011-06-10 19:55 ` [PATCH 4/4] Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property Derek Foreman
  3 siblings, 1 reply; 11+ messages in thread
From: Derek Foreman @ 2011-06-10 19:55 UTC (permalink / raw)
  To: linux-input

From: Daniel Stone <daniel.stone@collabora.co.uk>


Signed-off-by: Derek Foreman <derek.foreman@collabora.co.uk>
---
 drivers/input/mouse/synaptics.c |   35 ++++++++++++++++++++++++++---------
 drivers/input/mouse/synaptics.h |    2 ++
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 40748e3..3c68663 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -162,6 +162,11 @@ static int synaptics_capability(struct psmouse *psmouse)
 		} else {
 			priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
 
+			if (priv->model_id == 0x1e2b1)
+				priv->use_bounding_box = 0;
+			else
+				priv->use_bounding_box = 1;
+
 			/*
 			 * if nExtBtn is greater than 8 it should be considered
 			 * invalid and treated as 0
@@ -485,7 +490,8 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
 	return 0;
 }
 
-static void set_slot(struct input_dev *dev, int slot, bool active, int x, int y)
+static void set_slot(struct input_dev *dev, int slot, bool active, int x, int y,
+		     int z)
 {
 	input_mt_slot(dev, slot);
 	input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
@@ -493,23 +499,30 @@ static void set_slot(struct input_dev *dev, int slot, bool active, int x, int y)
 		input_report_abs(dev, ABS_MT_POSITION_X, x);
 		input_report_abs(dev, ABS_MT_POSITION_Y,
 				 YMAX_NOMINAL + YMIN_NOMINAL - y);
+		input_report_abs(dev, ABS_MT_PRESSURE, z);
 	}
 }
 
 static void synaptics_report_semi_mt_data(struct input_dev *dev,
+					  struct synaptics_data *priv,
 					  const struct synaptics_hw_state *a,
 					  const struct synaptics_hw_state *b,
 					  int num_fingers)
 {
-	if (num_fingers >= 2) {
-		set_slot(dev, 0, true, min(a->x, b->x), min(a->y, b->y));
-		set_slot(dev, 1, true, max(a->x, b->x), max(a->y, b->y));
+	if (num_fingers >= 2 && priv->use_bounding_box) {
+		set_slot(dev, 0, true, min(a->x, b->x), min(a->y, b->y),
+			 min(a->z, b->z));
+		set_slot(dev, 1, true, max(a->x, b->x), max(a->y, b->y),
+			 max(a->z, b->z));
+	} else if (num_fingers >= 2) {
+		set_slot(dev, 0, true, a->x, a->y, a->z);
+		set_slot(dev, 1, true, b->x, b->y, b->z);
 	} else if (num_fingers == 1) {
-		set_slot(dev, 0, true, a->x, a->y);
-		set_slot(dev, 1, false, 0, 0);
+		set_slot(dev, 0, true, a->x, a->y, a->z);
+		set_slot(dev, 1, false, 0, 0, 0);
 	} else {
-		set_slot(dev, 0, false, 0, 0);
-		set_slot(dev, 1, false, 0, 0);
+		set_slot(dev, 0, false, 0, 0, 0);
+		set_slot(dev, 1, false, 0, 0, 0);
 	}
 }
 
@@ -573,7 +586,8 @@ static void synaptics_process_packet(struct psmouse *psmouse)
 	}
 
 	if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c))
-		synaptics_report_semi_mt_data(dev, &hw, &priv->mt, num_fingers);
+		synaptics_report_semi_mt_data(dev, priv, &hw, &priv->mt,
+					      num_fingers);
 
 	/* Post events
 	 * BTN_TOUCH has to be first as mousedev relies on it when doing
@@ -702,6 +716,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 				     priv->x_max ?: XMAX_NOMINAL, 0, 0);
 		input_set_abs_params(dev, ABS_MT_POSITION_Y, YMIN_NOMINAL,
 				     priv->y_max ?: YMAX_NOMINAL, 0, 0);
+		input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
 	}
 
 	if (SYN_CAP_PALMDETECT(priv->capabilities))
@@ -736,6 +751,8 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 
 	input_abs_set_res(dev, ABS_X, priv->x_res);
 	input_abs_set_res(dev, ABS_Y, priv->y_res);
+	input_abs_set_res(dev, ABS_MT_POSITION_X, priv->x_res);
+	input_abs_set_res(dev, ABS_MT_POSITION_Y, priv->y_res);
 
 	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
 		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 7453938..9a2b0a7 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -136,6 +136,8 @@ struct synaptics_data {
 	unsigned char mode;			/* current mode byte */
 	int scroll;
 
+	unsigned int use_bounding_box:1;        /* report bounding box for MT */
+
 	struct serio *pt_port;			/* Pass-through serio port */
 
 	struct synaptics_hw_state mt;		/* current gesture packet */
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property
  2011-06-10 19:55 [PATCH 0/4] Some synaptics tweaks Derek Foreman
                   ` (2 preceding siblings ...)
  2011-06-10 19:55 ` [PATCH 3/4] Input: Synaptics: Some touchpads can sense the complete locations of two fingers rather than just the bounding box, so for these pads, report the co-ordinates directly Derek Foreman
@ 2011-06-10 19:55 ` Derek Foreman
  2011-06-10 21:13   ` Henrik Rydberg
  3 siblings, 1 reply; 11+ messages in thread
From: Derek Foreman @ 2011-06-10 19:55 UTC (permalink / raw)
  To: linux-input

This new property indicates that the trackpad is able to track more than two contacts, but can only report the positions of two contacts due to bus bandwidth limitations.

Signed-off-by: Derek Foreman <derek.foreman@collabora.co.uk>
---
 drivers/input/mouse/synaptics.c |    3 +++
 include/linux/input.h           |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 3c68663..a8ff669 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -701,6 +701,9 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 
 	__set_bit(INPUT_PROP_POINTER, dev->propbit);
 
+	if (priv->use_bounding_box == 0)
+		__set_bit(INPUT_PROP_SYNAPTICS_T3R2, dev->propbit);
+
 	__set_bit(EV_ABS, dev->evbit);
 	input_set_abs_params(dev, ABS_X,
 			     XMIN_NOMINAL, priv->x_max ?: XMAX_NOMINAL, 0, 0);
diff --git a/include/linux/input.h b/include/linux/input.h
index 388cdef..b667e88 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -137,6 +137,7 @@ struct input_keymap_entry {
 #define INPUT_PROP_DIRECT		0x01	/* direct input devices */
 #define INPUT_PROP_BUTTONPAD		0x02	/* has button(s) under pad */
 #define INPUT_PROP_SEMI_MT		0x03	/* touch rectangle only */
+#define INPUT_PROP_SYNAPTICS_T3R2	0x04	/* synaptics track 3 report 2 */
 #define INPUT_PROP_INCONSISTENT_RATE	0x05	/* device report rate changes */
 
 #define INPUT_PROP_MAX			0x1f
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] Input: New property to indicate that a device's report rate may not be consistent
  2011-06-10 19:55 ` [PATCH 1/4] Input: New property to indicate that a device's report rate may not be consistent Derek Foreman
@ 2011-06-10 20:49   ` Henrik Rydberg
  0 siblings, 0 replies; 11+ messages in thread
From: Henrik Rydberg @ 2011-06-10 20:49 UTC (permalink / raw)
  To: Derek Foreman; +Cc: linux-input

Hi Derek,

> Some (multi-touch) devices are capable of reporting 1 finger at 80Hz or 2 fingers at 40Hz.
> This property allows a user space driver to know that this can happen, and perform extrapolation to present the illusion of fluidity.

Evdev events contain a timestamp, so any rate or rate variation can
easily be detected in userspace.

Thanks,
Henrik

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] Input: Report defuzzed event once before filtering for devices with the INCONSISTENT_RATE property
  2011-06-10 19:55 ` [PATCH 2/4] Input: Report defuzzed event once before filtering for devices with the INCONSISTENT_RATE property Derek Foreman
@ 2011-06-10 20:56   ` Henrik Rydberg
  2011-06-13 14:19     ` Derek Foreman
  0 siblings, 1 reply; 11+ messages in thread
From: Henrik Rydberg @ 2011-06-10 20:56 UTC (permalink / raw)
  To: Derek Foreman; +Cc: linux-input

On Fri, Jun 10, 2011 at 03:55:02PM -0400, Derek Foreman wrote:
> Some input devices have a non-uniform report rate, which can make it difficult for a userspace driver to distinguish between a lack of motion or a lack of new input.
> 
> With this patch, if multiple duplicate events (after defuzz) are received in a row, the first duplicate is posted to userspace.

Every change is already propagated exactly once, which seems to amount
to the same thing your patch is aiming at. The evdev event signifies
the change itself (and when it occurs), so there is actually no
difference between the lack of motion and the lack of input.

Thanks, Henrik

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] Input: Synaptics: Some touchpads can sense the complete locations of two fingers rather than just the bounding box, so for these pads, report the co-ordinates directly.
  2011-06-10 19:55 ` [PATCH 3/4] Input: Synaptics: Some touchpads can sense the complete locations of two fingers rather than just the bounding box, so for these pads, report the co-ordinates directly Derek Foreman
@ 2011-06-10 21:07   ` Henrik Rydberg
  0 siblings, 0 replies; 11+ messages in thread
From: Henrik Rydberg @ 2011-06-10 21:07 UTC (permalink / raw)
  To: Derek Foreman; +Cc: linux-input

Hi Derek,

> From: Daniel Stone <daniel.stone@collabora.co.uk>
> 
> 
> Signed-off-by: Derek Foreman <derek.foreman@collabora.co.uk>
> ---
>  drivers/input/mouse/synaptics.c |   35 ++++++++++++++++++++++++++---------
>  drivers/input/mouse/synaptics.h |    2 ++
>  2 files changed, 28 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 40748e3..3c68663 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -162,6 +162,11 @@ static int synaptics_capability(struct psmouse *psmouse)
>  		} else {
>  			priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
>  
> +			if (priv->model_id == 0x1e2b1)
> +				priv->use_bounding_box = 0;
> +			else
> +				priv->use_bounding_box = 1;
> +
>  			/*
>  			 * if nExtBtn is greater than 8 it should be considered
>  			 * invalid and treated as 0
> @@ -485,7 +490,8 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
>  	return 0;
>  }
>  
> -static void set_slot(struct input_dev *dev, int slot, bool active, int x, int y)
> +static void set_slot(struct input_dev *dev, int slot, bool active, int x, int y,
> +		     int z)

This part adds logic for pressure information, which is separate from
the main objective of the patch. Please split the patch accordingly.

>  {
>  	input_mt_slot(dev, slot);
>  	input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
> @@ -493,23 +499,30 @@ static void set_slot(struct input_dev *dev, int slot, bool active, int x, int y)
>  		input_report_abs(dev, ABS_MT_POSITION_X, x);
>  		input_report_abs(dev, ABS_MT_POSITION_Y,
>  				 YMAX_NOMINAL + YMIN_NOMINAL - y);
> +		input_report_abs(dev, ABS_MT_PRESSURE, z);
>  	}
>  }
>  
>  static void synaptics_report_semi_mt_data(struct input_dev *dev,
> +					  struct synaptics_data *priv,
>  					  const struct synaptics_hw_state *a,
>  					  const struct synaptics_hw_state *b,
>  					  int num_fingers)
>  {
> -	if (num_fingers >= 2) {
> -		set_slot(dev, 0, true, min(a->x, b->x), min(a->y, b->y));
> -		set_slot(dev, 1, true, max(a->x, b->x), max(a->y, b->y));
> +	if (num_fingers >= 2 && priv->use_bounding_box) {
> +		set_slot(dev, 0, true, min(a->x, b->x), min(a->y, b->y),
> +			 min(a->z, b->z));
> +		set_slot(dev, 1, true, max(a->x, b->x), max(a->y, b->y),
> +			 max(a->z, b->z));
> +	} else if (num_fingers >= 2) {
> +		set_slot(dev, 0, true, a->x, a->y, a->z);
> +		set_slot(dev, 1, true, b->x, b->y, b->z);
>  	} else if (num_fingers == 1) {
> -		set_slot(dev, 0, true, a->x, a->y);
> -		set_slot(dev, 1, false, 0, 0);
> +		set_slot(dev, 0, true, a->x, a->y, a->z);
> +		set_slot(dev, 1, false, 0, 0, 0);
>  	} else {
> -		set_slot(dev, 0, false, 0, 0);
> -		set_slot(dev, 1, false, 0, 0);
> +		set_slot(dev, 0, false, 0, 0, 0);
> +		set_slot(dev, 1, false, 0, 0, 0);
>  	}
>  }
>  

Please simplify this hunk further, to only show the additional logic
based on !use_bounding_box.

> @@ -573,7 +586,8 @@ static void synaptics_process_packet(struct psmouse *psmouse)
>  	}
>  
>  	if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c))
> -		synaptics_report_semi_mt_data(dev, &hw, &priv->mt, num_fingers);
> +		synaptics_report_semi_mt_data(dev, priv, &hw, &priv->mt,
> +					      num_fingers);
>  
>  	/* Post events
>  	 * BTN_TOUCH has to be first as mousedev relies on it when doing
> @@ -702,6 +716,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
>  				     priv->x_max ?: XMAX_NOMINAL, 0, 0);
>  		input_set_abs_params(dev, ABS_MT_POSITION_Y, YMIN_NOMINAL,
>  				     priv->y_max ?: YMAX_NOMINAL, 0, 0);
> +		input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
>  	}

Separate patch, please.

>  
>  	if (SYN_CAP_PALMDETECT(priv->capabilities))
> @@ -736,6 +751,8 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
>  
>  	input_abs_set_res(dev, ABS_X, priv->x_res);
>  	input_abs_set_res(dev, ABS_Y, priv->y_res);
> +	input_abs_set_res(dev, ABS_MT_POSITION_X, priv->x_res);
> +	input_abs_set_res(dev, ABS_MT_POSITION_Y, priv->y_res);

These seem off-topic to this patch, please move to separate patch.

>  
>  	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
>  		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
> diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
> index 7453938..9a2b0a7 100644
> --- a/drivers/input/mouse/synaptics.h
> +++ b/drivers/input/mouse/synaptics.h
> @@ -136,6 +136,8 @@ struct synaptics_data {
>  	unsigned char mode;			/* current mode byte */
>  	int scroll;
>  
> +	unsigned int use_bounding_box:1;        /* report bounding box for MT */
> +

Please use bool.

>  	struct serio *pt_port;			/* Pass-through serio port */
>  
>  	struct synaptics_hw_state mt;		/* current gesture packet */
> -- 
> 1.7.5.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks,
Henrik

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property
  2011-06-10 19:55 ` [PATCH 4/4] Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property Derek Foreman
@ 2011-06-10 21:13   ` Henrik Rydberg
  2011-06-13 14:36     ` Derek Foreman
  0 siblings, 1 reply; 11+ messages in thread
From: Henrik Rydberg @ 2011-06-10 21:13 UTC (permalink / raw)
  To: Derek Foreman; +Cc: linux-input

On Fri, Jun 10, 2011 at 03:55:04PM -0400, Derek Foreman wrote:
> This new property indicates that the trackpad is able to track more than two contacts, but can only report the positions of two contacts due to bus bandwidth limitations.
> 
> Signed-off-by: Derek Foreman <derek.foreman@collabora.co.uk>
> ---
>  drivers/input/mouse/synaptics.c |    3 +++
>  include/linux/input.h           |    1 +
>  2 files changed, 4 insertions(+), 0 deletions(-)

This information is already contained in INPUT_PROP_SEMI_MT, together
with the use of BTN_TRIPLETAP. Please check
Documentation/input/event-codes.txt for further details.

Thanks,
Henrik

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] Input: Report defuzzed event once before filtering for devices with the INCONSISTENT_RATE property
  2011-06-10 20:56   ` Henrik Rydberg
@ 2011-06-13 14:19     ` Derek Foreman
  0 siblings, 0 replies; 11+ messages in thread
From: Derek Foreman @ 2011-06-13 14:19 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: Derek Foreman, linux-input

On 06/10/11 16:56, Henrik Rydberg wrote:
> On Fri, Jun 10, 2011 at 03:55:02PM -0400, Derek Foreman wrote:
>> Some input devices have a non-uniform report rate, which can make it difficult for a userspace driver to distinguish between a lack of motion or a lack of new input.
>>
>> With this patch, if multiple duplicate events (after defuzz) are received in a row, the first duplicate is posted to userspace.
>
> Every change is already propagated exactly once, which seems to amount
> to the same thing your patch is aiming at. The evdev event signifies
> the change itself (and when it occurs), so there is actually no
> difference between the lack of motion and the lack of input.

Hi Henrik,

Thank you for all your input.

The specific problem that this patch aims to solve is that a certain 
family of synaptics devices drops from 80Hz to 40Hz reporting when 2 or 
more fingers are on the pad.  As the screen refresh rate for a modern PC 
is generally 60Hz, input feels subjectively much less interactive.

It is possible - by maintaining a short history of past events and 
predicting where the cursor would be in the future - to do a reasonable 
job of creating 60Hz motion from this lower input rate.  This is where 
the difference between lack of motion and lack of input is key.

If I receive an event, then 1/80th of a second later I do NOT receive 
another one, I don't know whether the device has dropped to a lower 
reporting rate (lack of input), or whether the device reported the same 
event 2 times in a row, and the kernel "defuzz" code filtered it (lack 
of motion).

In the "lack of input" case, I want to fabricate a synthetic event to 
keep the pointer motion fluid.  In the "lack of motion" case, I want 
pointer motion to stop.

Currently, the kernel knows it has started to filter unchanging input, 
but userspace has no mechanism to detect that this filtering has begun. 
  As two identical events in a row is an impossibility in the face of 
the defuzz code, I had thought this would be a good way to expose this 
information without confusing any existing applications...

Thanks,
Derek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property
  2011-06-10 21:13   ` Henrik Rydberg
@ 2011-06-13 14:36     ` Derek Foreman
  0 siblings, 0 replies; 11+ messages in thread
From: Derek Foreman @ 2011-06-13 14:36 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: Derek Foreman, linux-input

On 06/10/11 17:13, Henrik Rydberg wrote:
> On Fri, Jun 10, 2011 at 03:55:04PM -0400, Derek Foreman wrote:
>> This new property indicates that the trackpad is able to track more than two contacts, but can only report the positions of two contacts due to bus bandwidth limitations.
>>
>> Signed-off-by: Derek Foreman<derek.foreman@collabora.co.uk>
>> ---
>>   drivers/input/mouse/synaptics.c |    3 +++
>>   include/linux/input.h           |    1 +
>>   2 files changed, 4 insertions(+), 0 deletions(-)
>
> This information is already contained in INPUT_PROP_SEMI_MT, together
> with the use of BTN_TRIPLETAP. Please check
> Documentation/input/event-codes.txt for further details.

I really sorry, but I don't understand how this provides the same 
information.

INPUT_PROP_SEMI_MT, at least according to input.h specifies that the 
device reports a rectangle only, and not accurate touch co-ordinates.

BTN_TOOL_TRIPLETAP indicates that there are 3 fingers on the pad.


My intent was to indicate to userspace that the device is reporting 
co-ordinates like certain synaptics devices do:

3 fingers are accurately tracked
2 fingers are accurately (not bounding box) reported

Further, all the idiosyncrasies of the synaptics method of reporting apply:
The device has 3 "slots" for tracking data, and once they are all 
filled, it reports slots 1 and 3.  If the slot 1 contact is lifted, 
slots 2 and 3 will report.  If a third finger is once again added to the 
pad, it will become the new slot 1.

INPUT_PROP_SEMI_MT is actually inaccurate for these devices, and in 
retrospect, the bounding box patch should have removed that bit from the 
properties of the devices it applies to.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-06-13 14:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-10 19:55 [PATCH 0/4] Some synaptics tweaks Derek Foreman
2011-06-10 19:55 ` [PATCH 1/4] Input: New property to indicate that a device's report rate may not be consistent Derek Foreman
2011-06-10 20:49   ` Henrik Rydberg
2011-06-10 19:55 ` [PATCH 2/4] Input: Report defuzzed event once before filtering for devices with the INCONSISTENT_RATE property Derek Foreman
2011-06-10 20:56   ` Henrik Rydberg
2011-06-13 14:19     ` Derek Foreman
2011-06-10 19:55 ` [PATCH 3/4] Input: Synaptics: Some touchpads can sense the complete locations of two fingers rather than just the bounding box, so for these pads, report the co-ordinates directly Derek Foreman
2011-06-10 21:07   ` Henrik Rydberg
2011-06-10 19:55 ` [PATCH 4/4] Input: Synaptics: Add INPUT_PROP_SYNAPTICS_T3R2 property Derek Foreman
2011-06-10 21:13   ` Henrik Rydberg
2011-06-13 14:36     ` Derek Foreman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).