Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f5a8104 authored by Jiri Kosina's avatar Jiri Kosina
Browse files

Merge branches 'for-3.10/appleir', 'for-3.10/hid-debug',...

Merge branches 'for-3.10/appleir', 'for-3.10/hid-debug', 'for-3.10/hid-driver-transport-cleanups', 'for-3.10/i2c-hid' and 'for-3.10/logitech' into for-linus
Loading
Loading
Loading
Loading
+49 −49
Original line number Original line Diff line number Diff line
@@ -92,14 +92,14 @@ menu "Special HID drivers"


config HID_A4TECH
config HID_A4TECH
	tristate "A4 tech mice" if EXPERT
	tristate "A4 tech mice" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for A4 tech X5 and WOP-35 / Trust 450L mice.
	Support for A4 tech X5 and WOP-35 / Trust 450L mice.


config HID_ACRUX
config HID_ACRUX
	tristate "ACRUX game controller support"
	tristate "ACRUX game controller support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Say Y here if you want to enable support for ACRUX game controllers.
	Say Y here if you want to enable support for ACRUX game controllers.


@@ -113,7 +113,7 @@ config HID_ACRUX_FF


config HID_APPLE
config HID_APPLE
	tristate "Apple {i,Power,Mac}Books" if EXPERT
	tristate "Apple {i,Power,Mac}Books" if EXPERT
	depends on (USB_HID || BT_HIDP)
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for some Apple devices which less or more break
	Support for some Apple devices which less or more break
@@ -135,34 +135,34 @@ config HID_APPLEIR


config HID_AUREAL
config HID_AUREAL
	tristate "Aureal"
	tristate "Aureal"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes.
	Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes.


config HID_BELKIN
config HID_BELKIN
	tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT
	tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Belkin Flip KVM and Wireless keyboard.
	Support for Belkin Flip KVM and Wireless keyboard.


config HID_CHERRY
config HID_CHERRY
	tristate "Cherry Cymotion keyboard" if EXPERT
	tristate "Cherry Cymotion keyboard" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Cherry Cymotion keyboard.
	Support for Cherry Cymotion keyboard.


config HID_CHICONY
config HID_CHICONY
	tristate "Chicony Tactical pad" if EXPERT
	tristate "Chicony Tactical pad" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Chicony Tactical pad.
	Support for Chicony Tactical pad.


config HID_PRODIKEYS
config HID_PRODIKEYS
	tristate "Prodikeys PC-MIDI Keyboard support"
	tristate "Prodikeys PC-MIDI Keyboard support"
	depends on USB_HID && SND
	depends on HID && SND
	select SND_RAWMIDI
	select SND_RAWMIDI
	---help---
	---help---
	Support for Prodikeys PC-MIDI Keyboard device support.
	Support for Prodikeys PC-MIDI Keyboard device support.
@@ -177,14 +177,14 @@ config HID_PRODIKEYS


config HID_CYPRESS
config HID_CYPRESS
	tristate "Cypress mouse and barcode readers" if EXPERT
	tristate "Cypress mouse and barcode readers" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for cypress mouse and barcode readers.
	Support for cypress mouse and barcode readers.


config HID_DRAGONRISE
config HID_DRAGONRISE
	tristate "DragonRise Inc. game controller"
	tristate "DragonRise Inc. game controller"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Say Y here if you have DragonRise Inc. game controllers.
	Say Y here if you have DragonRise Inc. game controllers.
	These might be branded as:
	These might be branded as:
@@ -203,7 +203,7 @@ config DRAGONRISE_FF


config HID_EMS_FF
config HID_EMS_FF
	tristate "EMS Production Inc. force feedback support"
	tristate "EMS Production Inc. force feedback support"
	depends on USB_HID
	depends on HID
	select INPUT_FF_MEMLESS
	select INPUT_FF_MEMLESS
	---help---
	---help---
	Say Y here if you want to enable force feedback support for devices by
	Say Y here if you want to enable force feedback support for devices by
@@ -213,13 +213,13 @@ config HID_EMS_FF


config HID_ELECOM
config HID_ELECOM
	tristate "ELECOM BM084 bluetooth mouse"
	tristate "ELECOM BM084 bluetooth mouse"
	depends on BT_HIDP
	depends on HID
	---help---
	---help---
	Support for the ELECOM BM084 (bluetooth mouse).
	Support for the ELECOM BM084 (bluetooth mouse).


config HID_EZKEY
config HID_EZKEY
	tristate "Ezkey BTC 8193 keyboard" if EXPERT
	tristate "Ezkey BTC 8193 keyboard" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Ezkey BTC 8193 keyboard.
	Support for Ezkey BTC 8193 keyboard.
@@ -242,7 +242,7 @@ config HOLTEK_FF


config HID_KEYTOUCH
config HID_KEYTOUCH
	tristate "Keytouch HID devices"
	tristate "Keytouch HID devices"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Keytouch HID devices not fully compliant with
	Support for Keytouch HID devices not fully compliant with
	the specification. Currently supported:
	the specification. Currently supported:
@@ -250,7 +250,7 @@ config HID_KEYTOUCH


config HID_KYE
config HID_KYE
	tristate "KYE/Genius devices"
	tristate "KYE/Genius devices"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for KYE/Genius devices not fully compliant with HID standard:
	Support for KYE/Genius devices not fully compliant with HID standard:
	- Ergo Mouse
	- Ergo Mouse
@@ -260,25 +260,25 @@ config HID_KYE


config HID_UCLOGIC
config HID_UCLOGIC
	tristate "UC-Logic"
	tristate "UC-Logic"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for UC-Logic tablets.
	Support for UC-Logic tablets.


config HID_WALTOP
config HID_WALTOP
	tristate "Waltop"
	tristate "Waltop"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Waltop tablets.
	Support for Waltop tablets.


config HID_GYRATION
config HID_GYRATION
	tristate "Gyration remote control"
	tristate "Gyration remote control"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Gyration remote control.
	Support for Gyration remote control.


config HID_ICADE
config HID_ICADE
	tristate "ION iCade arcade controller"
	tristate "ION iCade arcade controller"
	depends on BT_HIDP
	depends on HID
	---help---
	---help---
	Support for the ION iCade arcade controller to work as a joystick.
	Support for the ION iCade arcade controller to work as a joystick.


@@ -287,20 +287,20 @@ config HID_ICADE


config HID_TWINHAN
config HID_TWINHAN
	tristate "Twinhan IR remote control"
	tristate "Twinhan IR remote control"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Twinhan IR remote control.
	Support for Twinhan IR remote control.


config HID_KENSINGTON
config HID_KENSINGTON
	tristate "Kensington Slimblade Trackball" if EXPERT
	tristate "Kensington Slimblade Trackball" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Kensington Slimblade Trackball.
	Support for Kensington Slimblade Trackball.


config HID_LCPOWER
config HID_LCPOWER
	tristate "LC-Power"
	tristate "LC-Power"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for LC-Power RC1000MCE RF remote control.
	Support for LC-Power RC1000MCE RF remote control.


@@ -319,7 +319,7 @@ config HID_LENOVO_TPKBD


config HID_LOGITECH
config HID_LOGITECH
	tristate "Logitech devices" if EXPERT
	tristate "Logitech devices" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Logitech devices that are not fully compliant with HID standard.
	Support for Logitech devices that are not fully compliant with HID standard.
@@ -385,7 +385,7 @@ config LOGIWHEELS_FF


config HID_MAGICMOUSE
config HID_MAGICMOUSE
	tristate "Apple MagicMouse multi-touch support"
	tristate "Apple MagicMouse multi-touch support"
	depends on BT_HIDP
	depends on HID
	---help---
	---help---
	Support for the Apple Magic Mouse multi-touch.
	Support for the Apple Magic Mouse multi-touch.


