diff options
Diffstat (limited to 'xpp/utils/zconf/Zaptel/Xpp/Xpd.pm')
-rw-r--r-- | xpp/utils/zconf/Zaptel/Xpp/Xpd.pm | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm b/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm index c05cfdb..326aafd 100644 --- a/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm +++ b/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm @@ -9,6 +9,8 @@ package Zaptel::Xpp::Xpd; # use strict; use Zaptel::Utils; +use Zaptel::Xpp; +use Zaptel::Xpp::Line; my $proc_base = "/proc/xpp"; @@ -64,21 +66,15 @@ sub zt_registration($$) { return $result; } -# -# Backward compatibility for old drivers -# before changeset:5119 -# -# Newer drivers should directly have $xpd->spanno -# -sub spanno_of_xpd($) { - my $xpd = shift || die; - - warn "Running on old driver. Keep going...\n"; - use Zaptel; - my @spans = Zaptel::spans; - - my ($span) = grep { $_->name eq $xpd->fqn } @spans; - return ($span) ? $span->num : 0; +sub xpds_by_spanno() { + my @xbuses = Zaptel::Xpp::xbuses("SORT_CONNECTOR"); + my @xpds = map { $_->xpds } @xbuses; + @xpds = grep { $_->spanno } @xpds; + @xpds = sort { $a->spanno <=> $b->spanno } @xpds; + my @spanno = map { $_->spanno } @xpds; + my @idx; + @idx[@spanno] = @xpds; # The spanno is the index now + return @idx; } sub new($$) { @@ -92,8 +88,18 @@ sub new($$) { local $/ = "\n"; open(F, "$procdir/summary") || die "Missing summary file in $procdir"; my $head = <F>; - chomp $head; - # "XPD-00 (BRI_TE ,card present, span 3)" + chomp $head; # "XPD-00 (BRI_TE ,card present, span 3)" + # The driver does not export the number of channels... + # Let's find it indirectly + while(<F>) { + chomp; + if(s/^\s*offhook\s*:\s*//) { + my @offhook = split; + @offhook || die "No channels in '$procdir/summary'"; + $self->{CHANNELS} = @offhook; + last; + } + } close F; $head =~ s/^(XPD-(\d\d))\s+// || die; $self->{ID} = $2; @@ -105,13 +111,12 @@ sub new($$) { #warn "Garbage in '$procdir/summary': rest='$rest'\n" if $rest; if($span =~ s/span\s+(\d+)//) { # since changeset:5119 $self->{SPANNO} = $1; - } else { - $self->{SPANNO} = $self->spanno_of_xpd; } $self->{TYPE} = $type; $self->{IS_BRI} = ($type =~ /BRI_(NT|TE)/); $self->{IS_PRI} = ($type =~ /[ETJ]1_(NT|TE)/); $self->{IS_DIGITAL} = ( $self->{IS_BRI} || $self->{IS_PRI} ); + Zaptel::Xpp::Line->create_all($self, $procdir); return $self; } |