diff options
author | Michal Malý <madcatxster@devoid-pointer.net> | 2015-02-18 11:59:22 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-02-18 15:14:54 -0500 |
commit | a54dc7795efceb9a458457540c69450c995a2772 (patch) | |
tree | 7bd740caa1cb95b69a014f3630c24ca031a510ba | |
parent | b96d23ec698fdc1fdf904e5547d9abb6354eef5c (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.c | 7 | ||||
-rw-r--r-- | drivers/hid/hid-lg.h | 12 | ||||
-rw-r--r-- | drivers/hid/hid-lg4ff.c | 4 | ||||
-rw-r--r-- | drivers/hid/hid-lg4ff.h | 18 |
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 | }; |
819 | module_hid_driver(lg_driver); | 820 | module_hid_driver(lg_driver); |
820 | 821 | ||
822 | #ifdef CONFIG_LOGIWHEELS_FF | ||
823 | int lg4ff_no_autoswitch = 0; | ||
824 | module_param_named(lg4ff_no_autoswitch, lg4ff_no_autoswitch, int, S_IRUGO); | ||
825 | MODULE_PARM_DESC(lg4ff_no_autoswitch, "Do not switch multimode wheels to their native mode automatically"); | ||
826 | #endif | ||
827 | |||
821 | MODULE_LICENSE("GPL"); | 828 | MODULE_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); | |||
24 | static inline int lg3ff_init(struct hid_device *hdev) { return -1; } | 24 | static inline int lg3ff_init(struct hid_device *hdev) { return -1; } |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #ifdef CONFIG_LOGIWHEELS_FF | ||
28 | int 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); | ||
30 | int lg4ff_init(struct hid_device *hdev); | ||
31 | int lg4ff_deinit(struct hid_device *hdev); | ||
32 | #else | ||
33 | static 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; } | ||
35 | static inline int lg4ff_init(struct hid_device *hdev) { return -1; } | ||
36 | static 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 | ||
5 | extern int lg4ff_no_autoswitch; /* From hid-lg.c */ | ||
6 | |||
7 | int 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); | ||
9 | int lg4ff_init(struct hid_device *hdev); | ||
10 | int lg4ff_deinit(struct hid_device *hdev); | ||
11 | #else | ||
12 | static 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; } | ||
14 | static inline int lg4ff_init(struct hid_device *hdev) { return -1; } | ||
15 | static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; } | ||
16 | #endif | ||
17 | |||
18 | #endif | ||