line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Win32::Ports; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
73040151
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
71
|
|
4
|
1
|
|
|
1
|
|
18
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Had never been tested. |
7
|
1
|
|
|
1
|
|
680
|
use FusionInventory::Agent::Tools::Win32; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
697
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# cf http://msdn.microsoft.com/en-us/library/aa394486%28VS.85%29.aspx |
10
|
|
|
|
|
|
|
my @portType = ( |
11
|
|
|
|
|
|
|
'Unknown', |
12
|
|
|
|
|
|
|
'Other', |
13
|
|
|
|
|
|
|
'Male', |
14
|
|
|
|
|
|
|
'Female', |
15
|
|
|
|
|
|
|
'Shielded', |
16
|
|
|
|
|
|
|
'Unshielded', |
17
|
|
|
|
|
|
|
'SCSI (A) High-Density (50 pins)', |
18
|
|
|
|
|
|
|
'SCSI (A) Low-Density (50 pins)', |
19
|
|
|
|
|
|
|
'SCSI (P) High-Density (68 pins)', |
20
|
|
|
|
|
|
|
'SCSI SCA-I (80 pins)', |
21
|
|
|
|
|
|
|
'SCSI SCA-II (80 pins)', |
22
|
|
|
|
|
|
|
'SCSI Fibre Channel (DB-9, Copper)', |
23
|
|
|
|
|
|
|
'SCSI Fibre Channel (Fibre)', |
24
|
|
|
|
|
|
|
'SCSI Fibre Channel SCA-II (40 pins)', |
25
|
|
|
|
|
|
|
'SCSI Fibre Channel SCA-II (20 pins)', |
26
|
|
|
|
|
|
|
'SCSI Fibre Channel BNC', |
27
|
|
|
|
|
|
|
'ATA 3-1/2 Inch (40 pins)', |
28
|
|
|
|
|
|
|
'ATA 2-1/2 Inch (44 pins)', |
29
|
|
|
|
|
|
|
'ATA-2', |
30
|
|
|
|
|
|
|
'ATA-3', |
31
|
|
|
|
|
|
|
'ATA/66', |
32
|
|
|
|
|
|
|
'DB-9', |
33
|
|
|
|
|
|
|
'DB-15', |
34
|
|
|
|
|
|
|
'DB-25', |
35
|
|
|
|
|
|
|
'DB-36', |
36
|
|
|
|
|
|
|
'RS-232C', |
37
|
|
|
|
|
|
|
'RS-422', |
38
|
|
|
|
|
|
|
'RS-423', |
39
|
|
|
|
|
|
|
'RS-485', |
40
|
|
|
|
|
|
|
'RS-449', |
41
|
|
|
|
|
|
|
'V.35', |
42
|
|
|
|
|
|
|
'X.21', |
43
|
|
|
|
|
|
|
'IEEE-488', |
44
|
|
|
|
|
|
|
'AUI', |
45
|
|
|
|
|
|
|
'UTP Category 3', |
46
|
|
|
|
|
|
|
'UTP Category 4', |
47
|
|
|
|
|
|
|
'UTP Category 5', |
48
|
|
|
|
|
|
|
'BNC', |
49
|
|
|
|
|
|
|
'RJ11', |
50
|
|
|
|
|
|
|
'RJ45', |
51
|
|
|
|
|
|
|
'Fiber MIC', |
52
|
|
|
|
|
|
|
'Apple AUI', |
53
|
|
|
|
|
|
|
'Apple GeoPort', |
54
|
|
|
|
|
|
|
'PCI', |
55
|
|
|
|
|
|
|
'ISA', |
56
|
|
|
|
|
|
|
'EISA', |
57
|
|
|
|
|
|
|
'VESA', |
58
|
|
|
|
|
|
|
'PCMCIA', |
59
|
|
|
|
|
|
|
'PCMCIA Type I', |
60
|
|
|
|
|
|
|
'PCMCIA Type II', |
61
|
|
|
|
|
|
|
'PCMCIA Type III', |
62
|
|
|
|
|
|
|
'ZV Port', |
63
|
|
|
|
|
|
|
'CardBus', |
64
|
|
|
|
|
|
|
'USB', |
65
|
|
|
|
|
|
|
'IEEE 1394', |
66
|
|
|
|
|
|
|
'HIPPI', |
67
|
|
|
|
|
|
|
'HSSDC (6 pins)', |
68
|
|
|
|
|
|
|
'GBIC', |
69
|
|
|
|
|
|
|
'DIN', |
70
|
|
|
|
|
|
|
'Mini-DIN', |
71
|
|
|
|
|
|
|
'Micro-DIN', |
72
|
|
|
|
|
|
|
'PS/2', |
73
|
|
|
|
|
|
|
'Infrared', |
74
|
|
|
|
|
|
|
'HP-HIL', |
75
|
|
|
|
|
|
|
'Access.bus', |
76
|
|
|
|
|
|
|
'NuBus', |
77
|
|
|
|
|
|
|
'Centronics', |
78
|
|
|
|
|
|
|
'Mini-Centronics', |
79
|
|
|
|
|
|
|
'Mini-Centronics Type-14', |
80
|
|
|
|
|
|
|
'Mini-Centronics Type-20', |
81
|
|
|
|
|
|
|
'Mini-Centronics Type-26', |
82
|
|
|
|
|
|
|
'Bus Mouse', |
83
|
|
|
|
|
|
|
'ADB', |
84
|
|
|
|
|
|
|
'AGP', |
85
|
|
|
|
|
|
|
'VME Bus', |
86
|
|
|
|
|
|
|
'VME64', |
87
|
|
|
|
|
|
|
'Proprietary', |
88
|
|
|
|
|
|
|
'Proprietary Processor Card Slot', |
89
|
|
|
|
|
|
|
'Proprietary Memory Card Slot', |
90
|
|
|
|
|
|
|
'Proprietary I/O Riser Slot', |
91
|
|
|
|
|
|
|
'PCI-66MHZ', |
92
|
|
|
|
|
|
|
'AGP2X', |
93
|
|
|
|
|
|
|
'AGP4X', |
94
|
|
|
|
|
|
|
'PC-98', |
95
|
|
|
|
|
|
|
'PC-98-Hireso', |
96
|
|
|
|
|
|
|
'PC-H98', |
97
|
|
|
|
|
|
|
'PC-98Note', |
98
|
|
|
|
|
|
|
'PC-98Full', |
99
|
|
|
|
|
|
|
'PCI-X', |
100
|
|
|
|
|
|
|
'SSA SCSI', |
101
|
|
|
|
|
|
|
'Circular', |
102
|
|
|
|
|
|
|
'On-Board IDE Connector', |
103
|
|
|
|
|
|
|
'On-Board Floppy Connector', |
104
|
|
|
|
|
|
|
'9 Pin Dual Inline', |
105
|
|
|
|
|
|
|
'25 Pin Dual Inline', |
106
|
|
|
|
|
|
|
'50 Pin Dual Inline', |
107
|
|
|
|
|
|
|
'68 Pin Dual Inline', |
108
|
|
|
|
|
|
|
'On-Board Sound Connector', |
109
|
|
|
|
|
|
|
'Mini-Jack', |
110
|
|
|
|
|
|
|
'PCI-X', |
111
|
|
|
|
|
|
|
'Sbus IEEE 1396-1993 32 Bit', |
112
|
|
|
|
|
|
|
'Sbus IEEE 1396-1993 64 Bit', |
113
|
|
|
|
|
|
|
'MCA', |
114
|
|
|
|
|
|
|
'GIO', |
115
|
|
|
|
|
|
|
'XIO', |
116
|
|
|
|
|
|
|
'HIO', |
117
|
|
|
|
|
|
|
'NGIO', |
118
|
|
|
|
|
|
|
'PMC', |
119
|
|
|
|
|
|
|
'MTRJ', |
120
|
|
|
|
|
|
|
'VF-45', |
121
|
|
|
|
|
|
|
'Future I/O', |
122
|
|
|
|
|
|
|
'SC', |
123
|
|
|
|
|
|
|
'SG', |
124
|
|
|
|
|
|
|
'Electrical', |
125
|
|
|
|
|
|
|
'Optical', |
126
|
|
|
|
|
|
|
'Ribbon', |
127
|
|
|
|
|
|
|
'GLM', |
128
|
|
|
|
|
|
|
'1x9', |
129
|
|
|
|
|
|
|
'Mini SG', |
130
|
|
|
|
|
|
|
'LC', |
131
|
|
|
|
|
|
|
'HSSC', |
132
|
|
|
|
|
|
|
'VHDCI Shielded (68 pins)', |
133
|
|
|
|
|
|
|
'InfiniBand', |
134
|
|
|
|
|
|
|
'AGP8X', |
135
|
|
|
|
|
|
|
'PCI-E', |
136
|
|
|
|
|
|
|
); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub isEnabled { |
139
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
140
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{port}; |
141
|
0
|
|
|
|
|
|
return 1; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub doInventory { |
145
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
146
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
150
|
|
|
|
|
|
|
class => 'Win32_SerialPort', |
151
|
|
|
|
|
|
|
properties => [ qw/Name Caption Description/ ] |
152
|
|
|
|
|
|
|
)) { |
153
|
|
|
|
|
|
|
$inventory->addEntry( |
154
|
|
|
|
|
|
|
section => 'PORTS', |
155
|
|
|
|
|
|
|
entry => { |
156
|
|
|
|
|
|
|
NAME => $object->{Name}, |
157
|
|
|
|
|
|
|
CAPTION => $object->{Caption}, |
158
|
|
|
|
|
|
|
DESCRIPTION => $object->{Description}, |
159
|
0
|
|
|
|
|
|
TYPE => 'Serial', |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
); |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
165
|
|
|
|
|
|
|
class => 'Win32_ParallelPort', |
166
|
|
|
|
|
|
|
properties => [ qw/Name Caption Description/ ] |
167
|
|
|
|
|
|
|
)) { |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
$inventory->addEntry( |
170
|
|
|
|
|
|
|
section => 'PORTS', |
171
|
|
|
|
|
|
|
entry => { |
172
|
|
|
|
|
|
|
NAME => $object->{Name}, |
173
|
|
|
|
|
|
|
CAPTION => $object->{Caption}, |
174
|
|
|
|
|
|
|
DESCRIPTION => $object->{Description}, |
175
|
0
|
|
|
|
|
|
TYPE => 'Parallel', |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
); |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
181
|
|
|
|
|
|
|
class => 'Win32_PortConnector', |
182
|
|
|
|
|
|
|
properties => [ qw/ConnectorType InternalReferenceDesignator/ ] |
183
|
|
|
|
|
|
|
)) { |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
|
|
|
|
my $type; |
186
|
0
|
0
|
|
|
|
|
if ($object->{ConnectorType}) { |
187
|
0
|
|
|
|
|
|
$type = join(', ', map { $portType[$_] } @{$object->{ConnectorType}}); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
} |
189
|
0
|
0
|
|
|
|
|
if (!$type) { |
190
|
0
|
|
|
|
|
|
$type = $object->{InternalReferenceDesignator}; |
191
|
0
|
|
|
|
|
|
$type =~ s/\ \d.*//; # Drop the port number |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
0
|
0
|
0
|
|
|
|
if (!$type && !$object->{InternalReferenceDesignator}) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
next; |
196
|
|
|
|
|
|
|
} elsif ($object->{InternalReferenceDesignator} =~ /SERIAL/) { |
197
|
0
|
|
|
|
|
|
next; # Already done |
198
|
|
|
|
|
|
|
} elsif ($object->{InternalReferenceDesignator} =~ /PARALLEL/) { |
199
|
0
|
|
|
|
|
|
next; # Already done |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
$inventory->addEntry( |
203
|
|
|
|
|
|
|
section => 'PORTS', |
204
|
|
|
|
|
|
|
entry => { |
205
|
|
|
|
|
|
|
NAME => $object->{InternalReferenceDesignator}, |
206
|
|
|
|
|
|
|
CAPTION => $object->{InternalReferenceDesignator}, |
207
|
|
|
|
|
|
|
DESCRIPTION => $object->{InternalReferenceDesignator}, |
208
|
0
|
|
|
|
|
|
TYPE => $type |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
); |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
1; |