File: Bios.pm

package info (click to toggle)
ocsinventory-agent 2%3A2.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,424 kB
  • sloc: perl: 26,492; xml: 773; objc: 528; sh: 386; ansic: 333; makefile: 12
file content (60 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package Ocsinventory::Agent::Backend::OS::Linux::Archs::ARM::Bios;

use strict;
use warnings;

sub check {
    my $params = shift;
    my $common = $params->{common};
    $common->can_read("/proc/cpuinfo");
    $common->can_run("vcgencmd");
}

sub run {
    my $params = shift;
    my $common = $params->{common};
    my $current;
    my @infos;

    # processor         : 0
    # model name        : ARMv6-compatible processor rev 7 (v6l)
    # BogoMIPS          : 697.95
    # Features          : half thumb fastmult vfp edsp java tls
    # CPU implementer   : 0x41
    # CPU architecture  : 7
    # CPU variant       : 0x0
    # CPU part          : 0xb76
    # CPU revision      : 7
    #
    # Hardware          : BCM2835
    # Revision          : 0002
    # Serial            : 0000000081355bf5
    # Model             : Raspberry Pi Model B Rev 1
    open INFO, "</proc/cpuinfo" or warn;
    foreach(<INFO>) {
        $current->{SSN} = $1 if /Serial\s+:\s+(\S.*)/;
        $current->{BVERSION} =  $1 if /Revision\s+:\s+(.*)/;
        $current->{TYPE} = $1 if /Model\s+:\s+(.*)/;
        push @infos, $current;
    }
    close(INFO);

    # vcgencmd version
    my $bd=`vcgencmd version | head -1`;
    $bd =~ s/^(#.*\n)//g;
    $bd =~ s/Invalid.*$//g;
    chomp($bd);

    # Writing data
    foreach my $info (@infos) {
        $info->{ASSETTAG}='N/A';
        $info->{SMANUFACTURER}='Raspberry';
        $info->{SMODEL}='Raspberry';
        $info->{BMANUFACTURER}='N/A';
        $info->{BDATE}=$bd;
        $info->{MMANUFACTURER}='N/A';
        $common->setBios($info);
    }
}

1;