@@ -394,21 +394,21 @@ config HID_MAGICMOUSE


config HID_MICROSOFT
config HID_MICROSOFT
	tristate "Microsoft non-fully HID-compliant devices" if EXPERT
	tristate "Microsoft non-fully HID-compliant devices" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Microsoft devices that are not fully compliant with HID standard.
	Support for Microsoft devices that are not fully compliant with HID standard.


config HID_MONTEREY
config HID_MONTEREY
	tristate "Monterey Genius KB29E keyboard" if EXPERT
	tristate "Monterey Genius KB29E keyboard" if EXPERT
	depends on USB_HID
	depends on HID
	default !EXPERT
	default !EXPERT
	---help---
	---help---
	Support for Monterey Genius KB29E.
	Support for Monterey Genius KB29E.


config HID_MULTITOUCH
config HID_MULTITOUCH
	tristate "HID Multitouch panels"
	tristate "HID Multitouch panels"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	  Generic support for HID multitouch panels.
	  Generic support for HID multitouch panels.


@@ -456,7 +456,7 @@ config HID_NTRIG


config HID_ORTEK
config HID_ORTEK
	tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad"
	tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	There are certain devices which have LogicalMaximum wrong in the keyboard
	There are certain devices which have LogicalMaximum wrong in the keyboard
	usage page of their report descriptor. The most prevailing ones so far
	usage page of their report descriptor. The most prevailing ones so far
@@ -469,7 +469,7 @@ config HID_ORTEK


config HID_PANTHERLORD
config HID_PANTHERLORD
	tristate "Pantherlord/GreenAsia game controller"
	tristate "Pantherlord/GreenAsia game controller"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	  Say Y here if you have a PantherLord/GreenAsia based game controller
	  Say Y here if you have a PantherLord/GreenAsia based game controller
	  or adapter.
	  or adapter.
@@ -484,13 +484,13 @@ config PANTHERLORD_FF


config HID_PETALYNX
config HID_PETALYNX
	tristate "Petalynx Maxter remote control"
	tristate "Petalynx Maxter remote control"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Petalynx Maxter remote control.
	Support for Petalynx Maxter remote control.


config HID_PICOLCD
config HID_PICOLCD
	tristate "PicoLCD (graphic version)"
	tristate "PicoLCD (graphic version)"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	  This provides support for Minibox PicoLCD devices, currently
	  This provides support for Minibox PicoLCD devices, currently
	  only the graphical ones are supported.
	  only the graphical ones are supported.
@@ -556,14 +556,14 @@ config HID_PICOLCD_CIR


config HID_PRIMAX
config HID_PRIMAX
	tristate "Primax non-fully HID-compliant devices"
	tristate "Primax non-fully HID-compliant devices"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Primax devices that are not fully compliant with the
	Support for Primax devices that are not fully compliant with the
	HID standard.
	HID standard.


config HID_PS3REMOTE
config HID_PS3REMOTE
	tristate "Sony PS3 BD Remote Control"
	tristate "Sony PS3 BD Remote Control"
	depends on BT_HIDP
	depends on HID
	---help---
	---help---
	Support for the Sony PS3 Blue-ray Disk Remote Control and Logitech
	Support for the Sony PS3 Blue-ray Disk Remote Control and Logitech
	Harmony Adapter for PS3, which connect over Bluetooth.
	Harmony Adapter for PS3, which connect over Bluetooth.
@@ -580,7 +580,7 @@ config HID_ROCCAT


config HID_SAITEK
config HID_SAITEK
	tristate "Saitek non-fully HID-compliant devices"
	tristate "Saitek non-fully HID-compliant devices"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Saitek devices that are not fully compliant with the
	Support for Saitek devices that are not fully compliant with the
	HID standard.
	HID standard.
