Re: [PATCH 2/2] iio: hid-sensor-rotation: Fix stale or zero output when reading raw values

From: Jonathan Cameron

Date: Sun Jun 14 2026 - 12:51:13 EST


On Fri, 12 Jun 2026 05:33:32 +0000
"Zhang, Lixu" <lixu.zhang@xxxxxxxxx> wrote:

> >-----Original Message-----
> >From: Jonathan Cameron <jic23@xxxxxxxxxx>
> >Sent: Friday, June 12, 2026 12:35 AM
> >To: Zhang, Lixu <lixu.zhang@xxxxxxxxx>
> >Cc: Jiri Kosina <jikos@xxxxxxxxxx>; Srinivas Pandruvada
> ><srinivas.pandruvada@xxxxxxxxxxxxxxx>; Benjamin Tissoires
> ><bentiss@xxxxxxxxxx>; David Lechner <dlechner@xxxxxxxxxxxx>; Nuno Sá
> ><nuno.sa@xxxxxxxxxx>; Andy Shevchenko <andy@xxxxxxxxxx>; linux-
> >input@xxxxxxxxxxxxxxx; linux-iio@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> >Subject: Re: [PATCH 2/2] iio: hid-sensor-rotation: Fix stale or zero output when
> >reading raw values
> >
> >On Wed, 10 Jun 2026 16:29:10 +0800
> >Zhang Lixu <lixu.zhang@xxxxxxxxx> wrote:
> >
> >> 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.
> >>
> >> Signed-off-by: Zhang Lixu <lixu.zhang@xxxxxxxxx>
> >Hi Zhang,
> >
> >Given this is clearly a fix, can you reply to this thread with an appropriate Fixes
> >tag. Otherwise looks fine to me.
>
> Sure, here is the Fixes tag:
>
> Fixes: fc18dddc0625 ("iio: hid-sensors: Added device rotation support")
>
> >
> >Given timing and I guess that this bug is fairly old, this will probably only go
> >upstream after rc1.
>
> That's perfectly fine. Thanks for the review!
Applied to the fixes-togreg branch of iio.git.

Note I'll be rebasing that on rc1 before sending out a pull request.

Thanks,

Jonathan

>
> Best regards,
> Lixu
>
> >
> >Thanks,
> >
> >Jonathan
> >
>