From: Zhang Lixu <lixu.zhang@intel.com>
To: Jiri Kosina <jikos@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Benjamin Tissoires <bentiss@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, lixu.zhang@intel.com
Subject: [PATCH 0/2] HID: iio: Fix stale or zero quaternion reads with multi-byte read helper
Date: Wed, 10 Jun 2026 16:29:08 +0800 [thread overview]
Message-ID: <20260610082911.157232-1-lixu.zhang@intel.com> (raw)
When reading in_rot_quaternion_raw from hid-sensor-rotation, the driver
returns either all zeros (if the sensor was never enabled) or stale data
(if previously enabled), because it reads from an internal buffer without
requesting a fresh sample from the device.
This series fixes the issue in two steps:
1. Add sensor_hub_input_attr_read_values() to the HID sensor hub core.
Unlike sensor_hub_input_attr_get_raw_value(), which is limited to a
single 32-bit value, the new helper accepts a caller-provided buffer
and accumulates incoming input report data until the buffer is full.
The two code paths are distinguished in sensor_hub_raw_event() by
pending.max_raw_size being non-zero, preserving backward compatibility.
2. Switch hid-sensor-rotation to use the new helper for raw quaternion
reads. It now powers up the sensor, issues a synchronous GET_REPORT,
and receives all four quaternion components directly into a local
buffer before decoding them, eliminating stale or zero output.
Srinivas Pandruvada (1):
HID: sensor-hub: Add sensor_hub_input_attr_read_values() for
multi-byte reads
Zhang Lixu (1):
iio: hid-sensor-rotation: Fix stale or zero output when reading raw
values
drivers/hid/hid-sensor-hub.c | 77 +++++++++++++++++--
drivers/iio/orientation/hid-sensor-rotation.c | 40 +++++++++-
include/linux/hid-sensor-hub.h | 25 ++++++
3 files changed, 134 insertions(+), 8 deletions(-)
base-commit: 49e02880ec0a8c378e811bc9d85da188d7c6204c
--
2.43.0
next reply other threads:[~2026-06-10 8:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 8:29 Zhang Lixu [this message]
2026-06-10 8:29 ` [PATCH 1/2] HID: sensor-hub: Add sensor_hub_input_attr_read_values() for multi-byte reads Zhang Lixu
2026-06-10 8:38 ` sashiko-bot
2026-06-10 10:52 ` Andy Shevchenko
2026-06-10 8:29 ` [PATCH 2/2] iio: hid-sensor-rotation: Fix stale or zero output when reading raw values Zhang Lixu
2026-06-10 8:40 ` sashiko-bot
2026-06-10 10:53 ` Andy Shevchenko
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=20260610082911.157232-1-lixu.zhang@intel.com \
--to=lixu.zhang@intel.com \
--cc=andy@kernel.org \
--cc=bentiss@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=srinivas.pandruvada@linux.intel.com \
/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