From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 19 13:42:33 2009 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 E12C1106568D for ; Wed, 19 Aug 2009 13:42:32 +0000 (UTC) (envelope-from rgrover1@gmail.com) Received: from mail-yw0-f199.google.com (mail-yw0-f199.google.com [209.85.211.199]) by mx1.freebsd.org (Postfix) with ESMTP id A0ADA8FC45 for ; Wed, 19 Aug 2009 13:42:32 +0000 (UTC) Received: by ywh37 with SMTP id 37so6250870ywh.28 for ; Wed, 19 Aug 2009 06:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=NqF8MSjMEgoM5mBoeKmPkm4LzMgUHzX+uFcoWO3xBDM=; b=bc6Hb6Uw0WOD4chdNVqupqMbAMOrWfyA8JLSRWaD6G2bNNf5s37fCO5UKG0fhC0Xyz /9pgOIVwiSXICLfG+GWlm9amHpXiWQnRO+TFvcfysvmz2CChdIzxWMxKHdOdorTuE1dn DZVv8ndPj/VeT2iECmYMChGgsrtjrQzKam75Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=PCDt9jKyjRrZZjPTxm0CQArK9NdrX0/o2rgtiAZzqLemQ7YLOUHFBHCuR4PcmqRq8/ 7lRxvAMeastc01WpnSFWmbAVriw5zD/S99gX9X8QB4viK/LUg3kRAcistWuocbIJA1P+ aXsb4Vv4gMWtXiSpymlDMzVczHctrqtcJ7BJk= MIME-Version: 1.0 Received: by 10.150.239.19 with SMTP id m19mr10401393ybh.247.1250687766320; Wed, 19 Aug 2009 06:16:06 -0700 (PDT) Date: Wed, 19 Aug 2009 21:16:06 +0800 Message-ID: <426bed110908190616m21d39e9bm95a60f624b831418@mail.gmail.com> From: Rohit Grover To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: introducing a FreeBSD driver for the Apple Touchpad; and a few questions.. 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: Wed, 19 Aug 2009 13:42:33 -0000 Hello, I have developed a driver for the Touchpad device on Apple Macbooks. Mine is a Macbook 3,1, and I run FreeBSD7.2 on it--so testing has sor far been limited to this configuration. In its present state, the driver supports multi-tap, edge detection, and movement smothening. The driver creates a pseudo device: /dev/atp, which expects to be read from moused. You can setup moused to work with it by adding the following to /etc/rc.conf: moused_port="/dev/atp" and then you would also need to tell your X-server to get mouse data from /dev/sysmouse. You may get the driver from git://github.com/rgrover/freebsd-atp.git. The git command is: "git clone git://github.com/rgrover/freebsd-atp.git". I have been using this driver for a while now. It is stable. Please help me test this driver for a wider range of hardware. There is more work to be done in the area of movement smoothening. I am also going to add support for detecting gestures. For this I need to track strokes. For my algorithms, I would like to allocate memory dynamically out of a small pool of fixed sized structures. I have read a bit about UMA; is UMA a good alternative for managing a small pool (~20) of buffers (of around 20 bytes in size)? regards, From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 19 21:16:12 2009 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 219A2106568B for ; Wed, 19 Aug 2009 21:16:12 +0000 (UTC) (envelope-from rgrover1@gmail.com) Received: from mail-gx0-f227.google.com (mail-gx0-f227.google.com [209.85.217.227]) by mx1.freebsd.org (Postfix) with ESMTP id CCE428FC51 for ; Wed, 19 Aug 2009 21:16:11 +0000 (UTC) Received: by gxk27 with SMTP id 27so6019161gxk.12 for ; Wed, 19 Aug 2009 14:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=tDja8BKTMLHqTbvvDvNZhIonAbbJCsVMMkMtOYgO5So=; b=gy6GfyNAYVIx8RKrtGGxmhXJvezyJ6lmzkz7kdP6oGiaNbI2XPRj7lQZAeMwZcayiB l1WsY7COHp4ePAlp0r8+MQvs20u240qCpJ2qUoSZmwQyhJ21OzaWrPBHKfxQYp+ontkj ROH4T0CkjqlHvWc3sJ0OLyLTqM6WQpdd2aFkw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=chilslkASuqLzmkao6yZ2sUaUk5LTgKTh7egmYaLQzECKUPKoQNg+5wyd28RacEjNs lErUq6O5URrzAQv6vIm6bRb+7OxI3EPkw/EH8r6E1H35a6xFUzuVz6yr7FZKGl16bVJy F9dxRTE8gAW/XhsrwzgR26zEguYWSDc6H2HjE= MIME-Version: 1.0 Received: by 10.150.239.11 with SMTP id m11mr11211939ybh.345.1250716571129; Wed, 19 Aug 2009 14:16:11 -0700 (PDT) In-Reply-To: <20090819194426.3bf401d9@baby-jane.lamaiziere.net> References: <426bed110908190616m21d39e9bm95a60f624b831418@mail.gmail.com> <20090819194426.3bf401d9@baby-jane.lamaiziere.net> Date: Thu, 20 Aug 2009 05:16:10 +0800 Message-ID: <426bed110908191416q35cf8613ue912b741d6285f1c@mail.gmail.com> From: Rohit Grover To: Patrick Lamaiziere Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-drivers@freebsd.org Subject: Re: introducing a FreeBSD driver for the Apple Touchpad; and a few questions.. 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: Wed, 19 Aug 2009 21:16:12 -0000 On Thu, Aug 20, 2009 at 1:44 AM, Patrick Lamaiziere wrote: > Le Wed, 19 Aug 2009 21:16:06 +0800, > Rohit Grover a =E9crit : > > > I have developed a driver for the Touchpad device on Apple Macbooks. > > Mine is a Macbook 3,1, and I run FreeBSD7.2 > > Cool! Shall it work on a MacBookPro 3,1? Please give it a try. The number of Y sensors on a MacBookPro might be different. On my MacBook, I've got 20 X sensors and 10 Y sensors; but that is with a mouse-button at the bottom of the touch-sensitive area. The butto= n has been replaced with additional touchpad surface in the MacBookPro. So it will require a bit of experimentation, and even some reverse-engineering. The key to interpreting data from the device is atp_read_sensors(). That might have to change to support newer models. If someone is willing to contribute with testing, I can create a version of the driver which logs additional detail to help us with the reverse engineering. > Do you plan a version to the new usb stack on 8.0? > Certainly. I can't yet run 8.0 on my MacBook. ACPI panics the kernel right at the beginning of boot, and even if I disable ACPI, the kernel is still unable to mount the root partition. I have tried compiling my driver agains= t 8.0, and I see that I will need to adapt to the new USB stack. I'm very kee= n on moving to 8.0 once it can boot on my laptop. I'd be happy to maintain support for multiple versions of FreeBSD. > > > For my algorithms, I would like to allocate memory dynamically out of > > a small pool of fixed sized structures. I have read a bit about UMA; > > is UMA a good alternative for managing a small pool (~20) of buffers > > (of around 20 bytes in size)? > > I'm not sure for this, IMHO UMA does not care about the size of the > buffers, and malloc uses UMA for the allocation. > But is UMA a very heavy-weight approach to managing a small pool of fixed sized buffers whose total footprint is under 512 bytes? > I've read a bit the source, you should not use spl on 7.x, they are > no-ops. Instead use some mutexes. And you should not use the giant lock. > Thanks for pointing this out. I will research the use of SMP primitives. Th= e 'ums' driver, which is what I am replacing, also uses splx(). Could you tel= l me which giant lock I am using in my code? Is there any documentation I can refer to for SMP synchronization under FreeBSD? regards, Rohit.