Skip to contentSkip to conversation

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

PATCH Applied Pablo Ceballos 3 participants 3 messages Nov 3, 2020 – Nov 5, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/hid/hid-sensor-hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +2 -1
index 94c7398b5c27..3dd7d3246737 100644
@@ -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);
 
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · 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.

Quoted 20 lines
---
 drivers/hid/hid-sensor-hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor- renamed from drivers/hid/hid-sensor-hub.c +0 -0

hub.c
index 94c7398b5c27..3dd7d3246737 100644

drivers/hid/hid-sensor-hub.c +2 -1
@@ -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);
maintainer Applied
#2 lore raw
In reply to Pablo Ceballos
Quoted 15 lines · 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.

---
 drivers/hid/hid-sensor-hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 94c7398b5c27..3dd7d3246737 100644

drivers/hid/hid-sensor-hub.c static int sensor_hub_raw_event(struct hid_device *hdev, · line 488

Quoted 7 lines
drivers/hid/hid-sensor-hub.c +2 -1
@@ -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.

Signature · 2 lines
Jiri Kosina
SUSE Labs