Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
disabling Ibook trackpad in gentoo
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Fri Sep 24, 2004 1:46 pm    Post subject: disabling Ibook trackpad in gentoo Reply with quote

is there a way i can disable my iBook's trackpad in gentoo? i've already compilied the kernel, and i would not like to do it again
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Fri Sep 24, 2004 7:47 pm    Post subject: Reply with quote

I'm afraid I don't know of any method to turn off the trackpad without patching your kernel. But don't worry - as long as you follow these instructions it will be really easy and you might learn something along the way.

The patch provided here disables your trackpad automatically as soon as you plug any kind of USB mouse into your Powerbook/iBook. I'm positive this is exactly the functionality you want - disabling the trackpad without an external mouse will leave many windowmanagers almost unusable ;) Disconnect the external mouse and your trackpad is activated again automatically. The patch is against kernel 2.6.8 but I can make you a patch against different kernel versions too. It is not mine, I found it on the debian-ppc mailing list some time ago.

1. Save the following file in /usr/src/linux (the source root of your current kernel) as trackpad.patch:
Code:
--- linux-2.6.7/drivers/macintosh/Kconfig.orig   2004-06-16 07:19:21.000000000 +0200
+++ linux-2.6.7/drivers/macintosh/Kconfig   2004-07-06 16:06:55.289679712 +0200
@@ -168,6 +168,19 @@
 
      If you have an Apple machine with a 1-button mouse, say Y here.
 
+config MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+        bool "Support for disabling trackpad on usbmouse plugging"
+       depends on INPUT_ADBHID
+       help
+         This provides support for disabling the iBook/PowerBook
+         trackpad when one or more usb mouses are plugged in.
+         This behavior remains off until you specify in
+
+          /proc/sys/dev/mac_hid/adb_trackpad_disable_on_usb_mouse
+
+          the minimum number of usb mouses that have to be plugged
+          in to disable the trackpad (normally 1).
+
 config THERM_WINDTUNNEL
    tristate "Support for thermal management on Windtunnel G4s"
    depends on I2C && I2C_KEYWEST && PPC_PMAC && !PPC_PMAC64
--- linux-2.6.7/drivers/macintosh/adbhid.c.orig   2004-06-16 07:20:26.000000000 +0200
+++ linux-2.6.7/drivers/macintosh/adbhid.c   2004-07-06 16:20:04.295732560 +0200
@@ -54,6 +54,58 @@
 #include <asm/backlight.h>
 #endif
 
+
+#ifdef CONFIG_MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+
+#include <linux/proc_fs.h>
+#include <linux/sysctl.h>
+
+static int disable_adb_on_usb = 0 ;
+
+ctl_table mac_hid_files2[] = {
+        {
+                .ctl_name       = DEV_MAC_HID_ADB_TRACKPAD_DISABLE_ON_USB_MOUSE,
+                .procname       = "adb_trackpad_disable_on_usb_mouse",
+                .data           = &disable_adb_on_usb,
+                .maxlen         = sizeof(int),
+                .mode           = 0644,
+                .proc_handler   = &proc_dointvec,
+        },
+        { .ctl_name = 0 }
+};
+
+ctl_table mac_hid_dir2[] = {
+        {
+                .ctl_name       = DEV_MAC_HID,
+                .procname       = "mac_hid",
+                .maxlen         = 0,
+                .mode           = 0555,
+                .child          = mac_hid_files2,
+        },
+        { .ctl_name = 0 }
+};
+
+ctl_table mac_hid_root_dir2[] = {
+        {
+                .ctl_name       = CTL_DEV,
+                .procname       = "dev",
+                .maxlen         = 0,
+                .mode           = 0555,
+                .child          = mac_hid_dir2,
+        },
+        { .ctl_name = 0 }
+};
+
+static struct ctl_table_header *mac_hid_sysctl_header;
+
+
+int mouseesterno = 0 ;
+EXPORT_SYMBOL(mouseesterno) ;
+
+#endif
+
+
+
 MODULE_AUTHOR("Franz Sirl <Franz.Sirl-kernel@lauterbach.com>");
 
 #define KEYB_KEYREG   0   /* register # for key up/down data */
@@ -321,6 +373,14 @@
                 break;
    }
 
+ #ifdef CONFIG_MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+
+        if (disable_adb_on_usb>0 && adbhid[id]->mouse_kind ==
+ADBMOUSE_TRACKPAD && mouseesterno>=disable_adb_on_usb) {
+        }
+        else {
+ #endif
+
    input_regs(&adbhid[id]->input, regs);
 
    input_report_key(&adbhid[id]->input, BTN_LEFT,   !((data[1] >> 7) & 1));
@@ -335,6 +395,11 @@
           ((data[1]&0x7f) < 64 ? (data[1]&0x7f) : (data[1]&0x7f)-128 ));
 
    input_sync(&adbhid[id]->input);
