[dahdi-commits] dahdi/tools.git branch "master" updated.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Apr 30 14:52:19 CDT 2014


branch "master" has been updated
       via  1e6b2741db99b34f7d63ac96dd5a876686d27131 (commit)
       via  794c8eb0482c5b2a4f5054f9d926e2f66286a14d (commit)
       via  ffe36c63e0e2af7d92ef26a36a7151f97c972ea6 (commit)
      from  f2628eeedd1bf9dc41c56062c9afbe190196232f (commit)

Summary of changes:
 xpp/dahdi_registration                         |   10 ++++++-
 xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm |   17 +++++++-----
 xpp/waitfor_xpds                               |   33 +++++++++++++++++-------
 3 files changed, 44 insertions(+), 16 deletions(-)


- Log -----------------------------------------------------------------
commit 1e6b2741db99b34f7d63ac96dd5a876686d27131
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Sun Apr 6 13:01:32 2014 -0400

    dahdi_genconf: remove hard-coded E1 default
    
    * The "spantypes" generator had E1 default if no 'line-mode' parameter
      was passed.
    
    * As a result the new logic in "dahdi_span_types dumpconfig" had no
      effect when called from dahdi_genconf, as it was always called
      with "--line-mode=" argument.
    
    * Now "dahdi_genconf spantype" behaves just like
      "dahdi_span_types dumpconfig":
      - The "--line-mode=" forces generation of provided line-mode (E1/J1/T1)
      - Without this option, the generated config matches the current spans
        state according to new dahd_span_types default logic:
        - Wildcard rule if all spans have same line-mode.
        - Uncommented specific matches if spans have different line-modes.
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm b/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
index dfa0608..b1914bb 100644
--- a/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
+++ b/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
@@ -30,16 +30,21 @@ sub generate($$$) {
 	return if $?;
 
 	my $line_mode = $genopts->{'line-mode'};
-	$line_mode = 'E1' unless defined $line_mode;
-	$line_mode =~ /^[ETJ]1$/ or die "Bad line-mode='$line_mode'\n";
-	warn "Empty configuration -- no spans\n" unless @spans;
+	my $cmd;
+	if (defined $line_mode) {
+		$line_mode =~ /^[ETJ]1$/ or die "Bad line-mode='$line_mode'\n";
+		$cmd = "dahdi_span_types --line-mode=$line_mode dumpconfig > $file";
+		printf("Generating $file (with default line-mode %s)\n", $line_mode)
+			if $genopts->{verbose};
+	} else {
+		$cmd = "dahdi_span_types dumpconfig > $file";
+		printf("Generating $file (no --line-mode override)\n")
+			if $genopts->{verbose};
+	}
 	rename "$file", "$file.bak"
 		or $! == 2	# ENOENT (No dependency on Errno.pm)
 		or die "Failed to backup old config: $!\n";
 	#$gconfig->dump;
-	printf("Generating $file (with default line-mode %s)\n", $line_mode)
-		if $genopts->{verbose};
-	my $cmd = "dahdi_span_types --line-mode=$line_mode dumpconfig > $file";
 	system $cmd;
 	die "Command failed (status=$?): '$cmd'" if $?;
 }

commit 794c8eb0482c5b2a4f5054f9d926e2f66286a14d
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Mon Mar 31 13:35:34 2014 +0300

    xpp: waitfor_xpds: handle missing serial numbers
    
    Fixes a regression since 949ea4ca9f9c9050811af9e80d44530beb10fd8f
    (2.7.0) - allows using an Astribank with no serial.
    
    * Some of the olderst Astribanks don't have a serial number burned in
      them. Thus there is no serial attribute for the sysfs USB device node.
    
    * waitfor_xpds identifies the Astribanks by their serial numbers.
    
    * An lone Astribank without serial number would thus block waitfor_xpds
      (until timeout).
    
    * Now we warn about them.
    
    * We also try to handle it gracefully. As long as there's only one
      of thease, it would be counted as "NO-SERIAL".
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

