[Pkg-voip-commits] r10473 - in /dahdi-tools/trunk/debian: ./ patches/ patches/upstream/

tzafrir at alioth.debian.org tzafrir at alioth.debian.org
Mon May 5 09:39:22 UTC 2014


Author: tzafrir
Date: Mon May  5 09:39:22 2014
New Revision: 10473

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=10473
Log:
Extra upstream backports - mainly for fixing hotplugging support.

Added:
    dahdi-tools/trunk/debian/patches/upstream/
    dahdi-tools/trunk/debian/patches/upstream/0001-improved-dahdi_span_types-dumpconfig.patch
    dahdi-tools/trunk/debian/patches/upstream/0002-xpp-dahdi_registration-force-re-assignment.patch
    dahdi-tools/trunk/debian/patches/upstream/0004-dahdi_genconf-remove-hard-coded-E1-default.patch
Modified:
    dahdi-tools/trunk/debian/changelog
    dahdi-tools/trunk/debian/patches/series

Modified: dahdi-tools/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-tools/trunk/debian/changelog?rev=10473&op=diff
==============================================================================
--- dahdi-tools/trunk/debian/changelog	(original)
+++ dahdi-tools/trunk/debian/changelog	Mon May  5 09:39:22 2014
@@ -7,6 +7,7 @@
     - example_scriptlet removed: merged upstream.
   * Don't add spans automatically in Asterisk (it's the job of asterisk).
   * Also depend on usbutils: xpp_fxloader uses lsusb.
+  * Extra upstream backports - mainly for fixing hotplugging support.
 
   [ Mark Purcell ]
   * New upstream release

Modified: dahdi-tools/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-tools/trunk/debian/patches/series?rev=10473&op=diff
==============================================================================
--- dahdi-tools/trunk/debian/patches/series	(original)
+++ dahdi-tools/trunk/debian/patches/series	Mon May  5 09:39:22 2014
@@ -2,3 +2,8 @@
 echocan_oslec
 init_unload_oslec
 remove_dahdi_speed
+
+# Commits included in upstream after 2.9.1 . To be removed later:
+upstream/0001-improved-dahdi_span_types-dumpconfig.patch
+upstream/0002-xpp-dahdi_registration-force-re-assignment.patch
+upstream/0004-dahdi_genconf-remove-hard-coded-E1-default.patch

