lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 14 Jun 2020 17:10:51 +0200
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     Jean-Baptiste Maneyrol <jmaneyrol@...ensense.com>,
        jic23@...nel.org, robh+dt@...nel.org, robh@...nel.org,
        mchehab+huawei@...nel.org, davem@...emloft.net,
        gregkh@...uxfoundation.org
Cc:     linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 06/13] iio: imu: inv_icm42600: add temperature sensor
 support

On 6/8/20 10:42 PM, Jean-Baptiste Maneyrol wrote:
> +	case IIO_CHAN_INFO_PROCESSED:
> +		ret = iio_device_claim_direct_mode(indio_dev);
> +		if (ret)
> +			return ret;
> +		ret = inv_icm42600_temp_read(st, &temp);
> +		iio_device_release_direct_mode(indio_dev);
> +		if (ret)
> +			return ret;
> +		*val = temp;
> +		return IIO_VAL_INT;
> +	case IIO_CHAN_INFO_SCALE:
> +		*val = 483;
> +		*val2 = 91787;
> +		return IIO_VAL_INT_PLUS_MICRO;
> +	case IIO_CHAN_INFO_OFFSET:
> +		*val = 25000;
> +		return IIO_VAL_INT;

If the data is returned processed there is no need to specify scale and 
offset.

But since the transformation to turn the data into standard units is a 
simple linear transform the preferred way to handle this is to return 
RAW data and specify scale and offset.

Powered by blists - more mailing lists