mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-13 17:00:15 +00:00
sensors-detect: Add generic PCI SMBus adapter detection.
The detection is based of the PCI device class (SMBus is 0x0c05). This will let us spot new adapters. Of course we can't load or even suggest a driver for an unknown adapter, but at least the user will know there's something to be investigated, and this should help us when users report such configurations. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4143 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
bd012ca251
commit
fe14085d93
2 files changed
+37
-12
No files matched your search
@@ -82,6 +82,7 @@ lm_sensors CHANGES file
|
||||
Add VT8237A and VT8251
|
||||
Remove detection of nVidia graphics adapters
|
||||
Use sysfs for PCI device enumeration
|
||||
Add generic PCI SMBus adapter detection
|
||||
|
||||
|
||||
2.10.0 (20060214)
|
||||
|
||||
+36
-12
@@ -2208,27 +2208,42 @@ sub adapter_pci_detection_sis_96x
|
||||
}
|
||||
}
|
||||
|
||||
# Build and return a PCI device's bus ID
|
||||
sub pci_busid($)
|
||||
{
|
||||
my $device = shift;
|
||||
my $busid;
|
||||
|
||||
$busid = sprintf("\%02x:\%02x.\%x",
|
||||
$device->{bus}, $device->{slot}, $device->{func});
|
||||
$busid = sprintf("\%04x:", $device->{domain}) . $busid
|
||||
if defined $device->{domain};
|
||||
|
||||
return $busid;
|
||||
}
|
||||
|
||||
sub adapter_pci_detection
|
||||
{
|
||||
my ($key,$device,$try,@res);
|
||||
my ($key, $device, $try, @res, %smbus);
|
||||
print "Probing for PCI bus adapters...\n";
|
||||
|
||||
# Custom detection routine for some SiS chipsets
|
||||
adapter_pci_detection_sis_96x();
|
||||
|
||||
# Generic detection loop
|
||||
# Build a list of detected SMBus devices
|
||||
foreach $key (keys %pci_list) {
|
||||
$device = $pci_list{$key};
|
||||
$smbus{$key}++
|
||||
if exists $device->{class} && $device->{class} == 0x0c05; # SMBus
|
||||
}
|
||||
|
||||
# Loop over the known I2C/SMBus adapters
|
||||
foreach $try (@pci_adapters) {
|
||||
$key = sprintf("%04x:%04x", $try->{vendid}, $try->{devid});
|
||||
if (exists $pci_list{$key}) {
|
||||
$device = $pci_list{$key};
|
||||
printf "Use driver `\%s' for device \%s: \%s\n",
|
||||
$try->{driver},
|
||||
(defined $device->{domain} ?
|
||||
sprintf("\%04x:\%02x:\%02x.\%x", $device->{domain},
|
||||
$device->{bus}, $device->{slot}, $device->{func}) :
|
||||
sprintf("\%02x:\%02x.\%x",
|
||||
$device->{bus}, $device->{slot}, $device->{func})),
|
||||
$try->{procid};
|
||||
$try->{driver}, pci_busid($device), $try->{procid};
|
||||
if ($try->{driver} eq "to-be-tested") {
|
||||
print "\nWe are currently looking for testers for this adapter!\n".
|
||||
"Please see http://www.lm-sensors.org/wiki/NewDrivers\n".
|
||||
@@ -2238,12 +2253,21 @@ sub adapter_pci_detection
|
||||
print "\n";
|
||||
}
|
||||
push @res,$try->{driver};
|
||||
|
||||
# Delete from detected SMBus device list
|
||||
delete $smbus{$key};
|
||||
}
|
||||
}
|
||||
|
||||
# Now see if there are unknown SMBus devices left
|
||||
foreach $key (keys %smbus) {
|
||||
$device = $pci_list{$key};
|
||||
printf "Found unknown SMBus adapter \%04x:\%04x at \%s.\n",
|
||||
$device->{vendid}, $device->{devid}, pci_busid($device);
|
||||
}
|
||||
|
||||
if (! @res) {
|
||||
print ("Sorry, no PCI bus adapters found.\n");
|
||||
} else {
|
||||
printf ("Probe successfully concluded.\n");
|
||||
print "Sorry, no known PCI bus adapters found.\n";
|
||||
}
|
||||
return @res;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user