Hi all, this is a patch for kernel >2.6.5 (i am using it on a 2.6.6-rc2-mm1 ) that allows you to disable the trackpad on iBook/PowerBook when you plug one or more usb mouses.
The behaviour is driven by a proc file: /proc/sys/dev/mac_hid/adb_trackpad_disable_on_usb_mouse when this file is setted > 0 the trackpad will be disabled if you plug >= N mouse in the system,where N is the number written in the proc file. Please test it :) -- Roberto De Ioris the Packardt imaging via belfiore, 20 10125 Torino Italy tel. 0116699470 --- cel.3886699470 --- fax.0116695528
diff -Naur linux-2.6.5/drivers/macintosh/Kconfig linux-2.6.5-robbo/drivers/macintosh/Kconfig --- linux-2.6.5/drivers/macintosh/Kconfig 2004-04-04 05:36:57.000000000 +0200 +++ linux-2.6.5-robbo/drivers/macintosh/Kconfig 2004-05-04 17:10:35.000000000 +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 diff -Naur linux-2.6.5/drivers/macintosh/adbhid.c linux-2.6.5-robbo/drivers/macintosh/adbhid.c --- linux-2.6.5/drivers/macintosh/adbhid.c 2004-04-04 05:38:27.000000000 +0200 +++ linux-2.6.5-robbo/drivers/macintosh/adbhid.c 2004-05-04 17:15:44.000000000 +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 <[EMAIL PROTECTED]>"); #define KEYB_KEYREG 0 /* register # for key up/down data */ @@ -321,6 +373,13 @@ 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 +394,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 +1110,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; } diff -Naur linux-2.6.5/drivers/usb/input/hid-core.c linux-2.6.5-robbo/drivers/usb/input/hid-core.c --- linux-2.6.5/drivers/usb/input/hid-core.c 2004-04-04 05:37:23.000000000 +0200 +++ linux-2.6.5-robbo/drivers/usb/input/hid-core.c 2004-05-04 17:18:37.000000000 +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 */ @@ -1678,10 +1684,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); @@ -1697,6 +1706,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); } @@ -1754,6 +1771,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; } diff -Naur linux-2.6.5/include/linux/sysctl.h linux-2.6.5-robbo/include/linux/sysctl.h --- linux-2.6.5/include/linux/sysctl.h 2004-04-04 05:37:23.000000000 +0200 +++ linux-2.6.5-robbo/include/linux/sysctl.h 2004-05-04 17:29:14.000000000 +0200 @@ -716,7 +716,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 */
signature.asc
Description: This is a digitally signed message part