Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68674
b: refs/heads/master
c: efc493f
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Kosina committed Oct 14, 2007
1 parent bc51a27 commit e475861
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 313 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb6c8d8fa9b5587eea18078ce0bcf6bb2905789f
refs/heads/master: efc493f9d5463d933a64a2758fbe6d9bb8300cbb
40 changes: 20 additions & 20 deletions trunk/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;
const char *description;
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);

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

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) {
static const char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" };
static const char *units[5][8] = {
char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" };
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 ? "NoPreferredState " : "");
printk("%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPrefferedState " : "");
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 const char *table[] = {"INPUT", "OUTPUT", "FEATURE"};
static 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(KERN_DEBUG "hid-debug: input ");
printk("hid-debug: input ");
hid_resolv_usage(usage->hid);
printk(" = %d\n", value);
}
EXPORT_SYMBOL_GPL(hid_dump_input);

static const char *events[EV_MAX + 1] = {
static 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 const char *events[EV_MAX + 1] = {
[EV_FF_STATUS] = "ForceFeedbackStatus",
};

static const char *syncs[2] = {
static char *syncs[2] = {
[SYN_REPORT] = "Report", [SYN_CONFIG] = "Config",
};
static const char *keys[KEY_MAX + 1] = {
static 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,8 +697,7 @@ static const 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_SPELLCHECK] = "SpellCheck",
[KEY_LOGOFF] = "Logoff",
[KEY_DOCUMENTS] = "Documents",
[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 @@ -716,15 +715,15 @@ static const char *keys[KEY_MAX + 1] = {
[KEY_SWITCHVIDEOMODE] = "SwitchVideoMode",
};

static const char *relatives[REL_MAX + 1] = {
static 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 const char *absolutes[ABS_MAX + 1] = {
static 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 @@ -740,29 +739,29 @@ static const char *absolutes[ABS_MAX + 1] = {
[ABS_VOLUME] = "Volume", [ABS_MISC] = "Misc",
};

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

static const char *leds[LED_MAX + 1] = {
static 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 const char *repeats[REP_MAX + 1] = {
static char *repeats[REP_MAX + 1] = {
[REP_DELAY] = "Delay", [REP_PERIOD] = "Period"
};

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

static const char **names[EV_MAX + 1] = {
static 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 @@ -778,3 +777,4 @@ void hid_resolv_event(__u8 type, __u16 code) {
names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
}
EXPORT_SYMBOL_GPL(hid_resolv_event);

92 changes: 9 additions & 83 deletions trunk/drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static const unsigned char hid_keyboard[256] = {
115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk,
122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
unk,unk,unk,unk,unk,unk,179,180,unk,unk,unk,unk,unk,unk,unk,unk,
unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
Expand Down Expand Up @@ -86,10 +86,6 @@ static const struct {
#define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0)
#define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0)

/* hardware needing special handling due to colliding MSVENDOR page usages */
#define IS_CHICONY_TACTICAL_PAD(x) (x->vendor == 0x04f2 && device->product == 0x0418)
#define IS_MS_KB(x) (x->vendor == 0x045e && (x->product == 0x00db || x->product == 0x00f9))

#ifdef CONFIG_USB_HIDINPUT_POWERBOOK

struct hidinput_key_translation {
Expand Down Expand Up @@ -299,7 +295,7 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
{
struct hid_device *hid = dev->private;
struct hid_usage *usage;

usage = hidinput_find_key(hid, scancode, 0);
if (usage) {
*keycode = usage->code;
Expand All @@ -314,26 +310,26 @@ static int hidinput_setkeycode(struct input_dev *dev, int scancode,
struct hid_device *hid = dev->private;
struct hid_usage *usage;
int old_keycode;

if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;

usage = hidinput_find_key(hid, scancode, 0);
if (usage) {
old_keycode = usage->code;
usage->code = keycode;

clear_bit(old_keycode, dev->keybit);
set_bit(usage->code, dev->keybit);
dbg_hid(KERN_DEBUG "Assigned keycode %d to HID usage code %x\n", keycode, scancode);
/* Set the keybit for the old keycode if the old keycode is used
* by another key */
if (hidinput_find_key (hid, 0, old_keycode))
set_bit(old_keycode, dev->keybit);

return 0;
}

return -EINVAL;
}

Expand All @@ -355,13 +351,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
if (field->flags & HID_MAIN_ITEM_CONSTANT)
goto ignore;

/* only LED usages are supported in output fields */
if (field->report_type == HID_OUTPUT_REPORT &&
(usage->hid & HID_USAGE_PAGE) != HID_UP_LED) {
dbg_hid_line(" [non-LED output field] ");
goto ignore;
}

switch (usage->hid & HID_USAGE_PAGE) {

case HID_UP_UNDEFINED:
Expand Down Expand Up @@ -606,7 +595,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x0f6: map_key_clear(KEY_NEXT); break;
case 0x0fa: map_key_clear(KEY_BACK); break;

case 0x182: map_key_clear(KEY_BOOKMARKS); break;
case 0x183: map_key_clear(KEY_CONFIG); break;
case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
case 0x185: map_key_clear(KEY_EDITOR); break;
Expand All @@ -623,13 +611,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x192: map_key_clear(KEY_CALC); break;
case 0x194: map_key_clear(KEY_FILE); break;
case 0x196: map_key_clear(KEY_WWW); break;
case 0x19c: map_key_clear(KEY_LOGOFF); break;
case 0x19e: map_key_clear(KEY_COFFEE); break;
case 0x1a6: map_key_clear(KEY_HELP); break;
case 0x1a7: map_key_clear(KEY_DOCUMENTS); break;
case 0x1ab: map_key_clear(KEY_SPELLCHECK); break;
case 0x1b6: map_key_clear(KEY_MEDIA); break;
case 0x1b7: map_key_clear(KEY_SOUND); break;
case 0x1bc: map_key_clear(KEY_MESSENGER); break;
case 0x1bd: map_key_clear(KEY_INFO); break;
case 0x201: map_key_clear(KEY_NEW); break;
Expand Down Expand Up @@ -736,15 +720,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel

case HID_UP_MSVENDOR:

/* Unfortunately, there are multiple devices which
* emit usages from MSVENDOR page that require different
* handling. If this list grows too much in the future,
* more general handling will have to be introduced here
* (i.e. another blacklist).
*/

/* Chicony Chicony KU-0418 tactical pad */
if (IS_CHICONY_TACTICAL_PAD(device)) {
/* special case - Chicony Chicony KU-0418 tactical pad */
if (device->vendor == 0x04f2 && device->product == 0x0418) {
set_bit(EV_REP, input->evbit);
switch(usage->hid & HID_USAGE) {
case 0xff01: map_key_clear(BTN_1); break;
Expand All @@ -760,26 +737,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0xff0b: map_key_clear(BTN_B); break;
default: goto ignore;
}

/* Microsoft Natural Ergonomic Keyboard 4000 */
} else if (IS_MS_KB(device)) {
switch(usage->hid & HID_USAGE) {
case 0xfd06:
map_key_clear(KEY_CHAT);
break;
case 0xfd07:
map_key_clear(KEY_PHONE);
break;
case 0xff05:
set_bit(EV_REP, input->evbit);
map_key_clear(KEY_F13);
set_bit(KEY_F14, input->keybit);
set_bit(KEY_F15, input->keybit);
set_bit(KEY_F16, input->keybit);
set_bit(KEY_F17, input->keybit);
set_bit(KEY_F18, input->keybit);
default: goto ignore;
}
} else {
goto ignore;
}
Expand Down Expand Up @@ -931,11 +888,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
set_bit(KEY_VOLUMEDOWN, input->keybit);
}

if (usage->type == EV_KEY) {
set_bit(EV_MSC, input->evbit);
set_bit(MSC_SCAN, input->mscbit);
}

hid_resolv_event(usage->type, usage->code);

dbg_hid_line("\n");
Expand Down Expand Up @@ -1039,29 +991,6 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
return;
}

/* Handling MS keyboards special buttons */
if (IS_MS_KB(hid) && usage->hid == (HID_UP_MSVENDOR | 0xff05)) {
int key = 0;
static int last_key = 0;
switch (value) {
case 0x01: key = KEY_F14; break;
case 0x02: key = KEY_F15; break;
case 0x04: key = KEY_F16; break;
case 0x08: key = KEY_F17; break;
case 0x10: key = KEY_F18; break;
default: break;
}
if (key) {
input_event(input, usage->type, key, 1);
last_key = key;
} else {
input_event(input, usage->type, last_key, 0);
}
}
/* report the usage code as scancode if the key status has changed */
if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value)
input_event(input, EV_MSC, MSC_SCAN, usage->hid);

input_event(input, usage->type, usage->code, value);

if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY))
Expand Down Expand Up @@ -1122,9 +1051,6 @@ int hidinput_connect(struct hid_device *hid)
int i, j, k;
int max_report_type = HID_OUTPUT_REPORT;

if (hid->quirks & HID_QUIRK_IGNORE_HIDINPUT)
return -1;

INIT_LIST_HEAD(&hid->inputs);

for (i = 0; i < hid->maxcollection; i++)
Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/hid/usbhid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,19 @@ config LOGITECH_FF
force feedback.

config PANTHERLORD_FF
bool "PantherLord/GreenAsia based device support"
bool "PantherLord USB/PS2 2in1 Adapter support"
depends on HID_FF
select INPUT_FF_MEMLESS if USB_HID
help
Say Y here if you have a PantherLord/GreenAsia based game controller
or adapter and want to enable force feedback support for it.
Say Y here if you have a PantherLord USB/PS2 2in1 Adapter and want
to enable force feedback support for it.

config THRUSTMASTER_FF
bool "ThrustMaster devices support (EXPERIMENTAL)"
bool "ThrustMaster FireStorm Dual Power 2 support (EXPERIMENTAL)"
depends on HID_FF && EXPERIMENTAL
select INPUT_FF_MEMLESS if USB_HID
help
Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel,
Say Y here if you have a THRUSTMASTER FireStore Dual Power 2,
and want to enable force feedback support for it.
Note: if you say N here, this device will still be supported, but without
force feedback.
Expand Down
Loading

0 comments on commit e475861

Please sign in to comment.