How to pass board specific info to I2C driver module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 5 Nov 2008, Jean Delvare wrote:
> Lastly, the conversion from current to voltage is not something we
> handle really well, I have to admit. This is basically the same as ADC
> being used for temperature measurements using a thermistor. It is
> possible to convert the numerical value using libsensors, however it
> will not change the unit which is displayed after the value, so it gets
> very confusing. We have a ticket opened for this feature:
> http://lm-sensors.org/ticket/2258
> But this is really only a placeholder, nothing has been implemented yet
> and I have no clear idea how we would do it.

I looked at that ticket and the email it links to
http://article.gmane.org/gmane.linux.drivers.sensors/14564/
and came up with the following.  This isn't complete yet but it might be
a start.

What you do is put a line like

type in0 2

in sensors.conf.  This says to treat in0 as a temperature (0=in, 1=fan,
2=temp).  The code treats it like an ignore, remembering that something
different has to happen to in0.  (Specfically, it treats the number that
it is supposed to be changed to as an expression.)  When somebody calls
sensors_get_features(), after the ignores are checked, the type changes
are checked.  If there is a type change, the expression gets evaluated,
and the change is made.

Once this patch is applied, the "type" lines do have an effect: they
make sensors print "N/A" for the features they apply to.  If you take
the "type" lines out, those features work normally again.

Things that are wrong with this:

- Using a number instead of a real name (in, fan, temp) in sensors.conf.
   This was just a quick hack to avoid writing a string -> number looker
   upper.

- Using the name 'type' makes me think of ints, chars, and floats rather
   than ins, fans, and temps.  Is a better name needed?

- Only changing it when somebody calls sensors_get_features().  Maybe
   the change should happen sooner.

- Maybe it should be handled more like a compute, rather than an ignore.

- I think the reason that this generates 'N/A's in the sensors output is
   that right now it only changes the feature number and not all the
   related subfeature numbers.  In other words, if you have a voltage
   input, there is the in feature, plus (say) in-min and in-max
   subfeatures.  When the feature gets changed to a temp, the subfeatures
   stay at in-min and in-max.  When sensors sees the temp feature, it
   looks up (say) temp-max and can't find it, so it says N/A.

Comments welcome, up to and including "This is a bad way to go about this".

Matt Roberds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: channel-type-change.diff
Type: text/x-diff
Size: 6581 bytes
Desc: First cut at channel type changing
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20081105/009cfbc5/attachment.bin 


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux