[PATCH] Generic HID layer - pb_fnmode
authorJiri Kosina <jkosina@suse.cz>
Fri, 8 Dec 2006 17:41:22 +0000 (18:41 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Dec 2006 18:43:19 +0000 (10:43 -0800)
pb_fnmode parameter has to be passed to usbhid, both for compatibility reasons
and also because it logically belongs there.

Also removes empty hid-input.c file in drivers/usb/input.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

drivers/hid/hid-input.c
drivers/usb/input/hid-core.c
drivers/usb/input/hid-input.c [deleted file]
include/linux/hid.h

index e542ef9..14cdf09 100644 (file)
@@ -128,12 +128,6 @@ static struct hidinput_key_translation powerbook_iso_keyboard[] = {
        { }
 };
 
-
-static int usbhid_pb_fnmode = 1;
-module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
-MODULE_PARM_DESC(pb_fnmode,
-               "Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)");
-
 static struct hidinput_key_translation *find_translation(struct hidinput_key_translation *table, u16 from)
 {
        struct hidinput_key_translation *trans;
@@ -160,7 +154,7 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
                return 1;
        }
 
-       if (usbhid_pb_fnmode) {
+       if (hid->pb_fnmode) {
                int do_translate;
 
                trans = find_translation(powerbook_fn_keys, usage->code);
@@ -169,8 +163,8 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
                                do_translate = 1;
                        else if (trans->flags & POWERBOOK_FLAG_FKEY)
                                do_translate =
-                                       (usbhid_pb_fnmode == 2 &&  (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
-                                       (usbhid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
+                                       (hid->pb_fnmode == 2 &&  (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
+                                       (hid->pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
                        else
                                do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
 
index a20ff61..89fa688 100644 (file)
@@ -56,6 +56,11 @@ static unsigned int hid_mousepoll_interval;
 module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);
 MODULE_PARM_DESC(mousepoll, "Polling interval of mice");
 
+static int usbhid_pb_fnmode = 1;
+module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
+MODULE_PARM_DESC(pb_fnmode,
+               "Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)");
+
 /*
  * Input submission and I/O error handler.
  */
@@ -1232,6 +1237,9 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
        hid->hiddev_hid_event = hiddev_hid_event;
        hid->hiddev_report_event = hiddev_report_event;
 #endif
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+       hid->pb_fnmode = usbhid_pb_fnmode;
+#endif
 
        return hid;
 
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
deleted file mode 100644 (file)
index 8756eb3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * $Id: hid-input.c,v 1.2 2002/04/23 00:59:25 rdamazio Exp $
- *
- *  Copyright (c) 2000-2001 Vojtech Pavlik
- *
- *  USB HID to Linux Input mapping
- *
- */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
- * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
- */
-
-
index 342b4e6..770120a 100644 (file)
@@ -438,6 +438,7 @@ struct hid_device {                                                 /* device report descriptor */
                                  struct hid_usage *, __s32);
        void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
 #ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+       unsigned int  pb_fnmode;
        unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
        unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
 #endif