+
+ #ifdef CONFIG_MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+                }
+ #endif
+
 }
 
 static void
@@ -1046,6 +1111,13 @@
 
    notifier_chain_register(&adb_client_list, &adbhid_adb_notifier);
 
+ #ifdef CONFIG_MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+
+        mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir2, 1);
+
+ #endif
+
+
    return 0;
 }
 
--- linux-2.6.7/drivers/usb/input/hid-core.c.orig   2004-06-16 07:19:36.000000000 +0200
+++ linux-2.6.7/drivers/usb/input/hid-core.c   2004-07-06 16:14:41.454811840 +0200
@@ -33,6 +33,12 @@
 #include "hid.h"
 #include <linux/hiddev.h>
 
+#ifdef CONFIG_MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+
+extern int mouseesterno ;
+
+#endif
+
 /*
  * Version Information
  */
@@ -1704,10 +1710,13 @@
 static void hid_disconnect(struct usb_interface *intf)
 {
    struct hid_device *hid = usb_get_intfdata (intf);
+   char *c ;
 
    if (!hid)
       return;
 
+   c = hid_types[hid->collection[0].usage & 0xffff];
+
    usb_set_intfdata(intf, NULL);
    usb_unlink_urb(hid->urbin);
    usb_unlink_urb(hid->urbout);
@@ -1723,6 +1732,14 @@
    if (hid->urbout)
       usb_free_urb(hid->urbout);
 
+#ifdef CONFIG_MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+
+               if (c == "Mouse" && mouseesterno>0) {
+                   mouseesterno-- ;
+               }
+
+#endif
+
    hid_free_buffers(hid->dev, hid);
    hid_free_device(hid);
 }
@@ -1780,6 +1797,14 @@
    printk(": USB HID v%x.%02x %s [%s] on %s\n",
       hid->version >> 8, hid->version & 0xff, c, hid->name, path);
 
+#ifdef CONFIG_MAC_DISABLE_ADB_TRACKPAD_ON_USB_MOUSE
+
+               if (c == "Mouse") {
+                  mouseesterno++ ;
+               }
+
+#endif
+
    return 0;
 }
 
--- linux-2.6.7/include/linux/sysctl.h.orig   2004-06-16 07:19:35.000000000 +0200
+++ linux-2.6.7/include/linux/sysctl.h   2004-07-06 16:08:43.194275720 +0200
@@ -730,7 +730,8 @@
    DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
    DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
    DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
-   DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
+   DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6,
+   DEV_MAC_HID_ADB_TRACKPAD_DISABLE_ON_USB_MOUSE=7
 };
 
 /* /proc/sys/dev/scsi */


2. Enter your kernel source directory and apply the patch using the patch command:
Code:
cd /usr/src/linux
patch -p1 < trackpad.patch


3. While still in the kernel source directory, run
Code:
make xconfig
to start the graphical kernel configuration interface and then navigate through the menus to activate support for disabling the trackpad:
Code:
Device Drivers
         -> Macintosh device drivers
              [*] Support for ADB input devices
                   [*] Support for disabling trackpad on usbmouse plugging


4. Run:
Code:
$ make
and copy your new vmlinux and System.map into /boot:
Code:
$ cp vmlinux System.map /boot


5. Edit /etc/sysctl.conf using the editor of your choice and add the following line to the end of the file:
Code:
dev/mac_hid/adb_trackpad_disable_on_usb_mouse=1

This will always activate the functionality when you boot.

6. Reboot and enjoy! 8) Once you plug any kind of USB mouse into your Powerbook/iBook the internal trackpad will be disabled so you won't accidentaly displace your cursor if you touch the trackpad. Quite useful with those huge trackpads on the iBooks.

Hope that helps,
DiskBreaker


Last edited by DiskBreaker on Sat Sep 25, 2004 5:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sat Sep 25, 2004 5:08 pm    Post subject: Reply with quote

yeah, for #3, it says "make xconfig and activate" do i just run "xconfig" or do i have to remake X?
Back to top
View user's profile Send private message
porodzila
Guru
Guru


Joined: 22 May 2004
Posts: 307
Location: Terrapin Station

PostPosted: Sat Sep 25, 2004 5:13 pm    Post subject: Reply with quote

he means "make menuconfig" so that you can make the kernel with the patch
_________________
ubi primum potero, me hinc subduco.
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sat Sep 25, 2004 5:50 pm    Post subject: Reply with quote

when i try to do step 2, i get an error saying: "patch: **** stripcount 1 is not a number"
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sat Sep 25, 2004 6:02 pm    Post subject: Reply with quote

