Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/usr/share/fusioninventory/lib/FusionInventory/Agent/Tools/Screen/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/share/fusioninventory/lib/FusionInventory/Agent/Tools/Screen/Goldstar.pm
package FusionInventory::Agent::Tools::Screen::Goldstar;

use strict;
use warnings;

use parent 'FusionInventory::Agent::Tools::Screen';

# Well-known eisa_id for which wee need to revert serial and altserial
my $eisa_id_match = qr/4b21$/ ;

sub serial {
    my ($self) = @_;

    # Revert serial and altserial when eisa_id matches
    return $self->_altserial if ($self->eisa_id =~ $eisa_id_match);

    return $self->{_serial};
}

sub altserial {
    my ($self) = @_;

    return $self->{_altserial} if $self->{_altserial};

    # Revert serial and altserial when eisa_id matches
    return $self->{_altserial} = $self->eisa_id =~ $eisa_id_match ?
        $self->{_serial} : $self->_altserial;
}

sub _altserial {
    my ($self) = @_;

    my $serial1 = $self->{edid}->{serial_number};

    # split serial in two parts
    my ($high, $low) = $serial1 =~ /(\d+) (\d\d\d)$/x;

    return 0 unless defined($high) && defined($low);

    # translate the first part using a custom alphabet
    my @alphabet = split(//, "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ");
    my $base     = scalar @alphabet;

    return 0 if $high/$base > $#alphabet;

    return $alphabet[$high / $base] . $alphabet[$high % $base] . $low;
}

1;

Hry