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: (21 commits)
  HID: hidraw_connect() memleak fix
  HID: add hidraw interface
  USB HID: provide hook for hidraw write()
  HID: hiddev: Add 32bit ioctl compatibilty
  HID: Add GeneralTouch touchscreen to the blacklist
  HID: add support for Microsoft Wireless Laser Keyboard 6000
  Input: add KEY_LOGOFF
  USBHID: report descriptor fix for MacBook JIS keyboard
  HID: trivial fixes in hid-debug
  HID: fix input mapping for Microsoft Ergonomic Keyboard
  HID: use hid-plff driver for GreenAsia 0e8f:0003 devices
  USBHID: Add HID_QUIRK_NOGET for ELO Touch Screen 2700 display
  HID: enable hiddev for the SantaRosa MacBookPro IR receiver
  USBHID: add CM109 device to blacklist
  HID: Report usage codes of keys as EV_MSC scancode events
  HID: ignore all non-LED usages in output fields in hid-input
  HID: fix whitespace damage
  HID: add support for Thrustmaster FGT Force Feedback wheel
  HID: minimal autosuspend support for USB HID devices
  HID: add support for Microsoft Natural Ergonomic Keyboard 4000
  ...
  • Loading branch information
Linus Torvalds committed Oct 14, 2007
2 parents f248488 + d057fd4 commit 52d4e66
Show file tree
Hide file tree
Showing 16 changed files with 877 additions and 88 deletions.
19 changes: 19 additions & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@ config HID_DEBUG

If unsure, say N

config HIDRAW
bool "/dev/hidraw raw HID device support"
depends on HID
---help---
Say Y here if you want to support HID devices (from the USB
specification standpoint) that aren't strictly user interface
devices, like monitor controls and Uninterruptable Power Supplies.

This module supports these devices separately using a separate
event interface on /dev/hidraw.

There is also a /dev/hiddev configuration option in the USB HID
configuration menu. In comparison to hiddev, this device does not process
the hid events at all (no parsing, no lookups). This lets applications
to work on raw hid events when they want to, and avoid using transport-specific
userspace libhid/libusb libraries.

If unsure, say Y.

source "drivers/hid/usbhid/Kconfig"

endif # HID_SUPPORT
2 changes: 2 additions & 0 deletions drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
hid-objs := hid-core.o hid-input.o

obj-$(CONFIG_HID) += hid.o

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

obj-$(CONFIG_USB_HID) += usbhid/
obj-$(CONFIG_USB_MOUSE) += usbhid/
Expand Down
16 changes: 16 additions & 0 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/hid.h>
#include <linux/hiddev.h>
#include <linux/hid-debug.h>
#include <linux/hidraw.h>

