# Re: \[PATCH\] iio: hid-sensor-attributes: Fix gravity sensor scale value not right issue

- List: linux-input
- 1 message, 1 author
- Page: https://ratatoskr.run/linux-input/2017/03/8929535/t

## Re: \[PATCH\] iio: hid-sensor-attributes: Fix gravity sensor scale value not right issue

- From: Jonathan Cameron \<hidden\>
- Date: 2017-03-25 16:24:47 
- Message: https://ratatoskr.run/linux-input/2017/03/8929535.md

```text
On 20/03/17 09:12, Song Hongyan wrote:
> Scale value include two parts: unit conversion and exponent conversion.
> Add gravity unit convert table to fix gravity sensor scale value not
> right issue.
> 
> Signed-off-by: Song Hongyan <redacted>
> Acked-by: Srinivas Pandruvada <redacted>
I guess this only effects the recently added gravity driver, but
would have been good to have a fixes tag.

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> index cc2ce2a..2884783 100644
> --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> @@ -38,6 +38,12 @@
>  	{HID_USAGE_SENSOR_ACCEL_3D,
>  		HID_USAGE_SENSOR_UNITS_G, 9, 806650000},
>  
> +	{HID_USAGE_SENSOR_GRAVITY_VECTOR, 0, 9, 806650000},
> +	{HID_USAGE_SENSOR_GRAVITY_VECTOR,
> +		HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD, 1, 0},
> +	{HID_USAGE_SENSOR_GRAVITY_VECTOR,
> +		HID_USAGE_SENSOR_UNITS_G, 9, 806650000},
> +
>  	{HID_USAGE_SENSOR_GYRO_3D, 0, 0, 17453293},
>  	{HID_USAGE_SENSOR_GYRO_3D,
>  		HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND, 1, 0},
> 
```
