[svn-commits] tzafrir: tools/trunk r6647 - in /tools/trunk/xpp: ./ perl_modules/Dahdi/Confi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 19 11:46:09 CDT 2009


Author: tzafrir
Date: Tue May 19 11:46:06 2009
New Revision: 6647

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6647
Log:
dahdi-perl: make dahdi_genconf default to hardhdlc

dahdi_genconf's 'bri_hardhdlc' parameter changes. Should generally work
with no need for manual configuration unless you use a bristuffed driver
(zaphfc, qozap). 

See notes in genconf_parameters.

Modified:
    tools/trunk/xpp/dahdi_genconf
    tools/trunk/xpp/genconf_parameters
    tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/System.pm
    tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm
    tools/trunk/xpp/perl_modules/Dahdi/Config/Params.pm
    tools/trunk/xpp/perl_modules/Dahdi/Xpp/Xpd.pm

Modified: tools/trunk/xpp/dahdi_genconf
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/dahdi_genconf?view=diff&rev=6647&r1=6646&r2=6647
==============================================================================
--- tools/trunk/xpp/dahdi_genconf (original)
+++ tools/trunk/xpp/dahdi_genconf Tue May 19 11:46:06 2009
@@ -128,7 +128,7 @@
 
  The actual dahdi hardware is automatically detected on the host.
 
-=item /etc/dahdi/genconf_params
+=item /etc/dahdi/genconf_parameters
 
 A configuration file that supplements the hardware information.
 Its location may be overriden via the C<GENCONF_PARAMETERS> environment

Modified: tools/trunk/xpp/genconf_parameters
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/genconf_parameters?view=diff&rev=6647&r1=6646&r2=6647
==============================================================================
--- tools/trunk/xpp/genconf_parameters (original)
+++ tools/trunk/xpp/genconf_parameters Tue May 19 11:46:06 2009
@@ -89,10 +89,17 @@
 #echo_can		oslec
 #echo_can		none  # to avoid echo canceler altogether
 
-# bri_hardhdlc: If this parameter is set to 'yes', in the entries for
-# BRI cards 'hardhdlc' will be used instead of 'dchan' (an alias for
-# 'fcshdlc').
-#bri_hardhdlc		yes
+# bri_hardhdlc:
+#   'yes'  - forces BRI cards to use 'hardhdlc' signalling.
+#   'no'   - forces BRI cards to use 'dchan' (an alias for 'fcshdlc').
+#            It is usefull only for dahdi with the bristuff patch.
+#
+# If it is left out or set to 'auto':
+#   * Information supplied by the driver is used to decide:
+#     - Currently implemented for Astribanks.
+#     - Taken from /sys/bus/xpds/drivers/bri/dchan_hardhdlc.
+#   * Without this info, falls back to 'hardhdlc'.
+#bri_hardhdlc		auto
 
 # For MFC/R2 Support: 'R2' will make E1 spans CAS and with the
 # 'r2_idle_bits' bit in system.conf . It will also make dahdi_genconf default

Modified: tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/System.pm
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/System.pm?view=diff&rev=6647&r1=6646&r2=6647
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/System.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/System.pm Tue May 19 11:46:06 2009
@@ -48,11 +48,6 @@
 		$span_crc4 = '';
 		$framing = 'cas';
 	}
-	my $dchan_type = 'dchan';
-	if ($span->is_bri() && is_true($gconfig->{'bri_hardhdlc'})) {
-		$dchan_type = 'hardhdlc';
-	}
-
 	$timing = ($termtype eq 'NT') ? 0 : $bri_te_last_timing++;
 	printf "span=%d,%d,%d,%s,%s%s%s\n",
 			$num,
@@ -63,14 +58,42 @@
 			$span_crc4,
 			$span_yellow;
 	printf "# termtype: %s\n", lc($termtype);
-	if ($gconfig->{'pri_connection_type'} eq 'PRI') {
+	my $dchan_type;
+	if ($span->is_bri()) {
+		my $use_bristuff = 0;
+		my $cfg_hardhdlc = $gconfig->{'bri_hardhdlc'};
+		my $xpd = $span->xpd();
+		if(!defined($cfg_hardhdlc) || $cfg_hardhdlc =~ /AUTO/i) {
+			# Autodetect
+			if(defined($xpd)) {
+				# Bristuff?
+				if(defined($xpd->dchan_hardhdlc) && !is_true($xpd->dchan_hardhdlc)) {
+					$use_bristuff = 1;
+				}
+			}
+		} elsif(!is_true($cfg_hardhdlc)) {
+			$use_bristuff = 1;
+		}
+		if($use_bristuff) {
+			$dchan_type = 'dchan';
+		} else {
+			$dchan_type = 'hardhdlc';
+		}
 		printf "bchan=%s\n", Dahdi::Config::Gen::bchan_range($span);
 		my $dchan = $span->dchan();
 		printf "$dchan_type=%d\n", $dchan->num();
-	} elsif ($gconfig->{'pri_connection_type'} eq 'R2' ) {
-		my $idle_bits = $gconfig->{'r2_idle_bits'};
-		printf "cas=%s:$idle_bits\n", Dahdi::Config::Gen::bchan_range($span);
-		printf "dchan=%d\n", $span->dchan()->num();
+	} elsif($span->is_pri()) {
+		if ($gconfig->{'pri_connection_type'} eq 'PRI') {
+			printf "bchan=%s\n", Dahdi::Config::Gen::bchan_range($span);
+			my $dchan = $span->dchan();
+			printf "dchan=%d\n", $dchan->num();
+		} elsif ($gconfig->{'pri_connection_type'} eq 'R2' ) {
+			my $idle_bits = $gconfig->{'r2_idle_bits'};
+			printf "cas=%s:$idle_bits\n", Dahdi::Config::Gen::bchan_range($span);
+			printf "dchan=%d\n", $span->dchan()->num();
+		}
+	} else {
+		die "Digital span $num is not BRI, nor PRI?";
 	}
 	print_echo_can($gconfig, Dahdi::Config::Gen::bchan_range($span));
 }

Modified: tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm?view=diff&rev=6647&r1=6646&r2=6647
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm Tue May 19 11:46:06 2009
@@ -2,6 +2,7 @@
 use strict;
 
 use Dahdi::Config::Gen qw(is_true);
+use Dahdi::Xpp;
 
 sub new($$$) {
 	my $pack = shift || die;

Modified: tools/trunk/xpp/perl_modules/Dahdi/Config/Params.pm
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Config/Params.pm?view=diff&rev=6647&r1=6646&r2=6647
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Config/Params.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Config/Params.pm Tue May 19 11:46:06 2009
@@ -106,7 +106,7 @@
 			brint_overlap		=> 'no',
 			bri_sig_style		=> 'bri_ptmp',
 			echo_can		=> 'mg2',
-			bri_hardhdlc		=> 'no',
+			bri_hardhdlc		=> 'auto',
 			pri_connection_type	=> 'PRI',
 			r2_idle_bits		=> '1101',
 			'pri_termtype'		=> [ 'SPAN/* TE' ],

Modified: tools/trunk/xpp/perl_modules/Dahdi/Xpp/Xpd.pm
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Xpp/Xpd.pm?view=diff&rev=6647&r1=6646&r2=6647
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Xpp/Xpd.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Xpp/Xpd.pm Tue May 19 11:46:06 2009
@@ -84,6 +84,25 @@
 }
 
 my %attr_missing_warned;	# Prevent duplicate warnings
+
+sub xpd_driver_getattr($$) {
+	my $xpd = shift || die;
+	my $attr = shift || die;
+	$attr = lc($attr);
+	my ($busnum, $unitnum, $subunitnum) = ($xpd->xbus->num, $xpd->unit, $xpd->subunit);
+	my $file = sprintf "$Dahdi::Xpp::sysfs_xpds/%02d:%1d:%1d/driver/$attr",
+			$busnum, $unitnum, $subunitnum;
+	if(!defined($file)) {
+		warn "$0: xpd_driver_getattr($attr) -- Missing attribute.\n" if
+			$attr_missing_warned{$attr};
+		return undef;
+	}
+	open(F, $file) || return undef;
+	my $val = <F>;
+	close F;
+	chomp $val;
+	return $val;
+}
 
 sub xpd_getattr($$) {
 	my $xpd = shift || die;
@@ -198,6 +217,7 @@
 	if($type =~ /BRI_(NT|TE)/) {
 		$self->{IS_BRI} = 1;
 		$self->{TERMTYPE} = $1;
+		$self->{DCHAN_HARDHDLC} = $self->xpd_driver_getattr('dchan_hardhdlc');
 	}
 	$self->{IS_PRI} = ($type =~ /[ETJ]1/);
 	$self->{IS_DIGITAL} = ( $self->{IS_BRI} || $self->{IS_PRI} );




More information about the svn-commits mailing list