Porting the fscpos driver to 2.6

Stefan Ott stefan at desire.ch
Sun Dec 19 03:02:52 CET 2004


On Sat, 18 Dec 2004 21:54:06 +0100
Jean Delvare <khali at linux-fr.org> wrote:

>> I'm not much of a C coder (as in "I hardly know any C") and even less
>> of a kernel hacker. What I did was to see, how the lm78 driver
>> changed from 2.4 to 2.6 and change the fscpos module in more or less
>> the same way (and, of course, I read the porting-clients document).
> I would suggest that you base your work on fscher, not lm78. fscher
> and fscpos have significant similarities, it'll make your work much
> easier.
> Also make sure you read the i2c/sysfs-interface document if you need
> to add interface files the Hermes chip doesn't have.

Well, meanwhile I somehow managed to get a working driver based on the old fscpos code, ported the way lm78 was ported and added a real lot of code from the new fscher driver. It's read-only, as the only write function I implemented crashed my system (maybe I should listen to GCC's warnings) :). I don't think write support is extremely important - most users only want to see how how their CPU is - but as I get more familiar with C and the sensors world I'll add it.

The code is still messy, especially as I couldn't figure out how to add additional arguments to the functions (eg. a "nr" argument for the show_fan_status in order to have one function for all three fans - not a function per fan). As time passes, I might find out more about C and do it right.

There are also some masked bits in the fscher code which were different in the old fscpos driver. I'm going to contact the original fscpos author to find out where he got those values from and then probably use them.

One issue I couldn't fix is the following: My code seems to get the temperatures right (the temp1_input and temp2_input files contain the correct values) but tools which rely on the sensors library keep getting wrong values ("sensors" shows 0.04°C instead of 39°C - a factor 1000 missing?). As I took that code (TEMP_FROM_REG) from the old fscpos driver I'm really puzzled. Do you have a clue?

Stefan Ott

"Quelli come me si svegliano alle tre e dicono che i giorni sono corti"
  -- Luciano Ligabue
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fscpos.c
Type: text/x-csrc
Size: 20586 bytes
Desc: not available
URL: <http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20041219/0ab7996d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20041219/0ab7996d/attachment.sig>

More information about the lm-sensors mailing list