diff options
| author | Maximilian Czirr <maxx-cz@web.de> | 2026-10-07 02:01:07 +0200 |
|---|---|---|
| committer | Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> | 2026-11-02 21:49:24 +0000 |
| commit | c72dcaeaabd60e164e7324f80ccb037e879eefdd (patch) | |
| tree | 51adfb9837deef8e557425f1ce4defbf18109421 /kernel | |
| parent | c293f0db308fe76a0a9b0f6674cd2dea149b03aa (diff) | |
iio: hid-sensor: Fix scale for magnetic north heading
hid_sensor_format_scale() applies the HID unit exponent only when
the usage and unit match an entry in unit_conversion[].
Rotation-from-north support uses
HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH, but that usage has no entry in
the conversion table. As a result, the unit exponent is ignored and the
heading can be exposed with a scale of 1 instead of the scale specified
by the HID descriptor.
Add a unitless conversion entry so the HID unit exponent is applied to
the magnetic north heading. A sensor reporting an exponent of -5 then
correctly exposes a scale of 0.00001 instead of 1.
Fixes: abea9c62c32f ("iio: hid-sensor-magn-3d: Add support for rotation from north")
Cc: stable@vger.kernel.org
Signed-off-by: Maximilian Czirr <maxx-cz@web.de>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions
