Skip to contentSkip to conversation

correct some quirks for trust 15351 bluetooth mouse

RFC PATCH In review Thomas Ilnseher 2 participants 2 messages May 30, 2008 – Jun 19, 2008 HID

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 correct some quirks for trust 15351 bluetooth mouse

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

Signature · 1 line
Thomas Ilnseher <[email protected]>
drivers/hid/hid-input-quirks.c renamed from drivers/hid/hid-input-quirks.c.orig +17 -0
@@ -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 }
 };
drivers/hid/hid-input.c renamed from drivers/hid/hid-input.c.orig +2 -0
@@ -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;
#1 lore raw
Quoted 7 lines · Thomas Ilnseher

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.

Quoted 8 lines

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:

drivers/hid/hid-input.c line 393

Quoted 8 lines
drivers/hid/hid-input.c renamed from drivers/hid/hid-input.c.orig +2 -0
@@ -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,

Signature · 2 lines
Jiri Kosina
SUSE Labs