@@ -589,7 +589,7 @@ config HID_SAITEK


config HID_SAMSUNG
config HID_SAMSUNG
	tristate "Samsung InfraRed remote control or keyboards"
	tristate "Samsung InfraRed remote control or keyboards"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Samsung InfraRed remote control or keyboards.
	Support for Samsung InfraRed remote control or keyboards.


@@ -603,25 +603,25 @@ config HID_SONY


config HID_SPEEDLINK
config HID_SPEEDLINK
	tristate "Speedlink VAD Cezanne mouse support"
	tristate "Speedlink VAD Cezanne mouse support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Speedlink Vicious and Divine Cezanne mouse.
	Support for Speedlink Vicious and Divine Cezanne mouse.


config HID_STEELSERIES
config HID_STEELSERIES
	tristate "Steelseries SRW-S1 steering wheel support"
	tristate "Steelseries SRW-S1 steering wheel support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Steelseries SRW-S1 steering wheel
	Support for Steelseries SRW-S1 steering wheel


config HID_SUNPLUS
config HID_SUNPLUS
	tristate "Sunplus wireless desktop"
	tristate "Sunplus wireless desktop"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Sunplus wireless desktop.
	Support for Sunplus wireless desktop.


config HID_GREENASIA
config HID_GREENASIA
	tristate "GreenAsia (Product ID 0x12) game controller support"
	tristate "GreenAsia (Product ID 0x12) game controller support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	  Say Y here if you have a GreenAsia (Product ID 0x12) based game
	  Say Y here if you have a GreenAsia (Product ID 0x12) based game
	  controller or adapter.
	  controller or adapter.
@@ -643,7 +643,7 @@ config HID_HYPERV_MOUSE


config HID_SMARTJOYPLUS
config HID_SMARTJOYPLUS
	tristate "SmartJoy PLUS PS2/USB adapter support"
	tristate "SmartJoy PLUS PS2/USB adapter support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box,
	Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box,
	Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro.
	Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro.
@@ -661,20 +661,20 @@ config SMARTJOYPLUS_FF


config HID_TIVO
config HID_TIVO
	tristate "TiVo Slide Bluetooth remote control support"
	tristate "TiVo Slide Bluetooth remote control support"
	depends on (USB_HID || BT_HIDP)
	depends on HID
	---help---
	---help---
	Say Y if you have a TiVo Slide Bluetooth remote control.
	Say Y if you have a TiVo Slide Bluetooth remote control.


config HID_TOPSEED
config HID_TOPSEED
	tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support"
	tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic
	Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic
	CLLRCMCE remote control.
	CLLRCMCE remote control.


config HID_THINGM
config HID_THINGM
	tristate "ThingM blink(1) USB RGB LED"
	tristate "ThingM blink(1) USB RGB LED"
	depends on USB_HID
	depends on HID
	depends on LEDS_CLASS
	depends on LEDS_CLASS
	---help---
	---help---
	Support for the ThingM blink(1) USB RGB LED. This driver registers a
	Support for the ThingM blink(1) USB RGB LED. This driver registers a
@@ -684,7 +684,7 @@ config HID_THINGM


config HID_THRUSTMASTER
config HID_THRUSTMASTER
	tristate "ThrustMaster devices support"
	tristate "ThrustMaster devices support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	  Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
	  Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
	  a THRUSTMASTER Ferrari GT Rumble Wheel.
	  a THRUSTMASTER Ferrari GT Rumble Wheel.
@@ -700,7 +700,7 @@ config THRUSTMASTER_FF


config HID_WACOM
config HID_WACOM
	tristate "Wacom Bluetooth devices support"
	tristate "Wacom Bluetooth devices support"
	depends on BT_HIDP
	depends on HID
	depends on LEDS_CLASS
	depends on LEDS_CLASS
	select POWER_SUPPLY
	select POWER_SUPPLY
	---help---
	---help---
@@ -708,7 +708,7 @@ config HID_WACOM


