From eb7afcaf1b0fd5dc34725479eb5ce91108ee06b8 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Thu, 5 Nov 2009 09:41:22 +0000 Subject: Use the timing_priority attribute, if available, to provide more corrent LED indiction and such. Merged revisions 7252-7253 via svnmerge from http://svn.digium.com/svn/dahdi/tools/trunk ........ r7252 | tzafrir | 2009-09-29 21:06:47 +0200 (Tue, 29 Sep 2009) | 2 lines xpp: xpp_sync: add -v and fix perldoc ........ r7253 | tzafrir | 2009-09-29 21:12:22 +0200 (Tue, 29 Sep 2009) | 2 lines xpp: use xpd sysfs attr. timing_priority to set NT/TE ........ git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/branches/2.2@7492 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- xpp/perl_modules/Dahdi/Xpp/Xpd.pm | 12 +++++++++++- xpp/xpp_sync | 28 ++++++++++++++++++---------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/xpp/perl_modules/Dahdi/Xpp/Xpd.pm b/xpp/perl_modules/Dahdi/Xpp/Xpd.pm index 5cf6f96..b438b3b 100644 --- a/xpp/perl_modules/Dahdi/Xpp/Xpd.pm +++ b/xpp/perl_modules/Dahdi/Xpp/Xpd.pm @@ -300,14 +300,24 @@ sub new($$$$$) { $self->{CHANNELS} = @offhook; my $type = $self->xpd_getattr('type'); my $span = $self->xpd_getattr('span'); + my $timing_priority = $self->xpd_getattr('timing_priority'); $self->{SPANNO} = $span; $self->{TYPE} = $type; + $self->{TIMING_PRIORITY} = $timing_priority; if($type =~ /BRI_(NT|TE)/) { $self->{IS_BRI} = 1; $self->{TERMTYPE} = $1; $self->{DCHAN_HARDHDLC} = $self->xpd_driver_getattr('dchan_hardhdlc'); + } elsif($type =~ /[ETJ]1/) { + $self->{IS_PRI} = 1; + # older drivers may not have 'timing_priority' + # attribute. Preserve original behaviour: + if(defined($timing_priority) && ($timing_priority == 0)) { + $self->{TERMTYPE} = 'NT'; + } else { + $self->{TERMTYPE} = 'TE'; + } } - $self->{IS_PRI} = ($type =~ /[ETJ]1/); $self->{IS_DIGITAL} = ( $self->{IS_BRI} || $self->{IS_PRI} ); Dahdi::Xpp::Line->create_all($self, $procdir); return $self; diff --git a/xpp/xpp_sync b/xpp/xpp_sync index 44f8e39..41cfd61 100755 --- a/xpp/xpp_sync +++ b/xpp/xpp_sync @@ -9,6 +9,7 @@ # use strict; use File::Basename; +use Getopt::Std; BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); } use Dahdi::Xpp; @@ -21,16 +22,17 @@ sub usage() { print "$0: show / set Astribank sync source\n". "\n". - "Usage: $0 Show sync source.\n". - " $0 Set sync source.\n". + "Usage: $0 [-v] Show sync source.\n". + " $0 [-v] Set sync source.\n". ""; + exit 1; } +my %opts; +getopts('hv', \%opts) || usage; + +$opts{h} && usage; if(@ARGV == 1) { - if ($ARGV[0] =~ /^(-h|--help|help)$/) { - usage; - exit(0); - } $sync = shift; $autoselect = 1 if $sync =~ /^auto$/i; } @@ -52,7 +54,7 @@ sub get_sorted_xpds() { } } my @xpd_prio = Dahdi::Xpp::Xpd::xpds_by_rank(@good_xpds); - #Dahdi::Xpp::Xpd::show_xpd_rank(@xpd_prio); + Dahdi::Xpp::Xpd::show_xpd_rank(@xpd_prio) if $opts{v}; return @xpd_prio; } @@ -143,7 +145,9 @@ xpp_sync - Handle sync selection of Xorcom Astribanks. =head1 SYNOPSIS -xpp_sync [auto|dahdi|nn] +xpp_sync + +xpp_sync [-v] =head1 DESCRIPTION @@ -173,6 +177,10 @@ Gets synchronization from the Dahdi sync master. Sets XBUS-I as sync source. +=item -v + +Also print the numeric xpp sync rank. + =back (Parameter name is case-insensitive) @@ -211,8 +219,8 @@ xpp_sync is essentially a nicer interface to /proc/xpp/sync . That file shows the current xpp sync master (and in what format you need to write to it to set the master). +=back + =head1 SEE ALSO dahdi_registration(1), dahdi_cfg(1), README.Astribank - -=back -- cgit v1.2.3