summaryrefslogtreecommitdiff
path: root/xpp/utils/xpp_sync
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-08-02 12:21:11 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-08-02 12:21:11 +0000
commitc88eaa22e13bd4c092b367a28e57064659660466 (patch)
tree2978dd7342b09b60bf9dbe5e333d043fb43d9114 /xpp/utils/xpp_sync
parent183cf9c2af77e6444450cf5d2b5c62ca6b875fbe (diff)
Merge xpp r4372:
* Update to zaptel-1.2.18 and zaptel-1.4.3 (r4308 onward) * Fix a critical race with zaptel synchronization (r4362) * Added a /proc/xpp/cmds for statistics about command timing (r4360) * Fix a digit mapping bug with hardware dtmf detection (r4357) * In xpp/utils/Makefile add perl syntax checks to our scripts (r4337) * Better USB data error checking (r4336) * udev rules (xpp.rules) avoid false calls from wrong nodes (r4331) * Improve hardware detection and reporting in lszaptel, zaptel_hardware. zapconf is basically functional. * Leds are blinked synchronously on all Astribanks now (r4262) * Fix a BRI bug if OPTIMIZE_CHANMUTE was compiled into zaptel (r4258) (This feature was not yet accepted into official zaptel) * Removed compile warning about HZ != 1000 (r4218) * Firmware updates. * fpga_load now supports USB pathes without zeros (r4211) * XPD numbers have changed to '<Unit><Subunit>' (r4196) * Proper support for ZT_VMWI ioctl, if used in zaptel (r4092) * Fix FXO power denial detection (r4054) * FXO could accidentally go off-hook with some compilers (r4048) (From branches/1.2 r2732, r2735 - branches/1.4 2736) git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2813 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/xpp_sync')
-rwxr-xr-xxpp/utils/xpp_sync86
1 files changed, 68 insertions, 18 deletions
diff --git a/xpp/utils/xpp_sync b/xpp/utils/xpp_sync
index d03c0a4..67825f8 100755
--- a/xpp/utils/xpp_sync
+++ b/xpp/utils/xpp_sync
@@ -8,7 +8,8 @@
# $Id$
#
use strict;
-BEGIN { my $dir = $0; $dir =~ s:/[^/]+$::; unshift(@INC, "$dir", "$dir/zconf"); }
+use File::Basename;
+BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); }
use Zaptel::Xpp;
use Zaptel::Xpp::Xbus;
@@ -38,10 +39,17 @@ sub get_sorted_xpds() {
}
}
- my @bri_xpds = grep { $_->type =~ /BRI/; } @good_xpds;
+ my @bri_nt_xpds = grep { $_->type eq 'BRI_NT'; } @good_xpds;
+ my @bri_te_xpds = grep { $_->type eq 'BRI_TE'; } @good_xpds;
my @fxo_xpds = grep { $_->type eq 'FXO'; } @good_xpds;
my @fxs_xpds = grep { $_->type eq 'FXS'; } @good_xpds;
- return (@bri_xpds, @fxo_xpds, @fxs_xpds);
+
+ # Sync Priority
+ return
+ @bri_nt_xpds,
+ @fxo_xpds,
+ @bri_te_xpds,
+ @fxs_xpds;
}
sub do_select(@) {
@@ -88,13 +96,30 @@ sub show_sync() {
my @xpds = $xbus->xpds;
my @types = map { $_->type } @xpds;
my $mark = ($curr_sync =~ /\d+/ and $xbus->num == $curr_sync)?"+":"";
- printf "\t%1s %s [ ", $mark, $xbus->name;
- foreach my $x (sort { $a->num <=> $b->num } @xpds) {
- printf "%-3s ", $x->type;
+ my $xpdstr = '';
+ my @xpd_types = map { $_->type } sort { $a->num <=> $b->num } @xpds;
+ my $last_type = '';
+ my $mult = 0;
+ foreach my $curr (@xpd_types) {
+ if(!$last_type || ($curr eq $last_type)) {
+ $mult++;
+ } else {
+ if($mult == 1) {
+ $xpdstr .= "$last_type ";
+ } elsif($mult) {
+ $xpdstr .= "$last_type*$mult ";
+ }
+ $mult = 1;
+ }
+ $last_type = $curr;
}
- print "]";
- my $padding = ' ' x (4 * (8 - @xpds));
- printf "%s (%s)\n", $padding, $xbus->connector;
+ if($mult == 1) {
+ $xpdstr .= "$last_type ";
+ } elsif($mult) {
+ $xpdstr .= "$last_type*$mult ";
+ }
+ my $padding = ' ' x (40 - length $xpdstr);
+ printf " %1s %s [ %s]%s (%s)\n", $mark, $xbus->name, $xpdstr, $padding, $xbus->connector;
}
}
@@ -135,7 +160,7 @@ __END__
=head1 NAME
-xpp_sync - Handle sync selection of Xorcom XPD's.
+xpp_sync - Handle sync selection of Xorcom Astribanks.
=head1 SYNOPSIS
@@ -143,8 +168,15 @@ xpp_sync [auto|host|nn]
=head1 DESCRIPTION
-Without parameters, the current syncer. Either HOST or the XBUS number.
-Then a list of the 3 best XPD's for syncing.
+On a normal operation one Astribank device provides timing for all the
+other Astribank devices.
+
+When run without parameters, xpp_sync will display a list of Astribanks
+(xbuses) that are connected and registered as Zaptel spans. The current
+xpp sync master will be marked (if it is not HOST).
+
+If you this an Astribank is connected and yet it does not appear on the
+output of xpp_sync, it may be unregistered. Try running zt_registration .
=head2 Parameters
@@ -152,7 +184,7 @@ Then a list of the 3 best XPD's for syncing.
=item auto
-Automatically selects the best XPD for syncing (with HOST fallback).
+Automatically selects the best Astribank for syncing (with HOST fallback).
=item host
@@ -166,9 +198,27 @@ Set XBUS number nn as sync source.
=head2 Example output:
- Current sync: 03
+ Current sync: 02
Best Available Syncers:
- XBUS-00: FXS FXO (USB-0000:00:10.4-4)
- + XBUS-03: FXS FXS FXS FXS (USB-0000:00:10.4-1)
- XBUS-02: FXS FXS FXS FXS (USB-0000:00:10.4-2)
- XBUS-01: FXS FXS FXS FXS (USB-0000:00:10.4-3)
+ + XBUS-02 [ FXS*3 FXO ] (usb-0000:00:1d.7-3)
+ XBUS-04 [ FXS*4 ] (usb-0000:00:1d.7-1)
+ XBUS-03 [ FXS*4 ] (usb-0000:00:1d.7-2)
+ XBUS-01 [ FXS*4 ] (usb-0000:00:1d.7-4)
+ XBUS-00 [ FXS*4 ] (usb-0000:00:1d.7-5)
+ XBUS-05 [ FXS*4 ] (usb-0000:00:1d.7-6)
+
+In this example we see that the recommended xpp sync master is XBUS-02 -
+it is the first on the list. It is also the actual syncer, as we can see
+from the '+' beside it.
+
+=head1 FILES
+
+=over
+
+=item /proc/xpp/sync
+
+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