]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/hid/hid-input.c
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
[mirror_ubuntu-zesty-kernel.git] / drivers / hid / hid-input.c
Content-type: text/html ]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/hid/hid-input.c


500 - Internal Server Error

Malformed UTF-8 character (fatal) at (eval 6) line 1, <$fd> line 315.
CommitLineData
dde5845a
JK
1/*
2 * $Id: hid-input.c,v 1.2 2002/04/23 00:59:25 rdamazio Exp $
3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik
b55fd23c 5 * Copyright (c) 2006-2007 Jiri Kosina
dde5845a
JK
6 *
7 * HID to Linux Input mapping
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 * Should you need to contact me, the author, you can do so either by
26 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
27 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
28 */
29
30#include <linux/module.h>
31#include <linux/slab.h>
32#include <linux/kernel.h>
dde5845a 33
dde5845a 34#include <linux/hid.h>
c080d89a 35#include <linux/hid-debug.h>
dde5845a 36
81e1a875
MD
37static int hid_apple_fnmode = 1;
38module_param_named(pb_fnmode, hid_apple_fnmode, int, 0644);
76398f96 39MODULE_PARM_DESC(pb_fnmode,
81e1a875 40 "Mode of fn key on Apple keyboards (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)");
76398f96 41
dde5845a
JK
42#define unk KEY_UNKNOWN
43
44static const unsigned char hid_keyboard[256] = {
45 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
46 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3,
47 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26,
48 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64,
49 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106,
50 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71,
51 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190,
52 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113,
53 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk,
54 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
55 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
1fe8736d 56 unk,unk,unk,unk,unk,unk,179,180,unk,unk,unk,unk,unk,unk,unk,unk,
dde5845a
JK
57 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
58 unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,
59 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
60 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk
61};
62
5f9c464a
RD
63/* extended mapping for certain Logitech hardware (Logitech cordless desktop LX500) */
64#define LOGITECH_EXPANDED_KEYMAP_SIZE 80
65static int logitech_expanded_keymap[LOGITECH_EXPANDED_KEYMAP_SIZE] = {
66 0,216, 0,213,175,156, 0, 0, 0, 0,
67 144, 0, 0, 0, 0, 0, 0, 0, 0,212,
68 174,167,152,161,112, 0, 0, 0,154, 0,
69 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
70 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
71 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
72 0, 0, 0, 0, 0,183,184,185,186,187,
73 188,189,190,191,192,193,194, 0, 0, 0
74};
75
dde5845a
JK
76static const struct {
77 __s32 x;
78 __s32 y;
79} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
80
81#define map_abs(c) do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0)
82#define map_rel(c) do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0)
83#define map_key(c) do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0)
84#define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; max = LED_MAX; } while (0)
85
86#define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0)
87#define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0)
88
89#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
90
91struct hidinput_key_translation {
92 u16 from;
93 u16 to;
94 u8 flags;
95};
96
81e1a875 97#define APPLE_FLAG_FKEY 0x01
dde5845a 98
a45d82d1 99static struct hidinput_key_translation apple_fn_keys[] = {
5906a044 100 { KEY_BACKSPACE, KEY_DELETE },
07146648
MH
101 { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
102 { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
103