/*
* Version Information
Expand Down Expand Up @@ -979,6 +980,8 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i

if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
hid->hiddev_report_event(hid, report);
if (hid->claimed & HID_CLAIMED_HIDRAW)
hidraw_report_event(hid, data, size);

for (n = 0; n < report->maxfield; n++)
hid_input_field(hid, report->field[n], data, interrupt);
Expand All @@ -990,5 +993,18 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
}
EXPORT_SYMBOL_GPL(hid_input_report);

static int __init hid_init(void)
{
return hidraw_init();
}

static void __exit hid_exit(void)
{
hidraw_exit();
}

module_init(hid_init);
module_exit(hid_exit);

MODULE_LICENSE(DRIVER_LICENSE);

40 changes: 20 additions & 20 deletions drivers/hid/hid-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
struct hid_usage_entry {
unsigned page;
unsigned usage;
char *description;
const char *description;
};

static const struct hid_usage_entry hid_usage_table[] = {
Expand Down Expand Up @@ -365,8 +365,8 @@ void hid_resolv_usage(unsigned usage) {
}
EXPORT_SYMBOL_GPL(hid_resolv_usage);

__inline__ static void tab(int n) {
while (n--) printk(" ");
static void tab(int n) {
printk(KERN_DEBUG "%*s", n, "");
}

void hid_dump_field(struct hid_field *field, int n) {
Expand Down Expand Up @@ -401,8 +401,8 @@ void hid_dump_field(struct hid_field *field, int n) {
tab(n); printk("Unit Exponent(%d)\n", field->unit_exponent);
}
if (field->unit) {
char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" };
char *units[5][8] = {
static const char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" };
static const char *units[5][8] = {
{ "None", "None", "None", "None", "None", "None", "None", "None" },
{ "None", "Centimeter", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" },
{ "None", "Radians", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" },
Expand Down Expand Up @@ -457,7 +457,7 @@ void hid_dump_field(struct hid_field *field, int n) {
printk("%s", HID_MAIN_ITEM_RELATIVE & j ? "Relative " : "Absolute ");
printk("%s", HID_MAIN_ITEM_WRAP & j ? "Wrap " : "");
printk("%s", HID_MAIN_ITEM_NONLINEAR & j ? "NonLinear " : "");
printk("%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPrefferedState " : "");
printk("%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPreferredState " : "");
printk("%s", HID_MAIN_ITEM_NULL_STATE & j ? "NullState " : "");
printk("%s", HID_MAIN_ITEM_VOLATILE & j ? "Volatile " : "");
printk("%s", HID_MAIN_ITEM_BUFFERED_BYTE & j ? "BufferedByte " : "");
Expand All @@ -470,7 +470,7 @@ void hid_dump_device(struct hid_device *device) {
struct hid_report *report;
struct list_head *list;
unsigned i,k;
static char *table[] = {"INPUT", "OUTPUT", "FEATURE"};
static const char *table[] = {"INPUT", "OUTPUT", "FEATURE"};

if (!hid_debug)
return;
Expand Down Expand Up @@ -501,13 +501,13 @@ void hid_dump_input(struct hid_usage *usage, __s32 value) {
if (!hid_debug)
return;

printk("hid-debug: input ");
printk(KERN_DEBUG "hid-debug: input ");
hid_resolv_usage(usage->hid);
printk(" = %d\n", value);
}
EXPORT_SYMBOL_GPL(hid_dump_input);

static char *events[EV_MAX + 1] = {
static const char *events[EV_MAX + 1] = {
[EV_SYN] = "Sync", [EV_KEY] = "Key",
[EV_REL] = "Relative", [EV_ABS] = "Absolute",
[EV_MSC] = "Misc", [EV_LED] = "LED",
Expand All @@ -516,10 +516,10 @@ static char *events[EV_MAX + 1] = {
[EV_FF_STATUS] = "ForceFeedbackStatus",
};

static char *syncs[2] = {
static const char *syncs[2] = {
[SYN_REPORT] = "Report", [SYN_CONFIG] = "Config",
};
static char *keys[KEY_MAX + 1] = {
static const char *keys[KEY_MAX + 1] = {
[KEY_RESERVED] = "Reserved", [KEY_ESC] = "Esc",
[KEY_1] = "1", [KEY_2] = "2",
[KEY_3] = "3", [KEY_4] = "4",
Expand Down Expand Up @@ -697,7 +697,8 @@ static char *keys[KEY_MAX + 1] = {
[KEY_DEL_LINE] = "DeleteLine",
[KEY_SEND] = "Send", [KEY_REPLY] = "Reply",
[KEY_FORWARDMAIL] = "ForwardMail", [KEY_SAVE] = "Save",
[KEY_DOCUMENTS] = "Documents",
[KEY_DOCUMENTS] = "Documents", [KEY_SPELLCHECK] = "SpellCheck",
[KEY_LOGOFF] = "Logoff",
[KEY_FN] = "Fn", [KEY_FN_ESC] = "Fn+ESC",
[KEY_FN_1] = "Fn+1", [KEY_FN_2] = "Fn+2",
[KEY_FN_B] = "Fn+B", [KEY_FN_D] = "Fn+D",
Expand All @@ -715,15 +716,15 @@ static char *keys[KEY_MAX + 1] = {
[KEY_SWITCHVIDEOMODE] = "SwitchVideoMode",
};

static char *relatives[REL_MAX + 1] = {
static const char *relatives[REL_MAX + 1] = {
[REL_X] = "X", [REL_Y] = "Y",
[REL_Z] = "Z", [REL_RX] = "Rx",
[REL_RY] = "Ry", [REL_RZ] = "Rz",
[REL_HWHEEL] = "HWheel", [REL_DIAL] = "Dial",
[REL_WHEEL] = "Wheel", [REL_MISC] = "Misc",
};

static char *absolutes[ABS_MAX + 1] = {
static const char *absolutes[ABS_MAX + 1] = {
[ABS_X] = "X", [ABS_Y] = "Y",
[ABS_Z] = "Z", [ABS_RX] = "Rx",
[ABS_RY] = "Ry", [ABS_RZ] = "Rz",
Expand All @@ -739,29 +740,29 @@ static char *absolutes[ABS_MAX + 1] = {
[ABS_VOLUME] = "Volume", [ABS_MISC] = "Misc",
};

static char *misc[MSC_MAX + 1] = {
static const char *misc[MSC_MAX + 1] = {
[MSC_SERIAL] = "Serial", [MSC_PULSELED] = "Pulseled",
[MSC_GESTURE] = "Gesture", [MSC_RAW] = "RawData"
};

static char *leds[LED_MAX + 1] = {
static const char *leds[LED_MAX + 1] = {
[LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock",
[LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose",
[LED_KANA] = "Kana", [LED_SLEEP] = "Sleep",
[LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute",
[LED_MISC] = "Misc",
};

static char *repeats[REP_MAX + 1] = {
static const char *repeats[REP_MAX + 1] = {
[REP_DELAY] = "Delay", [REP_PERIOD] = "Period"
};

static char *sounds[SND_MAX + 1] = {
static const char *sounds[SND_MAX + 1] = {
[SND_CLICK] = "Click", [SND_BELL] = "Bell",
[SND_TONE] = "Tone"
};

static char **names[EV_MAX + 1] = {
static const char **names[EV_MAX + 1] = {
[EV_SYN] = syncs, [EV_KEY] = keys,
[EV_REL] = relatives, [EV_ABS] = absolutes,
[EV_MSC] = misc, [EV_LED] = leds,
Expand All @@ -777,4 +778,3 @@ void hid_resolv_event(__u8 type, __u16 code) {
names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
}
EXPORT_SYMBOL_GPL(hid_resolv_event);

Loading

0 comments on commit 52d4e66

Please sign in to comment.