HID: iio: Fix stale or zero quaternion reads with multi-byte read helper
Status from this message: Applied to the fixes-togreg branch of iio.git.
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | HID: sensor-hub: Add sensor_hub_input_attr_read_values() for multi-byte readsdrivers/ include/ | +96 | 3 replies | |
| 2/2 | iio: hid-sensor-rotation: Fix stale or zero output when reading raw valuesdrivers/ | +38 | 4 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Andy Shevchenko | Jiri Kosina |
|---|---|---|
| 1/2 | R-b | A-b |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] HID: iio: Fix stale or zero quaternion reads with multi-byte read helper
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
Signature · 1 line
2.43.0