Added: dahdi-tools/trunk/debian/patches/upstream/0001-improved-dahdi_span_types-dumpconfig.patch
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-tools/trunk/debian/patches/upstream/0001-improved-dahdi_span_types-dumpconfig.patch?rev=10473&op=file
==============================================================================
--- dahdi-tools/trunk/debian/patches/upstream/0001-improved-dahdi_span_types-dumpconfig.patch	(added)
+++ dahdi-tools/trunk/debian/patches/upstream/0001-improved-dahdi_span_types-dumpconfig.patch	Mon May  5 09:39:22 2014
@@ -0,0 +1,140 @@
+From f2628eeedd1bf9dc41c56062c9afbe190196232f Mon Sep 17 00:00:00 2001
+From: Oron Peled <oron.peled at xorcom.com>
+Date: Mon, 31 Mar 2014 19:48:30 +0300
+Subject: [PATCH 1/4] improved dahdi_span_types dumpconfig
+
+* Better defaults:
+  - A wildcard match:
+    - If '--line-mode' option is given, generate a wildcard entry.
+      (existing behavior).
+
+    - Otherwise, if *all spans* are of the same type (E1/T1),
+      generate a wildcard entry for this type.
+      This is the most common use-case and now it work without
+      any command line flags.
+
+    - Otherwise (mixed E1/T1 spans), do not generate a wildcard entry.
+      This isn't common case (except from our labs), but regardless
+      without '--line-mode' any guess could be wrong.
+
+  - Specific device matches:
+    - If all spans are of the same type, generate commented out
+      specific entries (for manual overrides).
+
+    - If spans have mixed E1/T1 types, generate specific entries
+      In this case, specific entries MUST NOT be commented out
+      otherwise, the configuration file is wrong!
+
+* Generated header with better organization:
+  - Shows what is generated:
+    - Generating wildcard / Not generating wildcard
+    - Generating specific lines / Generating *commented-out* specific lines
+
+  - For each decision, show *why* it was taken.
+
+Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>
+---
+ dahdi_span_types |   61 ++++++++++++++++++++++++++++++++++++++++--------------
+ 1 file changed, 45 insertions(+), 16 deletions(-)
+
+diff --git a/dahdi_span_types b/dahdi_span_types
+index 85204d8..4154772 100755
+--- a/dahdi_span_types
++++ b/dahdi_span_types
+@@ -188,28 +188,57 @@ show_spantypes() {
+ 	done
+ }
+ 
++list_pri_spantypes() {
++	find $DEVICES -follow -maxdepth 1 -name spantype | \
++		xargs cat | \
++		sed -n '/:[ETJ]1$/s/^.*://p' | \
++		sort -u | \
++		tr '\n' ' ' | \
++		sed -e 's/^ *//' -e 's/ *$//'
++}
++
+ dump_config() {
++	pri_spantypes=`list_pri_spantypes`
++	num_spantypes=`echo "$pri_spantypes" | wc -w`
++	gen_default=''
+ 	echo '#'
+ 	echo "# Autogenerated by $0 on `date`"
+ 	echo "# Map PRI DAHDI devices to span types for E1/T1/J1"
++	echo "#"
++
++	echo "# Summary:"
+ 	if [ "$DEFAULT_LINE_MODE" != '' ]; then
+-		echo "# Was run with '--line-mode=$DEFAULT_LINE_MODE' -- so will:"
+-		echo "#     * Generate default wildcard entry"
+-		echo "#     * Generate commented-out device list (for overrides)"
++		gen_default="$DEFAULT_LINE_MODE"
++		echo "#  * Generating wildcard match of $gen_default."
++		echo "#    - Was run with '--line-mode=$DEFAULT_LINE_MODE'"
++	elif [ "$num_spantypes" -eq 1 ]; then
++		gen_default="$pri_spantypes"
++		echo "#  * Generating wildcard match of $gen_default."
++		echo "#    - Spans were $pri_spantypes"
++	else
++		echo "#  * Not generating wildcard match."
++		echo "#    - Was run without '--line-mode' option and span were of mixed types [$pri_spantypes]"
++	fi
++	echo "#"
++	if [ "$num_spantypes" -eq 1 ]; then
++		echo "#  * Generating a list of commented out configurations for spans."
++		echo "#    - Spans were $pri_spantypes"
++		echo "#    - Uncomment for specific overrides"
++	else
++		echo "#  * Generating a list of specific span configurations."
++		echo "#    - Spans were of mixed types: $pri_spantypes"
+ 	fi
++	echo "#"
+ 	echo ''
+-	fmt="%-65s %s\n"
+-	printf "$fmt" '# @location/hardware_id' 'span_type'
+ 
+-	if [ "$DEFAULT_LINE_MODE" != '' ]; then
+-		echo ""
+-		echo "# Wildcard line-mode $DEFAULT_LINE_MODE".
+-		printf "$fmt" "*" "*:$DEFAULT_LINE_MODE"
+-		echo ""
+-		echo "# A list of commented out configurations for spans."
+-		echo "# Each item may be un-commented to provide an override."
++	fmt="%-65s %s"
++	printf "$fmt\n" '# @location/hardware_id' 'span_type'
++
++	if [ "$gen_default" != '' ]; then
++		printf "$fmt\t\t# Wildcard line-mode" "*" "*:$gen_default"
+ 		echo ""
+ 	fi
++	echo ""
+ 	for device in $DEVICES
+ 	do
+ 		devpath=`cd "$device" && pwd -P`
+@@ -226,10 +255,10 @@ dump_config() {
+ 		cat "$device/spantype" | while read st; do
+ 			case "$st" in
+ 			*:[ETJ]1)
+-				if [ "$DEFAULT_LINE_MODE" != '' ]; then
+-					printf "#$fmt" "$id" "$st"
++				if [ "$num_spantypes" -eq 1 ]; then
++					printf "#$fmt\n" "$id" "$st"
+ 				else
+-					printf "$fmt" "$id" "$st"
++					printf "$fmt\n" "$id" "$st"
+ 				fi
+ 				;;
+ 			*)
+@@ -237,7 +266,7 @@ dump_config() {
+ 				;;
+ 			esac
+ 		done | sort -n
+-		#echo ''
++		echo ''
+ 	done
+ }
+ 
+-- 
+1.7.10.4
+

Added: dahdi-tools/trunk/debian/patches/upstream/0002-xpp-dahdi_registration-force-re-assignment.patch
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-tools/trunk/debian/patches/upstream/0002-xpp-dahdi_registration-force-re-assignment.patch?rev=10473&op=file
==============================================================================
--- dahdi-tools/trunk/debian/patches/upstream/0002-xpp-dahdi_registration-force-re-assignment.patch	(added)
+++ dahdi-tools/trunk/debian/patches/upstream/0002-xpp-dahdi_registration-force-re-assignment.patch	Mon May  5 09:39:22 2014
@@ -0,0 +1,61 @@
+From ffe36c63e0e2af7d92ef26a36a7151f97c972ea6 Mon Sep 17 00:00:00 2001
+From: Oron Peled <oron.peled at xorcom.com>
+Date: Sun, 30 Mar 2014 21:38:52 +0300
+Subject: [PATCH 2/4] 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>
+---
+ xpp/dahdi_registration |   10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+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 $?;
+-- 
+1.7.10.4
+

Added: dahdi-tools/trunk/debian/patches/upstream/0004-dahdi_genconf-remove-hard-coded-E1-default.patch
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-tools/trunk/debian/patches/upstream/0004-dahdi_genconf-remove-hard-coded-E1-default.patch?rev=10473&op=file
==============================================================================
--- dahdi-tools/trunk/debian/patches/upstream/0004-dahdi_genconf-remove-hard-coded-E1-default.patch	(added)
+++ dahdi-tools/trunk/debian/patches/upstream/0004-dahdi_genconf-remove-hard-coded-E1-default.patch	Mon May  5 09:39:22 2014
@@ -0,0 +1,61 @@
+From 1e6b2741db99b34f7d63ac96dd5a876686d27131 Mon Sep 17 00:00:00 2001
+From: Oron Peled <oron.peled at xorcom.com>
+Date: Sun, 6 Apr 2014 13:01:32 -0400
+Subject: [PATCH 4/4] 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>
+---
+ xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm |   17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+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 $?;
+ }
+-- 
+1.7.10.4
+




More information about the Pkg-voip-commits mailing list