config HID_WIIMOTE
config HID_WIIMOTE
	tristate "Nintendo Wii Remote support"
	tristate "Nintendo Wii Remote support"
	depends on BT_HIDP
	depends on HID
	depends on LEDS_CLASS
	depends on LEDS_CLASS
	select POWER_SUPPLY
	select POWER_SUPPLY
	select INPUT_FF_MEMLESS
	select INPUT_FF_MEMLESS
@@ -726,7 +726,7 @@ config HID_WIIMOTE_EXT


config HID_ZEROPLUS
config HID_ZEROPLUS
	tristate "Zeroplus based game controller support"
	tristate "Zeroplus based game controller support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	  Say Y here if you have a Zeroplus based game controller.
	  Say Y here if you have a Zeroplus based game controller.


@@ -740,13 +740,13 @@ config ZEROPLUS_FF


config HID_ZYDACRON
config HID_ZYDACRON
	tristate "Zydacron remote control support"
	tristate "Zydacron remote control support"
	depends on USB_HID
	depends on HID
	---help---
	---help---
	Support for Zydacron remote control.
	Support for Zydacron remote control.


config HID_SENSOR_HUB
config HID_SENSOR_HUB
	tristate "HID Sensors framework support"
	tristate "HID Sensors framework support"
	depends on USB_HID && GENERIC_HARDIRQS
	depends on HID && GENERIC_HARDIRQS
	select MFD_CORE
	select MFD_CORE
	default n
	default n
	-- help---
	-- help---
+0 −1
Original line number Original line Diff line number Diff line
@@ -21,7 +21,6 @@
#include <linux/hid.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/usb.h>


#include "hid-ids.h"
#include "hid-ids.h"


+2 −4
Original line number Original line Diff line number Diff line
@@ -29,14 +29,12 @@


#include <linux/input.h>
#include <linux/input.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/hid.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/module.h>


#include "hid-ids.h"
#include "hid-ids.h"


#ifdef CONFIG_HID_ACRUX_FF
#ifdef CONFIG_HID_ACRUX_FF
#include "usbhid/usbhid.h"


struct axff_device {
struct axff_device {
	struct hid_report *report;
	struct hid_report *report;
@@ -68,7 +66,7 @@ static int axff_play(struct input_dev *dev, void *data, struct ff_effect *effect
	}
	}


	dbg_hid("running with 0x%02x 0x%02x", left, right);
	dbg_hid("running with 0x%02x 0x%02x", left, right);
	usbhid_submit_report(hid, axff->report, USB_DIR_OUT);
	hid_hw_request(hid, axff->report, HID_REQ_SET_REPORT);


	return 0;
	return 0;
}
}
@@ -114,7 +112,7 @@ static int axff_init(struct hid_device *hid)
		goto err_free_mem;
		goto err_free_mem;


	axff->report = report;
	axff->report = report;
	usbhid_submit_report(hid, axff->report, USB_DIR_OUT);
	hid_hw_request(hid, axff->report, HID_REQ_SET_REPORT);


	hid_info(hid, "Force Feedback for ACRUX game controllers by Sergei Kolzun <x0r@dv-life.ru>\n");
	hid_info(hid, "Force Feedback for ACRUX game controllers by Sergei Kolzun <x0r@dv-life.ru>\n");


+25 −28
Original line number Original line Diff line number Diff line
@@ -728,8 +728,7 @@ static int hid_scan_report(struct hid_device *hid)
		} else if (page == HID_UP_SENSOR &&
		} else if (page == HID_UP_SENSOR &&
			item.type == HID_ITEM_TYPE_MAIN &&
			item.type == HID_ITEM_TYPE_MAIN &&
			item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
			item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
			(item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL &&
			(item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL)
			(hid->bus == BUS_USB || hid->bus == BUS_I2C))
			hid->group = HID_GROUP_SENSOR_HUB;
			hid->group = HID_GROUP_SENSOR_HUB;
	}
	}


