Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1218412 > unrolled thread

[PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report

Started byFernando D S Lima <fernandodsl@gmail.com>
First post2015-09-03 18:10 +0200
Last post2015-09-04 14:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report Fernando D S Lima <fernandodsl@gmail.com> - 2015-09-03 18:10 +0200
    Re: [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2  sensor hub report Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2015-09-03 22:10 +0200
      Re: [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2  sensor hub report Jiri Kosina <jikos@kernel.org> - 2015-09-04 14:50 +0200

#1218412 — [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report

FromFernando D S Lima <fernandodsl@gmail.com>
Date2015-09-03 18:10 +0200
Subject[PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report
Message-ID<q4Ffk-8tV-33@gated-at.bofh.it>
There is an error in the report descriptor of the Thinkpad Helix 2 where
logical minimum value (557376) is greater than logical maximum (491200)
for all of the magnetic flux axis data fields. This error results in a
report descriptor parsing failure that causes the sensors attached to the
hub not to be detected.

dmesg excerpt:
[   19.866905] drivers/hid/hid-core.c: logical range invalid 0x88140 0x77ec0
[   19.866914] hid-sensor-hub 0018:2047:0855.0007: item 0 1 0 8 parsing failed
[   19.866926] hid-sensor-hub 0018:2047:0855.0007: parse failed
[   19.866933] hid-sensor-hub: probe of 0018:2047:0855.0007 failed with error -22

Add a report fixup to change magnetic flux logical minimums to -557376
for the parsing to succeed and the sensors to get detected.
After applying the fix the sensors get detected, with corresponding drivers
(hid-accel-3d,hid-gyro-3d,etc) loaded, and its possible to read their values.

Signed-off-by: Fernando D S Lima <fernandodsl@gmail.com>
---
 drivers/hid/hid-sensor-hub.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 090a1ba..6c94257 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -593,6 +593,20 @@ static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 		}
 	}
 
+	/* Checks if the report descriptor of Thinkpad Helix 2 has a logical
+	 * minimum for magnetic flux axis greater than the maximum */
+	if (hdev->product == USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA &&
+		*rsize == 2558 && rdesc[913] == 0x17 && rdesc[914] == 0x40 &&
+		rdesc[915] == 0x81 && rdesc[916] == 0x08 &&
+		rdesc[917] == 0x00 && rdesc[918] == 0x27 &&
+		rdesc[921] == 0x07 && rdesc[922] == 0x00) {
+		/* Sets negative logical minimum for mag x, y and z */
+		rdesc[914] = rdesc[935] = rdesc[956] = 0xc0;
+		rdesc[915] = rdesc[936] = rdesc[957] = 0x7e;
+		rdesc[916] = rdesc[937] = rdesc[958] = 0xf7;
+		rdesc[917] = rdesc[938] = rdesc[959] = 0xff;
+	}
+
 	return rdesc;
 }
 
-- 
1.9.1

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

[toc] | [next] | [standalone]


#1218555 — Re: [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report

FromSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date2015-09-03 22:10 +0200
SubjectRe: [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report
Message-ID<q4IZA-5qs-23@gated-at.bofh.it>
In reply to#1218412
On Thu, 2015-09-03 at 12:56 -0300, Fernando D S Lima wrote:
> There is an error in the report descriptor of the Thinkpad Helix 2 
> where
> logical minimum value (557376) is greater than logical maximum 
> (491200)
> for all of the magnetic flux axis data fields. This error results in 
> a
> report descriptor parsing failure that causes the sensors attached to 
> the
> hub not to be detected.
> 
> dmesg excerpt:
> [   19.866905] drivers/hid/hid-core.c: logical range invalid 0x88140 
> 0x77ec0
> [   19.866914] hid-sensor-hub 0018:2047:0855.0007: item 0 1 0 8 
> parsing failed
> [   19.866926] hid-sensor-hub 0018:2047:0855.0007: parse failed
> [   19.866933] hid-sensor-hub: probe of 0018:2047:0855.0007 failed 
> with error -22
> 
> Add a report fixup to change magnetic flux logical minimums to 
> -557376
> for the parsing to succeed and the sensors to get detected.
> After applying the fix the sensors get detected, with corresponding 
> drivers
> (hid-accel-3d,hid-gyro-3d,etc) loaded, and its possible to read their 
> values.
> 
> Signed-off-by: Fernando D S Lima <fernandodsl@gmail.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/hid/hid-sensor-hub.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor
> -hub.c
> index 090a1ba..6c94257 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -593,6 +593,20 @@ static __u8 *sensor_hub_report_fixup(struct 
> hid_device *hdev, __u8 *rdesc,
>  		}
>  	}
>  
> +	/* Checks if the report descriptor of Thinkpad Helix 2 has a 
> logical
> +	 * minimum for magnetic flux axis greater than the maximum 
> */
> +	if (hdev->product == 
> USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA &&
> +		*rsize == 2558 && rdesc[913] == 0x17 && rdesc[914] 
> == 0x40 &&
> +		rdesc[915] == 0x81 && rdesc[916] == 0x08 &&
> +		rdesc[917] == 0x00 && rdesc[918] == 0x27 &&
> +		rdesc[921] == 0x07 && rdesc[922] == 0x00) {
> +		/* Sets negative logical minimum for mag x, y and z 
> */
> +		rdesc[914] = rdesc[935] = rdesc[956] = 0xc0;
> +		rdesc[915] = rdesc[936] = rdesc[957] = 0x7e;
> +		rdesc[916] = rdesc[937] = rdesc[958] = 0xf7;
> +		rdesc[917] = rdesc[938] = rdesc[959] = 0xff;
> +	}
> +
>  	return rdesc;
>  }
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1218896 — Re: [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report

FromJiri Kosina <jikos@kernel.org>
Date2015-09-04 14:50 +0200
SubjectRe: [PATCH v1] HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report
Message-ID<q4YBj-2kr-9@gated-at.bofh.it>
In reply to#1218555
On Thu, 3 Sep 2015, Srinivas Pandruvada wrote:

> On Thu, 2015-09-03 at 12:56 -0300, Fernando D S Lima wrote:
> > There is an error in the report descriptor of the Thinkpad Helix 2 
> > where
> > logical minimum value (557376) is greater than logical maximum 
> > (491200)
> > for all of the magnetic flux axis data fields. This error results in 
> > a
> > report descriptor parsing failure that causes the sensors attached to 
> > the
> > hub not to be detected.
> > 
> > dmesg excerpt:
> > [   19.866905] drivers/hid/hid-core.c: logical range invalid 0x88140 
> > 0x77ec0
> > [   19.866914] hid-sensor-hub 0018:2047:0855.0007: item 0 1 0 8 
> > parsing failed
> > [   19.866926] hid-sensor-hub 0018:2047:0855.0007: parse failed
> > [   19.866933] hid-sensor-hub: probe of 0018:2047:0855.0007 failed 
> > with error -22
> > 
> > Add a report fixup to change magnetic flux logical minimums to 
> > -557376
> > for the parsing to succeed and the sensors to get detected.
> > After applying the fix the sensors get detected, with corresponding 
> > drivers
> > (hid-accel-3d,hid-gyro-3d,etc) loaded, and its possible to read their 
> > values.
> > 
> > Signed-off-by: Fernando D S Lima <fernandodsl@gmail.com>
> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Applied to for-4.3/upstream-fixes. Thanks,

-- 
Jiri Kosina
SUSE Labs

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web