Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 May 2008 10:36:36 +0200
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        freebsd-usb@freebsd.org
Subject:   How to remap or ignore certain mouse buttons? (was: Fun with Logitech keyboard/mouse kombo (diNovo Edge)...)
Message-ID:  <20080508103636.153b1576@deskjail>
In-Reply-To: <20080507192420.694f57ee@deskjail>
References:  <20080507192420.694f57ee@deskjail>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Alexander Leidinger <Alexander@Leidinger.net> (Wed, 7 May 2008 19:24:20 +0200):

> Hi,
> 
> I bought a keyboard with an integrated touchpad from logitech. Just
> plugging in the BT-dongle gives an usb hub with ums and ukbd.
> Unfortunately the ums doesn't work. When I start moused with
> "-p /dev/ums0 -3 -f -d" I get no output when I press the buttons or
> touch the touchpad. Any hints how to debug this problem? usbhidctl
> doesn't print anything useful (but I don't know if it is ok to use it
> with /dev/ums0).

After a little bit of googling I found a description of the problem
with the diNovo Edge. Quoting from
http://www.mail-archive.com/linux-usb-users@lists.sourceforge.net/msg17777.html
---snip---
Mouse device shows multiple reports with the same usage, which makes
hid-input.c remap those instances of this usage to different events. As a
result, the actual GenericDesktop.X and .Y usages end up mapped to .Z and .RX
events, which prevents the mouse from working.

--- a/drivers/usb/input/hid-input.c     2006-12-11 11:32:53.000000000 -0800
+++ b/drivers/usb/input/hid-input.c     2006-12-26 17:18:46.000000000 -0800
@@ -583,8 +583,11 @@ static void hidinput_configure_usage(str
 
        set_bit(usage->type, input->evbit);
 
-       while (usage->code <= max && test_and_set_bit(usage->code, bit))
-               usage->code = find_next_zero_bit(bit, max + 1, usage->code);
+       if(device->quirks & HID_QUIRK_NO_USAGE_UNIQUIFY)
+               set_bit(usage->code, bit);
+       else
+               while (usage->code <= max && test_and_set_bit(usage->code, bit))
+                       usage->code = find_next_zero_bit(bit, max + 1, 
---snip---

The git repository (as indexed by fxr.watson.org) shows a different
fix. In the linux hid-input.c they have this:
---snip---
409                 case HID_UP_BUTTON:
410 
411                         code = ((usage->hid - 1) & 0xf);
412 
413                         switch (field->application) {
414                                 case HID_GD_MOUSE:
415                                 case HID_GD_POINTER:  code += 0x110; break;
416                                 case HID_GD_JOYSTICK: code += 0x120; break;
417                                 case HID_GD_GAMEPAD:  code += 0x130; break;
418                                 default:
419                                         switch (field->physical) {
420                                                 case HID_GD_MOUSE:
421                                                 case HID_GD_POINTER:  code += 0x110; break;
422                                                 case HID_GD_JOYSTICK: code += 0x120; break;
423                                                 case HID_GD_GAMEPAD:  code += 0x130; break;
424                                                 default:              code += 0x100;
425                                         }
426                         }
427 
428                         /* Special handling for Logitech Cordless Desktop */
429                         if (field->application != HID_GD_MOUSE) {
430                                 if (device->quirks & HID_QUIRK_LOGITECH_EXPANDED_KEYMAP) {
431                                         int hid = usage->hid & HID_USAGE;
432                                         if (hid < LOGITECH_EXPANDED_KEYMAP_SIZE && logitech_expanded_keymap[hid] != 0)
433                                                 code = logitech_expanded_keymap[hid];
434                                 }
435                         } else {
436                                 if (device->quirks & HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL) {
437                                         int hid = usage->hid & HID_USAGE; 438                                         if (hid == 7 || hid == 8) 439                                                 goto ignore; 440                                 }
441                         }
442 
443                         map_key(code);
444                         break;
---snip---

As we see there, they think the wheel is incorrectly doubled
(HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL). I'm not really sure if the
wheel is realy doubled. The touchwheel on the keyboard is supposed to
have a mouse area in the inside, and on the upper and right edge, there
are areas which are supposed to be able to move the scrollbars in
windows (left<->right + up<->down). So I think there are maybe 2
wheels (in one physical one). I tried to use both parts of the
touchwheel, but nothing works, so for the moment I search for a way to
do the same what linux does. How can I do the same thing in FreeBSD
what Linux does? Later I would be interested to get the additional
parts working. Any hints how to do this are welcome.

Bye,
Alexander.

-- 
 Leela: Hey, you know what might be a hoot?
 Professor: No. Why would I know that? 
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild @ FreeBSD.org  : PGP ID = 72077137



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080508103636.153b1576>