Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: completely remove apple mightymouse from blacklist
  HID: support larger reports than 64 bytes in hiddev
  HID: local function should be static
  HID: ignore Philips IEEE802.15.4 RF Dongle
  HID: ignore all recent SoundGraph iMON devices
  HID: fix memory leak on error patch in debug code
  HID: fix overrun in quirks initialization
  HID: Drop NULL test on list_entry result
  HID: driver for Twinhan USB 6253:0100 remote control
  HID: adding __init/__exit macros to module init/exit functions
  HID: add rumble support for Thrustmaster Dual Trigger 3-in-1
  HID: ntrig tool separation and pen usages
  HID: Avoid double spin_lock_init on usbhid->lock
  HID: add force feedback support for Logitech WingMan Formula Force GP
  HID: Support new variants of Samsung USB IR receiver (0419:0001)
  HID: fix memory leak on error path in debug code
  HID: fix debugfs build with !CONFIG_DEBUG_FS
  HID: use debugfs for events/reports dumping
  HID: use debugfs for report dumping descriptor
  • Loading branch information
Linus Torvalds committed Sep 15, 2009
2 parents 355bbd8 + 8123e8f commit 5489375
Show file tree
Hide file tree
Showing 37 changed files with 755 additions and 232 deletions.
29 changes: 11 additions & 18 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,6 @@ config HID

If unsure, say Y.

config HID_DEBUG
bool "HID debugging support"
default y
depends on HID
---help---
This option lets the HID layer output diagnostics about its internal
state, resolve HID usages, dump HID fields, etc. Individual HID drivers
use this debugging facility to output information about individual HID
devices, etc.

This feature is useful for those who are either debugging the HID parser
or any HID hardware device.

If unsure, say Y.

config HIDRAW
bool "/dev/hidraw raw HID device support"
depends on HID
Expand Down Expand Up @@ -152,6 +137,13 @@ config HID_GYRATION
---help---
Support for Gyration remote control.

config HID_TWINHAN
tristate "Twinhan" if EMBEDDED
depends on USB_HID
default !EMBEDDED
---help---
Support for Twinhan IR remote control.

config HID_KENSINGTON
tristate "Kensington" if EMBEDDED
depends on USB_HID
Expand All @@ -176,6 +168,7 @@ config LOGITECH_FF
- Logitech WingMan Cordless RumblePad 2
- Logitech WingMan Force 3D
- Logitech Formula Force EX
- Logitech WingMan Formula Force GP
- Logitech MOMO Force wheel

and if you want to enable force feedback for them.
Expand Down Expand Up @@ -314,9 +307,9 @@ config THRUSTMASTER_FF
depends on HID_THRUSTMASTER
select INPUT_FF_MEMLESS
---help---
Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel and
want to enable force feedback support for it.
Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or 3,
a THRUSTMASTER Dual Trigger 3-in-1 or a THRUSTMASTER Ferrari GT
Rumble Force or Force Feedback Wheel.

config HID_WACOM
tristate "Wacom Bluetooth devices support" if EMBEDDED
Expand Down
6 changes: 5 additions & 1 deletion drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
#
hid-objs := hid-core.o hid-input.o

ifdef CONFIG_DEBUG_FS
hid-objs += hid-debug.o
endif

obj-$(CONFIG_HID) += hid.o

hid-$(CONFIG_HID_DEBUG) += hid-debug.o
hid-$(CONFIG_HIDRAW) += hidraw.o

hid-logitech-objs := hid-lg.o
Expand Down Expand Up @@ -40,6 +43,7 @@ obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o
obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o
obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o
obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o
obj-$(CONFIG_HID_WACOM) += hid-wacom.o

Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-a4tech.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ static struct hid_driver a4_driver = {
.remove = a4_remove,
};

static int a4_init(void)
static int __init a4_init(void)
{
return hid_register_driver(&a4_driver);
}

