From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 13 16:05:18 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BFF31065689; Wed, 13 Aug 2008 16:05:18 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id EFFC88FC3D; Wed, 13 Aug 2008 16:05:17 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id F162E744191; Wed, 13 Aug 2008 18:41:51 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eQleWWqNKSrh; Wed, 13 Aug 2008 18:41:51 +0300 (EEST) Received: from [10.2.1.87] (gateway.cybervisiontech.com.ua [91.198.50.114]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 1F9E5744174; Wed, 13 Aug 2008 18:41:51 +0300 (EEST) Message-ID: <48A300B9.5090105@icyb.net.ua> Date: Wed, 13 Aug 2008 18:41:45 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.16 (X11/20080805) MIME-Version: 1.0 To: freebsd-usb@freebsd.org, freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: tilt/horizontal scroll support X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2008 16:05:18 -0000 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