[dahdi-commits] tzafrir: branch tools/tzafrir/sysfs r5979 - /tools/team/tzafrir/sysfs/xpp/

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Feb 4 19:11:30 CST 2009


Author: tzafrir
Date: Wed Feb  4 19:11:30 2009
New Revision: 5979

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=5979
Log:
dahdi_genconf: generation of partial configuration

If a command-line parameter begins with '/' , it is interpreted as a
sysfs path (of a span). If any such parameters are given, configuration 
will only be created for those spans.

Modified:
    tools/team/tzafrir/sysfs/xpp/dahdi_genconf

Modified: tools/team/tzafrir/sysfs/xpp/dahdi_genconf
URL: http://svn.digium.com/svn-view/dahdi/tools/team/tzafrir/sysfs/xpp/dahdi_genconf?view=diff&rev=5979&r1=5978&r2=5979
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/dahdi_genconf (original)
+++ tools/team/tzafrir/sysfs/xpp/dahdi_genconf Wed Feb  4 19:11:30 2009
@@ -151,7 +151,7 @@
 
 my @default_files = ("dahdi", "chan_dahdi");
 
-my @spans = Dahdi::spans();
+my @spans;
 
 sub bchan_range($) {
 	my $span = shift || die;
@@ -748,9 +748,31 @@
 	$chan_dahdi_conf_file = $ENV{CHAN_DAHDI_CONF_FILE} || "/etc/asterisk/chan_dahdi.conf";
 }
 
+# Returns the list of spans to use.
+# Input: optional list of sysfs device nodes of spans.
+# If list is empty, use the list of all spans.
+sub get_spans {
+	if (not @_) {
+		return Dahdi::spans();
+	}
+	
+	my @spans_list = map { Dahdi::span_of_node($_) } @_;
+	return @spans_list;
+}
+
 sub parse_args {
-	push(@ARGV, 'unicall') if $pri_connection_type eq 'R2';
-	for my $file (@ARGV) {
+	my @span_nodes = grep /^\//, at ARGV;
+	my @files = grep !/^\//, at ARGV;
+	@spans = get_spans(@span_nodes);
+
+	if (not @files) {
+		push(@default_files, 'unicall') if $pri_connection_type eq 'R2';
+		return;
+	}
+
+	# If we got here, the user wants to generate non-default files.
+	@default_files = ();
+	for my $file (@files) {
 		die "$0: Unknown file '$file'" unless defined $files{$file};
 		push @default_files, $file;
 	}




More information about the dahdi-commits mailing list