@@ -1260,14 +1259,12 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
	struct hid_report_enum *report_enum;
	struct hid_report_enum *report_enum;
	struct hid_driver *hdrv;
	struct hid_driver *hdrv;
	struct hid_report *report;
	struct hid_report *report;
	char *buf;
	unsigned int i;
	int ret = 0;
	int ret = 0;


	if (!hid)
	if (!hid)
		return -ENODEV;
		return -ENODEV;


	if (down_trylock(&hid->driver_lock))
	if (down_trylock(&hid->driver_input_lock))
		return -EBUSY;
		return -EBUSY;


	if (!hid->driver) {
	if (!hid->driver) {
@@ -1284,28 +1281,9 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
	}
	}


	/* Avoid unnecessary overhead if debugfs is disabled */
	/* Avoid unnecessary overhead if debugfs is disabled */
	if (list_empty(&hid->debug_list))
	if (!list_empty(&hid->debug_list))
		goto nomem;
		hid_dump_report(hid, type, data, size);

	buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);

	if (!buf)
		goto nomem;

	/* dump the report */
	snprintf(buf, HID_DEBUG_BUFSIZE - 1,
			"\nreport (size %u) (%snumbered) = ", size, report_enum->numbered ? "" : "un");
	hid_debug_event(hid, buf);

	for (i = 0; i < size; i++) {
		snprintf(buf, HID_DEBUG_BUFSIZE - 1,
				" %02x", data[i]);
		hid_debug_event(hid, buf);
	}
	hid_debug_event(hid, "\n");
	kfree(buf);


nomem:
	report = hid_get_report(report_enum, data);
	report = hid_get_report(report_enum, data);


	if (!report) {
	if (!report) {
@@ -1324,7 +1302,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
	ret = hid_report_raw_event(hid, type, data, size, interrupt);
	ret = hid_report_raw_event(hid, type, data, size, interrupt);


unlock:
unlock:
	up(&hid->driver_lock);
	up(&hid->driver_input_lock);
	return ret;
	return ret;
}
}
EXPORT_SYMBOL_GPL(hid_input_report);
EXPORT_SYMBOL_GPL(hid_input_report);
@@ -1848,6 +1826,11 @@ static int hid_device_probe(struct device *dev)


	if (down_interruptible(&hdev->driver_lock))
	if (down_interruptible(&hdev->driver_lock))
		return -EINTR;
		return -EINTR;
	if (down_interruptible(&hdev->driver_input_lock)) {
		ret = -EINTR;
		goto unlock_driver_lock;
	}
	hdev->io_started = false;


	if (!hdev->driver) {
	if (!hdev->driver) {
		id = hid_match_device(hdev, hdrv);
		id = hid_match_device(hdev, hdrv);
@@ -1870,6 +1853,9 @@ static int hid_device_probe(struct device *dev)
		}
		}
	}
	}
unlock:
unlock:
	if (!hdev->io_started)
		up(&hdev->driver_input_lock);
unlock_driver_lock:
	up(&hdev->driver_lock);
	up(&hdev->driver_lock);
	return ret;
	return ret;
}
}
@@ -1878,9 +1864,15 @@ static int hid_device_remove(struct device *dev)
{
{
	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
	struct hid_driver *hdrv;
	struct hid_driver *hdrv;
	int ret = 0;


	if (down_interruptible(&hdev->driver_lock))
	if (down_interruptible(&hdev->driver_lock))
		return -EINTR;
		return -EINTR;
	if (down_interruptible(&hdev->driver_input_lock)) {
		ret = -EINTR;
		goto unlock_driver_lock;
	}
	hdev->io_started = false;


	hdrv = hdev->driver;
	hdrv = hdev->driver;
	if (hdrv) {
	if (hdrv) {
@@ -1892,8 +1884,11 @@ static int hid_device_remove(struct device *dev)
		hdev->driver = NULL;
		hdev->driver = NULL;
	}
	}


	if (!hdev->io_started)
		up(&hdev->driver_input_lock);
unlock_driver_lock:
	up(&hdev->driver_lock);
	up(&hdev->driver_lock);
	return 0;
	return ret;
}
}


