Hi Lucas,
On 02/17/2017 08:07 AM, Lucas Tanure wrote:
Hi,
We have here in our company an internal hardware platform for our linux
development that can measure current in a few circuits with nanoamps precision.
The measured values are exposed by a 32bit register that must read as a 32bit
float.
If we follow the hwmon sysfs interface we loss precision converting to
milliamps, where the final value exposed is zero.
Example :
Measure 291nA becomes 0mA under sysfs curr1_input
The best solution for me would be a file in sysfs that I could just expose the
float from my register (like curr1_input_float), this solution has two benefits
for me:
- I wouldn't need to convert my internal float to int
- This would give the best precision that I can have from my hardware
The value could be exposed as a 32bit hex string, like 0x349c3abc.
So, how should I proceed with this ?
A hex string would be really bad; userspace (generic) would not know what to do
with it.
You could on purpose violate the ABI and report the current in nano-Amps with
currX_input
(properly documented). This way the sensors command would still work after
proper
adjustments in /etc/sensors3.conf. If the current sense resistor is
configurable,
you could also not tell me at all and assume a current sense resistor which is
1,000,000 times larger than the one you actually use (after all, currency is
usually measured as voltage loss over a current sense resistor).
Another possibility would be to add a curr1_input_na attribute, but I would
prefer
the above mechanism.
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html