Re: [PATCH] HID: sensor-hub: Restore fixup for Lenovo ThinkPad Helix 2 sensor hub report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2018-08-16 at 22:30 +0200, Hans de Goede wrote:
> Commit b0f847e16c1e ("HID: hid-sensor-hub: Force logical minimum to 1
> for
> power and report state") not only replaced the descriptor fixup done
> for
> devices with the HID_SENSOR_HUB_ENUM_QUIRK with a generic fix, but
> also
> accidentally removed the unrelated descriptor fixup for the Lenovo
> ThinkPad
> Helix 2 sensor hub. This commit restores this fixup.
> 
> Restoring this fixup not only fixes the Lenovo ThinkPad Helix 2's
> sensors,
> but also the Lenovo ThinkPad 8's sensors.
> 
> Fixes: b0f847e16c1e ("HID: hid-sensor-hub: Force logical minimum
> ...")
> Cc: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
> Cc: Fernando D S Lima <fernandodsl@xxxxxxxxx>
> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
One minor comment on the style below. You can add:
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>

> ---
>  drivers/hid/hid-sensor-hub.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-
> hub.c
> index 50af72baa5ca..c1c62604ed77 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -579,6 +579,26 @@ void sensor_hub_device_close(struct
> hid_sensor_hub_device *hsdev)
>  }
>  EXPORT_SYMBOL_GPL(sensor_hub_device_close);
>  
> +static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8
> *rdesc,
> +		unsigned int *rsize)
> +{
> +	/* Checks if the report descriptor of Thinkpad Helix 2 has a
> logical
> +	 * minimum for magnetic flux axis greater than the maximum
> */
Multi-line comment style is preferred.

> +	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;
> +}
> +
>  static int sensor_hub_probe(struct hid_device *hdev,
>  				const struct hid_device_id *id)
>  {
> @@ -743,6 +763,7 @@ static struct hid_driver sensor_hub_driver = {
>  	.probe = sensor_hub_probe,
>  	.remove = sensor_hub_remove,
>  	.raw_event = sensor_hub_raw_event,
> +	.report_fixup = sensor_hub_report_fixup,
>  #ifdef CONFIG_PM
>  	.suspend = sensor_hub_suspend,
>  	.resume = sensor_hub_resume,



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux