rpms/kernel/F-13 add-appleir-usb-driver.patch, 1.1, 1.2 kernel.spec, 1.2009, 1.2010

Kyle McMartin kyle at fedoraproject.org
Thu Apr 29 16:15:21 UTC 2010


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv13453

Modified Files:
	add-appleir-usb-driver.patch kernel.spec 
Log Message:
* Thu Apr 29 2010 Kyle McMartin <kyle at redhat.com>
- add-appleir-usb-driver.patch: updates from hadess.


add-appleir-usb-driver.patch:
 Documentation/input/appleir.txt |   45 +++
 drivers/hid/hid-apple.c         |    4 
 drivers/hid/hid-core.c          |   10 
 drivers/hid/hid-ids.h           |    2 
 drivers/hid/hid-wacom.c         |    2 
 drivers/hid/usbhid/hid-core.c   |    1 
 drivers/input/misc/Kconfig      |   13 +
 drivers/input/misc/Makefile     |    1 
 drivers/input/misc/appleir.c    |  453 ++++++++++++++++++++++++++++++++++++++++
 include/linux/hid.h             |    2 
 10 files changed, 525 insertions(+), 8 deletions(-)

Index: add-appleir-usb-driver.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-13/add-appleir-usb-driver.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- add-appleir-usb-driver.patch	20 Jan 2010 15:50:21 -0000	1.1
+++ add-appleir-usb-driver.patch	29 Apr 2010 16:15:20 -0000	1.2
@@ -1,20 +1,59 @@
- Documentation/input/appleir.txt |   46 ++++
- drivers/hid/hid-apple.c         |    4 -
- drivers/hid/hid-core.c          |    5 +-
- drivers/hid/hid-ids.h           |    1 +
- drivers/input/misc/Kconfig      |   13 +
- drivers/input/misc/Makefile     |    1 +
- drivers/input/misc/appleir.c    |  477 +++++++++++++++++++++++++++++++++++++++
- 7 files changed, 541 insertions(+), 6 deletions(-)
- create mode 100644 Documentation/input/appleir.txt
- create mode 100644 drivers/input/misc/appleir.c
+commit 1afccbf536dd706838656a24b6623111299fd5f2
+Author: Bastien Nocera <hadess at hadess.net>
+Date:   Wed Apr 21 15:24:56 2010 +0100
+
+    Add support for the Wacom Intuos 4 wireless
+    
+    And to the HID blacklist.
+    
+    Same command set as the Graphire Bluetooth tablet.
+    
+    Signed-off-by: Bastien Nocera <hadess at hadess.net>
+
+commit 92c912df2a0725d719263357176f98b2201a2acd
+Author: Bastien Nocera <hadess at hadess.net>
+Date:   Wed Apr 21 14:51:58 2010 +0100
+
+    Input: add appleir USB driver
+    
+    This driver was originally written by James McKenzie, updated by
+    Greg Kroah-Hartman, further updated by myself, with suspend support
+    added.
+    
+    More recent versions of the IR receiver are also supported through
+    a patch by Alex Karpenko.
+    
+    Tested on a MacbookAir1,1
+    
+    Signed-off-by: Bastien Nocera <hadess at hadess.net>
+
+commit 6ffcbf68913840e9e882db14441576ffee6eba0c
+Author: Bastien Nocera <hadess at hadess.net>
+Date:   Fri Apr 16 17:19:50 2010 +0100
+
+    Add HID_QUIRK_HIDDEV_FORCE and HID_QUIRK_NO_IGNORE
+    
+    Add two quirks to make it possible for usbhid module options to
+    override whether a device is ignored (HID_QUIRK_NO_IGNORE) and
+    whether to connect a hiddev device (HID_QUIRK_HIDDEV_FORCE).
+    
+    Passing HID_QUIRK_NO_IGNORE for your device means that it will
+    not be ignored by the HID layer, even if present in a blacklist.
+    
+    HID_QUIRK_HIDDEV_FORCE will force the creation of a hiddev for that
+    device, making it accessible from user-space.
+    
+    Tested with an Apple IR Receiver, switching it from using appleir
+    to using lirc's macmini driver.
+    
+    Signed-off-by: Bastien Nocera <hadess at hadess.net>
 
 diff --git a/Documentation/input/appleir.txt b/Documentation/input/appleir.txt
 new file mode 100644
