[svn-commits] tzafrir: branch tools/tzafrir/sysfs r8440 - /tools/team/tzafrir/sysfs/xpp/per...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Mar 28 06:47:56 CDT 2010


Author: tzafrir
Date: Sun Mar 28 06:47:48 2010
New Revision: 8440

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8440
Log:
Adapt to slight SysFS info. Though it got better

* The name of the DAHDI chan SysFS node changed. Fix parsing.
* Signalling and alarm are no longer numbers. Just use them as strings.
* Print all the information original lsdahdi printed.
* Bring back the optional span->xpd().

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

Modified: tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Chans.pm
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Chans.pm?view=diff&rev=8440&r1=8439&r2=8440
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Chans.pm (original)
+++ tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Chans.pm Sun Mar 28 06:47:48 2010
@@ -103,28 +103,24 @@
 	my $pack = shift or die "Wasn't called as a class method\n";
 	my $span = shift or die "Missing a span parameter\n";
 	my $dev_dir = shift or die "Missing SysFS path parameter\n";
-	my $index = $1;
-	if ($dev_dir !~ /:(\d)+$/) {
+	if ($dev_dir !~ /!(\d)+$/) {
 		die "Malformed SysFS device name $dev_dir\n";
 	}
 	my $self = {
 		'SPAN' => $span,
 		'DEV_DIR' => $dev_dir,
-		'INDEX' => $index,
 	};
 	bless $self, $pack;
 	$self->{NUM} = $self->_get_dev_attr('channo');
+	$self->{INDEX} = $self->_get_dev_attr('chanpos');
 	$self->{FQN} = $self->_get_dev_attr('name'); # TODO: correct?
 
-	# FIXME: resolve numbers to string
 	$self->{ALARMS} = [];
-	my $alarms = $self->_get_dev_attr('chan_alarms');
+	my $alarms = $self->_get_dev_attr('alarms');
 	if ($alarms) {$self->{ALARMS} = [$alarms]}
 
-	$self->{SIGNALLING} = hex($self->_get_dev_attr('sig'));
+	$self->{SIGNALLING} = $self->_get_dev_attr('sig');
 	$self->{SIGCAP} = hex($self->_get_dev_attr('sigcap'));
-	# INFO?
-	# BATTERY
 	
 	# TODO: Where do I get __DAHDI_SIG_FXS and __DAHDI_SIG_FXO from?
 	my $maybe_fxs = $self->{SIGCAP} & (1 << 12);
@@ -136,7 +132,8 @@
      	} else {
 	}
 
-	$self->{INFO} = 'FIXME INFO';
+	$self->{INFO} .= ($self->_get_dev_attr('chanmute')) ? '(no pcm)' : '';
+	$self->{INFO} .= ($self->_get_dev_attr('in_use')) ? '(in use)' : '';
 
 	return $self;
 }
@@ -287,7 +284,7 @@
 
 	# It's an XPD (FXO)
 	my @lines = @{$xpd->lines};
-	my $line = $lines[$index];
+	my $line = $lines[$index - 1];
 	return $line->battery;
 }
 

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=8440&r1=8439&r2=8440
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm (original)
+++ tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm Sun Mar 28 06:47:48 2010
@@ -10,6 +10,7 @@
 use strict;
 use Dahdi::Utils;
 use Dahdi::Chans;
+use Dahdi::Xpp::Xpd;
 
 =head1 NAME
 
@@ -196,6 +197,12 @@
 	defined($num) or die "can't figure span number from $dev_dir\n";
 	my $self = { NUM => $num, DEV_DIR => $dev_dir };
 	bless $self, $pack;
+	my @xpds = Dahdi::Xpp::Xpd::xpds_by_spanno;
+	my $xpd = $xpds[$num];
+	if(defined $xpd) {
+		die "Spanno mismatch: $xpd->spanno, $num" unless $xpd->spanno == $num;
+		$self->{XPD} = $xpd;
+	}
 
 	$self->{IS_DIGITAL} = $self->_get_dev_attr('is_digital');
 	$self->{IS_DAHDI_SYNC_MASTER} = $self->_get_dev_attr('is_sync_master');
@@ -213,7 +220,7 @@
 	
 	$self->{CHANS} = [];
 	my @channels;
-	foreach my $chan_dev_dir (glob("$dev_dir/$num_str:[0-9][0-9]")) {
+	foreach my $chan_dev_dir (glob("$dev_dir/dahdi:dahdi![0-9]*")) {
 		my $chan = Dahdi::Chans->new($self, $chan_dev_dir);
 		push(@channels, $chan);
 	}




More information about the svn-commits mailing list