Changeset 336
- Timestamp:
- 03/23/99 22:48:41 (14 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/prog/detect/sensors-detect (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/prog/detect/sensors-detect
r325 r336 93 93 # i2c_addrs (optional): For I2C chips, the range of valid I2C addresses to 94 94 # probe. 95 # i2c_driver_addrs (optional): For I2C chips, the range of valid I2C 96 # addresses probed by the kernel driver. Strictly optional. 95 97 # i2c_detect (optional): For I2C chips, the function to call to detect 96 98 # this chip. The function should take two parameters: an open file … … 98 100 # isa_addrs (optional): For ISA chips, the range of valid port addresses to 99 101 # probe. 102 # isa_driver_addrs (optional): For ISA chips, the range of valid ISA 103 # addresses probed by the kernel driver. Strictly optional. 100 104 # isa_detect (optional): For ISA chips, the function to call to detect 101 105 # this chip. The function should take one parameter: the ISA address … … 110 114 driver => "lm78", 111 115 i2c_addrs => [0x00..0x7f], 116 i2c_driver_addrs => [0x20..0x2f], 112 117 i2c_detect => sub { lm78_detect 0, @_}, 113 118 isa_addrs => [0x290], … … 119 124 driver => "lm78", 120 125 i2c_addrs => [0x00..0x7f], 126 i2c_driver_addrs => [0x20..0x2f], 121 127 i2c_detect => sub { lm78_detect 1, @_ }, 122 128 isa_addrs => [0x290], … … 128 134 driver => "lm78", 129 135 i2c_addrs => [0x00..0x7f], 136 i2c_driver_addrs => [0x20..0x2f], 130 137 i2c_detect => sub { lm78_detect 2, @_ }, 131 138 isa_addrs => [0x290], … … 712 719 # with field 'i2c_sub_addrs', containing a reference to a list of 713 720 # other I2C addresses (if this is an I2C detection) 721 # with field 'i2c_extra' if this is an I2C detection and the address 722 # is not normally probed by the kernel driver 714 723 # with field 'isa_addr' containing the ISA address this chip is on 715 724 # (if this is an ISA detection) 725 # with field 'isa_extra' if this is an ISA detection and the address 726 # is not normally probed by the kernel driver 716 727 # with field 'conf', containing the confidence level of this detection 717 728 # with field 'chipname', containing the chip name … … 842 853 $new_misdetected_ref->[$i]->{i2c_addr})) { 843 854 $new_misdetected_ref->[$i]->{isa_addr} = $datahash->{isa_addr}; 855 $new_misdetected_ref->[$i]->{isa_extra} = $datahash->{isa_extra} 856 if exists $datahash->{isa_extra}; 844 857 close FILE; 845 858 return; … … 866 879 $new_detected_ref->[$i]->{i2c_addr})) { 867 880 $new_detected_ref->[$i]->{isa_addr} = $datahash->{isa_addr}; 881 $new_detected_ref->[$i]->{isa_extra} = $datahash->{isa_extra} 882 if exists $datahash->{isa_extra}; 868 883 ($datahash) = splice (@$new_detected_ref, $i, 1); 869 884 close FILE; … … 956 971 $new_hash->{i2c_sub_addrs} = \@chips_copy; 957 972 } 973 $new_hash->{i2c_extra} = 0 974 if exists $chip->{i2c_driver_addrs} and 975 not contains( $addr , @{$chip->{i2c_driver_addrs}}); 958 976 add_i2c_to_chips_detected $$chip{driver}, $new_hash; 959 977 } else { … … 981 999 print "Success!\n"; 982 1000 printf " (confidence %d, driver `%s')\n", $conf, $$chip{driver}; 983 add_isa_to_chips_detected $$chip{alias_detect},$$chip{driver}, 984 { conf => $conf, 985 isa_addr => $addr, 986 chipname => $$chip{name}, 987 }; 1001 my $new_hash = { conf => $conf, 1002 isa_addr => $addr, 1003 chipname => $$chip{name} 1004 }; 1005 $new_hash->{isa_extra} = 0 1006 if exists $chip->{isa_driver_addrs} and 1007 not contains ($addr, @{$chip->{isa_driver_addrs}}); 1008 add_isa_to_chips_detected $$chip{alias_detect},$$chip{driver},$new_hash; 988 1009 } 989 1010 } … … 1402 1423 my ($prefer_isa) = @_; 1403 1424 1404 my ($chip,$detection,%adapters,$nr,$i,@optionlist );1425 my ($chip,$detection,%adapters,$nr,$i,@optionlist,@probelist); 1405 1426 my $modprobes = ""; 1406 1427 my $configfile = ""; … … 1438 1459 foreach $chip (@chips_detected) { 1439 1460 next if not @{$chip->{detected}}; 1440 1441 # Handle misdetects1442 1461 $modprobes .= "modprobe $chip->{driver}\n"; 1443 1462 @optionlist = (); 1463 @probelist = (); 1464 1465 # Handle detects out-of-range 1466 foreach $detection (@{$chip->{detected}}) { 1467 push @probelist, %adapters->{$detection->{i2c_driver}}, 1468 $detection->{i2c_addr} 1469 if exists $detection->{i2c_driver} and 1470 exists %adapters->{$detection->{i2c_driver}} and 1471 exists $detection->{i2c_extra}; 1472 push @probelist, -1, $detection->{isa_addr} 1473 if exists $detection->{isa_addr} and 1474 exists %adapters->{"i2c-isa"} and 1475 exists $detection->{isa_extra}; 1476 } 1477 1478 # Handle misdetects 1444 1479 foreach $detection (@{$chip->{misdetected}}) { 1445 1480 push @optionlist, %adapters->{$detection->{i2c_driver}}, … … 1467 1502 } 1468 1503 1469 next if not @optionlist;1504 next if not (@probelist or @optionlist); 1470 1505 $configfile .= "options $chip->{driver}"; 1471 $configfile .= sprintf " ignore=0x%02x",shift @optionlist 1472 if @optionlist; 1473 $configfile .= sprintf ",0x%02x",shift @optionlist 1474 while @optionlist; 1506 $configfile .= sprintf " ignore=%d,0x%02x",shift @optionlist, 1507 shift @optionlist 1508 if @optionlist; 1509 $configfile .= sprintf ",%d,0x%02x",shift @optionlist, shift @optionlist 1510 while @optionlist; 1511 $configfile .= sprintf " probe=%d,0x%02x",shift @probelist, 1512 shift @probelist 1513 if @probelist; 1514 $configfile .= sprintf ",%d,0x%02x",shift @probelist, shift @probelist 1515 while @probelist; 1475 1516 $configfile .= "\n"; 1476 1517 }
