[CLUE-Tech] lm_sensors
Mike Staver
staver at fimble.com
Tue Mar 12 16:01:08 MST 2002
This is the function in question:
# This function returns a list of hashes. Each hash has some PCI
information
# (more than we will ever need, probably). The most important
# fields are 'bus', 'slot', 'func' (they uniquely identify a PCI device
in
# a computer) and 'vendid','devid' (they uniquely identify a type of
device).
# /proc/bus/pci/devices is only available on late 2.1 and 2.2 kernels.
sub read_proc_dev_pci
{
my ($dfn,$vend, at pci_list);
open INPUTFILE, "/proc/bus/pci/devices" or return;
while (<INPUTFILE>) {
my $record = {};
($dfn,$vend,$record->{irq},$record->{base_addr0},$record->{base_addr1},
$record->{base_addr2},$record->{base_addr3},$record->{base_addr4},
$record->{base_addr5},$record->{rom_base_addr}) =
map { oct "0x$_" } split;
$record->{bus} = $dfn >> 8;
$record->{slot} = ($dfn & 0xf8) >> 3;
$record->{func} = $dfn & 0x07;
$record->{vendid} = $vend >> 16;
$record->{devid} = $vend & 0xffff;
push @pci_list,$record;
}
close INPUTFILE or return;
return @pci_list;
}
Line 801 is the one starting with "map { oct". I don't know Perl, but I
would assume the = is throwing it off??
--
-Mike Staver
staver at fimble.com
mstaver at globaltaxnetwork.com
More information about the clue-tech
mailing list