/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Generic/PCI/Controllers.pm is in fusioninventory-agent 1:2.3.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | package FusionInventory::Agent::Task::Inventory::Generic::PCI::Controllers;
use strict;
use warnings;
use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Generic;
sub isEnabled {
return 1;
}
sub doInventory {
my (%params) = @_;
my $inventory = $params{inventory};
foreach my $controller (_getControllers(
logger => $params{logger},
datadir => $params{datadir}
)) {
$inventory->addEntry(
section => 'CONTROLLERS',
entry => $controller
);
}
}
sub _getControllers {
my @controllers;
foreach my $device (getPCIDevices(@_)) {
next unless $device->{PCIID};
# duplicate entry to avoid modifying it directly
my $controller = {
PCICLASS => $device->{PCICLASS},
NAME => $device->{NAME},
MANUFACTURER => $device->{MANUFACTURER},
REV => $device->{REV},
PCISLOT => $device->{PCISLOT},
};
$controller->{DRIVER} = $device->{DRIVER}
if $device->{DRIVER};
$controller->{PCISUBSYSTEMID} = $device->{PCISUBSYSTEMID}
if $device->{PCISUBSYSTEMID};
my ($vendor_id, $device_id) = split (/:/, $device->{PCIID});
$controller->{VENDORID} = $vendor_id;
$controller->{PRODUCTID} = $device_id;
my $subdevice_id = $device->{PCISUBSYSTEMID};
my $vendor = getPCIDeviceVendor(id => $vendor_id, @_);
if ($vendor) {
$controller->{MANUFACTURER} = $vendor->{name};
if ($vendor->{devices}->{$device_id}) {
my $entry = $vendor->{devices}->{$device_id};
$controller->{CAPTION} = $entry->{name};
$controller->{NAME} =
$subdevice_id && $entry->{subdevices}->{$subdevice_id} ?
$entry->{subdevices}->{$subdevice_id}->{name} :
$entry->{name};
}
}
next unless $device->{PCICLASS};
$device->{PCICLASS} =~ /^(\S\S)(\S\S)$/x;
my $class_id = $1;
my $subclass_id = $2;
my $class = getPCIDeviceClass(id => $class_id, @_);
if ($class) {
$controller->{TYPE} =
$subclass_id && $class->{subclasses}->{$subclass_id} ?
$class->{subclasses}->{$subclass_id}->{name} :
$class->{name};
}
push @controllers, $controller;
}
return @controllers;
}
1;
|