Changeset 1865
- Timestamp:
- 07/07/03 12:31:41 (10 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/prog/detect/sensors-detect (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/prog/detect/sensors-detect
r1847 r1865 771 771 fscscy_detect pcf8591_detect arp_detect ipmi_kcs_detect 772 772 ipmi_smic_detect via8231_isa_detect lm85_detect smartbatt_detect 773 adm1026_detect w83l785ts_detect lm83_detect );773 adm1026_detect w83l785ts_detect lm83_detect lm90_detect); 774 774 775 775 # This is a list of all recognized chips. … … 1047 1047 driver => "lm83", 1048 1048 i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], 1049 i2c_detect => sub { lm83_detect 0, @_ }, 1050 }, 1051 { 1052 name => "National Semiconductor LM90", 1053 driver => "to-be-written", 1054 i2c_addrs => [0x4c], 1049 1055 i2c_detect => sub { lm83_detect 0, @_ }, 1050 1056 }, … … 1355 1361 sysopen (IOPORTS, "/dev/port", O_RDWR) 1356 1362 or die "/dev/port: $!\n"; 1357 binmode (IOPORTS, ':raw');1363 binmode IOPORTS; 1358 1364 } 1359 1365 … … 1934 1940 "/dev/i2c[-/]$new_misdetected_ref->[$i]->{i2c_devnr}?!?\n"), 1935 1941 next; 1942 binmode FILE; 1936 1943 i2c_set_slave_addr \*FILE,$new_misdetected_ref->[$i]->{i2c_addr} or 1937 1944 print("Can't set I2C address for ", … … 1962 1969 "/dev/i2c[-/]$new_detected_ref->[$i]->{i2c_devnr}?!?\n"), 1963 1970 next; 1971 binmode FILE; 1964 1972 i2c_set_slave_addr \*FILE,$new_detected_ref->[$i]->{i2c_addr} or 1965 1973 print("Can't set I2C address for ", … … 2032 2040 open FILE,"/dev/i2c/$adapter_nr" or 2033 2041 (print "Can't open /dev/i2c[-/]$adapter_nr\n"), return; 2042 binmode FILE; 2034 2043 2035 2044 # Now scan each address in turn … … 2379 2388 sub lm83_detect 2380 2389 { 2381 my $reg;2382 2390 my ($chip, $file,$addr) = @_; 2383 2391 return if $chip == 0 and i2c_smbus_read_byte_data($file,0xfe) != 0x01; 2384 2392 return 8 2385 2393 if i2c_smbus_read_byte_data($file,0x04) == 0x00; 2394 return 6; 2395 } 2396 2397 # $_[0]: Chip to detect 2398 # (0 = LM90) 2399 # $_[1]: A reference to the file descriptor to access this chip. 2400 # We may assume an i2c_set_slave_addr was already done. 2401 # $_[2]: Address 2402 # Returns: undef if not detected, 6, 7 or 8 if detected. 2403 # Registers used: 2404 # 0x03: Configuration 2405 # 0xfe: Manufacturer ID 2406 # 0xff: Chip ID / die revision 2407 sub lm90_detect 2408 { 2409 my $reg; 2410 my ($chip, $file,$addr) = @_; 2411 return if $chip == 0 and i2c_smbus_read_byte_data($file,0xfe) != 0x01; 2412 return if (i2c_smbus_read_byte_data($file,0x03) & 0x2a) != 0; 2413 return 8 2414 if ($reg = i2c_smbus_read_byte_data($file,0xff)) == 0x21; 2415 return 7 2416 if $reg > 0x21 and $reg < 0x30; 2386 2417 return 6; 2387 2418 }
