line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# harware::fan Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Hardware::Fan; |
7
|
1
|
|
|
1
|
|
716
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use base qw(Metabrik::File::Text); |
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
394
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
commands => { |
19
|
|
|
|
|
|
|
info => [ ], |
20
|
|
|
|
|
|
|
#status => [ ], |
21
|
|
|
|
|
|
|
#speed => [ ], |
22
|
|
|
|
|
|
|
#level => [ ], |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub info { |
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $base_file = '/proc/acpi/ibm/fan'; |
31
|
0
|
0
|
|
|
|
|
$self->brik_help_run_file_not_found('info', $base_file) or return; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
my $data = $self->read($base_file) or return; |
34
|
0
|
|
|
|
|
|
chomp($data); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $info_hash = {}; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my @lines = split(/\n/, $data); |
39
|
0
|
|
|
|
|
|
for my $line (split(/\n/, $data)) { |
40
|
0
|
|
|
|
|
|
my ($name, $value) = $line =~ /^(\S+):\s+(.*)$/; |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ($name eq 'commands') { |
43
|
0
|
|
|
|
|
|
push @{$info_hash->{$name}}, $value; |
|
0
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
0
|
|
|
|
|
|
$info_hash->{$name} = $value; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $info_hash; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |