[svn-commits] sruffell: branch tools/2.5 r10256 - /tools/branches/2.5/xpp/perl_modules/Dahdi/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 21 17:12:53 CDT 2011


Author: sruffell
Date: Fri Oct 21 17:12:49 2011
New Revision: 10256

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10256
Log:
dahdi_genconf: Use 'dahdi_scan' to determine span_type for B410P cards.

The wcb4xxp driver does not put enough information in the proc filesystem to
determine if the ports are in TE or NT mode.  Previously the ports would
always just setup the dahdi-channels.conf file in TE mode. After this change
the dahdi_scan utility is used to detect if the ports are in TE or NT mode and
setup dahdi-channels.conf appropriately.

Internal-Issue-ID: DAHTOOL-54
Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10214

Modified:
    tools/branches/2.5/xpp/perl_modules/Dahdi/Span.pm

Modified: tools/branches/2.5/xpp/perl_modules/Dahdi/Span.pm
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.5/xpp/perl_modules/Dahdi/Span.pm?view=diff&rev=10256&r1=10255&r2=10256
==============================================================================
--- tools/branches/2.5/xpp/perl_modules/Dahdi/Span.pm (original)
+++ tools/branches/2.5/xpp/perl_modules/Dahdi/Span.pm Fri Oct 21 17:12:49 2011
@@ -131,7 +131,7 @@
 		'(?:quad|octo)BRI PCI ISDN Card.* \[(NT|TE)\]',
 		'octoBRI \[(NT|TE)\] ',
 		'HFC-S PCI A ISDN.* \[(NT|TE)\] ',
-		'(B4XXP) \(PCI\) Card', # Does not expose NT/TE type
+		'(B4XXP) \(PCI\) Card', # Use dahdi_scan to determine TE/NT mode
 		'(WCBRI)', # has selectable NT/TE modes via dahdi_cfg
 		);
 
@@ -175,6 +175,28 @@
 		$self->{BCHAN_LIST} = [ 0 .. 22 ];
 	}
 	$self->{TYPE} = "${proto}_$self->{TERMTYPE}";
+}
+
+sub get_digital_spantype {
+	my $span_no = shift;
+	my @lines = split /\n/, `dahdi_scan`;
+	my $found_span = 0;
+	foreach my $line (@lines) {
+		if (! $found_span) {
+			if ($line =~ m/\[$span_no\]/) {
+				$found_span = 1;
+			}
+		} else {
+			if ($line !~ m/^\[/) {
+				if ($line =~ m/digital-(TE|NT)/ ){
+					return $1;
+				}
+			} else {
+				$found_span = 0;
+			}
+		}
+	}
+	die "Cannot determine digital spantype";
 }
 
 sub new($$) {
@@ -195,7 +217,12 @@
 	foreach my $cardtype (@bri_strings) {
 		if($head =~ m/$cardtype/) {
 			my $termtype = $1;
-			$termtype = 'TE' if ( $1 eq 'B4XXP' or $1 eq 'WCBRI' );
+			if ($1 eq 'B4XXP') {
+				$termtype = get_digital_spantype($num);
+			}
+			if ($1 eq 'WCBRI') {
+				$termtype = 'TE';
+			}
 			$self->{IS_DIGITAL} = 1;
 			$self->{IS_BRI} = 1;
 			$self->{TERMTYPE} = $termtype;




More information about the svn-commits mailing list