]> git.karo-electronics.de Git - linux-beck.git/commitdiff
HID: hid-lg4ff: Introduce a module parameter to disable automatic switch of compatibi...
authorMichal Malý <madcatxster@devoid-pointer.net>
Wed, 18 Feb 2015 16:59:22 +0000 (17:59 +0100)
committerJiri Kosina <jkosina@suse.cz>
Wed, 18 Feb 2015 20:14:54 +0000 (21:14 +0100)
Introduce a module parameter to disable automatic switch of Logitech gaming
wheels from compatibility to native mode. This only applies to multimode wheels.

Signed-off-by: Michal Malý <madcatxster@devoid-pointer.net>
Tested-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-lg.c
drivers/hid/hid-lg.h
drivers/hid/hid-lg4ff.c
drivers/hid/hid-lg4ff.h [new file with mode: 0644]

index f91ff145db9a0761ce487aa2b43aee1f2503af2f..b86c18e651ed361bedb2c1584f78c5b494df2ae7 100644 (file)
@@ -27,6 +27,7 @@
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 #include "hid-lg.h"
+#include "hid-lg4ff.h"
 
 #define LG_RDESC               0x001
 #define LG_BAD_RELATIVE_KEYS   0x002
@@ -818,4 +819,10 @@ static struct hid_driver lg_driver = {
 };
 module_hid_driver(lg_driver);
 
+#ifdef CONFIG_LOGIWHEELS_FF
+int lg4ff_no_autoswitch = 0;
+module_param_named(lg4ff_no_autoswitch, lg4ff_no_autoswitch, int, S_IRUGO);
+MODULE_PARM_DESC(lg4ff_no_autoswitch, "Do not switch multimode wheels to their native mode automatically");
+#endif
+
 MODULE_LICENSE("GPL");
index 142ce3f5f055f0c3d7b00e34cc91e9411eb06817..10dd8f0241352544b24bc057c861cc04415292ec 100644 (file)
@@ -24,16 +24,4 @@ int lg3ff_init(struct hid_device *hdev);
 static inline int lg3ff_init(struct hid_device *hdev) { return -1; }
 #endif
 
-#ifdef CONFIG_LOGIWHEELS_FF
-int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
-                            struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data);
-int lg4ff_init(struct hid_device *hdev);
-int lg4ff_deinit(struct hid_device *hdev);
-#else
-static inline int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
-                                          struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data) { return 0; }
-static inline int lg4ff_init(struct hid_device *hdev) { return -1; }
-static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; }
-#endif
-
 #endif
index a64a35ed291f5c8640241040b2c63e89164a290b..dd307724965f6d9c7b2ebf1eed0f5d808ba29c06 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "usbhid/usbhid.h"
 #include "hid-lg.h"
+#include "hid-lg4ff.h"
 #include "hid-ids.h"
 
 #define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
@@ -803,7 +804,8 @@ static int lg4ff_handle_multimode_wheel(struct hid_device *hid, u16 *real_produc
        /* Switch from "Driving Force" mode to native mode automatically.
         * Otherwise keep the wheel in its current mode */
        if (reported_product_id == USB_DEVICE_ID_LOGITECH_WHEEL &&
-           reported_product_id != *real_product_id) {
+           reported_product_id != *real_product_id &&
+           !lg4ff_no_autoswitch) {
                const struct lg4ff_compat_mode_switch *s;
 
                switch (*real_product_id) {
diff --git a/drivers/hid/hid-lg4ff.h b/drivers/hid/hid-lg4ff.h
new file mode 100644 (file)
index 0000000..5b6a508
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __HID_LG4FF_H
+#define __HID_LG4FF_H
+
+#ifdef CONFIG_LOGIWHEELS_FF
+extern int lg4ff_no_autoswitch; /* From hid-lg.c */
+
+int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
+                            struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data);
+int lg4ff_init(struct hid_device *hdev);
+int lg4ff_deinit(struct hid_device *hdev);
+#else
+static inline int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
+                                          struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data) { return 0; }
+static inline int lg4ff_init(struct hid_device *hdev) { return -1; }
+static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; }
+#endif
+
+#endif