Skip to contentSkip to conversation

adding support for new 2.6 chips in (lib)sensors

DISCUSSION Jean Delvare 2 participants 10 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi MDS (and others),

I would like to add support for the 2.6 lm83 and lm90 drivers to libsensors/sensors. Although it should be obvious how to do that, I just can't find where it is. Any hints?

Thanks.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#1 lore raw
Quoted 2 lines

let me try again.
They already have 2.4 support, right?

Ja ja ;)

Quoted 4 lines

In that case, for every sysfs entry that is "non-standard" (i.e. not covered by the conversion routine getsysname() in lib/proc.c), add the name of the sysfs entry at the end of the entry in lib/chips.c. If the magnitude is non-standard, add it as well.

The amazing thing is that all entries *have* standard names:

alarms
temp_crit1
temp_crit2
temp_input1
temp_input2
temp_max1
temp_max2
temp_min1
temp_min2

So I would have expected everyting to work out of the box - but it doesn't. Any clue where I should start digging?

A few random notes BTW:

* I think there's a typo at lib/proc.h:438.

* What's the reason for doing:
if(sscanf(name, "temp%d_ove%c%c", &num, &last, &check) = 2

     && last ='r')

instead of
if(sscanf(name, "temp%d_over%c", &num, &check) = 2)
? I understand that you want to make sure that there's nothing after "other" with the &check trick, but I don't see why you would also need the &last trick for this. Anything obvious I'm missing?

* I'm seeing a strange behavior with the eeprom module for on my Vaio (i.e. non-memory) eeprom. Usually sensors will say "Memory type:
Unavailable" (it's obviously not noticing this isn't a regular memory eeprom). But it sometimes will succeed and print the expected, vaio-specific data. I didn't investigate any further, but there must be a bug hiding somewhere.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#2 lore raw
In reply to Jean Delvare

try steps 13-17 (if I counted right) in doc/developers/new_drivers. holler if you need more help.

Quoted 8 lines · Jean Delvare

Hi MDS (and others),

I would like to add support for the 2.6 lm83 and lm90 drivers to libsensors/sensors. Although it should be obvious how to do that, I just can't find where it is. Any hints?

Thanks.

#3 lore raw
In reply to Jean Delvare

let me try again.
They already have 2.4 support, right?
In that case, for every sysfs entry that is "non-standard" (i.e. not covered by the conversion routine getsysname() in lib/proc.c), add the name of the sysfs entry at the end of the entry in lib/chips.c. If the magnitude is non-standard, add it as well.

Quoted 8 lines · Jean Delvare

Hi MDS (and others),

I would like to add support for the 2.6 lm83 and lm90 drivers to libsensors/sensors. Although it should be obvious how to do that, I just can't find where it is. Any hints?

Thanks.

#4 lore raw
In reply to Jean Delvare

I checked in some better comments for getsysname() in lib/proc.c.

Quoted 20 lines · Mark Studebaker

let me try again.
They already have 2.4 support, right?
In that case, for every sysfs entry that is "non-standard" (i.e. not covered by the conversion routine getsysname() in lib/proc.c), add the name of the sysfs entry at the end of the entry in lib/chips.c. If the magnitude is non-standard, add it as well.

Quoted 8 lines · Jean Delvare

Hi MDS (and others),

I would like to add support for the 2.6 lm83 and lm90 drivers to libsensors/sensors. Although it should be obvious how to do that, I just can't find where it is. Any hints?

Thanks.

#5 lore raw
In reply to Jean Delvare

Quoting myself...

Quoted 6 lines

* What's the reason for doing:
if(sscanf(name, "temp%d_ove%c%c", &num, &last, &check) = 2

     && last ='r')

instead of
if(sscanf(name, "temp%d_over%c", &num, &check) = 2)
?

I of course meant "= 1" in the second case.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#6 lore raw
In reply to Jean Delvare
Quoted 4 lines

strace?

temp_critx is NOT standard, or at least not converted by getsysname(); so if 'sensors' is looking for it as tempx_crit it won't find it.

I figured it out. The 2.4 driver uses tempX_high and tempX_low instead of _max and _min, respectively. I added the conversion rules for those in lib/proc.c, and for tcritX -> temp_critX as well.

Now I need to work the hysteresis problem out. This is a single, relative value in 2.4, and has to be two absolute values in 2.6. This cannot possibly be done in libsensors as far as I can see, so I think I'll have to tweak sensors itself. Is there a way sensors could know wether we are running under 2.4 or 2.6? Or would I simply try the alternate method if and only if the first one failed?

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#7 lore raw
In reply to Jean Delvare
Quoted 25 lines · Jean Delvare
Quoted 2 lines

let me try again.
They already have 2.4 support, right?

Ja ja ;)

Quoted 4 lines

In that case, for every sysfs entry that is "non-standard" (i.e. not covered by the conversion routine getsysname() in lib/proc.c), add the name of the sysfs entry at the end of the entry in lib/chips.c. If the magnitude is non-standard, add it as well.

The amazing thing is that all entries *have* standard names:

alarms
temp_crit1
temp_crit2
temp_input1
temp_input2
temp_max1
temp_max2
temp_min1
temp_min2

Quoted 4 lines

So I would have expected everyting to work out of the box - but it doesn't. Any clue where I should start digging?

strace?

temp_critx is NOT standard, or at least not converted by getsysname(); so if 'sensors' is looking for it as tempx_crit it won't find it.

#8 lore raw
In reply to Jean Delvare
Quoted 5 lines · Jean Delvare

A few random notes BTW:

* I think there's a typo at lib/proc.h:438.

?? you mean proc.c?
I assume you fixed it, line numbers moved...

Quoted 9 lines

* What's the reason for doing:
if(sscanf(name, "temp%d_ove%c%c", &num, &last, &check) = 2

     && last ='r')

instead of
if(sscanf(name, "temp%d_over%c", &num, &check) = 1)
? I understand that you want to make sure that there's nothing after "other" with the &check trick, but I don't see why you would also need the &last trick for this. Anything obvious I'm missing?

In your example you can't tell if the "_over" part matched or not, can you? I know the way I did it is retarded, I just couldn't think of a better way. Anybody have an elegant way that works, speak up.

Quoted 7 lines

* I'm seeing a strange behavior with the eeprom module for on my Vaio (i.e. non-memory) eeprom. Usually sensors will say "Memory type:
Unavailable" (it's obviously not noticing this isn't a regular memory eeprom). But it sometimes will succeed and print the expected, vaio-specific data. I didn't investigate any further, but there must be a bug hiding somewhere.

We're getting good at finding bugs in the bus drivers with eeprom. What bus driver? Any more clues?

#9 lore raw
In reply to Jean Delvare

(Sorry for the delay, so busy...)

Quoted 4 lines
Quoted 1 line

* I think there's a typo at lib/proc.h:438.

?? you mean proc.c?
I assume you fixed it, line numbers moved...

Yes I did.

Quoted 9 lines
Quoted 8 lines

* What's the reason for doing:
if(sscanf(name, "temp%d_ove%c%c", &num, &last, &check) = 2

     && last ='r')

instead of
if(sscanf(name, "temp%d_over%c", &num, &check) = 1)
? I understand that you want to make sure that there's nothing after "other" with the &check trick, but I don't see why you would also need the &last trick for this. Anything obvious I'm missing?

Quoted 3 lines

In your example you can't tell if the "_over" part matched or not, can you? I know the way I did it is retarded, I just couldn't think of a better way. Anybody have an elegant way that works, speak up.

After a few tests (and reading the man page first) it appears that you are right. I must be too used to the power of regular expressions, I wouldn't figure that sscanf can fail matching the pattern and still return non-zero.

I can't think of any other way, so let's stick to your method. It's not that bad after all, just a bit harsh to understand at first (for me at least).

Quoted 9 lines
Quoted 6 lines

* I'm seeing a strange behavior with the eeprom module for on my Vaio(i.e. non-memory) eeprom. Usually sensors will say "Memory type:
Unavailable" (it's obviously not noticing this isn't a regular memory eeprom). But it sometimes will succeed and print the expected, vaio-specific data. I didn't investigate any further, but there must be a bug hiding somewhere.

We're getting good at finding bugs in the bus drivers with eeprom. What bus driver? Any more clues?

This is i2c-i801, kernek 2.6 (.0 and .1 alike). No problem under 2.4.whatever.

(a few minutes later)

Ah ah, this was sooo ridiculously easy. The "eeprom" file has permissions 0400, so sensors fails as a regular user and succeeds as root. This was once a wanted behavior for the *first* row of the eeprom, because it contains the BIOS password (if one was set). Now that the whole eeprom is exported as a single file, that's quite different.

That said, the solution retained in 2.4 should still apply. We use capable() to know if the caller is root, and is this case show the real data. If not, show zeroes instead, for the first row only. I'm on it.

And no, i2c-i801 wasn't guilty ;)

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/