Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Aug 2008 18:41:45 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        freebsd-usb@freebsd.org, freebsd-hackers@freebsd.org
Subject:   tilt/horizontal scroll support
Message-ID:  <48A300B9.5090105@icyb.net.ua>

next in thread | raw e-mail | index | archive | help

I have the following mouse:
http://www.logitech.com/index.cfm/partners/system_builders_integrators/products/mice/devices/3141&cl=gb,en#

It has "Tilt Wheel Plus Zoomâ„¢ technology", i.e. its scroll wheel can be
tilted left and right. Currently it perfectly works as 3 buttons + wheel
mouse, but tilting action does not cause any effect (in xev).

This is some debug output from ums driver:
ums0: Logitech USB-PS/2 Optical Mouse, rev 2.00/27.20, addr 2, iclass 3/1
ums0: 8 buttons and Z dir.
ums_attach: sc=0xffffff004d747400
ums_attach: X      8/8
ums_attach: Y      16/8
ums_attach: Z      24/8
ums_attach: B1     0/1
ums_attach: B2     1/1
ums_attach: B3     2/1
ums_attach: B4     3/1
ums_attach: B5     4/1
ums_attach: B6     5/1
ums_attach: B7     6/1
ums_attach: B8     7/1

Here's how "normal"/vertical scrolling of the wheel is reported by ums
(one scroll forward and one scroll backward):
ums_intr: sc=0xffffff006b502400 status=0
ums_intr: data = 00 00 00 ff 00
ums_intr: x:0 y:0 z:1 t:0 buttons:0x0
ums_intr: sc=0xffffff006b502400 status=0
ums_intr: data = 00 00 00 01 00
ums_intr: x:0 y:0 z:-1 t:0 buttons:0x0
As expected value in the 4th byte (data[3]) is interpreted as z-axis
movement (and seems to always be +1/-1).

Here's how tilting of the wheel is reported (tilted the wheel, held it
for some time and then released):
ums_intr: sc=0xffffff004d747400 status=0
ums_intr: data = 00 00 00 00 01
ums_intr: x:0 y:0 z:0 t:0 buttons:0x0
ums_intr: sc=0xffffff004d747400 status=0
ums_intr: data = 00 00 00 00 01
ums_intr: x:0 y:0 z:0 t:0 buttons:0x0
ums_intr: sc=0xffffff004d747400 status=0
ums_intr: data = 00 00 00 00 01
ums_intr: x:0 y:0 z:0 t:0 buttons:0x0
ums_intr: sc=0xffffff004d747400 status=0
ums_intr: data = 00 00 00 00 00
ums_intr: x:0 y:0 z:0 t:0 buttons:0x0

It seems that tilting is reported by value in the 5th byte (data[4]), it
has hardware "auto-repeat" and end of tilting is reported by all-zeroes
data. Currently, it seems, data[4] is completely ignored.

I would like to get tilting to work as horizontal scrolling in X, using
SysMouse protocol.
As I understand currently our sysmouse(4) protocol doesn't provide for
tilting data (there is no field for it in the packet structure), and
Xorg sysmouse driver does not have any support for tilting either.

So now I have two questions.
1. What would be the best way to each ums about the tilt capability of
this mouse? Is there some generic way to detect it or maybe
logitech-specific way or some model-specific quirk is required?

2. What would be the best way to pass tilting data to consumers?
I see two possibilities:
A) map data[4] to some extended button value (do it in ums driver), e.g.
to button 6 and button 7;
B) it seems that dz value is always 1 or -1, amount of scrolling affects
number of mouse events, but abs(dz) is always 1; if this is really
always true, then tilting could be piggy-backed onto dz as +2/-2 value
(or some such) and then Xorg sysmouse driver could be taught to
interpret such values as special button presses (similarly to how
vertical scrolling is handled in it).

Thank you in advance for advices and opinions.

-- 
Andriy Gapon



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