From bdcca1fd75421fb6616fd8fe974ad1397dca7dd4 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 15 Jan 2005 11:41:48 +0000 Subject: [PATCH] The ddcmon driver is deprecated, direct the user to eeprom instead. Cleanup the ddmonitor detection routine. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2850 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index f9bfb6ba..65a9092f 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1388,7 +1388,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect # }, { name => "DDC monitor", - driver => "ddcmon", + driver => "eeprom", i2c_addrs => [0x50], i2c_detect => sub { ddcmonitor_detect @_ }, }, @@ -4127,25 +4127,22 @@ sub eeprom_detect # 0x00..0x07: DDC signature # 0x08..0x7E: checksumed area # 0x7F: checksum -### commented out additional location checks for now - don't work? sub ddcmonitor_detect { my ($file,$addr) = @_; my $i; -### for ($i = 0; $i < 8; $i ++) { -### i2c_set_slave_addr \*FILE,$addr+$i or goto FAILURE; - i2c_smbus_read_byte_data($file,0x00) == 0x00 or goto FAILURE; - i2c_smbus_read_byte_data($file,0x01) == 0xFF or goto FAILURE; - i2c_smbus_read_byte_data($file,0x02) == 0xFF or goto FAILURE; - i2c_smbus_read_byte_data($file,0x03) == 0xFF or goto FAILURE; - i2c_smbus_read_byte_data($file,0x04) == 0xFF or goto FAILURE; - i2c_smbus_read_byte_data($file,0x05) == 0xFF or goto FAILURE; - i2c_smbus_read_byte_data($file,0x06) == 0xFF or goto FAILURE; - i2c_smbus_read_byte_data($file,0x07) == 0x00 or goto FAILURE; -### } -### i2c_set_slave_addr \*FILE,$addr or return; - # Check the checksum for validity. We should do this for all addresses, - # but it would be too slow. + + return unless + i2c_smbus_read_byte_data($file,0x00) == 0x00 and + i2c_smbus_read_byte_data($file,0x01) == 0xFF and + i2c_smbus_read_byte_data($file,0x02) == 0xFF and + i2c_smbus_read_byte_data($file,0x03) == 0xFF and + i2c_smbus_read_byte_data($file,0x04) == 0xFF and + i2c_smbus_read_byte_data($file,0x05) == 0xFF and + i2c_smbus_read_byte_data($file,0x06) == 0xFF and + i2c_smbus_read_byte_data($file,0x07) == 0x00; + + # Check the checksum for validity. my $checksum = 0; for ($i = 0; $i <= 127; $i = $i + 1) { $checksum = $checksum + i2c_smbus_read_byte_data($file,$i); @@ -4156,9 +4153,6 @@ sub ddcmonitor_detect return (2,$addr+1,$addr+2,$addr+3,$addr+4,$addr+5,$addr+6,$addr+7); } return (8,$addr+1,$addr+2,$addr+3,$addr+4,$addr+5,$addr+6,$addr+7); -FAILURE: - i2c_set_slave_addr \*FILE,$addr; - return; } # $_[0]: A reference to the file descriptor to access this chip.