]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: hid-sensor-rotation: Fix stale or zero output when reading raw values
authorZhang Lixu <lixu.zhang@intel.com>
Wed, 10 Jun 2026 08:29:10 +0000 (16:29 +0800)
committerJonathan Cameron <jic23@kernel.org>
Mon, 29 Jun 2026 22:24:46 +0000 (23:24 +0100)
commit3ce8d099e0afc5a7da75a2007a67f67c4f5a4af1
tree4b1c08ac9dbc32c12dc34e668aa6f6ed58958895
parentf784fcea450617055d2d12eec5b2f6e0e38bf878
iio: hid-sensor-rotation: Fix stale or zero output when reading raw values

When reading the raw quaternion attribute (in_rot_quaternion_raw), the
driver currently returns either all zeros (if the sensor was never enabled)
or stale data (if the sensor was previously enabled) because it reads from
the internal buffer without explicitly requesting a new sample from the
sensor.

To fix this, power up the sensor, call sensor_hub_input_attr_read_values()
to issue a synchronous GET_REPORT and receive the full quaternion data
directly into a local buffer, then decode the four components.

Fixes: fc18dddc0625 ("iio: hid-sensors: Added device rotation support")
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/orientation/hid-sensor-rotation.c