Skip to contentSkip to conversation

HID: hid-sensor-hub: fix attribute read for logical usage id

PATCH Applied Srinivas Pandruvada 2 participants 2 messages Feb 26, 2015 – Mar 16, 2015

Subsystems (2)
lore
Share & tools
lore

Srinivas Pandruvada

author maintainer
#0 lore raw

PATCH 1/1 HID: hid-sensor-hub: fix attribute read for logical usage id

For defining enumeration values like report or power status events, the enumeration usage ids are enclosed in a logical collection. In this case we need to match logical usage id for pending read on this usage id. For example, in the below field, when read is requested for 0319, the report will contain one of the status usages like 850, 851 etc. In this case the raw event will not match 0319. So when logical collection matches, then wake up the pending thread.

      Physical(Sensor.OtherCustom)
      Logical(Sensor.0319)
      Application(Sensor.Sensor)
      Usage(6)
        Sensor.0850
        Sensor.0851
        Sensor.0852
        Sensor.0853
        Sensor.0854
        Sensor.0855
      Logical Minimum(1)
      Logical Maximum(5)
      Report Size(8)
      Report Count(1)
      Report Offset(24)
      Flags( Array Absolute )
---
 drivers/hid/hid-sensor-hub.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hid/hid-sensor-hub.c +4 -2
index 36d4cb4..5eb338d 100644
@@ -497,8 +497,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
 			ptr += sz;
 			continue;
 		}
-		if (hsdev->pending.status && hsdev->pending.attr_usage_id ==
-				report->field[i]->usage->hid) {
+		if (hsdev->pending.status && (hsdev->pending.attr_usage_id ==
+					      report->field[i]->usage->hid ||
+					      hsdev->pending.attr_usage_id ==
+					      report->field[i]->logical)) {
 			hid_dbg(hdev, "data was pending ...\n");
 			hsdev->pending.raw_data = kmemdup(ptr, sz, GFP_ATOMIC);
 			if (hsdev->pending.raw_data)
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 26 lines · Srinivas Pandruvada

For defining enumeration values like report or power status events, the enumeration usage ids are enclosed in a logical collection. In this case we need to match logical usage id for pending read on this usage id. For example, in the below field, when read is requested for 0319, the report will contain one of the status usages like 850, 851 etc. In this case the raw event will not match 0319. So when logical collection matches, then wake up the pending thread.

      Physical(Sensor.OtherCustom)
      Logical(Sensor.0319)
      Application(Sensor.Sensor)
      Usage(6)
        Sensor.0850
        Sensor.0851
        Sensor.0852
        Sensor.0853
        Sensor.0854
        Sensor.0855
      Logical Minimum(1)
      Logical Maximum(5)
      Report Size(8)
      Report Count(1)
      Report Offset(24)
      Flags( Array Absolute )
Quoted 1 line

Applied to for-4.1/sensor-hub.

Signature · 2 lines
Jiri Kosina
SUSE Labs