Re: Enabling the extra wheel buttons in the Logitech optical mouse

2010-04-23 Thread Henry Hu
Hi,

On Sat, Apr 24, 2010 at 3:31 AM, Hans Petter Selasky  wrote:
> On Friday 23 April 2010 20:49:03 Henry Hu wrote:
>> Henry Hu
>>
> Hi,
>
> Thanks for your patch.
>
> I changed it a little bit, to be more general. Can you download and verify
> this patch:
>
> http://p4web.freebsd.org/@@177279?ac=10

The patch works well. Thanks!
>
> --HPS
>



-- 
Cheers,
Henry
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Enabling the extra wheel buttons in the Logitech optical mouse

2010-04-23 Thread Hans Petter Selasky
On Friday 23 April 2010 20:49:03 Henry Hu wrote:
> Henry Hu
> 
Hi,

Thanks for your patch.

I changed it a little bit, to be more general. Can you download and verify 
this patch:

http://p4web.freebsd.org/@@177279?ac=10

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Enabling the extra wheel buttons in the Logitech optical mouse

2010-04-23 Thread Henry Hu
Today I bought a logitech optical mouse.
ugen3.3:  at usbus3, cfg=0 md=HOST
spd=LOW (1.5Mbps) pwr=ON
The wheel has two extra buttons, so you can push it left or right to
click the extra buttons.
However, the extra buttons does not work.
I inspected the device, and found that it reports extra features.
Here is the verbose output of uhidd, describing the report descriptor:

#id=0 rid=()
id( 0): input(5) output(0) feature(0)
USAGE PAGE Generic Desktop(0x1)
USAGE Mouse(0x2)[Generic Desktop(0x1)]
COLLECTION Application(1)
  USAGE Pointer(0x1)[Generic Desktop(0x1)]
  COLLECTION Physical(0)
USAGE PAGE Button(0x9)
USAGE MINIMUM Button1(1)
USAGE MAXIMUM Button8(8)
LOGICAL MINIMUM 0
LOGICAL MAXIMUM 1
REPORT COUNT 8
REPORT SIZE 1
INPUT ( Data Variable Absolute ) (2)
REPORT COUNT 0
INPUT ( Const Variable Absolute ) (3)
USAGE PAGE Generic Desktop(0x1)
USAGE X(0x30)[Generic Desktop(0x1)]
USAGE Y(0x31)[Generic Desktop(0x1)]
USAGE Wheel(0x38)[Generic Desktop(0x1)]
LOGICAL MINIMUM -127
LOGICAL MAXIMUM 127
REPORT SIZE 8
REPORT COUNT 3
INPUT ( Data Variable Relative ) (6)
USAGE PAGE Consumer(0xc)
USAGE AC Pan(0x238)[Consumer(0xc)]
^^
REPORT COUNT 1
INPUT ( Data Variable Relative ) (6)
  END COLLECTION
END COLLECTION

So you can see that there's extra feature, in the Conumser usage
page(0xc), named AC Pan (0x238).
When pushing the wheel left or right, it says:

/dev/ugen3.3[iface:0]=> received data(5): 00 00 00 00 01
/dev/ugen3.3[iface:0][c0:mouse]=> mouse received data: dx(0) dy(0) dw(0) btn(0)
/dev/ugen3.3[iface:0]=> received data(5): 00 00 00 00 -1
/dev/ugen3.3[iface:0][c0:mouse]=> mouse received data: dx(0) dy(0) dw(0) btn(0)

So it seems like that left results in -1, and right results 1 in the
extra feature.
Since we cannot report this axis now, I tried to translate it into buttons.

I changed ums.c and usbhid.h, and now the tile axis works as forward
and backward in firefox.
So maybe we can implement at least such tile axis as extra buttons
now? Until we have a better way to report the tile axis...
Currently the buttons are reported as button 8 and 9 in Xorg.

--- usbhid.h.orig   2010-04-23 22:49:47.0 +0800
+++ usbhid.h2010-04-23 22:50:40.0 +0800
@@ -156,6 +156,9 @@
 #defineHUD_ERASER  0x0045
 #defineHUD_TABLET_PICK 0x0046

+/* Usages Conumsers */
+#define HUC_AC_PAN 0x0238
+
 #defineHID_USAGE2(p,u) (((p) << 16) | (u))

 #defineUHID_INPUT_REPORT 0x01
--- /home/henryhu/ums.c 2010-04-24 02:43:42.0 +0800
+++ ums.c   2010-04-24 02:45:33.0 +0800
@@ -283,6 +283,11 @@
if (dx || dy || dz || dt || dw ||
(buttons != sc->sc_status.button)) {

+   if (dt == 1)
+   buttons |= 1UL << 3;
+   if (dt == -1)
+   buttons |= 1UL << 4;
+
DPRINTFN(6, "x:%d y:%d z:%d t:%d w:%d buttons:0x%08x\n",
dx, dy, dz, dt, dw, buttons);

@@ -454,6 +459,13 @@
if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) {
info->sc_flags |= UMS_FLAG_T_AXIS;
}
+   } else if (hid_locate(buf, len, HID_USAGE2(HUP_CONSUMER,
+   HUC_AC_PAN), hid_input, index, &info->sc_loc_t,
+   &flags, &info->sc_iid_t)) {
+
+   if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) {
+   info->sc_flags |= UMS_FLAG_T_AXIS;
+   }
}
/* figure out the number of buttons */


-- 
Cheers,
Henry
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"