sysctl question
Andreas Tobler
andreast-list at fgznet.ch
Mon Jul 12 20:38:00 UTC 2010
Dear all,
I have an issue here, I do read a temperature sensor and I got a value
back, in integer. This value is 'encoded', it contains the integer and
the fractional part of the temperature I read.
This is inside a kernel module. I offer a sysctl interface to read this
value. Currently the access is done with sysctl_handle_int.
In my userland application I can print this value with the following macro:
FIX32TOPRINT(f) ((f) >> 16),((((f) & 0xffff) * 1000) >> 16)
But now I wonder how can I teach the sysctl to print my tempreature the
same way as my userland app does.
Right now it looks this way:
dev.sm.1.sensor.cpu_b_ad7417_amb.temp: 2736128
If I feed this 2736128 into the macro above I get this:
41.750 this is what I expect.
Is this even possible?
TIA for any pointer.
Andreas
More information about the freebsd-hackers
mailing list