Changeset 5905 for lm-sensors/trunk/prog/detect
- Timestamp:
- 01/19/11 10:56:53 (16 months 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
r5904 r5905 24 24 25 25 use strict; 26 use Fcntl ;26 use Fcntl qw(:DEFAULT :seek); 27 27 use File::Basename; 28 28 … … 2047 2047 detect => \&fam11h_pci_detect, 2048 2048 }, { 2049 name => "Intel Core familythermal sensor",2049 name => "Intel digital thermal sensor", 2050 2050 driver => "coretemp", 2051 detect => sub { coretemp_detect(0); }, 2052 }, { 2053 name => "Intel Atom thermal sensor", 2054 driver => "coretemp", 2055 detect => sub { coretemp_detect(1); }, 2051 detect => \&coretemp_detect, 2056 2052 }, { 2057 2053 name => "Intel AMB FB-DIMM thermal sensor", … … 2315 2311 if (m/^processor\s*:\s*(\d+)/) { 2316 2312 push @cpu, $entry if scalar keys(%{$entry}); # Previous entry 2317 $entry = { }; # New entry2313 $entry = { nr => $1 }; # New entry 2318 2314 next; 2319 2315 } 2320 if (m/^(vendor_id|cpu family|model|model name|stepping )\s*:\s*(.+)$/) {2316 if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level)\s*:\s*(.+)$/) { 2321 2317 my $k = $1; 2322 2318 my $v = $2; … … 2485 2481 $normalized =~ tr/-/_/; 2486 2482 $modules_list{$normalized} = 1; 2483 } 2484 2485 # udev may take some time to create device nodes when loading modules 2486 sub udev_settle 2487 { 2488 if (!(-x "/sbin/udevadm" && system("/sbin/udevadm settle") == 0) 2489 && !(-x "/sbin/udevsettle" && system("/sbin/udevsettle") == 0)) { 2490 sleep(1); 2491 } 2487 2492 } 2488 2493 … … 5834 5839 } 5835 5840 5841 sub cpuid 5842 { 5843 my ($cpu_nr, $eax) = @_; 5844 5845 sysopen(CPUID, "/dev/cpu/$cpu_nr/cpuid", O_RDONLY) or return; 5846 binmode CPUID; 5847 sysseek(CPUID, $eax, SEEK_SET) 5848 or die "Cannot seek /dev/cpu/$cpu_nr/cpuid"; 5849 sysread(CPUID, my $data, 16) 5850 or die "Cannot read /dev/cpu/$cpu_nr/cpuid"; 5851 close CPUID; 5852 5853 return unpack("L4", $data); 5854 } 5855 5836 5856 sub coretemp_detect 5837 5857 { 5838 my $chip = shift;5839 5858 my $probecpu; 5840 5859 5841 5860 foreach $probecpu (@cpu) { 5842 5861 next unless $probecpu->{vendor_id} eq 'GenuineIntel' && 5843 $probecpu->{'cpu family'} == 6; 5844 return 9 if $chip == 0 && 5845 ($probecpu->{model} == 14 || # Pentium M DC 5846 $probecpu->{model} == 15 || # Core 2 DC 65nm 5847 $probecpu->{model} == 0x16 || # Core 2 SC 65nm 5848 $probecpu->{model} == 0x17 || # Penryn 45nm 5849 $probecpu->{model} == 0x1a || # Nehalem 5850 $probecpu->{model} == 0x1e); # Lynnfield 5851 return 9 if $chip == 1 && 5852 ($probecpu->{model} == 0x1c); # Atom 5862 $probecpu->{'cpuid level'} >= 6; 5863 5864 # Now we check for the DTS flag 5865 my @regs = cpuid($probecpu->{nr}, 6); 5866 return unless @regs == 4; 5867 return 9 if ($regs[0] & (1 << 0)); # eax, bit 0 5853 5868 } 5854 5869 return; … … 6204 6219 "Do you want to scan for them? This is totally safe. (YES/no): "; 6205 6220 unless (<STDIN> =~ /^\s*n/i) { 6221 # Load the cpuid driver if needed 6222 unless (-e "/dev/cpu/$cpu[0]->{nr}/cpuid") { 6223 load_module("cpuid"); 6224 udev_settle(); 6225 } 6226 6206 6227 $| = 1; 6207 6228 foreach my $entry (@cpu_ids) { … … 6279 6300 'supermicro'); 6280 6301 6281 # udev may take some time to create the device node 6282 if (!(-x "/sbin/udevadm" && system("/sbin/udevadm settle") == 0) 6283 && !(-x "/sbin/udevsettle" && system("/sbin/udevsettle") == 0)) { 6284 sleep(1); 6285 } 6286 6302 udev_settle(); 6287 6303 for (my $dev_nr = 0; $dev_nr < @i2c_adapters; $dev_nr++) { 6288 6304 next unless exists $i2c_adapters[$dev_nr];
