linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] correct some quirks for trust 15351 bluetooth mouse
@ 2008-05-30 19:21 Thomas Ilnseher
  2008-06-19  9:14 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Ilnseher @ 2008-05-30 19:21 UTC (permalink / raw)
  To: vojtech, linux-input

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

I recently got a (trust 15351) bluetooth mouse.

when I hooked it up to my notebook, Only the Y-Axis did work,
not the X-Axis. with some help from peter hutterer, I could track the
problem down an hid->usage of 0006.0020 that got mapped to abs.misc,
which confused evdev.

There is also a Consumer.HWheel reported, which is not present on the
mouse, but is a further annoyance (it gets mapped to buttens 6/7,
that remaps the real buttons 6/7 to 8/9, and you have to use xmodmap).

I composed this patch to make the hid driver ignore these two "features"
of the mouse.

I'm not sure if this is the right way to do things.

Cheers,
Thomas
-- 
Thomas Ilnseher <illth@gmx.de>

[-- Attachment #2: Type: text/x-patch, Size: 1717 bytes --]

--- linux/drivers/hid/hid-input-quirks.c.orig	2008-04-17 04:49:44.000000000 +0200
+++ linux/drivers/hid/hid-input-quirks.c	2008-05-30 20:36:55.867668169 +0200
@@ -24,6 +24,18 @@
 #define map_abs_clear(c)        do { map_abs(c); clear_bit(c, *bit); } while (0)
 #define map_key_clear(c)        do { map_key(c); clear_bit(c, *bit); } while (0)
 
+static int quirk_trust15351_ignore_weird_axis(struct hid_usage *usage, struct input_dev *input,
+			      unsigned long **bit, int *max)
+{
+	/* 0006.0020 is some weird absolute axis that gets mapped to abs.misc */
+	if (usage->hid == 0x60020)
+		return 2;
+	/* consumer.hwheel (but the mouse has no hwheel) */
+	if (usage->hid == 0xc0238)
+		return 2;
+	return 0;
+}
+
 static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input,
 			      unsigned long **bit, int *max)
 {
@@ -306,6 +318,9 @@
 #define VENDOR_ID_PETALYNX			0x18b1
 #define DEVICE_ID_PETALYNX_MAXTER_REMOTE	0x0037
 
+#define VENDOR_ID_TRUST				0x0a5c
+#define DEVICE_IS_13531_BT			0x0001
+
 static const struct hid_input_blacklist {
 	__u16 idVendor;
 	__u16 idProduct;
@@ -332,6 +346,8 @@
 	{ VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e },
 
 	{ VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote },
+
+	{ VENDOR_ID_TRUST, DEVICE_IS_13531_BT, quirk_trust15351_ignore_weird_axis },
 	
 	{ 0, 0, 0 }
 };
--- linux/drivers/hid/hid-input.c.orig	2008-05-30 20:18:43.000000000 +0200
+++ linux/drivers/hid/hid-input.c	2008-05-30 20:36:55.880256291 +0200
@@ -387,6 +387,8 @@
 
 	/* handle input mappings for quirky devices */
 	ret = hidinput_mapping_quirks(usage, input, &bit, &max);
+	if (ret == 2)
+		goto ignore;
 	if (ret)
 		goto mapped;

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

* Re: [RFC][PATCH] correct some quirks for trust 15351 bluetooth mouse
  2008-05-30 19:21 [RFC][PATCH] correct some quirks for trust 15351 bluetooth mouse Thomas Ilnseher
@ 2008-06-19  9:14 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2008-06-19  9:14 UTC (permalink / raw)
  To: Thomas Ilnseher; +Cc: vojtech, linux-input

On Fri, 30 May 2008, Thomas Ilnseher wrote:

> I recently got a (trust 15351) bluetooth mouse.
>
> when I hooked it up to my notebook, Only the Y-Axis did work,
> not the X-Axis. with some help from peter hutterer, I could track the
> problem down an hid->usage of 0006.0020 that got mapped to abs.misc,
> which confused evdev.
>
> There is also a Consumer.HWheel reported, which is not present on the
> mouse, but is a further annoyance (it gets mapped to buttens 6/7,
> that remaps the real buttons 6/7 to 8/9, and you have to use xmodmap).
>
> I composed this patch to make the hid driver ignore these two "features"
> of the mouse.
>
> I'm not sure if this is the right way to do things.

Hi Thomas,

yes, the patch is OK, thanks. I would just prefer if you could change 
this:

> @@ -387,6 +387,8 @@
>
>         /* handle input mappings for quirky devices */
>         ret = hidinput_mapping_quirks(usage, input, &bit, &max);
> +       if (ret == 2)
> +               goto ignore;
>         if (ret)
>                 goto mapped;

and introduce some constants for return values of hidinput_mapping_quirks 
to make this more readable.

I.e. something like HIDINPUT_QUIRK_MAPPED, HIDINPUT_QUIRK_IGNORED, 
HIDINPUT_QUIRK_NONE, and return these values from 
hidinput_mapping_quirks() and all the quirk mapping functions, instead of 
values 0, 1 and 2.

Also, please send the patch with your Signed-off-by: line, so that I can 
merge it into my tree.

Thanks,

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2008-06-19  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-30 19:21 [RFC][PATCH] correct some quirks for trust 15351 bluetooth mouse Thomas Ilnseher
2008-06-19  9:14 ` Jiri Kosina

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