MACSRULETHEWORLD wrote:
yeah, for #3, it says "make xconfig and activate" do i just run "xconfig" or do i have to remake X?

Yeah sorry what I meant is just type in the command "make xconfig" at the command prompt while you are still in the kernel source directory (/usr/src/yourlinuxkernel).

The general procedure for compiling a 2.6 series kernel is:
1. emerge on of the many kernels in portage's sys-kernel directory, the kernel sources will be unpacked into /usr/src. Alternatively, you can download the kernel sources on your own from http://www.kernel.org and unpack them in /usr/src.

2. Change into the new kernel source directory, e.g. for kernel 2.6.8.1:
Code:
cd /usr/src/linux-2.6.8.1


3. To configure all features of your kernel you can either type in:
Code:
make menuconfig
which will present you with a console-based menu for the kernel configuration or you can run
Code:
make xconfig
for a GUI-based versioin

4. After configuring you need to compile the kernel, all you need to do for this is issue the simple command:
Code:
make


5. After compiling, you need to install the kernel which basically includes the kernel file itself named "vmlinux", the file containing the kernel's symbol table called "System.map" (more info ) and the various kernel modules (entries where you chose not to compile some functionality into the kernel but to have it as an independent module instead).

First, back up your old kernel in /boot so you always have a known working kernel version and adjust your /etc/yaboot.conf so you can always boot your old working kernel (don't forget to run "ybin -v" after editing yaboot.conf.

Then copy vmlinux and System.map into /boot.

And finally run:
Code:
make modules_install
to let the kernel automatically install its modules into /lib/modules/2.6.x/.
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sat Sep 25, 2004 6:05 pm    Post subject: Reply with quote

ok, but when i do make menuconfig, the patch doesnt' show up under ADB device drivers :(
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sat Sep 25, 2004 6:08 pm    Post subject: Reply with quote

MACSRULETHEWORLD wrote:
when i try to do step 2, i get an error saying: "patch: **** stripcount 1 is not a number"

You must have typed in a lower-case L instead of the number 1, that's why the patch program is complaining. The command is:
Code:
$ patch -p1 < yourpatch.patch
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sat Sep 25, 2004 7:42 pm    Post subject: Reply with quote

k, now when i do the patch step, i get this error:


Code:
patching file drivers/macintosh/Kconfig
Hunk #1 succeeded at 207 with fuzz 2 (offset 39 lines).
patching file drivers/macintosh/adbhid.c
Hunk #1 succeeded at 210 with fuzz 2 (offset 156 lines).
Hunk #2 FAILED at 529.
Hunk #3 FAILED at 551.
Hunk #4 FAILED at 1267.
3 out of 4 hunks FAILED -- saving rejects to file drivers/macintosh/adbhid.c.rej
patching file drivers/usb/input/hid-core.c
Hunk #2 FAILED at 1710.
Hunk #3 FAILED at 1732.
Hunk #4 FAILED at 1797.
3 out of 4 hunks FAILED -- saving rejects to file drivers/usb/input/hid-core.c.rej
patching file include/linux/sysctl.h
Hunk #1 FAILED at 730.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/sysctl.h.rej
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sat Sep 25, 2004 8:17 pm    Post subject: Reply with quote

MACSRULETHEWORLD wrote:
k, now when i do the patch step, i get this error:


Code:
patching file drivers/macintosh/Kconfig
Hunk #1 succeeded at 207 with fuzz 2 (offset 39 lines).
patching file drivers/macintosh/adbhid.c
Hunk #1 succeeded at 210 with fuzz 2 (offset 156 lines).
Hunk #2 FAILED at 529.
Hunk #3 FAILED at 551.
Hunk #4 FAILED at 1267.
3 out of 4 hunks FAILED -- saving rejects to file drivers/macintosh/adbhid.c.rej
patching file drivers/usb/input/hid-core.c
Hunk #2 FAILED at 1710.
Hunk #3 FAILED at 1732.
Hunk #4 FAILED at 1797.
3 out of 4 hunks FAILED -- saving rejects to file drivers/usb/input/hid-core.c.rej
patching file include/linux/sysctl.h
Hunk #1 FAILED at 730.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/sysctl.h.rej

Which linux kernel version are you using?
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sat Sep 25, 2004 10:03 pm    Post subject: Reply with quote

i have the 2.6 kernel
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sat Sep 25, 2004 11:49 pm    Post subject: Reply with quote

MACSRULETHEWORLD wrote:
i have the 2.6 kernel

In order to help you out I will need a little more detail :lol:

This patch has been tested on vanilla kernel 2.6.7 and 2.6.8. If you run an older 2.6 kernel, I would recommend that you update to the current 2.6.8.1 anyway :)
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sun Sep 26, 2004 12:08 am    Post subject: Reply with quote

