Revision: 135 http://svn.sourceforge.net/mactel-linux/?rev=135&view=rev Author: nboichat Date: 2007-07-17 11:50:21 -0700 (Tue, 17 Jul 2007)
Log Message: ----------- - Remove appleir.patch and unblacklist Apple IR from usbhid, not needed anymore, as lirc supports the remote using the driver "macmini". - Latest update of the appletouch patch. Modified Paths: -------------- trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch trunk/kernel/mactel-patches-2.6.22/series Added Paths: ----------- trunk/kernel/mactel-patches-2.6.22/appleir-undo-hid-blacklist.patch Removed Paths: ------------- trunk/kernel/mactel-patches-2.6.22/appleir.patch trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch Added: trunk/kernel/mactel-patches-2.6.22/appleir-undo-hid-blacklist.patch =================================================================== --- trunk/kernel/mactel-patches-2.6.22/appleir-undo-hid-blacklist.patch (rev 0) +++ trunk/kernel/mactel-patches-2.6.22/appleir-undo-hid-blacklist.patch 2007-07-17 18:50:21 UTC (rev 135) @@ -0,0 +1,30 @@ +Undo USB HID blacklisting of Apple IR, as it is support by lirc now. + +From: Nicolas Boichat <[EMAIL PROTECTED]> + + +--- + + drivers/hid/usbhid/hid-quirks.c | 2 -- + 1 files changed, 0 insertions(+), 2 deletions(-) + +diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c +index f6c4145..3e64d56 100644 +--- a/drivers/hid/usbhid/hid-quirks.c ++++ b/drivers/hid/usbhid/hid-quirks.c +@@ -61,7 +61,6 @@ + #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c + #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a + #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b +-#define USB_DEVICE_ID_APPLE_IR 0x8240 + + #define USB_VENDOR_ID_ATEN 0x0557 + #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 +@@ -300,7 +299,6 @@ static const struct hid_blacklist { + { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, +- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE }, Deleted: trunk/kernel/mactel-patches-2.6.22/appleir.patch =================================================================== --- trunk/kernel/mactel-patches-2.6.22/appleir.patch 2007-07-12 13:56:52 UTC (rev 134) +++ trunk/kernel/mactel-patches-2.6.22/appleir.patch 2007-07-17 18:50:21 UTC (rev 135) @@ -1,429 +0,0 @@ -Apple IR patch. - -From: James McKenzie <[EMAIL PROTECTED]> - - ---- - - drivers/input/misc/Kconfig | 5 + - drivers/input/misc/Makefile | 1 - drivers/input/misc/appleir.c | 379 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 385 insertions(+), 0 deletions(-) - -diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig -index 88e2907..d2d629a 100644 ---- a/drivers/input/misc/Kconfig -+++ b/drivers/input/misc/Kconfig -@@ -113,6 +113,10 @@ config INPUT_ATI_REMOTE2 - To compile this driver as a module, choose M here: the module will be - called ati_remote2. - -+config USB_APPLEIR -+ tristate "Apple Mac Mini USB IR receiver (built in)" -+ depends on USB && INPUT -+ - config INPUT_KEYSPAN_REMOTE - tristate "Keyspan DMR USB remote control (EXPERIMENTAL)" - depends on EXPERIMENTAL -@@ -179,3 +183,4 @@ config HP_SDC_RTC - of the HP SDC controller. - - endif -+ -diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile -index 3585b50..f73f139 100644 ---- a/drivers/input/misc/Makefile -+++ b/drivers/input/misc/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o - obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o - obj-$(CONFIG_INPUT_ATI_REMOTE) += ati_remote.o - obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o -+obj-$(CONFIG_USB_APPLEIR) += appleir.o - obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o - obj-$(CONFIG_INPUT_POWERMATE) += powermate.o - obj-$(CONFIG_INPUT_YEALINK) += yealink.o -diff --git a/drivers/input/misc/appleir.c b/drivers/input/misc/appleir.c -new file mode 100644 -index 0000000..3ff46fc ---- /dev/null -+++ b/drivers/input/misc/appleir.c -@@ -0,0 +1,379 @@ -+/* -+ * drivers/usb/input/appleir.c - driver for Apple Intel-based Macs IR Receiver -+ * -+ * Copyright (C) 2006 James McKenzie <[EMAIL PROTECTED]> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License v2 as published by the -+ * Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License along with -+ * this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/slab.h> -+#include <linux/input.h> -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/usb.h> -+#include <linux/usb/input.h> -+#include <linux/mutex.h> -+#include <asm/unaligned.h> -+#include <asm/byteorder.h> -+ -+#define DRIVER_VERSION "v1.2" -+#define DRIVER_AUTHOR "James McKenzie" -+#define DRIVER_DESC "USB Apple MacIntel IR Receiver driver" -+#define DRIVER_LICENSE "GPL" -+ -+MODULE_AUTHOR(DRIVER_AUTHOR); -+MODULE_DESCRIPTION(DRIVER_DESC); -+MODULE_LICENSE(DRIVER_LICENSE); -+ -+#define USB_VENDOR_ID_APPLE 0x05ac -+#define USB_DEVICE_ID_APPLE_IR 0x8240 -+ -+#define URB_SIZE 32 -+ -+#define MAX_KEYS 8 -+#define MAX_KEYS_MASK (MAX_KEYS - 1) -+ -+static int debug = 1; -+ -+struct appleir { -+ struct input_dev *dev; -+ uint8_t *data; -+ dma_addr_t dma_buf; -+ struct usb_device *usbdev; -+ struct urb *urb; -+ struct timer_list key_up_timer; -+ int current_key; -+ char phys[32]; -+}; -+ -+ -+static struct usb_device_id appleir_ids[] = { -+ { -+ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR), -+ .driver_info = 0 -+ }, -+ {} -+}; -+ -+MODULE_DEVICE_TABLE(usb, appleir_ids); -+ -+/* -+ * Devices report the following, where XX depends on the remote and/or the -+ * receiver (at least 2a, 83, ca, ee have been reported as possible values, it -+ * looks like it is remote control dependent). -+ * The fifth byte's LSB also depends on the hardware. -+ * 25 87 ee XX 0a/0b + -+ * 25 87 ee XX 0c/0d - -+ * 25 87 ee XX 09/08 << -+ * 25 87 ee XX 06/07 >> -+ * 25 87 ee XX 05/04 >" -+ * 25 87 ee 83 03/02 menu -+ * 26 00 00 00 00 for key repeat -+ * -+ * Thomas Glanzmann also observes the following event sometimes sent after a key -+ * is released, which I interpret as a flat battery message: -+ * 25 87 e0 ca 06 flat battery -+ */ -+ -+static int keymap[MAX_KEYS] = { -+ KEY_RESERVED, KEY_MENU, -+ KEY_PLAYPAUSE, KEY_NEXTSONG, -+ KEY_PREVIOUSSONG, KEY_VOLUMEUP, -+ KEY_VOLUMEDOWN, KEY_RESERVED -+}; -+ -+static void dump_packet(struct appleir *appleir, char *msg, -+ uint8_t *data, int len) -+{ -+ int i; -+ -+ printk(KERN_ERR "appleir: %s (%d bytes)", msg, len); -+ -+ for (i = 0; i < len; ++i) { -+ printk(" %02x", data[i]); -+ } -+ -+ printk("\n"); -+} -+ -+ -+static void key_up(struct appleir *appleir, int key) -+{ -+ if (debug) -+ printk (KERN_DEBUG "key %d up\n", key); -+ -+ input_report_key(appleir->dev, key, 0); -+ input_sync(appleir->dev); -+} -+ -+static void key_down(struct appleir *appleir, int key) -+{ -+ if (debug) -+ printk (KERN_DEBUG "key %d down\n", key); -+ -+ input_report_key(appleir->dev, key, 1); -+ input_sync(appleir->dev); -+} -+ -+static void battery_flat(struct appleir *appleir) -+{ -+ printk(KERN_WARNING "appleir: possible flat battery?\n"); -+} -+ -+static void key_up_tick(unsigned long data) -+{ -+ struct appleir *apple_ir = (struct appleir *)data; -+ -+ if (apple_ir->current_key) { -+ key_up(apple_ir, apple_ir->current_key); -+ apple_ir->current_key = 0; -+ } -+} -+ -+static void parse_data(struct appleir *apple_ir, uint8_t *data, int len) -+{ -+ static const uint8_t keydown[] = { 0x25, 0x87, 0xee }; -+ static const uint8_t keyrepeat[] = { 0x26, 0x00, 0x00, 0x00, 0x00 }; -+ static const uint8_t flatbattery[] = { 0x25, 0x87, 0xe0 }; -+ -+ if (debug) -+ dump_packet(apple_ir, "received", data, len); -+ -+ if (len != 5) -+ return; -+ -+ if (!memcmp(data, keydown, sizeof(keydown))) { -+ /* -+ * If we already have a key down, take it up before marking -+ * this one down. -+ */ -+ if (apple_ir->current_key) -+ key_up(apple_ir, apple_ir->current_key); -+ apple_ir->current_key = keymap[(data[4] >> 1) & MAX_KEYS_MASK]; -+ -+ key_down(apple_ir, apple_ir->current_key); -+ -+ /* -+ * Remote doesn't do key up, either pull them up, in the test -+ * above, or here set a timer which pulls them up after 1/8 s -+ */ -+ mod_timer(&apple_ir->key_up_timer, jiffies + HZ / 8); -+ -+ return; -+ } -+ -+ if (!memcmp(data, keyrepeat, sizeof(keyrepeat))) { -+ key_down(apple_ir, apple_ir->current_key); -+ -+ /* -+ * Remote doesn't do key up, either pull them up, in the test -+ * above, or here set a timer which pulls them up after 1/8 s -+ */ -+ mod_timer(&apple_ir->key_up_timer, jiffies + HZ / 8); -+ return; -+ } -+ -+ if (!memcmp(data, flatbattery, sizeof(flatbattery))) { -+ battery_flat(apple_ir); -+ /* Fall through */ -+ } -+ -+ dump_packet(apple_ir, "unknown packet", data, len); -+} -+ -+static void appleir_urb(struct urb *urb) -+{ -+ struct appleir *appleir = urb->context; -+ int retval; -+ -+ switch (urb->status) { -+ case 0: -+ parse_data(appleir, urb->transfer_buffer, urb->actual_length); -+ break; -+ case -ECONNRESET: -+ case -ENOENT: -+ case -ESHUTDOWN: -+ /* this urb is terminated, clean up */ -+ dbg("%s - urb shutting down with status: %d", -+ __FUNCTION__, urb->status); -+ return; -+ default: -+ dbg("%s - nonzero urb status received: %d", -+ __FUNCTION__, urb->status); -+ } -+ -+ retval = usb_submit_urb(urb, GFP_ATOMIC); -+ if (retval) -+ err("%s - usb_submit_urb failed with result %d", -+ __FUNCTION__, retval); -+} -+ -+ -+static int appleir_open(struct input_dev *dev) -+{ -+ struct appleir *appleir = dev->private; -+ -+ if (usb_submit_urb(appleir->urb, GFP_KERNEL)) -+ return -EIO; -+ -+ return 0; -+} -+ -+static void appleir_close(struct input_dev *dev) -+{ -+ struct appleir *appleir = dev->private; -+ usb_kill_urb(appleir->urb); -+ del_timer_sync(&appleir->key_up_timer); -+} -+ -+static int appleir_probe(struct usb_interface *intf, -+ const struct usb_device_id *id) -+{ -+ struct usb_device *dev = interface_to_usbdev(intf); -+ struct usb_endpoint_descriptor *endpoint; -+ struct appleir *appleir = NULL; -+ struct input_dev *input_dev; -+ int i; -+ int ret = -ENOMEM; -+ -+ appleir = kzalloc(sizeof(struct appleir), GFP_KERNEL); -+ if (!appleir) -+ goto fail; -+ -+ memset(appleir, 0, sizeof(struct appleir)); -+ -+ appleir->data = -+ usb_buffer_alloc(dev, URB_SIZE, GFP_KERNEL, &appleir->dma_buf); -+ if (!appleir->data) -+ goto fail_appleir; -+ -+ appleir->urb = usb_alloc_urb(0, GFP_KERNEL); -+ if (!appleir->urb) -+ goto fail_buffer; -+ -+ appleir->usbdev = dev; -+ -+ input_dev = input_allocate_device(); -+ if (!input_dev) -+ goto fail_urb; -+ -+ appleir->dev = input_dev; -+ -+ if (usb_make_path(dev, appleir->phys, sizeof(appleir->phys)) < 0) -+ goto fail_input_device; -+ -+ strlcpy(appleir->phys, "/input0", sizeof(appleir->phys)); -+ -+ input_dev->name = "Apple MacIntel infrared remote control driver"; -+ input_dev->phys = appleir->phys; -+ usb_to_input_id(dev, &input_dev->id); -+ input_dev->cdev.dev = &intf->dev; -+ input_dev->private = appleir; -+ -+ input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); -+ input_dev->ledbit[0] = 0; -+ -+ for (i = 0; i < MAX_KEYS; i++) { -+ set_bit(keymap[i], input_dev->keybit); -+ } -+ -+ clear_bit(0, input_dev->keybit); -+ -+ input_dev->open = appleir_open; -+ input_dev->close = appleir_close; -+ -+ endpoint = &intf->cur_altsetting->endpoint[0].desc; -+ -+ usb_fill_int_urb(appleir->urb, dev, -+ usb_rcvintpipe(dev, endpoint->bEndpointAddress), -+ appleir->data, 8, -+ appleir_urb, appleir, endpoint->bInterval); -+ -+ appleir->urb->transfer_dma = appleir->dma_buf; -+ appleir->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; -+ -+ usb_set_intfdata(intf, appleir); -+ -+ init_timer(&appleir->key_up_timer); -+ -+ appleir->key_up_timer.function = key_up_tick; -+ appleir->key_up_timer.data = (unsigned long) appleir; -+ -+ ret = input_register_device(appleir->dev); -+ if (ret < 0) -+ goto fail_timer; -+ -+ return 0; -+ -+fail_timer: -+ del_timer_sync(&appleir->key_up_timer); -+ -+fail_input_device: -+ input_free_device(appleir->dev); -+ -+fail_urb: -+ usb_free_urb(appleir->urb); -+ -+fail_buffer: -+ usb_buffer_free(dev, URB_SIZE, appleir->data, appleir->dma_buf); -+ -+fail_appleir: -+ kfree(appleir); -+ -+fail: -+ return ret; -+} -+ -+static void appleir_disconnect(struct usb_interface *intf) -+{ -+ struct appleir *appleir = usb_get_intfdata(intf); -+ -+ usb_set_intfdata(intf, NULL); -+ if (appleir) { -+ input_unregister_device(appleir->dev); -+ del_timer_sync(&appleir->key_up_timer); -+ usb_kill_urb(appleir->urb); -+ usb_free_urb(appleir->urb); -+ usb_buffer_free(interface_to_usbdev(intf), URB_SIZE, -+ appleir->data, appleir->dma_buf); -+ kfree(appleir); -+ } -+} -+ -+static struct usb_driver appleir_driver = { -+ .name = "appleir", -+ .probe = appleir_probe, -+ .disconnect = appleir_disconnect, -+ .id_table = appleir_ids, -+}; -+ -+static int __init appleir_init(void) -+{ -+ int retval; -+ retval = usb_register(&appleir_driver); -+ if (retval) -+ goto out; -+ info(DRIVER_VERSION ":" DRIVER_DESC); -+out: -+ return retval; -+} -+ -+static void __exit appleir_exit(void) -+{ -+ usb_deregister(&appleir_driver); -+} -+ -+module_init(appleir_init); -+module_exit(appleir_exit); Deleted: trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch =================================================================== --- trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch 2007-07-12 13:56:52 UTC (rev 134) +++ trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch 2007-07-17 18:50:21 UTC (rev 135) @@ -1,32 +0,0 @@ -The attached patch tries to resolve the 'appletouch runs amok' problem. - -From: Soeren Sonnenburg <[EMAIL PROTECTED]> - - ---- - - drivers/input/mouse/appletouch.c | 10 +++++++++- - 1 files changed, 9 insertions(+), 1 deletions(-) - -diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c -index 724bcd4..6b7aefe 100644 ---- a/drivers/input/mouse/appletouch.c -+++ b/drivers/input/mouse/appletouch.c -@@ -502,8 +502,16 @@ static void atp_complete(struct urb* urb) - several hundred times a second */ - if (atp_is_geyser_3(dev)) { - dev->idlecount++; -- if (dev->idlecount == 10) -+ if (dev->idlecount == 10) { -+ if (dev->data[dev->datalen-1] != 20) -+ input_report_key(dev->input, BTN_LEFT, -+ !!dev->data[dev->datalen - 1]); -+ -+ input_sync(dev->input); - schedule_work (&dev->work); -+ -+ goto exit; -+ } - } - } - Modified: trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch =================================================================== --- trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch 2007-07-12 13:56:52 UTC (rev 134) +++ trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch 2007-07-17 18:50:21 UTC (rev 135) @@ -1,42 +1,82 @@ -The appletouch devices found in the Intel Macs (and possibly some later PPC ones?) send a constant stream of packets after the first touch. This results in the kernel waking up around once every couple of milliseconds to process them, making it almost impossible to spend any significant period of time in C3 state on a dynamic HZ kernel. Sending the mode initialisation code makes the device shut up until it's touched again. This patch does so after receiving 10 packets with no interesting content. +The attached minimally intrusive patch is based on Matthew Garret's -From: Matthew Garrett <[EMAIL PROTECTED]> +From: Soeren Sonnenburg <[EMAIL PROTECTED]> +patch 'Make appletouch shut up when it has nothing to say' patches (e.g. +http://lkml.org/lkml/2007/5/13/117): Matthews description follows / +second paragraph lists my additional changes. +The appletouch geyser3 devices found in the Intel Macs (and possibly some later +PPC ones?) send a constant stream of packets after the first touch. This +results in the kernel waking up around once every couple of milliseconds +to process them, making it almost impossible to spend any significant +period of time in C3 state on a dynamic HZ kernel. Sending the mode +initialization code makes the device shut up until it's touched again. +This patch does so after receiving 10 packets with no interesting +content. + +In addition it now empties the work queue via cancel_work_sync on module +exit, keeps all error checking and only reports BTN_LEFT presses if bit +1 in the status byte (last byte in packet) is set. This fixes the random +left clicks issue. Furthermore it invalidates touchpad data before the +mode switch, which fixes the touchpad runs amok issue. + +Credits: +Sven Anders found out that one should only check for bit 1 for BTN_LEFT. +Matthew Garrett did the initial 'Make appletouch shut up when it has +nothing to say' so I am adding him to the signed-off lines (hope that is +the correct way). + +Patch follows inline and attached. + +Soeren. + +Signed-off-by: Soeren Sonnenburg <[EMAIL PROTECTED]> +Signed-off-by: Matthew Garrett <[EMAIL PROTECTED]> --- - drivers/input/mouse/appletouch.c | 93 ++++++++++++++++++++++++++------------ - 1 files changed, 63 insertions(+), 30 deletions(-) + drivers/input/mouse/appletouch.c | 112 ++++++++++++++++++++++++++------------ + 1 files changed, 77 insertions(+), 35 deletions(-) diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c -index c26af96..724bcd4 100644 +index c26af96..22182a7 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -155,6 +155,8 @@ struct atp { int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; int overflowwarn; /* overflow warning printed? */ int datalen; /* size of an USB urb transfer */ -+ int idlecount; /* number of empty packets */ ++ int idlecount; /* number of empty packets */ + struct work_struct work; }; #define dbg_dump(msg, tab) \ -@@ -208,6 +210,51 @@ static inline int atp_is_geyser_3(struct atp *dev) +@@ -208,6 +210,63 @@ static inline int atp_is_geyser_3(struct atp *dev) (productId == GEYSER4_JIS_PRODUCT_ID); } ++/* ++ * By default Geyser 3 device sends standard USB HID mouse ++ * packets (Report ID 2). This code changes device mode, so it ++ * sends raw sensor reports (Report ID 5). ++ */ +static int atp_geyser3_init(struct usb_device *udev) +{ + char data[8]; + int size; ++ int i; + + size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ ATP_GEYSER3_MODE_READ_REQUEST_ID, -+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, -+ ATP_GEYSER3_MODE_REQUEST_VALUE, -+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); -+ ++ ATP_GEYSER3_MODE_READ_REQUEST_ID, ++ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, ++ ATP_GEYSER3_MODE_REQUEST_VALUE, ++ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); ++ + if (size != 8) { ++ printk("appletouch atp_geyser3_init READ error\n"); ++ for (i=0; i<8; i++) ++ printk("appletouch[%d]: %d\n", i, (int) data[i]); ++ + err("Could not do mode read request from device" + " (Geyser 3 mode)"); + return -EIO; @@ -44,15 +84,17 @@ + + /* Apply the mode switch */ + data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; -+ ++ + size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ ATP_GEYSER3_MODE_WRITE_REQUEST_ID, -+ USB_DIR_OUT | USB_TYPE_CLASS | -+ USB_RECIP_INTERFACE, -+ ATP_GEYSER3_MODE_REQUEST_VALUE, -+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); -+ ++ ATP_GEYSER3_MODE_WRITE_REQUEST_ID, ++ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, ++ ATP_GEYSER3_MODE_REQUEST_VALUE, ++ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); ++ + if (size != 8) { ++ printk("appletouch atp_geyser3_init WRITE error\n"); ++ for (i=0; i<8; i++) ++ printk("appletouch[%d]: %d\n", i, (int) data[i]); + err("Could not do mode write request to device" + " (Geyser 3 mode)"); + return -EIO; @@ -73,42 +115,48 @@ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, int *z, int *fingers) { -@@ -441,7 +488,6 @@ static void atp_complete(struct urb* urb) - dev->y_old = y; - } - else if (!x && !y) { -- - dev->x_old = dev->y_old = -1; - input_report_key(dev->input, BTN_TOUCH, 0); - input_report_abs(dev->input, ABS_PRESSURE, 0); -@@ -449,10 +495,21 @@ static void atp_complete(struct urb* urb) +@@ -449,11 +508,21 @@ static void atp_complete(struct urb* urb) /* reset the accumulator on release */ memset(dev->xy_acc, 0, sizeof(dev->xy_acc)); -+ +- } + +- input_report_key(dev->input, BTN_LEFT, +- !!dev->data[dev->datalen - 1]); + /* Geyser 3 will continue to send packets continually after + the first touch unless reinitialised. Do so if it's been + idle for a while in order to avoid waking the kernel up + several hundred times a second */ + if (atp_is_geyser_3(dev)) { + dev->idlecount++; -+ if (dev->idlecount == 10) ++ if (dev->idlecount == 10) { ++ dev->valid=0; + schedule_work (&dev->work); ++ } + } - } ++ } -- input_report_key(dev->input, BTN_LEFT, -- !!dev->data[dev->datalen - 1]); -+ if (dev->data[dev->datalen-1] != 20) -+ input_report_key(dev->input, BTN_LEFT, -+ !!dev->data[dev->datalen - 1]); - ++ input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen-1] & 1); input_sync(dev->input); -@@ -533,35 +590,9 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id - * packets (Report ID 2). This code changes device mode, so it - * sends raw sensor reports (Report ID 5). - */ + exit: +@@ -480,6 +549,7 @@ static void atp_close(struct input_dev *input) + struct atp *dev = input_get_drvdata(input); + + usb_kill_urb(dev->urb); ++ cancel_work_sync(&dev->work); + dev->open = 0; + } + +@@ -528,40 +598,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id + dev->datalen = 81; + + if (atp_is_geyser_3(dev)) { +- /* +- * By default Geyser 3 device sends standard USB HID mouse +- * packets (Report ID 2). This code changes device mode, so it +- * sends raw sensor reports (Report ID 5). +- */ - char data[8]; - int size; - @@ -121,10 +169,11 @@ - if (size != 8) { - err("Could not do mode read request from device" - " (Geyser 3 mode)"); ++ /* switch to raw sensor mode */ + if (atp_geyser3_init(udev)) goto err_free_devs; - } - +- - /* Apply the mode switch */ - data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; - @@ -133,7 +182,7 @@ - USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, - ATP_GEYSER3_MODE_REQUEST_VALUE, - ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); -- + - if (size != 8) { - err("Could not do mode write request to device" - " (Geyser 3 mode)"); @@ -142,11 +191,11 @@ printk("appletouch Geyser 3 inited.\n"); } -@@ -636,6 +667,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id +@@ -636,6 +676,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id /* save our data pointer in this interface device */ usb_set_intfdata(iface, dev); -+ INIT_WORK(&dev->work, atp_reinit); ++ INIT_WORK(&dev->work, atp_reinit); + return 0; Modified: trunk/kernel/mactel-patches-2.6.22/series =================================================================== --- trunk/kernel/mactel-patches-2.6.22/series 2007-07-12 13:56:52 UTC (rev 134) +++ trunk/kernel/mactel-patches-2.6.22/series 2007-07-17 18:50:21 UTC (rev 135) @@ -5,6 +5,5 @@ sigmatel_audio3.patch applesmc_int.patch appletouch.patch -appleir.patch +appleir-undo-hid-blacklist.patch appletouch-shut-up-when-it-has-nothing-to-say.patch -appletouch-fix-run-amok-problem.patch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Mactel-linux-devel mailing list Mactel-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mactel-linux-devel