2005-02-21

TwoFingerScrolling Update

I've gotten some feedback from Joe Stroller with some modifications to the TwoFingerScrolling startup script. I'm also posting a tarball of the updated StartupItem at http://apesseekingknowledge.net/packages/TwoFingerScrolling.tar.gz to make it simpler to use.

These instructions assume that you're comfortable enough using Terminal to edit files with a command line editor like vi or emacs, and that you know how to boot into single user mode and remove the StartupItem if you have a problem.

All you need to do now is

  1. Download the tarball from here.
  2. Extract it
  3. Download the latest version of the kext from Daniel Becker's site here
  4. Put the extracted kext file into the StartupItem folder you got from step 2 above
  5. If it doesn't already exist, create a folder in /Library named StartupItems.
  6. Move the TwoFingerScrolling directory to /Library/StartupItems. If it is not named TwoFingerScrolling exactly, it will not load.
  7. In a Terminal window, edit /System/Library/StartupItems/LoginWindow/StartupParameters.plist and change the line that reads Requires = ("Disks", "SecurityServer"); to Requires = ("Disks", "SecurityServer", "TwoFingerScrolling");. This forces LoginWindow to not start until the new kext is loaded.

You're all set.

For those of you who want to see the new script, here it is:


#!/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
# and Joe Stroller

. /etc/rc.common

# http://www.macdevcenter.com/pub/a/mac/2003/10/21/startup.html says:
# The StartupItems specification requires that the executable file
# has the same name as the subdirectory that contains it and that the
# executable is in the root level of subdirectory.
#
# But since Joe User might choose to run this script manually
# (for testing or otherwise), we can't rely on $PWD and have
# to define the /path/to/the.kext programatically

MYDIR="${0%/*}"

if [ "$UID" != "0" ]
then
echo "Only root can load or unload kernel modules."
exit 1
fi

# 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.

if [ ! -d "$MYDIR/AppleADBMouse.kext" ]; then
ConsoleMessage "No patched AppleADBMouse.kext found."
exit 0
fi

# We have to source Apple's /etc/rc.common in order to get the ConsoleMessage
# function, but it breaks the below:
#
#if [ -z "$1" ]
#then
# echo "ERROR! This script requires a commandline argument, silly!"
#fi

# You don't have to be drunk to write Bash scripts on a Macintosh, but it helps!
#
ConsoleMessage ""
ConsoleMessage ' * If you see a message below saying "$1: unbound variable"'
ConsoleMessage " * It probably means $0 "
ConsoleMessage ' * has been called without a parameter (like "start" or "stop")'
ConsoleMessage " * "
ConsoleMessage " * If this message annoys you then please bitch to (IE file a"
ConsoleMessage " * bug report with) Apple, compaining that their /etc/rc.common"
ConsoleMessage " * functions break standard Bash syntax like: "
ConsoleMessage ' * if [ -z "$1" ] ; then echo "missing parameter" ; fi '
ConsoleMessage ""

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 $MYDIR/AppleADBMouse.kext
kextunload -b com.apple.driver.AppleADBMouse && kextload $MYDIR//AppleADBMouse.kext
;;
stop)

ConsoleMessage "Stopping Two Finger Scrolling"
kextunload $MYDIR/AppleADBMouse.kext && kextload /System/Library/Extensions/AppleADBMouse.kext
;;
*)
echo "Neither \"Start\" nor \"Stop\" are spelled \"$1\""
;;
esac

exit 0

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