static void a4_exit(void)
static void __exit a4_exit(void)
{
hid_unregister_driver(&a4_driver);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ static struct hid_driver apple_driver = {
.input_mapped = apple_input_mapped,
};

static int apple_init(void)
static int __init apple_init(void)
{
int ret;

Expand All @@ -462,7 +462,7 @@ static int apple_init(void)
return ret;
}

static void apple_exit(void)
static void __exit apple_exit(void)
{
hid_unregister_driver(&apple_driver);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-belkin.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ static struct hid_driver belkin_driver = {
.probe = belkin_probe,
};

static int belkin_init(void)
static int __init belkin_init(void)
{
return hid_register_driver(&belkin_driver);
}

static void belkin_exit(void)
static void __exit belkin_exit(void)
{
hid_unregister_driver(&belkin_driver);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-cherry.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ static struct hid_driver ch_driver = {
.input_mapping = ch_input_mapping,
};

static int ch_init(void)
static int __init ch_init(void)
{
return hid_register_driver(&ch_driver);
}

static void ch_exit(void)
static void __exit ch_exit(void)
{
hid_unregister_driver(&ch_driver);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-chicony.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ static struct hid_driver ch_driver = {
.input_mapping = ch_input_mapping,
};

static int ch_init(void)
static int __init ch_init(void)
{
return hid_register_driver(&ch_driver);
}

static void ch_exit(void)
static void __exit ch_exit(void)
{
hid_unregister_driver(&ch_driver);
}
Expand Down
71 changes: 53 additions & 18 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@
#define DRIVER_DESC "HID core driver"
#define DRIVER_LICENSE "GPL"

#ifdef CONFIG_HID_DEBUG
int hid_debug = 0;
module_param_named(debug, hid_debug, int, 0600);
MODULE_PARM_DESC(debug, "HID debugging (0=off, 1=probing info, 2=continuous data dumping)");
MODULE_PARM_DESC(debug, "toggle HID debugging messages");
EXPORT_SYMBOL_GPL(hid_debug);
#endif

/*
* Register a new report for a device.
Expand Down Expand Up @@ -861,7 +859,7 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field,
struct hid_driver *hdrv = hid->driver;
int ret;

hid_dump_input(usage, value);
hid_dump_input(hid, usage, value);

if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
ret = hdrv->event(hid, field, usage, value);
Expand Down Expand Up @@ -983,11 +981,10 @@ int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
{
unsigned size = field->report_size;

hid_dump_input(field->usage + offset, value);
hid_dump_input(field->report->device, field->usage + offset, value);

if (offset >= field->report_count) {
dbg_hid("offset (%d) exceeds report_count (%d)\n", offset, field->report_count);
hid_dump_field(field, 8);
return -1;
}
if (field->logical_minimum < 0) {
Expand Down Expand Up @@ -1078,6 +1075,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
struct hid_report_enum *report_enum;
struct hid_driver *hdrv;
struct hid_report *report;
char *buf;
unsigned int i;
int ret;

Expand All @@ -1091,18 +1089,38 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
return -1;
}

dbg_hid("report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un");
buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE,
interrupt ? GFP_ATOMIC : GFP_KERNEL);

if (!buf) {
report = hid_get_report(report_enum, data);
goto nomem;
}

snprintf(buf, HID_DEBUG_BUFSIZE - 1,
"\nreport (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un");
hid_debug_event(hid, buf);

report = hid_get_report(report_enum, data);
if (!report)
if (!report) {
kfree(buf);
return -1;
}

/* dump the report */
dbg_hid("report %d (size %u) = ", report->id, size);
for (i = 0; i < size; i++)
dbg_hid_line(" %02x", data[i]);
dbg_hid_line("\n");
snprintf(buf, HID_DEBUG_BUFSIZE - 1,
"report %d (size %u) = ", report->id, size);
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:
if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
ret = hdrv->raw_event(hid, report, data, size);
if (ret != 0)
Expand Down Expand Up @@ -1292,6 +1310,7 @@ static const struct hid_device_id hid_blacklist[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
Expand All @@ -1311,15 +1330,17 @@ static const struct hid_device_id hid_blacklist[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324) },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
{ 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_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },

{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
{ }
};
Expand Down Expand Up @@ -1622,12 +1643,8 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD4) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
Expand Down Expand Up @@ -1694,6 +1711,11 @@ static bool hid_ignore(struct hid_device *hdev)
hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST)
return true;
break;
case USB_VENDOR_ID_SOUNDGRAPH:
if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST &&
hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST)
return true;
break;
}

if (hdev->type == HID_TYPE_USBMOUSE &&
Expand Down Expand Up @@ -1725,6 +1747,8 @@ int hid_add_device(struct hid_device *hdev)
if (!ret)
hdev->status |= HID_STAT_ADDED;

hid_debug_register(hdev, dev_name(&hdev->dev));

return ret;
}
EXPORT_SYMBOL_GPL(hid_add_device);
Expand Down Expand Up @@ -1761,6 +1785,9 @@ struct hid_device *hid_allocate_device(void)
for (i = 0; i < HID_REPORT_TYPES; i++)
INIT_LIST_HEAD(&hdev->report_enum[i].report_list);

init_waitqueue_head(&hdev->debug_wait);
INIT_LIST_HEAD(&hdev->debug_list);

return hdev;
err:
put_device(&hdev->dev);
Expand All @@ -1772,6 +1799,7 @@ static void hid_remove_device(struct hid_device *hdev)
{
if (hdev->status & HID_STAT_ADDED) {
device_del(&hdev->dev);
hid_debug_unregister(hdev);
hdev->status &= ~HID_STAT_ADDED;
}
}
Expand Down Expand Up @@ -1847,6 +1875,10 @@ static int __init hid_init(void)
{
int ret;

if (hid_debug)
printk(KERN_WARNING "HID: hid_debug is now used solely for parser and driver debugging.\n"
"HID: debugfs is now used for inspecting the device (report descriptor, reports)\n");

ret = bus_register(&hid_bus_type);
if (ret) {
printk(KERN_ERR "HID: can't register hid bus\n");
Expand All @@ -1857,6 +1889,8 @@ static int __init hid_init(void)
if (ret)
goto err_bus;

hid_debug_init();

return 0;
err_bus:
bus_unregister(&hid_bus_type);
Expand All @@ -1866,6 +1900,7 @@ static int __init hid_init(void)

static void __exit hid_exit(void)
{
hid_debug_exit();
hidraw_exit();
bus_unregister(&hid_bus_type);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-cypress.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ static struct hid_driver cp_driver = {
.probe = cp_probe,
};

static int cp_init(void)
static int __init cp_init(void)
{
return hid_register_driver(&cp_driver);
}

static void cp_exit(void)
static void __exit cp_exit(void)
{
hid_unregister_driver(&cp_driver);
}
Expand Down
Loading

0 comments on commit 5489375

Please sign in to comment.