line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::MacOS::USB; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
83661765
|
use strict; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
94
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
93
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
676
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
400
|
|
7
|
2
|
|
|
2
|
|
1163
|
use FusionInventory::Agent::Tools::MacOS; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
585
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $seen; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub isEnabled { |
12
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
13
|
0
|
0
|
|
|
|
0
|
return 0 if $params{no_category}->{usb}; |
14
|
0
|
|
|
|
|
0
|
return 1; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub doInventory { |
18
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
21
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
foreach my $device (_getDevices(logger => $logger)) { |
24
|
|
|
|
|
|
|
# avoid duplicates |
25
|
0
|
0
|
0
|
|
|
0
|
next if $device->{SERIAL} && $seen->{$device->{SERIAL}}++; |
26
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
27
|
|
|
|
|
|
|
section => 'USBDEVICES', |
28
|
|
|
|
|
|
|
entry => $device, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _getDevices { |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return |
36
|
|
|
|
|
|
|
map { |
37
|
2
|
|
|
2
|
|
314
|
{ |
38
|
|
|
|
|
|
|
VENDORID => dec2hex($_->{'idVendor'}), |
39
|
|
|
|
|
|
|
PRODUCTID => dec2hex($_->{'idProduct'}), |
40
|
|
|
|
|
|
|
SERIAL => $_->{'USB Serial Number'}, |
41
|
|
|
|
|
|
|
NAME => $_->{'USB Product Name'}, |
42
|
|
|
|
|
|
|
CLASS => $_->{'bDeviceClass'}, |
43
|
11
|
|
|
|
|
40
|
SUBCLASS => $_->{'bDeviceSubClass'} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
getIODevices(class => 'IOUSBDevice', @_); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |