diff mbox

[3/3] hid: Calibrate Logitech Driving Force axes

Message ID 1359837925-6383-3-git-send-email-sbarra.paul@gmail.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Paul Sbarra Feb. 2, 2013, 8:45 p.m. UTC
Conflicts:
	drivers/hid/hid-lg.c

Signed-off-by: Paul Sbarra <sbarra.paul@gmail.com>
---
 drivers/hid/hid-lg.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Comments

simon@mungewell.org Feb. 4, 2013, 1:03 a.m. UTC | #1
Hi Paul,
I think it is unwise to calibrated the 'Driving Force' wheel by adjusting
the report descriptor as it might just be your wheel at fault. Calibration
should be done either with jscal (or eqivilant) or 'in-game'.

In your more recent patch your calibration would be enforced on all wheels
with the USB ID 046d:c294, which is not appropriate.

One thing which might be distorting the values read is the default values
for 'fuzz' and 'flat', which are applied by the kernel.

Probably not the best/only way, but you can use the application
'G25_Manage' to do this...

https://github.com/VDrift/vdrift/tree/master/tools/G25manage

I think that we should work to ensure that these are set to 0 for all
logitech wheels (DFP already has something - although non-ideal). Perhaps
the 'mapped' callback can be used to zero flat/fuzz after the controls
have been mapped, without the need to know what the range is.

Simon.


> This patch should be used in favor of the previous.
>
> Signed-off-by: Paul Sbarra <sbarra.paul@gmail.com>
> ---
>  drivers/hid/hid-lg4ff.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
> index d7947c7..4b72029e 100644
> --- a/drivers/hid/hid-lg4ff.c
> +++ b/drivers/hid/hid-lg4ff.c
> @@ -43,6 +43,13 @@
>  #define G27_REV_MAJ 0x12
>  #define G27_REV_MIN 0x38
>
> +#define DF_X_MIN 45
> +#define DF_X_MAX 935
> +#define DF_ACCEL_PEDAL_MIN 30
> +#define DF_ACCEL_PEDAL_MAX 175
> +#define DF_BRAKE_PEDAL_MIN 70
> +#define DF_BRAKE_PEDAL_MAX 215
> +
>  #define DFP_X_MIN 0
>  #define DFP_X_MAX 16383
>  #define DFP_PEDAL_MIN 0
> @@ -600,6 +607,12 @@ int lg4ff_init(struct hid_device *hid)
>
>   /* Set default axes parameters */
>   switch (lg4ff_devices[i].product_id) {
> + case USB_DEVICE_ID_LOGITECH_WHEEL:
> + dbg_hid("Setting axes parameters for Driving Force\n");
> + input_set_abs_params(dev, ABS_X, DF_X_MIN, DF_X_MAX, 0, 0);
> + input_set_abs_params(dev, ABS_Y, DF_ACCEL_PEDAL_MIN, DF_ACCEL_PEDAL_MAX,
> 0, 0);
> + input_set_abs_params(dev, ABS_RZ, DF_BRAKE_PEDAL_MIN,
> DF_BRAKE_PEDAL_MAX,
> 0, 0);
> + break;
>   case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
>   dbg_hid("Setting axes parameters for Driving Force Pro\n");
>   input_set_abs_params(dev, ABS_X, DFP_X_MIN, DFP_X_MAX, 0, 0);
> --
> 1.8.1.1
>


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 4bc0e1b..6f2067f 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -60,16 +60,14 @@  static __u8 df_rdesc_fixed[] = {
 0xA1, 0x02,         /*      Collection (Logical),               */
 0x95, 0x01,         /*          Report Count (1),               */
 0x75, 0x0A,         /*          Report Size (10),               */
-0x14,               /*          Logical Minimum (0),            */
-0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),         */
-0x34,               /*          Physical Minimum (0),           */
-0x46, 0xFF, 0x03,   /*          Physical Maximum (1023),        */
+0x15, 45,           /*          Logical Minimum (45),           */
+0x26, 0xA7, 0x03,   /*          Logical Maximum (935),          */
 0x09, 0x30,         /*          Usage (X),                      */
 0x81, 0x02,         /*          Input (Variable),               */
 0x95, 0x0C,         /*          Report Count (12),              */
 0x75, 0x01,         /*          Report Size (1),                */
+0x14,               /*          Logical Minimum (0),            */
 0x25, 0x01,         /*          Logical Maximum (1),            */
-0x45, 0x01,         /*          Physical Maximum (1),           */
 0x05, 0x09,         /*          Usage (Buttons),                */
 0x19, 0x01,         /*          Usage Minimum (1),              */
 0x29, 0x0c,         /*          Usage Maximum (12),             */
@@ -80,7 +78,6 @@  static __u8 df_rdesc_fixed[] = {
 0x81, 0x02,         /*          Input (Variable),               */
 0x05, 0x01,         /*          Usage Page (Desktop),           */
 0x26, 0xFF, 0x00,   /*          Logical Maximum (255),          */
-0x46, 0xFF, 0x00,   /*          Physical Maximum (255),         */
 0x95, 0x01,         /*          Report Count (1),               */
 0x75, 0x08,         /*          Report Size (8),                */
 0x81, 0x02,         /*          Input (Variable),               */
@@ -95,16 +92,18 @@  static __u8 df_rdesc_fixed[] = {
 0x65, 0x00,         /*          Unit (none),                    */
 0x06, 0x00, 0xFF,   /*          Usage Page (Vendor: 65280),     */
 0x09, 0x01,         /*          Usage (?: 1),                   */
+0x44,               /*          Physical Maximum (0),           */
 0x25, 0x01,         /*          Logical Maximum (1),            */
-0x45, 0x01,         /*          Physical Maximum (1),           */
 0x81, 0x02,         /*          Input (Variable),               */
 0x05, 0x01,         /*          Usage Page (Desktop),           */
 0x95, 0x01,         /*          Report Count (1),               */
 0x75, 0x08,         /*          Report Size (8),                */
-0x26, 0xFF, 0x00,   /*          Logical Maximum (255),          */
-0x46, 0xFF, 0x00,   /*          Physical Maximum (255),         */
+0x15, 30,           /*          Logical Minimum (30),           */
+0x25, 180,          /*          Logical Maximum (180),          */
 0x09, 0x31,         /*          Usage (Y),                      */
 0x81, 0x02,         /*          Input (Variable),               */
+0x15, 70,           /*          Logical Minimum (70),           */
+0x25, 215,          /*          Logical Maximum (215),          */
 0x09, 0x35,         /*          Usage (Rz),                     */
 0x81, 0x02,         /*          Input (Variable),               */
 0xC0,               /*      End Collection,                     */