line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::MacOS::Videos; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
75186727
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
65
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
724
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
263
|
|
7
|
2
|
|
|
2
|
|
745
|
use FusionInventory::Agent::Tools::MacOS; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
650
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
11
|
0
|
0
|
|
|
|
0
|
return 0 if $params{no_category}->{video}; |
12
|
0
|
|
|
|
|
0
|
return canRun('/usr/sbin/system_profiler'); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doInventory { |
16
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
19
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
my %displays = _getDisplays(logger => $logger); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
foreach my $monitor (@{$displays{MONITORS}}) { |
|
0
|
|
|
|
|
0
|
|
24
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
25
|
|
|
|
|
|
|
section => 'MONITORS', |
26
|
|
|
|
|
|
|
entry => $monitor, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
foreach my $video (@{$displays{VIDEOS}}) { |
|
0
|
|
|
|
|
0
|
|
31
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
32
|
|
|
|
|
|
|
section => 'VIDEOS', |
33
|
|
|
|
|
|
|
entry => $video, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _getDisplays { |
39
|
1
|
|
|
1
|
|
450
|
my (%params) = @_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $infos = getSystemProfilerInfos( |
42
|
|
|
|
|
|
|
type => 'SPDisplaysDataType', |
43
|
|
|
|
|
|
|
logger => $params{logger}, |
44
|
|
|
|
|
|
|
file => $params{file} |
45
|
1
|
|
|
|
|
23
|
); |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
10
|
my @monitors; |
48
|
|
|
|
|
|
|
my @videos; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
2
|
foreach my $videoName (keys %{$infos->{'Graphics/Displays'}}) { |
|
1
|
|
|
|
|
4
|
|
51
|
1
|
|
|
|
|
1
|
my $videoCardInfo = $infos->{'Graphics/Displays'}->{$videoName}; |
52
|
1
|
|
|
|
|
2
|
foreach my $displayName (keys %{$videoCardInfo->{Displays}}) { |
|
1
|
|
|
|
|
2
|
|
53
|
3
|
100
|
|
|
|
6
|
next if $displayName eq 'Display Connector'; |
54
|
2
|
50
|
|
|
|
4
|
next if $displayName eq 'Display'; |
55
|
2
|
|
|
|
|
2
|
my $displayInfo = $videoCardInfo->{Displays}->{$displayName}; |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
3
|
my $resolution = $displayInfo->{Resolution}; |
58
|
2
|
50
|
|
|
|
3
|
if ($resolution) { |
59
|
2
|
|
|
|
|
6
|
$resolution =~ s/\ //g; |
60
|
2
|
|
|
|
|
4
|
$resolution =~ s/\@.*//g; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
3
|
my $memory = $videoCardInfo->{'VRAM (Total)'}; |
64
|
2
|
50
|
|
|
|
5
|
$memory =~ s/\ .*//g if $memory; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
push @videos, { |
67
|
|
|
|
|
|
|
CHIPSET => $videoCardInfo->{'Chipset Model'}, |
68
|
|
|
|
|
|
|
MEMORY => $memory, |
69
|
|
|
|
|
|
|
NAME => $videoName, |
70
|
|
|
|
|
|
|
RESOLUTION => $resolution, |
71
|
|
|
|
|
|
|
PCISLOT => $videoCardInfo->{Slot} |
72
|
2
|
|
|
|
|
6
|
}; |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
4
|
push @monitors, { |
75
|
|
|
|
|
|
|
CAPTION => $displayName, |
76
|
|
|
|
|
|
|
DESCRIPTION => $displayName, |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return ( |
82
|
1
|
|
|
|
|
5
|
MONITORS => \@monitors, |
83
|
|
|
|
|
|
|
VIDEOS => \@videos |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |