linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: hid-sensor-hub: Fix issue with devices with no report ID
@ 2020-11-03  0:29 Pablo Ceballos
  2020-11-05  3:24 ` Srinivas Pandruvada
  2020-11-05 10:09 ` Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Pablo Ceballos @ 2020-11-03  0:29 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, Benjamin Tissoires
  Cc: linux-input, linux-iio, linux-kernel, Pablo Ceballos

Some HID devices don't use a report ID because they only have a single
report. In those cases, the report ID in struct hid_report will be zero
and the data for the report will start at the first byte, so don't skip
over the first byte.

Signed-off-by: Pablo Ceballos <pceballos@google.com>
---
 drivers/hid/hid-sensor-hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 94c7398b5c27..3dd7d3246737 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -483,7 +483,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
 		return 1;
 
 	ptr = raw_data;
-	ptr++; /* Skip report id */
+	if (report->id)
+		ptr++; /* Skip report id */
 
 	spin_lock_irqsave(&pdata->lock, flags);
 
-- 
2.29.1.341.ge80a0c044ae-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: hid-sensor-hub: Fix issue with devices with no report ID
  2020-11-03  0:29 [PATCH] HID: hid-sensor-hub: Fix issue with devices with no report ID Pablo Ceballos
@ 2020-11-05  3:24 ` Srinivas Pandruvada
  2020-11-05 10:09 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Pandruvada @ 2020-11-05  3:24 UTC (permalink / raw)
  To: Pablo Ceballos, Jiri Kosina, Jonathan Cameron, Benjamin Tissoires
  Cc: linux-input, linux-iio, linux-kernel

On Mon, 2020-11-02 at 19:29 -0500, Pablo Ceballos wrote:
> Some HID devices don't use a report ID because they only have a
> single
> report. In those cases, the report ID in struct hid_report will be
> zero
> and the data for the report will start at the first byte, so don't
> skip
> over the first byte.
> 
> Signed-off-by: Pablo Ceballos <pceballos@google.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/hid/hid-sensor-hub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-
> hub.c
> index 94c7398b5c27..3dd7d3246737 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -483,7 +483,8 @@ static int sensor_hub_raw_event(struct hid_device
> *hdev,
>  		return 1;
>  
>  	ptr = raw_data;
> -	ptr++; /* Skip report id */
> +	if (report->id)
> +		ptr++; /* Skip report id */
>  
>  	spin_lock_irqsave(&pdata->lock, flags);
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: hid-sensor-hub: Fix issue with devices with no report ID
  2020-11-03  0:29 [PATCH] HID: hid-sensor-hub: Fix issue with devices with no report ID Pablo Ceballos
  2020-11-05  3:24 ` Srinivas Pandruvada
@ 2020-11-05 10:09 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2020-11-05 10:09 UTC (permalink / raw)
  To: Pablo Ceballos
  Cc: Jonathan Cameron, Srinivas Pandruvada, Benjamin Tissoires,
	linux-input, linux-iio, linux-kernel

On Mon, 2 Nov 2020, Pablo Ceballos wrote:

> Some HID devices don't use a report ID because they only have a single
> report. In those cases, the report ID in struct hid_report will be zero
> and the data for the report will start at the first byte, so don't skip
> over the first byte.
> 
> Signed-off-by: Pablo Ceballos <pceballos@google.com>
> ---
>  drivers/hid/hid-sensor-hub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
> index 94c7398b5c27..3dd7d3246737 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -483,7 +483,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
>  		return 1;
>  
>  	ptr = raw_data;
> -	ptr++; /* Skip report id */
> +	if (report->id)
> +		ptr++; /* Skip report id */
>  

Applied, thank you.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-05 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  0:29 [PATCH] HID: hid-sensor-hub: Fix issue with devices with no report ID Pablo Ceballos
2020-11-05  3:24 ` Srinivas Pandruvada
2020-11-05 10:09 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).