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