static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
@@ -2343,7 +2338,9 @@ struct hid_device *hid_allocate_device(void)


	init_waitqueue_head(&hdev->debug_wait);
	init_waitqueue_head(&hdev->debug_wait);
	INIT_LIST_HEAD(&hdev->debug_list);
	INIT_LIST_HEAD(&hdev->debug_list);
	mutex_init(&hdev->debug_list_lock);
	sema_init(&hdev->driver_lock, 1);
	sema_init(&hdev->driver_lock, 1);
	sema_init(&hdev->driver_input_lock, 1);


	return hdev;
	return hdev;
}
}
+36 −0
Original line number Original line Diff line number Diff line
@@ -580,17 +580,49 @@ void hid_debug_event(struct hid_device *hdev, char *buf)
	int i;
	int i;
	struct hid_debug_list *list;
	struct hid_debug_list *list;


	mutex_lock(&hdev->debug_list_lock);
	list_for_each_entry(list, &hdev->debug_list, node) {
	list_for_each_entry(list, &hdev->debug_list, node) {
		for (i = 0; i < strlen(buf); i++)
		for (i = 0; i < strlen(buf); i++)
			list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
			list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
				buf[i];
				buf[i];
		list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;
		list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;
        }
        }
	mutex_unlock(&hdev->debug_list_lock);


	wake_up_interruptible(&hdev->debug_wait);
	wake_up_interruptible(&hdev->debug_wait);
}
}
EXPORT_SYMBOL_GPL(hid_debug_event);
EXPORT_SYMBOL_GPL(hid_debug_event);


void hid_dump_report(struct hid_device *hid, int type, u8 *data,
		int size)
{
	struct hid_report_enum *report_enum;
	char *buf;
	unsigned int i;

	buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);

	if (!buf)
		return;

	report_enum = hid->report_enum + type;

	/* dump the report */
	snprintf(buf, HID_DEBUG_BUFSIZE - 1,
			"\nreport (size %u) (%snumbered) = ", size,
			report_enum->numbered ? "" : "un");
	hid_debug_event(hid, buf);

	for (i = 0; i < size; i++) {
		snprintf(buf, HID_DEBUG_BUFSIZE - 1,
				" %02x", data[i]);
		hid_debug_event(hid, buf);
	}
	hid_debug_event(hid, "\n");
	kfree(buf);
}
EXPORT_SYMBOL_GPL(hid_dump_report);

void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 value)
void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 value)
{
{
	char *buf;
	char *buf;
@@ -960,7 +992,9 @@ static int hid_debug_events_open(struct inode *inode, struct file *file)
	file->private_data = list;
	file->private_data = list;
	mutex_init(&list->read_mutex);
	mutex_init(&list->read_mutex);


	mutex_lock(&list->hdev->debug_list_lock);
	list_add_tail(&list->node, &list->hdev->debug_list);
	list_add_tail(&list->node, &list->hdev->debug_list);
	mutex_unlock(&list->hdev->debug_list_lock);


out:
out:
	return err;
	return err;
@@ -1055,7 +1089,9 @@ static int hid_debug_events_release(struct inode *inode, struct file *file)
{
{
	struct hid_debug_list *list = file->private_data;
	struct hid_debug_list *list = file->private_data;


	mutex_lock(&list->hdev->debug_list_lock);
	list_del(&list->node);
	list_del(&list->node);
	mutex_unlock(&list->hdev->debug_list_lock);
	kfree(list->hid_debug_buf);
	kfree(list->hid_debug_buf);
	kfree(list);
	kfree(list);


Loading