diff mbox series

HID: hid-sensor-hub: Fix issue with devices with no report ID

Message ID 20201103002939.688690-1-pceballos@google.com (mailing list archive)
State Mainlined
Commit 34a9fa2025d9d3177c99351c7aaf256c5f50691f
Delegated to: Jiri Kosina
Headers show
Series HID: hid-sensor-hub: Fix issue with devices with no report ID | expand

Commit Message

Pablo Ceballos Nov. 3, 2020, 12:29 a.m. UTC
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(-)

Comments

srinivas pandruvada Nov. 5, 2020, 3:24 a.m. UTC | #1
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);
>
Jiri Kosina Nov. 5, 2020, 10:09 a.m. UTC | #2
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.
diff mbox series

Patch

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);