[dahdi-commits] tzafrir: branch tools/tzafrir/sysfs r7648 - in /tools/team/tzafrir/sysfs/xpp:...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Thu Nov 26 14:58:40 CST 2009
Author: tzafrir
Date: Thu Nov 26 14:58:38 2009
New Revision: 7648
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7648
Log:
Fix scanning of channels from Sysfs; add missing attributes
* Channels now reside in dahdi_chan:<span>:<chan> rather than <span>:<chan>.
Fix globbing.
* Add some extra perl Span methods from SysFS span attributes.
* Add a test program: (very partial for now) reimplementation of dahdi_scan.
Added:
tools/team/tzafrir/sysfs/xpp/dahdi_scan (with props)
Modified:
tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm
Added: tools/team/tzafrir/sysfs/xpp/dahdi_scan
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/xpp/dahdi_scan?view=auto&rev=7648
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/dahdi_scan (added)
+++ tools/team/tzafrir/sysfs/xpp/dahdi_scan Thu Nov 26 14:58:38 2009
@@ -1,0 +1,50 @@
+#! /usr/bin/perl -w
+#
+# dahdi_scan - reimplemented in perl
+#
+# As a test to the SysFS interface and perl perl modules, reimplement
+# dahdi_scan with it.
+
+use strict;
+use File::Basename;
+BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); }
+
+use Dahdi;
+use Dahdi::Span;
+
+sub usage {
+ die "Usage: $0\n";
+}
+
+my @spans = Dahdi::spans;
+
+my %seen;
+my $format = "%-20s %-12s %4s:%4s %s\n";
+
+my @devices = Dahdi::Hardware->device_list;
+foreach my $span (@spans) {
+ my $num = sprintf("%d", $span->num);
+ my $active = "MISSING"; # FIXME: how do I get this information?
+ my $alarms = "MISSING"; # FIXME: how do I get this information?
+ my $description = $span->description;
+ my $name = $span->name;
+ my $manufacturer = $span->manufacturer;
+ my $devicetype = $span->devicetype;
+ my $location = $span->location;
+ my $first_chan =($span->chans())[0]; # FIXME: what if there's none?
+ my $basechan = $first_chan->num();
+ my $totchans = $span->chans();
+
+ print <<EOT;
+[$num]
+active=$active
+alarms=$alarms
+description=$description
+name=$name
+manufacturer=$manufacturer
+devicetype=$devicetype
+location=$location
+basechan=$basechan
+totchans=$totchans
+EOT
+}
Propchange: tools/team/tzafrir/sysfs/xpp/dahdi_scan
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tools/team/tzafrir/sysfs/xpp/dahdi_scan
------------------------------------------------------------------------------
svn:executable = *
Propchange: tools/team/tzafrir/sysfs/xpp/dahdi_scan
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: tools/team/tzafrir/sysfs/xpp/dahdi_scan
------------------------------------------------------------------------------
svn:mime-type = text/plain
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=7648&r1=7647&r2=7648
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm (original)
+++ tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm Thu Nov 26 14:58:38 2009
@@ -216,11 +216,14 @@
$self->{IS_DAHDI_SYNC_MASTER} = $self->_get_dev_attr('is_sync_master');
$self->{NAME} = $self->_get_dev_attr('name');
$self->{DESCRIPTION} = $self->_get_dev_attr('desc');
+ $self->{DEVICETYPE} = $self->_get_dev_attr('devicetype');
+ $self->{LOCATION} = $self->_get_dev_attr('location');
+ $self->{MANUFACTURER} = $self->_get_dev_attr('manufacturer');
# TODO: span alarms?
$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_chan:$num_str:[0-9][0-9]")) {
my $chan = Dahdi::Chans->new($self, $chan_dev_dir);
push(@channels, $chan);
}
More information about the dahdi-commits
mailing list