linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: jkosina@suse.cz, jic23@kernel.org
Cc: linux-input@vger.kernel.org,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH] HID: hid-sensor-hub: fix attribute read for logical usage id
Date: Wed, 25 Feb 2015 18:56:27 -0800	[thread overview]
Message-ID: <1424919387-19136-1-git-send-email-srinivas.pandruvada@linux.intel.com> (raw)

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 )

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/hid/hid-sensor-hub.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 36d4cb4..5eb338d 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -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)
-- 
1.9.1


             reply	other threads:[~2015-02-26  2:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26  2:56 Srinivas Pandruvada [this message]
2015-03-16 15:22 ` [PATCH] HID: hid-sensor-hub: fix attribute read for logical usage id Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424919387-19136-1-git-send-email-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).