linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: alps - fix v4 button press recognition
@ 2014-10-14  2:26 Andreas Bosch
  2014-10-14 19:08 ` [PATCH v2] " Andreas Bosch
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Bosch @ 2014-10-14  2:26 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov

Since the change to struct input_mt_pos some variables are now bitfields
instead of integers. Automatic conversion from integer to bitfield entry
destroys information, therefore enforce boolean interpretation instead.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1114768
Fixes: 02d04254a5df ("Input: alps - use struct input_mt_pos to track
coordinates")
Signed-off-by: Andreas Bosch <linux@progandy.de>
---
 drivers/input/mouse/alps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 35a49bf..2b0ae8c 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -835,8 +835,8 @@ static void alps_process_packet_v4(struct psmouse *psmouse)
  f->fingers = alps_process_bitmap(priv, f);
  }

- f->left = packet[4] & 0x01;
- f->right = packet[4] & 0x02;
+ f->left = !!(packet[4] & 0x01);
+ f->right = !!(packet[4] & 0x02);

  f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) |
   ((packet[0] & 0x30) >> 4);
-- 
2.1.2

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

* [PATCH v2] Input: alps - fix v4 button press recognition
  2014-10-14  2:26 [PATCH] Input: alps - fix v4 button press recognition Andreas Bosch
@ 2014-10-14 19:08 ` Andreas Bosch
  2014-10-15 17:45   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Bosch @ 2014-10-14 19:08 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov

Since the change to struct input_mt_pos some variables are now bitfields
instead of integers. Automatic conversion from integer to bitfield entry
destroys information, therefore enforce boolean interpretation instead.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1114768
Fixes: 02d04254a5df ("Input: alps - use struct input_mt_pos to track coordinates")
Signed-off-by: Andreas Bosch <linux@progandy.de>
---

This is the second version of the patch. The first try got mangled 
during the transmission.

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 35a49bf..2b0ae8c 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -835,8 +835,8 @@ static void alps_process_packet_v4(struct psmouse *psmouse)
 		f->fingers = alps_process_bitmap(priv, f);
 	}
 
-	f->left = packet[4] & 0x01;
-	f->right = packet[4] & 0x02;
+	f->left = !!(packet[4] & 0x01);
+	f->right = !!(packet[4] & 0x02);
 
 	f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) |
 		  ((packet[0] & 0x30) >> 4);
-- 
2.1.2


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

* Re: [PATCH v2] Input: alps - fix v4 button press recognition
  2014-10-14 19:08 ` [PATCH v2] " Andreas Bosch
@ 2014-10-15 17:45   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2014-10-15 17:45 UTC (permalink / raw)
  To: Andreas Bosch; +Cc: linux-input

On Tue, Oct 14, 2014 at 09:08:05PM +0200, Andreas Bosch wrote:
> Since the change to struct input_mt_pos some variables are now bitfields
> instead of integers. Automatic conversion from integer to bitfield entry
> destroys information, therefore enforce boolean interpretation instead.
> 
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=1114768
> Fixes: 02d04254a5df ("Input: alps - use struct input_mt_pos to track coordinates")
> Signed-off-by: Andreas Bosch <linux@progandy.de>

Applied, thank you.

> ---
> 
> This is the second version of the patch. The first try got mangled 
> during the transmission.
> 
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index 35a49bf..2b0ae8c 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -835,8 +835,8 @@ static void alps_process_packet_v4(struct psmouse *psmouse)
>  		f->fingers = alps_process_bitmap(priv, f);
>  	}
>  
> -	f->left = packet[4] & 0x01;
> -	f->right = packet[4] & 0x02;
> +	f->left = !!(packet[4] & 0x01);
> +	f->right = !!(packet[4] & 0x02);
>  
>  	f->st.x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) |
>  		  ((packet[0] & 0x30) >> 4);
> -- 
> 2.1.2
> 

-- 
Dmitry

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

end of thread, other threads:[~2014-10-15 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-14  2:26 [PATCH] Input: alps - fix v4 button press recognition Andreas Bosch
2014-10-14 19:08 ` [PATCH v2] " Andreas Bosch
2014-10-15 17:45   ` Dmitry Torokhov

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).