diff --git a/xpp/waitfor_xpds b/xpp/waitfor_xpds
index bffa8c2..79e2806 100755
--- a/xpp/waitfor_xpds
+++ b/xpp/waitfor_xpds
@@ -41,18 +41,25 @@ ab_list() {
 }
 
 ab_serial_nums() {
-	ab_list | \
-		sed 's,$,/serial,' | \
-		xargs grep -H '' 2>/dev/null | \
-		sed 's,.*/serial:,,' | \
-		sed 's/^$/NO-SERIAL/' | \
-		sort -u
+	for i in `ab_list`; do
+		s=`cat "$i/serial" 2>/dev/null` || :
+		if [ "$s" = '' ]; then
+			echo "NO-SERIAL"
+		else
+			echo "$s"
+		fi
+	done | sort -u || :
 }
 
 detected_serial_nums() {
-	cat /sys/bus/astribanks/devices/*/transport/serial 2> /dev/null | \
-		sed 's/^$/NO-SERIAL/' | \
-		sort -u || :
+	for i in /sys/bus/astribanks/devices/*/transport; do
+		s=`cat "$i/serial" 2>/dev/null` || :
+		if [ "$s" = '' ]; then
+			echo "NO-SERIAL"
+		else
+			echo "$s"
+		fi
+	done | sort -u || :
 }
 
 calc_union() {
@@ -98,6 +105,14 @@ if ! astribank_is_starting; then
 	exit 0
 fi
 
+# Sanity check
+for i in `ab_list`; do
+	s=`cat "$i/serial" 2>/dev/null` || :
+	if [ "$s" = '' ]; then
+		echo >&2 "WARNING! Astribank without serial number: $i"
+	fi
+done
+
 serial_nums=`ab_serial_nums`
 
 # Loop until detected (hopefully) all astribanks and they are initialized

commit ffe36c63e0e2af7d92ef26a36a7151f97c972ea6
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Sun Mar 30 21:38:52 2014 +0300

    xpp: dahdi_registration: force re-assignment
    
    * The system state causing the bug:
      - DAHDI has auto_assign_spans==1
      - No /etc/dahdi/assigned-spans.conf
    
    * The bug scenario:
      - During initial device detection, they are assigned by
        DAHDI driver.
      - Later we run "dahdi_span_assignment remove"
      - Then, a "dahdi_registration on" would not assign any span.
    
    * The fix:
      - Using the '-R' option, force "dahdi_registration on" to also
        do "dahdi_span_assignment auto" on relevant devices.
      - This is the way it's called by /usr/share/dahdi/dahdi_auto_assign_compat
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Acked-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/xpp/dahdi_registration b/xpp/dahdi_registration
index 32bd746..7202e76 100755
--- a/xpp/dahdi_registration
+++ b/xpp/dahdi_registration
@@ -41,6 +41,11 @@ my $span_types_config = $ENV{'SPAN_TYPES_CONF_FILE'} || '/etc/dahdi/span-types.c
 my $have_assigned_spans_config = -f $assigned_spans_config || 0;
 my $have_span_types_config = -f $span_types_config || 0;
 
+# Spans will be auto-assigned by default if either:
+# - Driver $auto_assign_spans them or
+# - Udev script see that we $have_span_types_config and it "add" them
+my $default_auto_assign = $auto_assign_spans || $have_assigned_spans_config;
+
 my $sorter;
 my $sort_order = $opts{'s'};
 if(defined $sort_order) {
@@ -100,11 +105,14 @@ foreach my $xbus (Dahdi::Xpp::xbuses($sorter)) {
 		}
 		myprintf "%3s ==> %3s\n", state2str($prev), state2str($on);
 	}
-	if (defined($on) && $on && ! $have_assigned_spans_config && ! $auto_assign_spans) {
+	next unless defined($on) && $on;
+	# Only assign if no default assignment, or forced by '-R' option
+	if ($opts{'R'} || ! $default_auto_assign) {
 		# Emulate /etc/dahdi/assigned-spans.conf:
 		#   - We iterate over $xbus according to /etc/dahdi/xpp_order
 		#   - We "auto" assign all spans of current $xbus
 		my $devpath = sprintf "/sys/bus/dahdi_devices/devices/astribanks:xbus-%02d", $xbus->num;
+		myprintf "auto-assign $devpath\n";
 		my @cmd = ('dahdi_span_assignments', 'auto', $devpath);
 		system @cmd;
 		warn "Failed '@cmd' (status=$?)\n" if $?;

-----------------------------------------------------------------------


-- 
dahdi/tools.git



More information about the dahdi-commits mailing list