[svn-commits] tzafrir: branch tools/tzafrir/sysfs r8744 - in /tools/team/tzafrir/sysfs/xpp/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 3 13:55:13 CDT 2010


Author: tzafrir
Date: Thu Jun  3 13:55:09 2010
New Revision: 8744

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8744
Log:
Improve backward compatibility with trunk/

* If we initialize $span from /proc/dahdi (no sysfs info), than the
  $span->unique_string is set to its number.
* Generate globally numeric channel range if $span->unique_string is numeri
* Allow generating a numeric configuration also if DAHDI_DIALBYNAME
  environment variable is not set to true
* Also, return sorted spans as in trunk/
* Also, merge from trunk/ the LABEL/CONNECTOR specification matching
  in /etc/dahdi/xpp.conf

Modified:
    tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi.pm
    tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm

Modified: tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi.pm
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi.pm?view=diff&rev=8744&r1=8743&r2=8744
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi.pm (original)
+++ tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi.pm Thu Jun  3 13:55:09 2010
@@ -63,6 +63,7 @@
 	} else {
 		return ();
 	}
+	@spans = sort { $a->num <=> $b->num } @spans;
 	return @spans;
 }
 

Modified: tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm?view=diff&rev=8744&r1=8743&r2=8744
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm (original)
+++ tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm Thu Jun  3 13:55:09 2010
@@ -50,7 +50,7 @@
 
 =head2 chans()
 
-The list of the channels (L<Dahdi::Chans> objects) of this span.
+The list of the channels (L<Dahdi::Chan> objects) of this span.
 In a scalar context returns the number of channels this span has.
 
 =head2 bchans()
@@ -181,9 +181,15 @@
 	my $span = shift || die;
 	my @chans = @_;
 	my $unique_string = $span->unique_string;
-	my @index = map { $_->index } @chans;
-	my $channels_string = Dahdi::Utils::channo_range(@index);
-	my $str = $unique_string . '!' . $channels_string;
+	my $str;
+	if($unique_string =~ /^\d+$/) {
+		my @nums = map { $_->num } @chans;
+		$str = Dahdi::Utils::channo_range(@nums);
+	} else {
+		my @index = map { $_->index } @chans;
+		my $channels_string = Dahdi::Utils::channo_range(@index);
+		$str = $unique_string . '!' . $channels_string;
+	}
 	return $str;
 }
 
@@ -357,7 +363,7 @@
 	# FIXME: the following is a number, rather than a readable value:
 	$self->{ALARMS} = $self->_get_dev_attr('alarms');
 	my $hwname = $self->alias || $self->hardware_id || $self->location;
-	if (defined $hwname) {
+	if (defined $hwname && $ENV{DAHDI_DIALBYNAME}) {
 		my $unique_string = sprintf "span-names!%s(%s)", $hwname, $self->{SPAN_ID};
 		$self->{UNIQUE_STRING} = $unique_string;
 	} else {
@@ -420,6 +426,7 @@
 	$self->{IS_DIGITAL} = 0;
 	$self->{IS_BRI} = 0;
 	$self->{IS_PRI} = 0;
+	$self->{UNIQUE_STRING} = $num;
 	foreach my $cardtype (@bri_strings) {
 		if($head =~ m/$cardtype/) {
 			my $termtype = $1;
@@ -550,10 +557,17 @@
 	}
 	push(@pri_specs , 'SPAN/* TE');		# Default
 	my @patlist = ( "SPAN/" . $span->num );
-	my ($xbus_name, $xpd_name) = ($name =~ m|(XBUS-\d+)/(XPD-\d+)|);
-	if(defined $xbus_name) {
+	my $xpd = $span->{XPD};
+	if(defined $xpd) {
+		my $xbus = $xpd->xbus;
+		my $xbus_name = $xbus->name;
+		my $xpd_name = "XPD-" . $xpd->id;
+		my $label = $xbus->label;
+		my $connector = $xbus->connector;
+		#print "DEBUG: '$xbus_name/$xpd_name' LABEL='$label' CONNECTOR='$connector'\n";
 		push(@patlist, "NUM/$xbus_name/$xpd_name");
-#		push(@patlist, "CONNECTOR/$ENV{XBUS_CONNECTOR}/$xpd_name");
+		push(@patlist, "LABEL/$label/$xpd_name");
+		push(@patlist, "CONNECTOR/$connector/$xpd_name");
 	}
 	#print STDERR "PATLIST=@patlist\n";
 	my $match_termtype;




More information about the svn-commits mailing list