Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lim to hex converter

Status
Not open for further replies.

Damsube

Programmer
Mar 7, 2011
13
GB
Hi all,

Does anyone have a good equ pos to mult pos converter please?

cheers,
 
Hi, maybe a little perl-script will do good enough:


Enter EQU as: 1-0-20-00,
bpos as: 1-0-20 or
multno as four hex: 0040

Cut and paste.
For unix/linux: check that the first line points to perl in your system.
For windows: left as an exercise to the user to get it working :)



Code:
#!/usr/bin/perl
# ^^^^^^^^  change this to point to perl in your system

$cmdname = $1 if ($0 =~ s/.*\/(.*)// );

#print "$cmdname\n";
#exit;

$usage = 0;

$nxtarg = 0;
$argc = 0;

while ($argc < @ARGV) {
    if (substr($ARGV[$argc], 0, 1) eq "-") {
        $nxtarg = 0;
        if ($ARGV[$argc] eq "-h") {
            $argc++;
            $usage = 1;
        }
        else {
            $usage = 1;
            $argc++;
        }
    }
    else {
        if ($nxtarg == 0) {
            push(@parlist, $ARGV[$argc]);
            $argc++;
        }
        else {
            $usage = 1;
            $argc++;
        }
    }
}

if ($usage) {
    print "Usage: $cmdname [equ] [bpos] [multno]\n";
    print "\n";
    print "  -h         print this help info\n";
    print "  equ        equ pos to convert to multno\n";
    print "  bpos       bpos to convert to multno\n";
    print "  multno     convert from multno to equ, form XXXX (four hex digits)\n";
    print "    \n";
    print "   multno is built up as: \n";
    print "    000000mm bbbiiiii  for 32-pos board\n";
    print "    000000mm bbbbiiii  for 16-pos board\n";
    print "    000000mm bbbbbiii  for 8-pos board\n";
    print "    \n";
    print "    where m=magasine, b=board, i=individual\n";

    exit 0;
}

sub printmult {
    my $str = $_[0];
    my $lim = $_[1];
    my $mag = $_[2];
    my $brdh = $_[3];
    my $brdl = $_[4];
    my $ind = $_[5];
    my $multno = 0;

    $multno = $mag * 256 + ($brdh * 32) + ($brdl * 8) + $ind;

    printf("%-12s  ->  %04X\n",
           $str, $multno, $mag, $brdh, $brdl, $ind);
}

sub printequ {
    my $str = $_[0];
    my $multno = $_[1];
    my $mag = 0;
    my $brdh = 0;
    my $brd8 = 0;
    my $ind8 = 0;
    my $brd16 = 0;
    my $ind16 = 0;
    my $brd32 = 0;
    my $ind32 = 0;

    $mag = ($multno & 0x0300) / 256;
    $brdh = ($multno & 0x00E0) / 32;

    $brd8 = ($multno & 0x0018) / 8;
    $brd16 = ($multno & 0x0010) / 8;
    $brd32 = 0;

    $ind8 = ($multno & 0x0007);
    $ind16 = ($multno & 0x000F);
    $ind32 = ($multno & 0x0001F);

    printf("%04X   ->   ", $multno);
    printf("8-pos: LIM-%d-%d%d-%02d,  ", $mag, $brdh, $brd8, $ind8);
    printf("16-pos: LIM-%d-%d%d-%02d,  ", $mag, $brdh, $brd16, $ind16);
    printf("32-pos: LIM-%d-%d%d-%02d\n", $mag, $brdh, $brd32, $ind32);
}

#--------------------------------------------------
my $str = "";
for ($cnt = 0; $cnt <= $#parlist; $cnt++) {

    $str = $parlist[$cnt];

    if ($str =~ /^([0-9]+)-([0-9]+)-([0-9])([0-9])-([0-9]+)/ ) {  # equ  1-0-20-04
        $lim = $1;
        $mag = $2;
        $brdh = $3;
        $brdl = $4;
        $ind = $5;
        printmult($str, $lim, $mag, $brdh, $brdl, $ind);
    }
    elsif ($str =~ /^([0-9]+)-([0-9]+)-([0-9])([0-9])/ ) {        # bpos  1-0-20
        $lim = $1;
        $mag = $2;
        $brdh = $3;
        $brdl = $4;
        $ind = 0;
        printmult($str, $lim, $mag, $brdh, $brdl, $ind);
    }
    elsif ($str =~ /^([0-9a-fA-F]{4})/ ) {              # multno  16-bit hex
        $multno = hex($1);
        printequ($str, $multno);
    }
    else {
        print "Unknown: $str\n";
    }
}

exit(0);
 
Hi Every one. Can some one help I have MX-ONE TSE version 3.2 SP 2. License file is ok . I can read license file on an other running server but i can not read license file on original server for which i got this license file. license file is according to server hard ware ID
lim1:/home/eri_sn_admin # license_print -file /mnt/SN-02098-5.lic
Printing is done on hardware id: 002264-9f048a This one is running Server.

Exchange 002264-9f0eb2
Sequence 5
MX-ONEV32LIC 1 SYSTEM 0 LICENSE-FILE
FAL1045302 172 PORT 0 IP-EXTENSION
FAL1045303 96 PORT 0 ANALOGUE-EXTENSION
FAL1045304 1 PORT 0 LINE-INTERFACE-MODULE
FAL1045305 65535 PORT 0 FREESEATING
FAL1045307 44 PORT 0 EXTERNAL-LINE-H323
FAL1045308 44 PORT 0 EXTERNAL-LINE-H323-SERV
FAL1045309 90 PORT 0 EXTERNAL-LINE-ISDN-USR
FAL1045310 0 PORT 0 EXTERNAL-LINE-QSIG
FAL1045311 65535 PORT 0 PERSONAL-NUMBER-USER
FAL1045312 1 SYSTEM 0 NET-SERVICES
FAL1045313 0 PORT 0 EXTERNAL-LINE-ISDN-NET
FAL1045314 65535 PORT 0 IS-ETH-INTERFACE
FAL1045315 65535 PORT 0 VM-ETH-INTERFACE
FAL1045316 250 PORT 0 APP-LINK-INTERFACE
FAL1045317 65535 PORT 0 EM-ETH-INTERFACE
FAL1045319 65535 PORT 0 VOIP-ETH-INTERFACE
FAL1045477 20 PORT 0 MOBILE-EXTENSION
FAL1045498 65535 PORT 0 REPEAT-IND-DIV-USER
FAL1045502 96 PORT 0 DIGITAL-EXTENSION
FAL1045503 0 PORT 0 FIXED-REMOTE-EXTENSION
FAL1045504 2 PORT 0 OPERATOR-EXTENSION
FAL1045505 16 PORT 0 RVA-INTERNAL
FAL1046508 24 PORT 0 EXTERNAL-LINE-CAS-ANA
FAL1046510 30 PORT 0 EXTERNAL-LINE-CAS-DIG
FAL1046512 0 PORT 0 EXTERNAL-LINE-DASS
FAL1046513 0 PORT 0 EXTERNAL-LINE-CCSS7
FAL1046514 0 PORT 0 EXTERNAL-LINE-DPNSS
FAL1046515 0 PORT 0 CAS-EXTENSION
FAL1046622 0 PORT 0 ACD-AGENT
FAL1046623 96 PORT 0 ANALOGUE-EXTENSION-CLIP
FAL1046624 16 PORT 0 BASE-STATION-DECT
FAL1046625 50 PORT 0 CORDLESS-EXTENSION
FAL1046626 0 PORT 0 CCM-ETH-INTERFACE
FAL1046627 0 PORT 0 ISDN-TERMINAL-INTERFACE
FAL1046628 0 PORT 0 PAGING-LOOP
FAL1046629 0 PORT 0 PAGING-SERIAL
FAL1046630 65535 PORT 0 SMDR-ETH-INTERFACE
FAL1046631 65535 PORT 0 VCU-FAX-III-PORT
FAL1046634 0 PORT 0 EXTERNAL-LINE-SIP
FAL1046727 0 SYSTEM 0 HOSPITALITY-APPLICATION
FAL1046729 0 0 VIRTUAL-EXTENSION
FAL1046731 1 SYSTEM 0 DISA-NUMBER
FAL1046734 0 SYSTEM 0 ROUTING-SERVER-SERVER
FAL1046735 0 SYSTEM 0 ROUTING-SERVER-CLIENT
FAL1046758 0 PORT 0 PAGING-PARALLEL
FAL1046759 65535 PORT 0 GENERIC-EXT-SMS
FAL1046760 1 SYSTEM 0 ANCD-FEATURE
FAL1046975 0 SYSTEM 0 VOIP-SECURITY
FAL1048156 0 SYSTEM 0 AUTOMATIC-REGISTRATION
FAL1048157 0 0 SOM-APPLICATION

2. But when i try to read above file in original Server 002264-9f0eb2 just only one line is coming. like this one.
MDSH> license_print -file /mnt/SN-02098-5.lic
Printing is done on hardware id: 002264-9f0eb2.
other all text is not coming

lim1:/etc/opt/eri_sn # license_reread
License server LISH (29) in LIM 1 answered decryptError (10)
after this i get this alarm in system
S N Handle Dom. Code LIM Where Explanation
===============================================================================
4 1281 0 118 1 LISH License server out of order: internal error/inconsistency
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top