Skip to contentSkip to conversation

sensors-detect: Make LM73 detection less

PATCH In review Jean Delvare 2 participants 3 messages Aug 30, 2011 – Aug 31, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sensors-detect: Make LM73 detection less

Same idea as the change just made to the lm73 driver itself: do as much detection as possible with byte reads.

Index: prog/detect/sensors-detect
=================================--- prog/detect/sensors-detect (révision 5993)
+++ prog/detect/sensors-detect (copie de travail)
@@ -4044,7 +4044,9 @@
# Bits that always return 0
return if ($conf & 0x0c) or ($status & 0x10);

- return if i2c_smbus_read_word_data($file, 0x07) != 0x9001;
+ # Test with byte read first to avoid confusing other chips
+ return if i2c_smbus_read_byte_data($file, 0x07) != 0x01
+ or i2c_smbus_read_word_data($file, 0x07) != 0x9001;

# Make sure the chip supports SMBus read word transactions my $cur = i2c_smbus_read_word_data($file, 0x00);

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 9 lines · Jean Delvare

Same idea as the change just made to the lm73 driver itself: do as much detection as possible with byte reads.

Index: prog/detect/sensors-detect
=================================> --- prog/detect/sensors-detect (révision 5993)
+++ prog/detect/sensors-detect (copie de travail)

Review line 4052

Quoted 10 lines
(quoted diff) +3 -1
@@ -4044,7 +4044,9 @@
 	# Bits that always return 0
 	return if ($conf & 0x0c) or ($status & 0x10);
 
-	return if i2c_smbus_read_word_data($file, 0x07) != 0x9001;
+	# Test with byte read first to avoid confusing other chips
+	return if i2c_smbus_read_byte_data($file, 0x07) != 0x01
+	       or i2c_smbus_read_word_data($file, 0x07) != 0x9001;
 
 	# Make sure the chip supports SMBus read word transactions
 	my $cur = i2c_smbus_read_word_data($file, 0x00);

Looks good.

Reminds me - would be great if you could find the time to comment on the sensors patch I sent out a while ago (adding support for the new sysfs attributes).

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Jean Delvare
Quoted 22 lines · Guenter Roeck
Quoted 9 lines · Jean Delvare

Same idea as the change just made to the lm73 driver itself: do as much detection as possible with byte reads.

Index: prog/detect/sensors-detect
=================================> > --- prog/detect/sensors-detect (révision 5993)
+++ prog/detect/sensors-detect (copie de travail)

Review line 4052

Quoted 10 lines
(quoted diff) +3 -1
@@ -4044,7 +4044,9 @@
 	# Bits that always return 0
 	return if ($conf & 0x0c) or ($status & 0x10);
 
-	return if i2c_smbus_read_word_data($file, 0x07) != 0x9001;
+	# Test with byte read first to avoid confusing other chips
+	return if i2c_smbus_read_byte_data($file, 0x07) != 0x01
+	       or i2c_smbus_read_word_data($file, 0x07) != 0x9001;
 
 	# Make sure the chip supports SMBus read word transactions
 	my $cur = i2c_smbus_read_word_data($file, 0x00);

Looks good.

Quoted 3 lines

Reminds me - would be great if you could find the time to comment on the sensors patch I sent out a while ago (adding support for the new sysfs attributes).

Still on my long to-do list :( thanks for the reminder.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors