Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-20 Thread simon

> Whilst it is my intention to submit them, I might not achieve the 'very
> soon' part earliest I think would be mid next week as they still need
> a little tweaking.

I've sent in patches as 'RFC' as I think they still need a little more
testing and I'm tied up with work stuff for the next week or so (and won't
have access to the hardware).

If people can test/comment that would be great,
Simon

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-20 Thread simon

 Whilst it is my intention to submit them, I might not achieve the 'very
 soon' part earliest I think would be mid next week as they still need
 a little tweaking.

I've sent in patches as 'RFC' as I think they still need a little more
testing and I'm tied up with work stuff for the next week or so (and won't
have access to the hardware).

If people can test/comment that would be great,
Simon

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-14 Thread simon

> Simon mailed me his revised patchset which has the changes broken out into
> four separate patches and allows to switch "extended compatibility" modes
> on
> the fly through sysfs. I looked them over and I they seem fine to me. I
> suppose he'll submit them for review very soon.

Whilst it is my intention to submit them, I might not achieve the 'very
soon' part earliest I think would be mid next week as they still need
a little tweaking.
Simon

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-14 Thread simon

 Simon mailed me his revised patchset which has the changes broken out into
 four separate patches and allows to switch extended compatibility modes
 on
 the fly through sysfs. I looked them over and I they seem fine to me. I
 suppose he'll submit them for review very soon.

Whilst it is my intention to submit them, I might not achieve the 'very
soon' part earliest I think would be mid next week as they still need
a little tweaking.
Simon

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-12 Thread Michal Malý
On Tuesday 12 of August 2014 15:10:12 Jiri Kosina wrote:
> On Thu, 31 Jul 2014, si...@mungewell.org wrote:
> > > +#define LG4FF_MSW_MIN 0
> > > +#define LG4FF_MSW_NATIVE 0   /* Switch device to its native mode (if
> > > applicable) */
> > > +#define LG4FF_MSW_DONTSWITCH 1   /* Leave device in its current mode */
> > > +#define LG4FF_MSW_DFP 2  /* Switch device so that it emulates 
Driving
> > > Force Pro (only G25, G27, DFGT) */
> > > +#define LG4FF_MSW_G25 3  /* Switch device so that it emulates 
> > > G25 
(only
> > > G27) */
> > > +#define LG4FF_MSW_MAX 3
> > 
> > Just to let everyone know I am looking at this patch, and have emailed
> > Michal some questions on whether it covers all options for control.
> 
> Hi guys,
> 
> did you reach any kind of conclusion here?

Hi,

Simon mailed me his revised patchset which has the changes broken out into 
four separate patches and allows to switch "extended compatibility" modes on 
the fly through sysfs. I looked them over and I they seem fine to me. I 
suppose he'll submit them for review very soon.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-12 Thread Jiri Kosina
On Thu, 31 Jul 2014, si...@mungewell.org wrote:

> > +#define LG4FF_MSW_MIN 0
> > +#define LG4FF_MSW_NATIVE 0 /* Switch device to its native mode (if
> > applicable) */
> > +#define LG4FF_MSW_DONTSWITCH 1 /* Leave device in its current mode */
> > +#define LG4FF_MSW_DFP 2/* Switch device so that it emulates 
> > Driving
> > Force Pro (only G25, G27, DFGT) */
> > +#define LG4FF_MSW_G25 3/* Switch device so that it emulates 
> > G25 (only
> > G27) */
> > +#define LG4FF_MSW_MAX 3
> 
> Just to let everyone know I am looking at this patch, and have emailed
> Michal some questions on whether it covers all options for control.

Hi guys,

did you reach any kind of conclusion here?

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-12 Thread Jiri Kosina
On Thu, 31 Jul 2014, si...@mungewell.org wrote:

  +#define LG4FF_MSW_MIN 0
  +#define LG4FF_MSW_NATIVE 0 /* Switch device to its native mode (if
  applicable) */
  +#define LG4FF_MSW_DONTSWITCH 1 /* Leave device in its current mode */
  +#define LG4FF_MSW_DFP 2/* Switch device so that it emulates 
  Driving
  Force Pro (only G25, G27, DFGT) */
  +#define LG4FF_MSW_G25 3/* Switch device so that it emulates 
  G25 (only
  G27) */
  +#define LG4FF_MSW_MAX 3
 
 Just to let everyone know I am looking at this patch, and have emailed
 Michal some questions on whether it covers all options for control.

Hi guys,

did you reach any kind of conclusion here?

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-08-12 Thread Michal Malý
On Tuesday 12 of August 2014 15:10:12 Jiri Kosina wrote:
 On Thu, 31 Jul 2014, si...@mungewell.org wrote:
   +#define LG4FF_MSW_MIN 0
   +#define LG4FF_MSW_NATIVE 0   /* Switch device to its native mode (if
   applicable) */
   +#define LG4FF_MSW_DONTSWITCH 1   /* Leave device in its current mode */
   +#define LG4FF_MSW_DFP 2  /* Switch device so that it emulates 
Driving
   Force Pro (only G25, G27, DFGT) */
   +#define LG4FF_MSW_G25 3  /* Switch device so that it emulates 
   G25 
(only
   G27) */
   +#define LG4FF_MSW_MAX 3
  
  Just to let everyone know I am looking at this patch, and have emailed
  Michal some questions on whether it covers all options for control.
 
 Hi guys,
 
 did you reach any kind of conclusion here?

Hi,

Simon mailed me his revised patchset which has the changes broken out into 
four separate patches and allows to switch extended compatibility modes on 
the fly through sysfs. I looked them over and I they seem fine to me. I 
suppose he'll submit them for review very soon.

Michal
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-07-31 Thread simon

> +#define LG4FF_MSW_MIN 0
> +#define LG4FF_MSW_NATIVE 0   /* Switch device to its native mode (if
> applicable) */
> +#define LG4FF_MSW_DONTSWITCH 1   /* Leave device in its current mode */
> +#define LG4FF_MSW_DFP 2  /* Switch device so that it emulates 
> Driving
> Force Pro (only G25, G27, DFGT) */
> +#define LG4FF_MSW_G25 3  /* Switch device so that it emulates 
> G25 (only
> G27) */
> +#define LG4FF_MSW_MAX 3

Just to let everyone know I am looking at this patch, and have emailed
Michal some questions on whether it covers all options for control.

Cheers,
Simon.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-07-31 Thread Elias Vanderstuyft
On Wed, Jul 30, 2014 at 12:10 PM, Michal Malý
 wrote:
> Implement mode switching on Logitech gaming wheels accordingly to the 
> documentation
>
> Signed-off-by: Michal Malý 

Tested all lg4ff_switch_force_mode
modes (0, 1, 2, 3, default), on both:
- MOMO (Black) : PID 0xCA03
- Formula Vibration : PID 0xCA04

Behaviour didn't deviate from normal, which is as expected because
these devices don't use the native versus compatibility mode,
according to the documentation.
So I consider this patch successful for these devices:

Tested-by: Elias Vanderstuyft 

Elias
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-07-31 Thread Elias Vanderstuyft
On Wed, Jul 30, 2014 at 12:10 PM, Michal Malý
madcatxs...@devoid-pointer.net wrote:
 Implement mode switching on Logitech gaming wheels accordingly to the 
 documentation

 Signed-off-by: Michal Malý madcatxs...@devoid-pointer.net

Tested all lg4ff_switch_force_mode
modes (0, 1, 2, 3, default), on both:
- MOMO (Black) : PID 0xCA03
- Formula Vibration : PID 0xCA04

Behaviour didn't deviate from normal, which is as expected because
these devices don't use the native versus compatibility mode,
according to the documentation.
So I consider this patch successful for these devices:

Tested-by: Elias Vanderstuyft elias@gmail.com

Elias
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-07-31 Thread simon

 +#define LG4FF_MSW_MIN 0
 +#define LG4FF_MSW_NATIVE 0   /* Switch device to its native mode (if
 applicable) */
 +#define LG4FF_MSW_DONTSWITCH 1   /* Leave device in its current mode */
 +#define LG4FF_MSW_DFP 2  /* Switch device so that it emulates 
 Driving
 Force Pro (only G25, G27, DFGT) */
 +#define LG4FF_MSW_G25 3  /* Switch device so that it emulates 
 G25 (only
 G27) */
 +#define LG4FF_MSW_MAX 3

Just to let everyone know I am looking at this patch, and have emailed
Michal some questions on whether it covers all options for control.

Cheers,
Simon.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-07-30 Thread Michal Malý
Implement mode switching on Logitech gaming wheels accordingly to the 
documentation

Signed-off-by: Michal Malý 

---
 Logitech has recently released technical documentation which describes the
 protocol used by their force feedback gaming devices. The documentation
 describes the method by which the driver is supposed to recognize what
 model of the wheel is connected and switch it to so-called "native" mode.
 (https://opensource.logitech.com/opensource/index.php/Technical_Information)

 The patch implements this logic and provides an additional module parameter
 which can force the driver either not perform the switch at all or switch the
 wheel into an "extended compatibility" mode (not applicable for all wheels).
 If a wheel does not support the mode enforced by the parameter, it is left in
 its original mode. Default behavior is to switch all wheels into native mode.

 drivers/hid/hid-lg.c|  17 +++-
 drivers/hid/hid-lg.h|  11 ++-
 drivers/hid/hid-lg4ff.c | 224 +++-
 3 files changed, 188 insertions(+), 64 deletions(-)

diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index a976f48..dc0f2f1 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -334,6 +334,16 @@ static __u8 momo2_rdesc_fixed[] = {
 };
 
 /*
+ * Certain Logitech wheels provide various compatibililty modes
+ * for games that cannot handle their advanced features properly.
+ * This switch forces the wheel into a specific compatibililty
+ * instead of its native mode
+ */
+#ifdef CONFIG_LOGIWHEELS_FF
+static int lg4ff_switch_force_mode;
+#endif
+
+/*
  * Certain Logitech keyboards send in report #3 keys which are far
  * above the logical maximum described in descriptor. This extends
  * the original value of 0x28c of logical maximum to 0x104d
@@ -717,7 +727,7 @@ static int lg_probe(struct hid_device *hdev, const struct 
hid_device_id *id)
if (drv_data->quirks & LG_FF3)
lg3ff_init(hdev);
if (drv_data->quirks & LG_FF4)
-   lg4ff_init(hdev);
+   lg4ff_init(hdev, lg4ff_switch_force_mode);
 
return 0;
 err_free:
@@ -818,4 +828,9 @@ static struct hid_driver lg_driver = {
 };
 module_hid_driver(lg_driver);
 
+#ifdef CONFIG_LOGIWHEELS_FF
+module_param_named(lg4ff_switch_force_mode, lg4ff_switch_force_mode, int, 
S_IRUGO);
+MODULE_PARM_DESC(lg4ff_switch_force_mode, "Force gaming wheel into specific 
compatibililty mode (only certain devices)");
+#endif
+
 MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-lg.h b/drivers/hid/hid-lg.h
index 142ce3f..d070e479 100644
--- a/drivers/hid/hid-lg.h
+++ b/drivers/hid/hid-lg.h
@@ -25,14 +25,21 @@ static inline int lg3ff_init(struct hid_device *hdev) { 
return -1; }
 #endif
 
 #ifdef CONFIG_LOGIWHEELS_FF
+#define LG4FF_MSW_MIN 0
+#define LG4FF_MSW_NATIVE 0 /* Switch device to its native mode (if 
applicable) */
+#define LG4FF_MSW_DONTSWITCH 1 /* Leave device in its current mode */
+#define LG4FF_MSW_DFP 2/* Switch device so that it emulates 
Driving Force Pro (only G25, G27, DFGT) */
+#define LG4FF_MSW_G25 3/* Switch device so that it emulates 
G25 (only G27) */
+#define LG4FF_MSW_MAX 3
+
 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_init(struct hid_device *hdev, const int switch_force_mode);
 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_init(struct hid_device *hdev, const int 
switch_force_mode) { return -1; }
 static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; }
 #endif
 
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index cc2bd20..14692d9 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -32,21 +32,10 @@
 #include "hid-lg.h"
 #include "hid-ids.h"
 
-#define DFGT_REV_MAJ 0x13
-#define DFGT_REV_MIN 0x22
-#define DFGT2_REV_MIN 0x26
-#define DFP_REV_MAJ 0x11
-#define DFP_REV_MIN 0x06
-#define FFEX_REV_MAJ 0x21
-#define FFEX_REV_MIN 0x00
-#define G25_REV_MAJ 0x12
-#define G25_REV_MIN 0x22
-#define G27_REV_MAJ 0x12
-#define G27_REV_MIN 0x38
-#define G27_2_REV_MIN 0x39
-
 #define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
 
+#define LG4FF_FFEX_BCDDEVICE 0x2100
+
 static void hid_lg4ff_set_range_dfp(struct hid_device *hid, u16 range);
 static void hid_lg4ff_set_range_g25(struct hid_device *hid, u16 range);
 static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute 
*attr, char *buf);
@@ -73,6 +62,26 @@ static const signed short lg4ff_wheel_effects[] = {
   

PATCH hid: Implement mode switching on Logitech gaming wheels accordingly to the documentation

2014-07-30 Thread Michal Malý
Implement mode switching on Logitech gaming wheels accordingly to the 
documentation

Signed-off-by: Michal Malý madcatxs...@devoid-pointer.net

---
 Logitech has recently released technical documentation which describes the
 protocol used by their force feedback gaming devices. The documentation
 describes the method by which the driver is supposed to recognize what
 model of the wheel is connected and switch it to so-called native mode.
 (https://opensource.logitech.com/opensource/index.php/Technical_Information)

 The patch implements this logic and provides an additional module parameter
 which can force the driver either not perform the switch at all or switch the
 wheel into an extended compatibility mode (not applicable for all wheels).
 If a wheel does not support the mode enforced by the parameter, it is left in
 its original mode. Default behavior is to switch all wheels into native mode.

 drivers/hid/hid-lg.c|  17 +++-
 drivers/hid/hid-lg.h|  11 ++-
 drivers/hid/hid-lg4ff.c | 224 +++-
 3 files changed, 188 insertions(+), 64 deletions(-)

diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index a976f48..dc0f2f1 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -334,6 +334,16 @@ static __u8 momo2_rdesc_fixed[] = {
 };
 
 /*
+ * Certain Logitech wheels provide various compatibililty modes
+ * for games that cannot handle their advanced features properly.
+ * This switch forces the wheel into a specific compatibililty
+ * instead of its native mode
+ */
+#ifdef CONFIG_LOGIWHEELS_FF
+static int lg4ff_switch_force_mode;
+#endif
+
+/*
  * Certain Logitech keyboards send in report #3 keys which are far
  * above the logical maximum described in descriptor. This extends
  * the original value of 0x28c of logical maximum to 0x104d
@@ -717,7 +727,7 @@ static int lg_probe(struct hid_device *hdev, const struct 
hid_device_id *id)
if (drv_data-quirks  LG_FF3)
lg3ff_init(hdev);
if (drv_data-quirks  LG_FF4)
-   lg4ff_init(hdev);
+   lg4ff_init(hdev, lg4ff_switch_force_mode);
 
return 0;
 err_free:
@@ -818,4 +828,9 @@ static struct hid_driver lg_driver = {
 };
 module_hid_driver(lg_driver);
 
+#ifdef CONFIG_LOGIWHEELS_FF
+module_param_named(lg4ff_switch_force_mode, lg4ff_switch_force_mode, int, 
S_IRUGO);
+MODULE_PARM_DESC(lg4ff_switch_force_mode, Force gaming wheel into specific 
compatibililty mode (only certain devices));
+#endif
+
 MODULE_LICENSE(GPL);
diff --git a/drivers/hid/hid-lg.h b/drivers/hid/hid-lg.h
index 142ce3f..d070e479 100644
--- a/drivers/hid/hid-lg.h
+++ b/drivers/hid/hid-lg.h
@@ -25,14 +25,21 @@ static inline int lg3ff_init(struct hid_device *hdev) { 
return -1; }
 #endif
 
 #ifdef CONFIG_LOGIWHEELS_FF
+#define LG4FF_MSW_MIN 0
+#define LG4FF_MSW_NATIVE 0 /* Switch device to its native mode (if 
applicable) */
+#define LG4FF_MSW_DONTSWITCH 1 /* Leave device in its current mode */
+#define LG4FF_MSW_DFP 2/* Switch device so that it emulates 
Driving Force Pro (only G25, G27, DFGT) */
+#define LG4FF_MSW_G25 3/* Switch device so that it emulates 
G25 (only G27) */
+#define LG4FF_MSW_MAX 3
+
 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_init(struct hid_device *hdev, const int switch_force_mode);
 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_init(struct hid_device *hdev, const int 
switch_force_mode) { return -1; }
 static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; }
 #endif
 
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index cc2bd20..14692d9 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -32,21 +32,10 @@
 #include hid-lg.h
 #include hid-ids.h
 
-#define DFGT_REV_MAJ 0x13
-#define DFGT_REV_MIN 0x22
-#define DFGT2_REV_MIN 0x26
-#define DFP_REV_MAJ 0x11
-#define DFP_REV_MIN 0x06
-#define FFEX_REV_MAJ 0x21
-#define FFEX_REV_MIN 0x00
-#define G25_REV_MAJ 0x12
-#define G25_REV_MIN 0x22
-#define G27_REV_MAJ 0x12
-#define G27_REV_MIN 0x38
-#define G27_2_REV_MIN 0x39
-
 #define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
 
+#define LG4FF_FFEX_BCDDEVICE 0x2100
+
 static void hid_lg4ff_set_range_dfp(struct hid_device *hid, u16 range);
 static void hid_lg4ff_set_range_g25(struct hid_device *hid, u16 range);
 static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute 
*attr, char *buf);
@@ -73,6 +62,26 @@ static const signed short