2005-02-15

Activating Two Finger Scrolling on each boot with a StartupItem

Daniel Becker has modified Apple's trackpad driver kext to enable Two-Finger Scrolling on older PowerBooks and iBooks. Download the kext from http://www-users.kawo2.rwth-aachen.de/~razzfazz/.

I want to keep the original kext where it is so future system updates don't have issues if Apple decides to update the system kext, but I also want to automatically load Daniel's improved driver every boot, so I wrote a StartupItem to take care of it for me.

These instructions require a working knowledge of using Terminal and CLI editors like vi or emacs.


  1. open Terminal and make a new directory called TwoFingerScrolling.
  2. Use your favorite editor to create a new shell script in the new directory, also called TwoFingerScrolling. Paste the following content into the script:

    #!/bin/sh
    #
    # Load Daniel Becker's modified Trackpad Driver on recent PowerBooks and iBooks
    # This is released under a BSD license.
    # By J. P. Block <jpb@apesseekingknowledge.net>

    . /etc/rc.common

    export PATH=$PATH:/sw/bin:/sw/sbin
    export TFSKEXT=/path/to/your/work/dir/TwoFingerScrolling/AppleADBMouse.kext
    # When you are done testing, comment out the line above this, and uncomment the next line
    #export TFSKEXT=/Library/StartupItems/TwoFingerScrolling/AppleADBMouse.kext

    # Check to make sure we have a patched driver to load, or bad things will happen when we unload
    # the original driver and can't find the patched driver to replace it.
    #
    f [ ! -d $TFSKEXT ]; then
    ConsoleMessage "No patched AppleADBMouse.kext found."
    exit 0
    fi

    case "$1" in
    start)

    ConsoleMessage "Loading Two Finger Scrolling"
    # make sure the permissions are correct on it before we load it
    chown -R root:wheel $TFSKEXT
    kextunload -b com.apple.driver.AppleADBMouse && kextload $TFSKEXT
    ;;
    stop)

    ConsoleMessage "Stopping Two Finger Scrolling"
    /usr/bin/logger "Stopping Two Finger Scrolling"
    kextunload $TFSKEXT && kextload /System/Library/Extensions/AppleADBMouse.kext
    ;;
    esac

    exit 0

  3. StartupItems also need a plist file to work. Create a file in the directory you created called StartupParameters.plist and paste the following contents into it:

    {
    Description = "Two Finger Scrolling";
    Provides = ("TwoFingerScrolling");
    Requires = ("Network");
    OrderPreference = "Last";
    Messages =
    {
    start = "Starting Two Finger Scrolling";
    stop = "Stopping Two Finger Scrolling";
    restart = "Restarting Two Finger Scrolling";
    };
    }

  4. chown +rx TwoFingerScrolling/TwoFingerScrolling We have to mark the script as executable, or it won't work.
  5. Copy the AppleADBMouse.kext you downloaded from Daniel's site into the TwoFingerScrolling directory.
  6. sudo chown -R root:wheel ./AppleADBMouse.kext

    Do NOT move this into /Library/StartupItems yet! We want to make sure it is working and you have all your permissions correct before trying to boot with the new StartupItem, or it will kernel panic your system every time you boot.

    To test it, close all your applications except Terminal, then, in Terminal, cd into the TwoFingerScrolling directory you've been working in and do sudo ./TwoFingerScrolling start

    If you have done everything right, you should now be able to do two finger scrolling. If you haven't, your computer just crashed, and you should be glad you didn't set it up to load the broken StartupItem every boot.


Presuming it worked, you can now install it as a boot item.

  1. In Terminal, type ls /Library/StartupItems. If it tells you there is no such file or directory, do sudo mkdir /Library/StartupItems
  2. cd to the directory containing the TwoFingerScrolling directory you made and filled in the previous set of instructions.
  3. type sudo mv TwoFingerScrolling /Library/StartupItems/TwoFingerScrolling
  4. UPDATE: edit the script per comments so TFSKEXT is set to the correct directory, /Library/StartupItems/TwoFingerScrolling to find the modified kext. If you do not edit the script, it will not load your new driver.
  5. Finally, we have to get LoginWindow to wait for the new kext to load, or you're going to have a kernel panic if you touch the trackpad as the switchout takes place. To do this, edit /System/Library/StartupItems/LoginWindow/StartupParameters.plist and change the line Requires = ("Disks", "SecurityServer"); to Requires = ("Disks", "SecurityServer", "TwoFingerScrolling");


Your system is now set up to automatically load the new driver every boot.

No comments:

Creative Commons License

This work is licensed under a Creative Commons License.
Copyright 2007-2010, Joseph P. Block, Some Rights Reserved.

Creative Commons Logo