i have the .7 kernel, but no matter, i got it to work! thanks for your help!!
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sun Sep 26, 2004 12:11 am    Post subject: Reply with quote

MACSRULETHEWORLD wrote:
i have the .7 kernel, but no matter, i got it to work! thanks for your help!!

Cool 8) I hope it was the feature you were looking for...
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sun Sep 26, 2004 12:28 am    Post subject: Reply with quote

ok, on during the whole setup thing, everything went great. but on restart, it doesnt' work! the trackpad is still activated!
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sun Sep 26, 2004 12:34 am    Post subject: Reply with quote

Code:
cat /proc/sys/dev/mac_hid/adb_trackpad_disable_on_usb_mouse
and make sure it returns a 1. If not, type in:
Code:
 echo "1" >  /proc/sys/dev/mac_hid/adb_trackpad_disable_on_usb_mouse


Then plug in your USB mouse. Your trackpad should be disabled as long as the external USB mouse is plugged in.
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sun Sep 26, 2004 1:52 am    Post subject: Reply with quote

when i do the first command, i get a "no such file or directory error
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sun Sep 26, 2004 2:08 am    Post subject: Reply with quote

The error message you are getting simply means that the functionality is missing.

Are you sure there were no "FAILED" messages when you applied the patch using the patch command?

Are you sure you made a tick next to the "Support for disabling trackpad..." option?

Are you sure you rebooted into the new patched kernel (i.e. you copied the patched & recompiled kernel to /boot and selected exactly this new kernel at the yaboot prompt)?
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sun Sep 26, 2004 2:58 am    Post subject: Reply with quote

there were some FAILED messages, but i believe that was because i patched the kernel mulitple times, when i went into menu config, the patch was listed 3 times, and all the failed messages all said stuff about "module already loaded" or something like that.
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Sun Sep 26, 2004 7:45 am    Post subject: Reply with quote

If the patch already failed the first time around, it won't work at all.

Start off with a fresh, new kernel kernel source tree (get it through emerge or from kernel.org). You can copy your old config (.config) into the fresh source directory so you don't have to reconfigure all the stuff for your kernel. Then follow all steps from the beginning.

If you get any FAILEDs during the patching step, please post where the 2.6.7 kernel you are using comes from and the exact patch output.
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Sun Sep 26, 2004 7:51 pm    Post subject: Reply with quote

yeah, any tips about how one might go about doing that? im a total n00b
Back to top
View user's profile Send private message
Cayennes
n00b
n00b


Joined: 01 Oct 2004
Posts: 33

PostPosted: Thu Nov 04, 2004 10:09 pm    Post subject: Reply with quote

In case anyone's interested, here's a version of the patch that works with gentoo-dev-sources (rather than the vanilla that the one posted earlier works best with.)

Modified for 2.6.8 and worked for the earlier 2.6.9 sources: trackpad-2.6.8.diff

Modified for 2.6.9-r4: trackpad-2.6.9-r4.diff

[Edited to take long patch code off forum and to include 2.6.9-r4.]
Back to top
View user's profile Send private message
kubrick2001
n00b
n00b


Joined: 24 Nov 2004
Posts: 56

PostPosted: Mon Jan 17, 2005 5:46 pm    Post subject: Reply with quote

Cayennes wrote:

Modified for 2.6.9-r4: trackpad-2.6.9-r4.diff

[Edited to take long patch code off forum and to include 2.6.9-r4.]


this patch works great with kernel 2.6.10-gentoo-r5. :wink:
Back to top
View user's profile Send private message
Rawn027
Apprentice
Apprentice


Joined: 01 Mar 2004
Posts: 286

PostPosted: Tue Jan 18, 2005 11:36 pm    Post subject: Reply with quote

does the gentoo-dev-sources have thermal support for the new power mac g5 2nd gen?
_________________
AMD Athlon 64 1.8
1GB DDR 400 RAM
Nvidia 6600 GT

MacBook Pro Duo 1.67
1GB DDR2 667 RAM
ATI x1600 Mobility
Back to top
View user's profile Send private message
Hippi@Bacarni
n00b
n00b


Joined: 08 Mar 2004
Posts: 53
Location: Hannover, DE

PostPosted: Tue Jan 25, 2005 2:43 pm    Post subject: Reply with quote

the patch works great except for one point:
if I unplug the usb-mouse, my trackpad doesn't react on anything. It's just dead :( I can plug and unplug the usb mouse and the usb mouse works, but not the trackpad if no usbmouse is pluged in.

I used the trackpad-2.6.9-r4.diff and patched the gentoo-dev-sources-2.6.10-r6

I have a PB 15" 1.5Ghz
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum