Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Load it with a StartupItem without having to replace Apple's driver' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Load it with a StartupItem without having to replace Apple's driver
Authored by: jpbjpbjpbjpb on Feb 15, '05 07:04:03PM
I was uncomfortable having to move Apple's kext to get this to load every boot in case it caused problems with a future update. After a few weird little problems, I have a working StartupItem that will load the modified drivers every boot, without deleting or moving Apple's original driver. 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 modified Trackpad Driver
    
    . /etc/rc.common
    
    export PATH=$PATH:/sw/bin:/sw/sbin
    
    # 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 /Library/StartupItems/TwoFingerScrolling/AppleADBMouse.kext ]; 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 /Library/StartupItems/TwoFingerScrolling/AppleADBMouse.kext
                    kextunload -b com.apple.driver.AppleADBMouse && kextload /Library/StartupItems/TwoFingerScrolling/AppleADBMouse.kext
            ;;      
            stop)
    
                    ConsoleMessage "Stopping Two Finger Scrolling"
                    /usr/bin/logger "Stopping Two Finger Scrolling"
                    kextunload /Library/StartupItems/TwoFingerScrolling/AppleADBMouse.kext && 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 on you, and you should be very 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. 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.

[ Reply to This | # ]