-index 0000000..0aaf5fe
+index 0000000..0267a4b
 --- /dev/null
 +++ b/Documentation/input/appleir.txt
-@@ -0,0 +1,46 @@
+@@ -0,0 +1,45 @@
 +Apple IR receiver Driver (appleir)
 +----------------------------------
 +	Copyright (C) 2009 Bastien Nocera <hadess at hadess.net>
@@ -52,17 +91,16 @@ index 0000000..0aaf5fe
 +
 +This can be achieved by passing quirks to the usbhid driver.
 +The quirk line would be:
-+usbhid.quirks=0x05ac:0x8242:0x08
++usbhid.quirks=0x05ac:0x8242:0x40000010
 +
 +With 0x05ac being the vendor ID (Apple, you shouldn't need to change this)
 +With 0x8242 being the product ID (check the output of lsusb for your hardware)
-+And 0x08 being "HID_CONNECT_HIDDEV"
++And 0x10 being "HID_QUIRK_HIDDEV_FORCE" and 0x40000000 being "HID_QUIRK_NO_IGNORE"
 +
 +This should force the creation of a hiddev device for the receiver, and
 +make it usable under lirc.
-+
 diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
-index 4b96e7a..d1fdcd0 100644
+index 5b4d66d..b0e1811 100644
 --- a/drivers/hid/hid-apple.c
 +++ b/drivers/hid/hid-apple.c
 @@ -353,10 +353,6 @@ static void apple_remove(struct hid_device *hdev)
@@ -77,10 +115,19 @@ index 4b96e7a..d1fdcd0 100644
  		.driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL },
  
 diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
-index 7d05c4b..3efb0fa 100644
+index 8455f3d..c8d8dfb 100644
 --- a/drivers/hid/hid-core.c
 +++ b/drivers/hid/hid-core.c
-@@ -1252,8 +1252,6 @@ EXPORT_SYMBOL_GPL(hid_disconnect);
+@@ -1170,6 +1170,8 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
+ 	unsigned int i;
+ 	int len;
+ 
++	if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE)
++		connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV);
+ 	if (hdev->bus != BUS_USB)
+ 		connect_mask &= ~HID_CONNECT_HIDDEV;
+ 	if (hid_hiddev(hdev))
+@@ -1250,8 +1252,6 @@ EXPORT_SYMBOL_GPL(hid_disconnect);
  static const struct hid_device_id hid_blacklist[] = {
  	{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
  	{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
@@ -89,33 +136,83 @@ index 7d05c4b..3efb0fa 100644
  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },
  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) },
  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) },
-@@ -1539,6 +1537,9 @@ static const struct hid_device_id hid_ignore_list[] = {
- 	{ HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) },
- 	{ HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) },
+@@ -1352,6 +1352,7 @@ static const struct hid_device_id hid_blacklist[] = {
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) },
+ 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
++	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
+ 
+@@ -1545,6 +1546,9 @@ static const struct hid_device_id hid_ignore_list[] = {
  	{ HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) },
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)},
 +	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
 +	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
 +	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
- 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
- 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)},
  	{ HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) },
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
+ 	{ HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
+@@ -1749,7 +1753,7 @@ int hid_add_device(struct hid_device *hdev)
+ 
+ 	/* we need to kill them here, otherwise they will stay allocated to
+ 	 * wait for coming driver */
+-	if (hid_ignore(hdev))
++	if (!(hdev->quirks & HID_QUIRK_NO_IGNORE) && hid_ignore(hdev))
+ 		return -ENODEV;
+ 
+ 	/* XXX hack, any other cleaner solution after the driver core
 diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
-index adbef5d..c399110 100644
+index 793691f..a195e9f 100644
 --- a/drivers/hid/hid-ids.h
 +++ b/drivers/hid/hid-ids.h
-@@ -90,6 +90,7 @@
- #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS	0x0238
+@@ -93,6 +93,7 @@
+ #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
  #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY	0x030a
  #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY	0x030b
 +#define USB_DEVICE_ID_APPLE_IRCONTROL	0x8240
  #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL	0x8241
  #define USB_DEVICE_ID_APPLE_IRCONTROL4	0x8242
  
+@@ -428,6 +429,7 @@
+ 
+ #define USB_VENDOR_ID_WACOM		0x056a
+ #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH	0x81
++#define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH	0xbd
+ 
+ #define USB_VENDOR_ID_WISEGROUP		0x0925
+ #define USB_DEVICE_ID_SMARTJOY_PLUS	0x0005
+diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
+index 12dcda5..d6a48dc 100644
+--- a/drivers/hid/hid-wacom.c
++++ b/drivers/hid/hid-wacom.c
+@@ -228,7 +228,7 @@ static void wacom_remove(struct hid_device *hdev)
+ 
+ static const struct hid_device_id wacom_devices[] = {
+ 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
+-
++	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },
+ 	{ }
+ };
+ MODULE_DEVICE_TABLE(hid, wacom_devices);
+diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
+index 2f84237..2de42e1 100644
+--- a/drivers/hid/usbhid/hid-core.c
++++ b/drivers/hid/usbhid/hid-core.c
+@@ -1142,6 +1142,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
+ 	hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
+ 	hid->product = le16_to_cpu(dev->descriptor.idProduct);
+ 	hid->name[0] = 0;
++	hid->quirks = usbhid_lookup_quirk(hid->vendor, hid->product);
+ 	if (intf->cur_altsetting->desc.bInterfaceProtocol ==
+ 			USB_INTERFACE_PROTOCOL_MOUSE)
+ 		hid->type = HID_TYPE_USBMOUSE;
 diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
-index a9bb254..51b6684 100644
+index 16ec523..4340986 100644
 --- a/drivers/input/misc/Kconfig
 +++ b/drivers/input/misc/Kconfig
-@@ -148,6 +148,19 @@ config INPUT_KEYSPAN_REMOTE
+@@ -149,6 +149,19 @@ config INPUT_KEYSPAN_REMOTE
  	  To compile this driver as a module, choose M here: the module will
  	  be called keyspan_remote.
  
@@ -149,10 +246,10 @@ index a8b8485..041e6f5 100644
  obj-$(CONFIG_INPUT_ATLAS_BTNS)		+= atlas_btns.o
 diff --git a/drivers/input/misc/appleir.c b/drivers/input/misc/appleir.c
 new file mode 100644
-index 0000000..6e332ab
+index 0000000..cff4df6
 --- /dev/null
 +++ b/drivers/input/misc/appleir.c
-@@ -0,0 +1,477 @@
+@@ -0,0 +1,453 @@
 +/*
 + * appleir: USB driver for the apple ir device
 + *
@@ -205,34 +302,6 @@ index 0000000..6e332ab
 +module_param(debug, int, 0644);
 +MODULE_PARM_DESC(debug, "Enable extra debug messages and information");
 +
-+struct appleir {
-+	struct input_dev *input_dev;
-+	u8 *data;
-+	dma_addr_t dma_buf;
-+	struct usb_device *usbdev;
-+	unsigned int flags;
-+	struct urb *urb;
-+	int timer_initted;
-+	struct timer_list key_up_timer;
-+	int current_key;
-+	char phys[32];
-+};
-+
-+static DEFINE_MUTEX(appleir_mutex);
-+
-+enum {
-+	APPLEIR_OPENED = 0x1,
-+	APPLEIR_SUSPENDED = 0x2,
-+};
-+
-+static struct usb_device_id appleir_ids[] = {
-+	{ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
-+	{ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
-+	{ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
-+	{}
-+};
-+MODULE_DEVICE_TABLE(usb, appleir_ids);
-+
 +/* I have two devices both of which report the following */
 +/* 25 87 ee 83 0a  	+  */
 +/* 25 87 ee 83 0c  	-  */
@@ -264,7 +333,7 @@ index 0000000..6e332ab
 +/* 25 87 ee 47 02 	menu */
 +/* 26 87 ee 47 ** 	for key repeat (** is the code of the key being held) */
 +
-+static int keymap[MAX_KEYS] = {
++static const unsigned short appleir_key_table[] = {
 +	KEY_RESERVED,
 +	KEY_MENU,
 +	KEY_PLAYPAUSE,
@@ -275,6 +344,34 @@ index 0000000..6e332ab
 +	KEY_RESERVED,
 +};
 +
++struct appleir {
++	struct input_dev *input_dev;
++	unsigned short keymap[ARRAY_SIZE(appleir_key_table)];
++	u8 *data;
++	dma_addr_t dma_buf;
++	struct usb_device *usbdev;
++	unsigned int flags;
++	struct urb *urb;
++	struct timer_list key_up_timer;
++	int current_key;
++	char phys[32];
++};
++
++static DEFINE_MUTEX(appleir_mutex);
++
++enum {
++	APPLEIR_OPENED = 0x1,
++	APPLEIR_SUSPENDED = 0x2,
++};
++
++static struct usb_device_id appleir_ids[] = {
++	{ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
++	{ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
++	{ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
++	{}
++};
++MODULE_DEVICE_TABLE(usb, appleir_ids);
++
 +static void dump_packet(struct appleir *appleir, char *msg, u8 *data, int len)
 +{
 +	int i;
@@ -288,14 +385,14 @@ index 0000000..6e332ab
 +
 +static void key_up(struct appleir *appleir, int key)
 +{
-+	dbginfo (&appleir->input_dev->dev, "key %d up\n", key);
++	dbginfo(&appleir->input_dev->dev, "key %d up\n", key);
 +	input_report_key(appleir->input_dev, key, 0);
 +	input_sync(appleir->input_dev);
 +}
 +
 +static void key_down(struct appleir *appleir, int key)
 +{
-+	dbginfo (&appleir->input_dev->dev, "key %d down\n", key);
++	dbginfo(&appleir->input_dev->dev, "key %d down\n", key);
 +	input_report_key(appleir->input_dev, key, 1);
 +	input_sync(appleir->input_dev);
 +}
@@ -328,15 +425,15 @@ index 0000000..6e332ab
 +		return;
 +
 +	if (!memcmp(data, keydown, sizeof(keydown))) {
-+		/*If we already have a key down, take it up before marking */
-+		/*this one down */
++		/* If we already have a key down, take it up before marking
++		   this one down */
 +		if (appleir->current_key)
 +			key_up(appleir, appleir->current_key);
-+		appleir->current_key = keymap[(data[4] >> 1) & MAX_KEYS_MASK];
++		appleir->current_key = appleir->keymap[(data[4] >> 1) & MAX_KEYS_MASK];
 +
 +		key_down(appleir, appleir->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 */
++		/* 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(&appleir->key_up_timer, jiffies + HZ / 8);
 +
 +		return;
@@ -344,8 +441,8 @@ index 0000000..6e332ab
 +
 +	if (!memcmp(data, keyrepeat, sizeof(keyrepeat))) {
 +		key_down(appleir, appleir->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 */
++		/* 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(&appleir->key_up_timer, jiffies + HZ / 8);
 +		return;
 +	}
@@ -371,7 +468,7 @@ index 0000000..6e332ab
 +	case -ECONNRESET:
 +	case -ENOENT:
 +	case -ESHUTDOWN:
-+		/* this urb is terminated, clean up */
++		/* This urb is terminated, clean up */
 +		dbginfo(&appleir->input_dev->dev, "%s - urb shutting down with status: %d", __func__,
 +			urb->status);
 +		return;
@@ -401,7 +498,7 @@ index 0000000..6e332ab
 +
 +	mutex_lock(&appleir_mutex);
 +
-+	if (usb_submit_urb(appleir->urb, GFP_KERNEL)) {
++	if (usb_submit_urb(appleir->urb, GFP_ATOMIC)) {
 +		r = -EIO;
 +		goto fail;
 +	}
@@ -447,42 +544,44 @@ index 0000000..6e332ab
 +
 +	appleir = kzalloc(sizeof(struct appleir), GFP_KERNEL);
 +	if (!appleir)
-+		goto fail;
++		goto allocfail;
 +
 +	appleir->data = usb_buffer_alloc(dev, URB_SIZE, GFP_KERNEL,
 +					 &appleir->dma_buf);
 +	if (!appleir->data)
-+		goto fail;
++		goto usbfail;
 +
 +	appleir->urb = usb_alloc_urb(0, GFP_KERNEL);
 +	if (!appleir->urb)
-+		goto fail;
++		goto urbfail;
 +
 +	appleir->usbdev = dev;
 +
 +	input_dev = input_allocate_device();
 +	if (!input_dev)
-+		goto fail;
++		goto inputfail;
 +
 +	appleir->input_dev = input_dev;
 +
 +	usb_make_path(dev, appleir->phys, sizeof(appleir->phys));
 +	strlcpy(appleir->phys, "/input0", sizeof(appleir->phys));
 +
-+	input_dev->name = "Apple infrared remote control driver";
++	input_dev->name = "Apple Infrared Remote Controller";
 +	input_dev->phys = appleir->phys;
 +	usb_to_input_id(dev, &input_dev->id);
 +	input_dev->dev.parent = &intf->dev;
-+	input_set_drvdata(input_dev, appleir);
++	input_dev->keycode = appleir->keymap;
++	input_dev->keycodesize = sizeof(unsigned short);
++	input_dev->keycodemax = ARRAY_SIZE(appleir->keymap);
 +
 +	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);
++	memcpy(appleir->keymap, appleir_key_table, sizeof(appleir->keymap));
++	for (i = 0; i < ARRAY_SIZE(appleir_key_table); i++)
++		set_bit(appleir->keymap[i], input_dev->keybit);
++	clear_bit(KEY_RESERVED, input_dev->keybit);
 +
++	input_set_drvdata(input_dev, appleir);
 +	input_dev->open = appleir_open;
 +	input_dev->close = appleir_close;
 +
@@ -496,36 +595,29 @@ index 0000000..6e332ab
 +	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;
-+
-+	appleir->timer_initted++;
++	setup_timer(&appleir->key_up_timer,
++		    key_up_tick, (unsigned long) appleir);
 +
 +	retval = input_register_device(appleir->input_dev);
 +	if (retval)
-+		goto fail;
++		goto inputfail;
++
++	usb_set_intfdata(intf, appleir);
 +
 +	return 0;
 +
-+fail:
-+	printk(KERN_WARNING "Failed to load appleir\n");
-+	if (appleir) {
-+		if (appleir->data)
-+			usb_buffer_free(dev, URB_SIZE, appleir->data,
-+					appleir->dma_buf);
++inputfail:
++	input_free_device(appleir->input_dev);
 +
-+		if (appleir->timer_initted)
-+			del_timer_sync(&appleir->key_up_timer);
++urbfail:
++	usb_free_urb(appleir->urb);
 +
-+		if (appleir->input_dev)
-+			input_free_device(appleir->input_dev);
++usbfail:
++	usb_buffer_free(dev, URB_SIZE, appleir->data,
++			appleir->dma_buf);
 +
-+		kfree(appleir);
-+	}
++allocfail:
++	kfree(appleir);
 +
 +	return retval;
 +}
@@ -535,31 +627,21 @@ index 0000000..6e332ab
 +	struct appleir *appleir = usb_get_intfdata(intf);
 +
 +	usb_set_intfdata(intf, NULL);
-+	if (appleir) {
-+		input_unregister_device(appleir->input_dev);
-+		if (appleir->timer_initted)
-+			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);
-+	}
++	input_unregister_device(appleir->input_dev);
++	usb_free_urb(appleir->urb);
++	usb_buffer_free(interface_to_usbdev(intf), URB_SIZE,
++			appleir->data, appleir->dma_buf);
++	kfree(appleir);
 +}
 +
 +static int appleir_suspend(struct usb_interface *interface,
 +			   pm_message_t message)
 +{
-+	struct appleir *appleir;
-+
-+	appleir = usb_get_intfdata(interface);
++	struct appleir *appleir = usb_get_intfdata(interface);
 +
 +	mutex_lock(&appleir_mutex);
-+
-+	if (appleir->flags & APPLEIR_OPENED) {
++	if (appleir->flags & APPLEIR_OPENED)
 +		usb_kill_urb(appleir->urb);
-+		del_timer_sync(&appleir->key_up_timer);
-+	}
 +
 +	appleir->flags |= APPLEIR_SUSPENDED;
 +
@@ -571,11 +653,11 @@ index 0000000..6e332ab
 +static int appleir_resume(struct usb_interface *interface)
 +{
 +	struct appleir *appleir;
++	int r = 0;
 +
 +	appleir = usb_get_intfdata(interface);
 +
 +	mutex_lock(&appleir_mutex);
-+
 +	if (appleir->flags & APPLEIR_OPENED) {
 +		struct usb_endpoint_descriptor *endpoint;
 +
@@ -587,17 +669,16 @@ index 0000000..6e332ab
 +		appleir->urb->transfer_dma = appleir->dma_buf;
 +		appleir->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 +
-+		init_timer(&appleir->key_up_timer);
-+
-+		appleir->key_up_timer.function = key_up_tick;
-+		appleir->key_up_timer.data = (unsigned long)appleir;
++		/* And reset the USB device */
++		if (usb_submit_urb(appleir->urb, GFP_ATOMIC))
++			r = -EIO;
 +	}
 +
 +	appleir->flags &= ~APPLEIR_SUSPENDED;
 +
 +	mutex_unlock(&appleir_mutex);
 +
-+	return 0;
++	return r;
 +}
 +
 +static struct usb_driver appleir_driver = {
@@ -608,19 +689,11 @@ index 0000000..6e332ab
 +	.resume               = appleir_resume,
 +	.reset_resume         = appleir_resume,
 +	.id_table             = appleir_ids,
-+	.supports_autosuspend = 1,
 +};
 +
 +static int __init appleir_init(void)
 +{
-+	int retval;
-+
-+	retval = usb_register(&appleir_driver);
-+	if (retval)
-+		goto out;
-+	printk(KERN_INFO DRIVER_VERSION ":" DRIVER_DESC);
-+out:
-+	return retval;
++	return usb_register(&appleir_driver);
 +}
 +
 +static void __exit appleir_exit(void)
@@ -630,6 +703,21 @@ index 0000000..6e332ab
 +
 +module_init(appleir_init);
 +module_exit(appleir_exit);
--- 
-1.6.5.2
-
+diff --git a/include/linux/hid.h b/include/linux/hid.h
+index 8709365..662596b 100644
+--- a/include/linux/hid.h
++++ b/include/linux/hid.h
+@@ -308,11 +308,13 @@ struct hid_item {
+ #define HID_QUIRK_NOTOUCH			0x00000002
+ #define HID_QUIRK_IGNORE			0x00000004
+ #define HID_QUIRK_NOGET				0x00000008
++#define HID_QUIRK_HIDDEV_FORCE			0x00000010
+ #define HID_QUIRK_BADPAD			0x00000020
+ #define HID_QUIRK_MULTI_INPUT			0x00000040
+ #define HID_QUIRK_SKIP_OUTPUT_REPORTS		0x00010000
+ #define HID_QUIRK_FULLSPEED_INTERVAL		0x10000000
+ #define HID_QUIRK_NO_INIT_REPORTS		0x20000000
++#define HID_QUIRK_NO_IGNORE			0x40000000
+ 
+ /*
+  * This is the global environment of the parser. This information is


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-13/kernel.spec,v
retrieving revision 1.2009
retrieving revision 1.2010
diff -u -p -r1.2009 -r1.2010
--- kernel.spec	29 Apr 2010 01:06:41 -0000	1.2009
+++ kernel.spec	29 Apr 2010 16:15:20 -0000	1.2010
@@ -2168,6 +2168,9 @@ fi
 # and build.
 
 %changelog
+* Thu Apr 29 2010 Kyle McMartin <kyle at redhat.com>
+- add-appleir-usb-driver.patch: updates from hadess.
+
 * Thu Apr 29 2010 Ben Skeggs <bskeggs at redhat.com> 2.6.33.3-73
 - nouveau: initial eDP support + DP suspend/resume fixes
 - nouveau: fix monitor detection on certain chipsets with DP support



More information about the scm-commits mailing list