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