From owner-freebsd-drivers@FreeBSD.ORG Sat Dec 27 00:41:09 2008 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5D8F1065670 for ; Sat, 27 Dec 2008 00:41:09 +0000 (UTC) (envelope-from vince@unsane.co.uk) Received: from unsane.co.uk (unsane-pt.tunnel.tserv5.lon1.ipv6.he.net [IPv6:2001:470:1f08:110::2]) by mx1.freebsd.org (Postfix) with ESMTP id 262E78FC0C for ; Sat, 27 Dec 2008 00:41:08 +0000 (UTC) (envelope-from vince@unsane.co.uk) Received: from vhoffman-macbook.local ([10.0.0.173]) (authenticated bits=0) by unsane.co.uk (8.14.0/8.14.0) with ESMTP id mBR0fwCg089782 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 27 Dec 2008 00:41:59 GMT (envelope-from vince@unsane.co.uk) Message-ID: <495579A3.4030605@unsane.co.uk> Date: Sat, 27 Dec 2008 00:41:07 +0000 From: Vincent Hoffman User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: Rohit Grover References: <426bed110812261255s45ad2f82vb874e21165617be7@mail.gmail.com> In-Reply-To: <426bed110812261255s45ad2f82vb874e21165617be7@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-drivers@freebsd.org Subject: Re: Attempting to write a device driver for the macbook's USB trackpad X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2008 00:41:09 -0000 Rohit Grover wrote: > Hello People, > > I'm attempting to write a FreeBSD device driver for the USB trackpad on my > macbook. > Not much help but http://wiki.freebsd.org/AppleMacbook says or implies that Rui Paulo was working on somthing similar under the touchpad section, it might be worth talking to him directly (http://wiki.freebsd.org/RuiPaulo .) > The trackpad is an HID class device. Parsing the HID report descriptor > (fetched from an invocation of usbd_read_report_desc()) for this device > results in the following information: > > Legend: : > > > input: page: 0x9; usage: 0x1; reportID: 2 > size: 1, count: 1, loc: 0 > input: page: 0x9; usage: 0x2; reportID: 2 > size: 1, count: 1, loc: 1 > input: page: 0x9; usage: 0x3; reportID: 2 > size: 1, count: 1, loc: 2 > input: page: 0x0; usage: 0x0; reportID: 2 > size: 5, count: 1, loc: 3 > input: page: 0x1; usage: 0x30; reportID: 2 > size: 8, count: 1, loc: 8 > input: page: 0x1; usage: 0x31; reportID: 2 > size: 8, count: 1, loc: 16 > input: page: 0xffff; usage: 0x2; reportID: 5 > size: 8, count: 63, loc: 24 > collection: page: 0x1; usage: 0x2; collection: 1; collevel: 1, reportID: 0 > size: 0, count: 0, loc: 0 > collection: page: 0x1; usage: 0x1; collection: 0; collevel: 2, reportID: 0 > size: 0, count: 0, loc: 0 > collection: page: 0xffff; usage: 0x1; collection: 0; collevel: 1, reportID: > 2 > size: 8, count: 2, loc: 0 > feature: page: 0xffff; usage: 0x4, reportID: 5 > size: 8, count: 1, loc: 0 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 8 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 16 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 24 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 32 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 40 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 48 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 56 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 64 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 72 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 80 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 88 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 96 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 104 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 112 > feature: page: 0x0; usage: 0x0, reportID: 5 > size: 8, count: 1, loc: 120 > end_collection: page: 0x1; usage: 0x31, reportID: 2 > size: 8, count: 2, loc: 0 > end_collection: page: 0x0; usage: 0x0, reportID: 2 > size: 8, count: 2, loc: 0 > end_collection: page: 0xffff; usage: 0x4, reportID: 5 > size: 8, count: 16, loc: 0 > > As can be seen, there are two distinct report IDs being used. Report ID 2 > describes the mouse-buttons and XY deltas; and since the generic UMS driver > in Freebsd is able to parse these values, the macbook's trackpad is usable. > I would like to enhance the ums driver to report information from the > pressure sensors--with the hope that this will allow the detection of tap > events. > I suspect that the reports with ID == 5 will contain this information. Of > particular interest to me is the following (from the previous table): > > input: page: 0xffff; usage: 0x2; reportID: 5 > size: 8, count: 63, loc: 24 > > Unfortunately, this report uses a vendor specific page (0xffff), and > therefore will require some reverse engineering before it can be deciphered. > > I need help with receiving HID reports for both ID == 2 and ID == 5. > Currently, the interrupt handler (ums_intr) only parses reports with ID==2. > Based on my reading of the code, ums_attach() needs to setup sc->sc_iid and > sc->sc_isize based on the report-descriptors fetched from the device; but in > the case where there are multiple reportIDs supported by the device, the > current setup code uses values from only the first reportID. > > In order to parse reportID 2, sc->sc_isize is set to a value of 4 bytes: 1 > byte for the reportID header, together with 3 bytes for the button/XY-delta > values. > To accommodate an additional 63 bytes for the input in reportID 5, I am > guessing that I should set sc->sc_isize to 68: for the 63 bytes starting at > bit offset 24; with allowance for one additional byte which may be necessary > to accommodate a reportID header. I still don't know how to initialize > sc->sc_iid to handle both report IDs. > > Can someone please help me with setting up the device to receive reports > with both IDs so that I can begin reverse-engineering the vendor-specific > content of reportID 5? > > regards, > Rohit. > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" >