[Pkg-utopia-maintainers] Bug#562052: Correctly identify touchpads

Dmitry Torokhov dmitry.torokhov at gmail.com
Sun Jan 10 06:59:32 UTC 2010


On Sun, Jan 10, 2010 at 02:01:08AM +0300, Michael Tokarev wrote:
> Dmitry Torokhov wrote:
> []
> >>> This is exactly what happens, to me and to the original bug reporter --
> >>> we both are running 32bit userspace and 64bit kernel.
> []
> > Does the following patch fixes it for you guys?
> 
> No, Dmitry, it does not.  It's buggy.
> 
> With this patch applied, the bits are all completely wrong.
> 
> # hexdump -C /sys/devices/platform/i8042/serio4/input/input6/capabilities/key
> 00000000  00 00 00 00 20 30 20 00  00 00 00 00 20 30 20 00  |.... 0 ..... 0 .|
> 00000010  20 30 20 00 20 30 20 00  20 30 20 00 0a           | 0 . 0 . 0 ..|
> 0000001d
> # hexdump -C /sys/devices/platform/i8042/serio4/input/input6/capabilities/ev
> 00000000  00 0a                                             |..|
> 00000002
> 
> The same's in /proc/bus/input/devices, obviously.
> 
> I'll try to take a look at the patch tomorrow.
> 
> Thanks!
> 

Doh, amazing what min/max mixup will do. The patch below should fix
that.

-- 
Dmitry

input compat fixup.

Signed-off-by: Dmitry Torokhov <dtor at mail.ru>
---

 drivers/input/input.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/drivers/input/input.c b/drivers/input/input.c
index 687ea63..94385b9 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -838,13 +838,13 @@ static int input_bits_to_string(char *buf, int buf_size,
 	int len = 0;
 
 	if (INPUT_COMPAT_TEST) {
-		u32 dword = (bits & 0xffffffff00000000UL) >> 32;
+		u32 dword = bits >> 32;
 		if (dword || !skip_empty)
 			len += snprintf(buf, buf_size, "%x ", dword);
 
-		dword = (bits & 0xffffffffUL);
+		dword = bits & 0xffffffffUL;
 		if (dword || !skip_empty || len)
-			len += snprintf(buf + len, min(buf_size - len, 0),
+			len += snprintf(buf + len, max(buf_size - len, 0),
 					"%x", dword);
 	} else {
 		if (bits || !skip_empty)





More information about the Pkg-utopia-maintainers mailing list