aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Malý <madcatxster@devoid-pointer.net>2015-02-18 11:59:22 -0500
committerJiri Kosina <jkosina@suse.cz>2015-02-18 15:14:54 -0500
commita54dc7795efceb9a458457540c69450c995a2772 (patch)
tree7bd740caa1cb95b69a014f3630c24ca031a510ba
parentb96d23ec698fdc1fdf904e5547d9abb6354eef5c (diff)
HID: hid-lg4ff: Introduce a module parameter to disable automatic switch of compatibility mode
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>
-rw-r--r--drivers/hid/hid-lg.c7
-rw-r--r--drivers/hid/hid-lg.h12
-rw-r--r--drivers/hid/hid-lg4ff.c4
-rw-r--r--drivers/hid/hid-lg4ff.h18
4 files changed, 28 insertions, 13 deletions
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index f91ff145db9a..b86c18e651ed 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -27,6 +27,7 @@
27#include "usbhid/usbhid.h" 27#include "usbhid/usbhid.h"
28#include "hid-ids.h" 28#include "hid-ids.h"
29#include "hid-lg.h" 29#include "hid-lg.h"
30#include "hid-lg4ff.h"
30 31
31#define LG_RDESC 0x001 32#define LG_RDESC 0x001
32#define LG_BAD_RELATIVE_KEYS 0x002 33#define LG_BAD_RELATIVE_KEYS 0x002
@@ -818,4 +819,10 @@ static struct hid_driver lg_driver = {
818}; 819};
819module_hid_driver(lg_driver); 820module_hid_driver(lg_driver);
820 821
822#ifdef CONFIG_LOGIWHEELS_FF
823int lg4ff_no_autoswitch = 0;
824module_param_named(lg4ff_no_autoswitch, lg4ff_no_autoswitch, int, S_IRUGO);
825MODULE_PARM_DESC(lg4ff_no_autoswitch, "Do not switch multimode wheels to their native mode automatically");
826#endif
827
821MODULE_LICENSE("GPL"); 828MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-lg.h b/drivers/hid/hid-lg.h
index 142ce3f5f055..10dd8f024135 100644
--- a/drivers/hid/hid-lg.h
+++ b/drivers/hid/hid-lg.h
@@ -24,16 +24,4 @@ int lg3ff_init(struct hid_device *hdev);
24static inline int lg3ff_init(struct hid_device *hdev) { return -1; } 24static inline int lg3ff_init(struct hid_device *hdev) { return -1; }
25#endif 25#endif
26 26
27#ifdef CONFIG_LOGIWHEELS_FF
28int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
29 struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data);
30int lg4ff_init(struct hid_device *hdev);
31int lg4ff_deinit(struct hid_device *hdev);
32#else
33static inline int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
34 struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data) { return 0; }
35static inline int lg4ff_init(struct hid_device *hdev) { return -1; }
36static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; }
37#endif
38
39#endif 27#endif
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index a64a35ed291f..dd307724965f 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -30,6 +30,7 @@
30 30
31#include "usbhid/usbhid.h" 31#include "usbhid/usbhid.h"
32#include "hid-lg.h" 32#include "hid-lg.h"
33#include "hid-lg4ff.h"
33#include "hid-ids.h" 34#include "hid-ids.h"
34 35
35#define to_hid_device(pdev) container_of(pdev, struct hid_device, dev) 36#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
803 /* Switch from "Driving Force" mode to native mode automatically. 804 /* Switch from "Driving Force" mode to native mode automatically.
804 * Otherwise keep the wheel in its current mode */ 805 * Otherwise keep the wheel in its current mode */
805 if (reported_product_id == USB_DEVICE_ID_LOGITECH_WHEEL && 806 if (reported_product_id == USB_DEVICE_ID_LOGITECH_WHEEL &&
806 reported_product_id != *real_product_id) { 807 reported_product_id != *real_product_id &&
808 !lg4ff_no_autoswitch) {
807 const struct lg4ff_compat_mode_switch *s; 809 const struct lg4ff_compat_mode_switch *s;
808 810
809 switch (*real_product_id) { 811 switch (*real_product_id) {
diff --git a/drivers/hid/hid-lg4ff.h b/drivers/hid/hid-lg4ff.h
new file mode 100644
index 000000000000..5b6a5086c47f
--- /dev/null
+++ b/drivers/hid/hid-lg4ff.h
@@ -0,0 +1,18 @@
1#ifndef __HID_LG4FF_H
2#define __HID_LG4FF_H
3
4#ifdef CONFIG_LOGIWHEELS_FF
5extern int lg4ff_no_autoswitch; /* From hid-lg.c */
6
7int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
8 struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data);
9int lg4ff_init(struct hid_device *hdev);
10int lg4ff_deinit(struct hid_device *hdev);
11#else
12static inline int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
13 struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data) { return 0; }
14static inline int lg4ff_init(struct hid_device *hdev) { return -1; }
15static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; }
16#endif
17
18#endif