[PATCH 0/2] HID: iio: Fix stale or zero quaternion reads with multi-byte read helper

From: Zhang Lixu

Date: Wed Jun 10 2026 - 04:36:13 EST


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