All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: hid-sensors: Fix unit conversion
@ 2014-05-05  1:02 Srinivas Pandruvada
  2014-05-05 10:01 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Pandruvada @ 2014-05-05  1:02 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, Srinivas Pandruvada

When no units are specified the default units are milli-gauss. So
need to divide by 1000 to get iio default of Gauss.
Similarly the default units conversion from degrees to radians.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
index 29185a0..3729646 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -44,10 +44,10 @@ struct {
 	{HID_USAGE_SENSOR_GYRO_3D,
 		HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND, 0, 17453},
 
-	{HID_USAGE_SENSOR_COMPASS_3D, 0, 1000, 0},
+	{HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000},
 	{HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0},
 
-	{HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 17453, 0},
+	{HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453},
 	{HID_USAGE_SENSOR_INCLINOMETER_3D,
 		HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453},
 	{HID_USAGE_SENSOR_INCLINOMETER_3D,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: hid-sensors: Fix unit conversion
  2014-05-05  1:02 [PATCH] iio: hid-sensors: Fix unit conversion Srinivas Pandruvada
@ 2014-05-05 10:01 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2014-05-05 10:01 UTC (permalink / raw)
  To: Srinivas Pandruvada; +Cc: linux-iio

On 05/05/14 02:02, Srinivas Pandruvada wrote:
> When no units are specified the default units are milli-gauss. So
> need to divide by 1000 to get iio default of Gauss.
> Similarly the default units conversion from degrees to radians.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Seeing as I hadn't pushed the patch this is fixing out to the togreg branch
of kernel.org yet, I've applied this as a fixup patch to
4500173cd9abbf3dc8f48a5caca783cd4debe288 iio: hid-sensors: Convert units and exponent

> ---
>   drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> index 29185a0..3729646 100644
> --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> @@ -44,10 +44,10 @@ struct {
>   	{HID_USAGE_SENSOR_GYRO_3D,
>   		HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND, 0, 17453},
>
> -	{HID_USAGE_SENSOR_COMPASS_3D, 0, 1000, 0},
> +	{HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000},
>   	{HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0},
>
> -	{HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 17453, 0},
> +	{HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453},
>   	{HID_USAGE_SENSOR_INCLINOMETER_3D,
>   		HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453},
>   	{HID_USAGE_SENSOR_INCLINOMETER_3D,
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-05  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-05  1:02 [PATCH] iio: hid-sensors: Fix unit conversion Srinivas Pandruvada
2014-05-05 10:01 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.