Skip to contentSkip to conversation

sensord 2.8.2 on 2.6.0/ASUS chip - subclient problem

DISCUSSION Andrey Borzenkov 4 participants 7 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

sensord startup fails due to the fact that it tries to read alarms for ASUS as99127f subclient that are not available; sensors itself works OK:

Jan 11 13:06:40 localhost sensord: sensord started
Jan 11 13:06:40 localhost sensord: Error getting sensor data: as99127f/#81: 
Can't access /proc file
Jan 11 13:06:40 localhost sensord: sensord failed

strace sensord ...
..
open("/sys/bus/i2c/devices/0-0048/alarms", O_RDONLY) = -1 ENOENT (No such file or directory)

{pts/1}% LC_ALL=C lr /sys/bus/i2c/devices/*/
/sys/bus/i2c/devices/0-002d/:

alarms     beep_enable  beep_mask    detach_state  fan_div1     fan_div2
fan_div3   fan_input1   fan_input2   fan_input3    fan_min1     fan_min2
fan_min3   in_input0    in_input1    in_input2     in_input3    in_input4
in_input5  in_input6    in_max0      in_max1       in_max2      in_max3
in_max4    in_max5      in_max6      in_min0       in_min1      in_min2
in_min3    in_min4      in_min5      in_min6       name         power/
pwm1       pwm2         pwm_enable2  temp_input1   temp_input2  temp_input3
temp_max1  temp_max2    temp_max3    temp_min1     temp_min2    temp_min3
vid        vrm

/sys/bus/i2c/devices/0-002d/power:
state

/sys/bus/i2c/devices/0-0048/:
detach_state name power/

/sys/bus/i2c/devices/0-0048/power:
state

/sys/bus/i2c/devices/0-0049/:
detach_state name power/

/sys/bus/i2c/devices/0-0049/power:
state

{pts/1}% sensors
as99127f-i2c-0-2d
Adapter: SMBus I801 adapter at e800
Algorithm: Unavailable from sysfs
VCore 1: +1.70 V (min = +1.57 V, max = +1.73 V)

+3.3V:     +3.47 V  (min =  +3.14 V, max =  +3.49 V)
+5V:       +5.00 V  (min =  +4.73 V, max =  +5.24 V)
+12V:     +11.37 V  (min = +10.82 V, max = +13.19 V)
-12V:     -11.57 V  (min = -13.22 V, max = -10.74 V)       ALARM
-5V:       -5.03 V  (min =  -5.25 V, max =  -4.74 V)       ALARM
CPU:      4787 RPM  (min = 3000 RPM, div = 2)
Front:    2909 RPM  (min = 2657 RPM, div = 2)
MB:          +29?C  (high =   +50?C, hyst =   +45?C)
CPU:       +36.5?C  (high =   +65?C, hyst =   +70?C)
HDD:       +39.0?C  (high =   +45?C, hyst =   +50?C)

vid: +1.650 V
alarms:
beep_enable:
Sound alarm enabled

I do not know if it is a sensord (should not attempt to read subclient) or kernel (does not provide sufficient information) problem. Subclient can be determined by its name:

{pts/1}% for i in /sys/bus/i2c/devices/*
do
echo ${i:t}:$(<$i/name)
done
0-002d:as99127f
0-0048:as99127f subclient
0-0049:as99127f subclient

Greg, this is supposed to be established convention now?

regards

-andrey

#1 lore raw
Quoted 13 lines · Andrey Borzenkov

I do not know if it is a sensord (should not attempt to read subclient) or kernel (does not provide sufficient information) problem. Subclient can be determined by its name:

{pts/1}% for i in /sys/bus/i2c/devices/*
do
echo ${i:t}:$(<$i/name)
done
0-002d:as99127f
0-0048:as99127f subclient
0-0049:as99127f subclient

Quoted 1 line

Greg, this is supposed to be established convention now?

I think so, yes. I'll let the userspace people answer your other questions.

thanks,

greg k-h

#2 lore raw
In reply to Andrey Borzenkov

The names of clients and the addresses of their subclients are "well known" so in prog/sensors/main.c we just look for them (see that file for more info). Your proposal to look for the string "subclient" will work equally well. Feel free to submit a sensord patch to us using either technique. mds

Quoted 25 lines · Greg KH
Quoted 12 lines · Andrey Borzenkov

I do not know if it is a sensord (should not attempt to read subclient) or kernel (does not provide sufficient information) problem. Subclient can be determined by its name:

{pts/1}% for i in /sys/bus/i2c/devices/*
do
echo ${i:t}:$(<$i/name)
done
0-002d:as99127f
0-0048:as99127f subclient
0-0049:as99127f subclient

Quoted 1 line

Greg, this is supposed to be established convention now?

I think so, yes. I'll let the userspace people answer your other questions.

thanks,

greg k-h

#3 lore raw
In reply to Andrey Borzenkov
Quoted 4 lines · Mark Studebaker

The names of clients and the addresses of their subclients are "well known" so in prog/sensors/main.c we just look for them (see that file for more info). Your proposal to look for the string "subclient" will work equally well. Feel free to submit a sensord patch to us using either technique.

If I understood you correctly (subclient does not provide this information) here is patch. It simply ignores any chip that has a space in name. To my best knowledge every chip has single name without spaces except for special case of subclients (at least that what I have done in my kernel patch). If this is not true any more - tell so and I change it to look for "subclient" substring.

regards

-andrey

Quoted 24 lines

mds

Quoted 21 lines · Greg KH
Quoted 12 lines · Andrey Borzenkov

I do not know if it is a sensord (should not attempt to read subclient) or kernel (does not provide sufficient information) problem. Subclient can be determined by its name:

{pts/1}% for i in /sys/bus/i2c/devices/*
do
echo ${i:t}:$(<$i/name)
done
0-002d:as99127f
0-0048:as99127f subclient
0-0049:as99127f subclient

Quoted 1 line

Greg, this is supposed to be established convention now?

I think so, yes. I'll let the userspace people answer your other questions.

thanks,

greg k-h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm_sensors-2.8.2-subclient.patch
Type: text/x-diff
Size: 570 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040118/67b1eafe/lm_sensors-2.8.2-subclient.bin

#4 lore raw
In reply to Andrey Borzenkov

I think you misunderstood me.
Checking for "subclient" should provide this information. And checking only for a space may work now but could break later. So please look for a "subclient" substring.
thanks
mds

Quoted 69 lines · Andrey Borzenkov
Quoted 4 lines · Mark Studebaker

The names of clients and the addresses of their subclients are "well known" so in prog/sensors/main.c we just look for them (see that file for more info). Your proposal to look for the string "subclient" will work equally well. Feel free to submit a sensord patch to us using either technique.

If I understood you correctly (subclient does not provide this information) here is patch. It simply ignores any chip that has a space in name. To my best knowledge every chip has single name without spaces except for special case of subclients (at least that what I have done in my kernel patch). If this is not true any more - tell so and I change it to look for "subclient" substring.

regards

-andrey

Quoted 49 lines

mds

Quoted 45 lines · Greg KH
Quoted 12 lines · Andrey Borzenkov

I do not know if it is a sensord (should not attempt to read subclient) or kernel (does not provide sufficient information) problem. Subclient can be determined by its name:

{pts/1}% for i in /sys/bus/i2c/devices/*
do
echo ${i:t}:$(<$i/name)
done
0-002d:as99127f
0-0048:as99127f subclient
0-0049:as99127f subclient

Quoted 1 line

Greg, this is supposed to be established convention now?

I think so, yes. I'll let the userspace people answer your other questions.

thanks,

greg k-h

------------------------------------------------------------------------

lib/proc.c renamed from lib/proc.c.subclient +8 -1
@@ -123,8 +123,15 @@
 
 		if ((f = fopen(n, "r")) != NULL) {
 			char	x[120];
-			fscanf(f, "%[a-zA-z0-9_]", x);
+
+			/* skip "name subclient" */
+			fgets(x, sizeof(x), f);
 			fclose(f);
+			if (strchr(x, ' '))
+				continue;
+
+			if (strlen(x) && x[strlen(x)-1] = '\n')
+				x[strlen(x)-1] = '\0';
 			/* HACK */ strcat(x, "-*");
 			if ((res = sensors_parse_chip_name(x, &entry.name))) {
 				char	em[NAME_MAX + 20];
#5 lore raw
In reply to Andrey Borzenkov
Quoted 4 lines · Mark Studebaker

I think you misunderstood me.
Checking for "subclient" should provide this information. And checking only for a space may work now but could break later. So please look for a "subclient" substring.

ok, attached

Quoted 54 lines

thanks
mds

Quoted 50 lines · Andrey Borzenkov
Quoted 5 lines · Mark Studebaker

The names of clients and the addresses of their subclients are "well known" so in prog/sensors/main.c we just look for them (see that file for more info). Your proposal to look for the string "subclient" will work equally well. Feel free to submit a sensord patch to us using either technique.

If I understood you correctly (subclient does not provide this information) here is patch. It simply ignores any chip that has a space in name. To my best knowledge every chip has single name without spaces except for special case of subclients (at least that what I have done in my kernel patch). If this is not true any more - tell so and I change it to look for "subclient" substring.

regards

-andrey

Quoted 32 lines

mds

Quoted 29 lines · Greg KH
Quoted 12 lines · Andrey Borzenkov

I do not know if it is a sensord (should not attempt to read subclient) or kernel (does not provide sufficient information) problem. Subclient can be determined by its name:

{pts/1}% for i in /sys/bus/i2c/devices/*
do
echo ${i:t}:$(<$i/name)
done
0-002d:as99127f
0-0048:as99127f subclient
0-0049:as99127f subclient

Quoted 1 line

Greg, this is supposed to be established convention now?

I think so, yes. I'll let the userspace people answer your other questions.

thanks,

greg k-h

------------------------------------------------------------------------

--- lm_sensors-2.8.2/lib/proc.c.subclient 2003-11-29 20:44:30.000000000
+0300 +++ lm_sensors-2.8.2/lib/proc.c 2004-01-18 00:03:51.095435776
+0300 @@ -123,8 +123,15 @@

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
		if ((f = fopen(n, "r")) != NULL) {
			char	x[120];
(quoted diff) +3 -1
-			fscanf(f, "%[a-zA-z0-9_]", x);
+
+			/* skip "name subclient" */
+			fgets(x, sizeof(x), f);
			fclose(f);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +5 -0
+			if (strchr(x, ' '))
+				continue;
+
+			if (strlen(x) && x[strlen(x)-1] = '\n')
+				x[strlen(x)-1] = '\0';
			/* HACK */ strcat(x, "-*");
			if ((res = sensors_parse_chip_name(x, &entry.name))) {
				char	em[NAME_MAX + 20];

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm_sensors-2.8.2-subclient.patch
Type: text/x-diff
Size: 566 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040126/a24fb2c0/lm_sensors-2.8.2-subclient.bin

#6 lore raw
In reply to Andrey Borzenkov

Hi Andrey,

Quoted 6 lines
Quoted 4 lines

I think you misunderstood me.
Checking for "subclient" should provide this information. And checking only for a space may work now but could break later. So please look for a "subclient" substring.

ok, attached

Sorry for the delay. I committed a similar change to our CVS repository this morning. It's not exactly what you proposed (I didn't much like the idea of using 120 more bytes of the stack) but should work equaly well. Tested on my as99127f.

Please check it out and confirm that it works for you too.

Thanks.

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