Skip to contentSkip to conversation

Setting vrm with 'sensors -s' is broken (w/ Linux 2.6.x)

DISCUSSION Mark M. Hoffman 2 participants 5 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi...

The problem is in the last 8 lines of lib/proc.c:

Quoted 8 lines

/* give up, use old name (probably won't work though...) */ /* known to be the same:

        "alarms", "beep_enable", "vrm", "fan%d_div"
*/
        strcpy(sysname, name);
        *sysmag = (feature->scaling=0?0:3);
        return 0;
}

Oops, feature->scaling for VRM is 1! That explains why 'sensors -s' tries to write "9000" to vrm instead of "90" under Linux 2.6.x.

Anyone know what that '=0?0:3' qualification is *supposed* to do?

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]
#1 lore raw

According to Mark M. Hoffman:

Quoted 11 lines

The problem is in the last 8 lines of lib/proc.c:

Quoted 8 lines

/* give up, use old name (probably won't work though...) */ /* known to be the same:

        "alarms", "beep_enable", "vrm", "fan%d_div"
*/
        strcpy(sysname, name);
        *sysmag = (feature->scaling=0?0:3);
        return 0;
}
Quoted 4 lines

Oops, feature->scaling for VRM is 1! That explains why 'sensors -s' tries to write "9000" to vrm instead of "90" under Linux 2.6.x.

Anyone know what that '=0?0:3' qualification is *supposed* to do?

My bad :( Originally the scaling was left unchanged for unlisted entries. I thought that in 2.6 all values that weren't integer had magnitude = 3 (this is the case for temperatures, voltages and currents) so forcing non-zero magnitudes to 3 would be the best approximation. Too bad I forgot about vrm (although it is listed in the comment right above). Actually I though we were manupulating VRM values as 82 and 90, not 8.2 and 9.0 (although a quick look at sensors.conf.eg should have made me realize I was wrong).

In fact in looks like all voltage and temperatures cases are explicitly handled before, so just removing the offending line should be just find.

Sorry for the trouble.

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

Fixing myself:

Quoted 3 lines

In fact in looks like all voltage and temperatures cases are explicitly handled before, so just removing the offending line should be just find.

To be read as:

Replacing
*sysmag = (feature->scaling=0?0:3);
with
*sysmag = feature->scaling;
as it used to be before I broke it should fix the problem.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#3 lore raw
In reply to Mark M. Hoffman
Quoted 5 lines

Replacing
*sysmag = (feature->scaling=0?0:3);
with
*sysmag = feature->scaling;
as it used to be before I broke it should fix the problem.

Just did that.

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

Replacing
*sysmag = (feature->scaling=0?0:3);
with
*sysmag = feature->scaling;
as it used to be before I broke it should fix the problem.

Just did that.

BTW thanks. I figured that would be the fix but I wasn't sure.

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]