diff options
author | Jiri Kosina <jkosina@suse.cz> | 2007-01-29 06:44:41 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2007-01-30 09:05:27 -0500 |
commit | 76398f9667e8369023ed5f4847fb59e9da8b6968 (patch) | |
tree | bcb37fe18e6b1ec3b9b79c4ac9eb015b199d0c15 | |
parent | 8eda232e226b97c8f2fcbc5f672135247c1ee348 (diff) |
HID: fix pb_fnmode and move it to generic HID
The apple powerbook people are used to switch the pb_fnmode
setting at runtime through writing to sysfs, altering the
module parameter value. This was broken for them in 2.6.20-rc1
when generic HID layer was introduced, as the pb_fnmode flag
was made per-hiddevice, instead of global variable.
This patch moves the pb_fnmode module parameter from usbhid module
to hid module, but apart from that retains backward compatibility
with respect to changing the mode through sysfs.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-input.c | 11 | ||||
-rw-r--r-- | drivers/usb/input/hid-core.c | 9 | ||||
-rw-r--r-- | include/linux/hid.h | 1 |
3 files changed, 8 insertions, 13 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 981fcf01d41b..c7a6833f6821 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -35,6 +35,11 @@ | |||
35 | 35 | ||
36 | #include <linux/hid.h> | 36 | #include <linux/hid.h> |
37 | 37 | ||
38 | static int hid_pb_fnmode = 1; | ||
39 | module_param_named(pb_fnmode, hid_pb_fnmode, int, 0644); | ||
40 | MODULE_PARM_DESC(pb_fnmode, | ||
41 | "Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)"); | ||
42 | |||
38 | #define unk KEY_UNKNOWN | 43 | #define unk KEY_UNKNOWN |
39 | 44 | ||
40 | static const unsigned char hid_keyboard[256] = { | 45 | static const unsigned char hid_keyboard[256] = { |
@@ -154,7 +159,7 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, | |||
154 | return 1; | 159 | return 1; |
155 | } | 160 | } |
156 | 161 | ||
157 | if (hid->pb_fnmode) { | 162 | if (hid_pb_fnmode) { |
158 | int do_translate; | 163 | int do_translate; |
159 | 164 | ||
160 | trans = find_translation(powerbook_fn_keys, usage->code); | 165 | trans = find_translation(powerbook_fn_keys, usage->code); |
@@ -163,8 +168,8 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, | |||
163 | do_translate = 1; | 168 | do_translate = 1; |
164 | else if (trans->flags & POWERBOOK_FLAG_FKEY) | 169 | else if (trans->flags & POWERBOOK_FLAG_FKEY) |
165 | do_translate = | 170 | do_translate = |
166 | (hid->pb_fnmode == 2 && (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) || | 171 | (hid_pb_fnmode == 2 && (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) || |
167 | (hid->pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)); | 172 | (hid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)); |
168 | else | 173 | else |
169 | do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON); | 174 | do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON); |
170 | 175 | ||
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index b86480457a2c..c6c9e72e5fd9 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -56,11 +56,6 @@ static unsigned int hid_mousepoll_interval; | |||
56 | module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); | 56 | module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); |
57 | MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); | 57 | MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); |
58 | 58 | ||
59 | static int usbhid_pb_fnmode = 1; | ||
60 | module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644); | ||
61 | MODULE_PARM_DESC(pb_fnmode, | ||
62 | "Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)"); | ||
63 | |||
64 | /* | 59 | /* |
65 | * Input submission and I/O error handler. | 60 | * Input submission and I/O error handler. |
66 | */ | 61 | */ |
@@ -1246,10 +1241,6 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1246 | hid->hiddev_hid_event = hiddev_hid_event; | 1241 | hid->hiddev_hid_event = hiddev_hid_event; |
1247 | hid->hiddev_report_event = hiddev_report_event; | 1242 | hid->hiddev_report_event = hiddev_report_event; |
1248 | #endif | 1243 | #endif |
1249 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | ||
1250 | hid->pb_fnmode = usbhid_pb_fnmode; | ||
1251 | #endif | ||
1252 | |||
1253 | return hid; | 1244 | return hid; |
1254 | 1245 | ||
1255 | fail: | 1246 | fail: |
diff --git a/include/linux/hid.h b/include/linux/hid.h index 770120add15a..342b4e639acb 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -438,7 +438,6 @@ struct hid_device { /* device report descriptor */ | |||
438 | struct hid_usage *, __s32); | 438 | struct hid_usage *, __s32); |
439 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 439 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
440 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | 440 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK |
441 | unsigned int pb_fnmode; | ||
442 | unsigned long pb_pressed_fn[NBITS(KEY_MAX)]; | 441 | unsigned long pb_pressed_fn[NBITS(KEY_MAX)]; |
443 | unsigned long pb_pressed_numlock[NBITS(KEY_MAX)]; | 442 | unsigned long pb_pressed_numlock[NBITS(KEY_MAX)]; |
444 | #endif | 443 | #endif |