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