[dahdi-commits] dahdi/tools.git branch "master" updated.
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Thu Jan 23 13:55:56 CST 2014
branch "master" has been updated
via d3feed5c4c81d445e94b3ba8934583310b77bd98 (commit)
via b621c02b7f15262ca19b98f6b4408bed9224b6e9 (commit)
via 451a8b4d6f43e209faf1369004f1f17ed827adc3 (commit)
via 09fd3f53b1c3c4b7da5f1e68b59135083d047c74 (commit)
from c3b020a15567dcf2d0136332f34aa2a444dfc124 (commit)
Summary of changes:
dahdi_span_types | 169 +++++++++++++++++-------
doc/dahdi_span_assignments.8 | 101 +++++++++-----
doc/dahdi_span_types.8 | 99 ++++++++++----
xpp/dahdi_genconf | 53 +++++++-
xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm | 22 ++-
5 files changed, 327 insertions(+), 117 deletions(-)
- Log -----------------------------------------------------------------
commit d3feed5c4c81d445e94b3ba8934583310b77bd98
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date: Thu Jan 23 17:55:38 2014 +0200
dahdi_span_types: hush warning of missing attribute
Don't warn when a sysfs attribute does not exist.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks at digium.com>
diff --git a/dahdi_span_types b/dahdi_span_types
index 38dc347..85204d8 100755
--- a/dahdi_span_types
+++ b/dahdi_span_types
@@ -166,7 +166,7 @@ fi
# Beware of special characters in attributes
attr_clean() {
- cat "$1" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:.-' '_'
+ cat "$1" 2>/dev/null | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:.-' '_'
}
show_spantypes() {
commit b621c02b7f15262ca19b98f6b4408bed9224b6e9
Author: Oron Peled <oron.peled at xorcom.com>
Date: Mon Jan 20 20:10:56 2014 +0200
Change span-type.conf generation policy
* Add '--line-mode=<E1|T1|J1>' option to dahdi_span_types:
- Will first generate a wildcard entry (* *:<type>)
- All later entries will be commented-out.
- Manually uncommenting any of them will create an "override"
(e.g: mixed system with all spans T1, but some E1)
* Now dahdi_genconf does not generate span-types.conf by default:
- Added '--line-mode=<E1|T1|J1>' option to trigger generation
- This parameter will be passed to "dahdi_span_types dumpconfig"
- Also explicit specification of 'spantypes' as an argument will
trigger a similar generation (with a default of 'E1').
- The line-mode may also be passed to the generator directly
with identical results. Example:
dahdi_genconf spantypes=line-mode=T1
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks at digium.com>
diff --git a/dahdi_span_types b/dahdi_span_types
index 9fa3ff1..38dc347 100755
--- a/dahdi_span_types
+++ b/dahdi_span_types
@@ -77,11 +77,12 @@ usage() {
echo >&2 " -v|--verbose' - Show debugging messages (on stderr)"
echo >&2 " -n|--dry-run' - During 'set', only show what would be done"
echo >&2 " -k|--key <k> - Override prefered key during dumpconfig action"
+ echo >&2 " --line-mode <m> - Set default line mode to <m> (E1/T1/J1)"
exit 1
}
# Parse command line options
-TEMP=`getopt -o hnvk: --long help,dry-run,verbose,key: -n "$0" -- "$@"`
+TEMP=`getopt -o hnvk: --long help,dry-run,verbose,key:,line-mode: -n "$0" -- "$@"`
if [ $? != 0 ]; then
echo >&2 "Bad options"
usage
@@ -108,6 +109,11 @@ while true ; do
shift
shift
;;
+ --line-mode)
+ DEFAULT_LINE_MODE="$2"
+ shift
+ shift
+ ;;
--)
shift
break
@@ -131,7 +137,17 @@ case "$SPAN_ASSIGNMENTS_KEY" in
hwid|location|devpath)
;;
*)
- echo >&2 "Bad SPAN_ASSIGNMENTS_KEY='$SPAN_ASSIGNMENTS_KEY' (should be: hwid|location|devpath)"
+ echo >&2 "Bad --key='$SPAN_ASSIGNMENTS_KEY' (should be: hwid|location|devpath)"
+ usage
+ ;;
+esac
+
+# Validate DEFAULT_LINE_MODE
+case "$DEFAULT_LINE_MODE" in
+E1|T1|J1|'')
+ ;;
+*)
+ echo >&2 "Bad --line-mode='$DEFAULT_LINE_MODE' (should be: E1|T1|J1)"
usage
;;
esac
@@ -176,9 +192,24 @@ dump_config() {
echo '#'
echo "# Autogenerated by $0 on `date`"
echo "# Map PRI DAHDI devices to span types for E1/T1/J1"
+ if [ "$DEFAULT_LINE_MODE" != '' ]; then
+ echo "# Was run with '--line-mode=$DEFAULT_LINE_MODE' -- so will:"
+ echo "# * Generate default wildcard entry"
+ echo "# * Generate commented-out device list (for overrides)"
+ fi
echo ''
fmt="%-65s %s\n"
printf "$fmt" '# @location/hardware_id' 'span_type'
+
+ if [ "$DEFAULT_LINE_MODE" != '' ]; then
+ echo ""
+ echo "# Wildcard line-mode $DEFAULT_LINE_MODE".
+ printf "$fmt" "*" "*:$DEFAULT_LINE_MODE"
+ echo ""
+ echo "# A list of commented out configurations for spans."
+ echo "# Each item may be un-commented to provide an override."
+ echo ""
+ fi
for device in $DEVICES
do
devpath=`cd "$device" && pwd -P`
@@ -195,7 +226,11 @@ dump_config() {
cat "$device/spantype" | while read st; do
case "$st" in
*:[ETJ]1)
- printf "$fmt" "$id" "$st"
+ if [ "$DEFAULT_LINE_MODE" != '' ]; then
+ printf "#$fmt" "$id" "$st"
+ else
+ printf "$fmt" "$id" "$st"
+ fi
;;
*)
#echo "# Skipped local span `echo $st | sed 's/:/ -- /'`"
diff --git a/doc/dahdi_span_types.8 b/doc/dahdi_span_types.8
index 4f39bf5..f11054a 100644
--- a/doc/dahdi_span_types.8
+++ b/doc/dahdi_span_types.8
@@ -40,6 +40,16 @@ changing anything.
During \fB"set"\fR operation, show the actions that are being performed.
.RE
+.BI \-\-line\-mode= <E1|T1|J1>
+.RS
+During \fB"dumpconfig"\fR operation, force special generation mode:
+.IP \(bu 3
+First, generates a "wildcard" entry with the fiven \fBline\-mode\fR.
+.IP \(bu 3
+Comment out all span entries. Each of them may be manually un-commented
+to override the "wildcard".
+.RE
+
.SH SUB-COMMANDS
.B set
.RS
diff --git a/xpp/dahdi_genconf b/xpp/dahdi_genconf
index a4acfa8..842084d 100755
--- a/xpp/dahdi_genconf
+++ b/xpp/dahdi_genconf
@@ -11,17 +11,30 @@ use strict;
use File::Basename;
BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); }
-use Getopt::Std;
+use Getopt::Long;
use Dahdi;
use Dahdi::Xpp;
use Dahdi::Config::Gen;
use Dahdi::Config::Params;
+Getopt::Long::Configure ("bundling");
+
my $version = '1'; # Functionality version (integer)
my $revision = '$Revision$';
my %opts;
+sub usage {
+ warn "Usage: $0 [options] <generators>\n";
+ warn " Options:\n";
+ warn " --line-mode=<E1|T1|J1> - Also generate span-types.conf with default line mode\n";
+ warn " -F|--freepbx - Modify configuration for Freepbx (skip FXS channels)\n";
+ warn " -v|--verbose - Be versbose, show generated files\n";
+ warn " -V|--version - Show version and exit\n";
+ warn " -h|--help - Show this message\n";
+ exit 1;
+}
+
sub set_defaults {
my $default_file = $ENV{GENCONF_PARAMETERS} || "/etc/dahdi/genconf_parameters";
my $params = Dahdi::Config::Params->new($default_file);
@@ -44,12 +57,24 @@ sub spans_prep($@) {
}
}
+sub munge_spantypes {
+ if ($opts{'line-mode'}) {
+ print "Will generate span-types.conf with line-mode=$opts{'line-mode'}\n"
+ if $opts{'verbose'};
+ return "spantypes=line-mode=$opts{'line-mode'}";
+ } else {
+ print "Will generate span-types.conf\n" if $opts{'verbose'};
+ return "spantypes";
+ }
+}
+
sub generator_list($) {
my $gconfig = shift || die;
my @genlist;
if (@ARGV) {
for my $gen (@ARGV) {
+ $gen = munge_spantypes() if $gen eq 'spantypes';
push @genlist, $gen;
}
} else {
@@ -58,6 +83,7 @@ sub generator_list($) {
if($gconfig->{'pri_connection_type'} eq 'R2') {
push @genlist, 'unicall';
}
+ push(@genlist, munge_spantypes()) if $opts{'line-mode'};
}
return @genlist;
}
@@ -93,7 +119,16 @@ sub generate_files($@) {
}
}
-getopts('vVF', \%opts) || die "$0: Bad option\n";
+GetOptions(\%opts,
+ "line-mode=s",
+ "h|help",
+ "v|verbose",
+ "V|version",
+ "F|freepbx",
+ ) or usage;
+
+usage if $opts{h};
+
if($opts{'V'}) {
my $revstr = $revision;
$revstr =~ s/[^$]*\$[^:]+:\s*//;
@@ -156,19 +191,27 @@ a comma separated list of options to the generator name. E.g:
=over 4
-=item -V
+=item -V --version
Version -- print version string and exit.
-=item -v
+=item -v --verbose
Verbose -- sets the C<'verbose'> option for all generators.
-=item -F
+=item -F --freepbx
Freepbx -- sets the C<'freepbx'> option for all generators.
Currently, chandahdi is affected.
+=item --line-mode=I<mode>
+
+I<mode> may be E1, J1 or T1.
+
+Enables the generator B<spantypes> and the option B<line-mode> to it.
+(Equivalent to the option C<--line-mode> to C<dahdi_span_types>). This
+will generate a C<span-types.conf> file with a single wildcard line
+setting the line mode to I<mode>.
=back
diff --git a/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm b/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
index 6579685..dfa0608 100644
--- a/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
+++ b/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
@@ -29,13 +29,17 @@ sub generate($$$) {
system "which dahdi_span_types > /dev/null 2>&1";
return if $?;
+ my $line_mode = $genopts->{'line-mode'};
+ $line_mode = 'E1' unless defined $line_mode;
+ $line_mode =~ /^[ETJ]1$/ or die "Bad line-mode='$line_mode'\n";
warn "Empty configuration -- no spans\n" unless @spans;
rename "$file", "$file.bak"
or $! == 2 # ENOENT (No dependency on Errno.pm)
or die "Failed to backup old config: $!\n";
#$gconfig->dump;
- print "Generating $file\n" if $genopts->{verbose};
- my $cmd = "dahdi_span_types dumpconfig > $file";
+ printf("Generating $file (with default line-mode %s)\n", $line_mode)
+ if $genopts->{verbose};
+ my $cmd = "dahdi_span_types --line-mode=$line_mode dumpconfig > $file";
system $cmd;
die "Command failed (status=$?): '$cmd'" if $?;
}
@@ -61,3 +65,17 @@ Generate the F</etc/dahdi/span-types.conf>.
This is the configuration for dahdi_span_types.
Its location may be overriden via the environment variable F<SPAN_TYPES_CONF_FILE>.
+
+You would normally run:
+
+ dahdi_genconf --line-mode=<line_mode>
+
+which is a short for:
+
+ dahdi_genconf spantypes=line-mode=<line_mode>
+
+This is done by running:
+ dahdi_span_types dumpconfig --line-mode=line_mode>
+
+where I<line_mode> is the module parameter, and defaults to B<E1> if not
+given (running C<dahdi_genconf spantypes>).
commit 451a8b4d6f43e209faf1369004f1f17ed827adc3
Author: Oron Peled <oron.peled at xorcom.com>
Date: Mon Jan 20 20:10:55 2014 +0200
dahdi_span_types: allow defaults + overrides
* Allow wildcards for both device and span number (as before).
Example:
* *:T1
* But now we are carefull to follow strict order in the configuration
file. This means, if there are multiple matches -- last one wins.
* So we can use specialisation:
* *:T1 # Everything is T1
FOO [34]:T1 # Except spans 3,4 on the FOO device
* Added --dry-run and --verbose options.
* Updated the man-page:
- Fixed "registered" => "assigned".
- Use "line mode" for E1/J1/T1.
- Document current changes.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks at digium.com>
diff --git a/dahdi_span_types b/dahdi_span_types
index 7936076..9fa3ff1 100755
--- a/dahdi_span_types
+++ b/dahdi_span_types
@@ -27,6 +27,19 @@
# - "@location" - Location attribute from sysfs (embeded inside '<>')
# - "/devpath" - The sysfs absolute devpath
#
+# * Wildcard are allowed in the configuration file:
+# - In the device specifiers (keys)
+# - In the span numbers
+# - Example for "match-all": * *:T1
+#
+# * During "set":
+# - If there are multiple matches, for a span, all are applied
+# - They are always applied in their order in the configuration file
+# - This means the last match wins
+# - Example:
+# * *:T1 # All span on all devices are T1
+# usb:X1234567 [34]:E1 # Except spans 3,4 on specific device
+#
# * During "dumpconfig", for each device we take the first available key:
# - The preference is: "hwid" or else "@location" or else "/devpath"
# - This can be overriden via the SPAN_ASSIGNMENTS_KEY environment variable
@@ -34,6 +47,8 @@
#
# Command line options:
# - The '-h|--help' show a usage message.
+# - The '-v|--verbose' show debugging messages (on stderr)
+# - The '-n|--dry-run' During "set", only show what would be done
# - The '-k <key>|--key <key>' overrides the SPAN_ASSIGNMENTS_KEY environment
# variable.
#
@@ -59,12 +74,14 @@ usage() {
echo >&2 ""
echo >&2 " options:"
echo >&2 " -h|--help - Show this help"
+ echo >&2 " -v|--verbose' - Show debugging messages (on stderr)"
+ echo >&2 " -n|--dry-run' - During 'set', only show what would be done"
echo >&2 " -k|--key <k> - Override prefered key during dumpconfig action"
exit 1
}
# Parse command line options
-TEMP=`getopt -o hk: --long help,key: -n "$0" -- "$@"`
+TEMP=`getopt -o hnvk: --long help,dry-run,verbose,key: -n "$0" -- "$@"`
if [ $? != 0 ]; then
echo >&2 "Bad options"
usage
@@ -78,6 +95,14 @@ while true ; do
-h|--help)
usage
;;
+ -n|--dry-run)
+ shift
+ dry_run=true
+ ;;
+ -v|--verbose)
+ shift
+ verbose=true
+ ;;
-k|--key)
SPAN_ASSIGNMENTS_KEY="$2"
shift
@@ -138,11 +163,12 @@ show_spantypes() {
cat "$device/spantype" | while read st; do
case "$st" in
*:[ETJ]1)
- printf "%-10s %-20s %s\n" \
- "$st" "[$hardware_id]" "$location"
+ printf "%-10s %-20s %-30s %s\n" \
+ "$st" "[$hardware_id]" "$location" \
+ "$devpath"
;;
esac
- done | sort -n
+ done
done
}
@@ -185,70 +211,78 @@ filter_conf() {
sed -e 's/#.*//' -e '/^[ \t]*$/d' "$DAHDISPANTYPESCONF"
}
-conf_spans() {
- hardware_id="$1"
- location="$2"
- devpath="$3"
- filter_conf | (
- # Collect device spans
- # in a subshell, so $SPANS is not lost
- SPANS=''
- while read id spans; do
+handle_span() {
+ device="$1"
+ spantype="$2"
+ attr_file="$device/spantype"
+ devpath=`cd "$device" && pwd -P`
+ devname=`echo "$device" | sed "s,$devbase/,,"`
+ location='@'`attr_clean "$device/location"`
+ hardware_id=`attr_clean "$device/hardware_id"`
+ spanno=`echo "$spantype" | cut -d: -f1`
+ #echo >&2 "DEBUG: $device $spanno ($spantype)"
+ filter_conf | while read id span_spec; do
+ sn=`echo "$span_spec" | cut -d: -f1`
+ val=`echo "$span_spec" | cut -d: -f2`
+ case "$spanno" in
+ $sn)
+ ;;
+ *)
+ #echo >&2 "no-match($device $spanno): $sn"
+ continue
+ ;;
+ esac
+ found=no
# GLOBBING
case "$location" in
$id)
- #echo >&2 "match($id): $spans"
- SPANS="$SPANS $spans"
+ #echo >&2 "match($id): $span_spec"
+ found=yes
;;
esac
case "$hardware_id" in
$id)
- #echo >&2 "match([$id]): $spans"
- SPANS="$SPANS $spans"
+ #echo >&2 "match([$id]): $span_spec"
+ found=yes
;;
esac
case "$devpath" in
$id)
- #echo >&2 "match([$id]): $spans"
- SPANS="$SPANS $spans"
+ #echo >&2 "match([$id]): $span_spec"
+ found=yes
;;
esac
+ if [ "$found" = 'yes' ]; then
+ if [ "$dry_run" = 'true' -o "$verbose" = 'true' ]; then
+ echo >&2 "Set $devname span $spanno = $val"
+ fi
+ if [ "$dry_run" != 'true' ]; then
+ echo "$spanno:$val" > "$attr_file"
+ fi
+ fi
done
- echo "$SPANS"
- )
}
-device_set_spantype() {
- device="$1"
- attr_file="$device/spantype"
- devpath=`cd "$device" && pwd -P`
- location='@'`attr_clean "$device/location"`
- hardware_id=`attr_clean "$device/hardware_id"`
- spanspecs=`conf_spans "$hardware_id" "$location" "$devpath"`
- #echo >&2 "MATCHED($device): $spanspecs"
- cut -d: -f1 "$attr_file" | while read spanno; do
- for sp in $spanspecs
- do
- s=`echo "$sp" | cut -d: -f1`
- v=`echo "$sp" | cut -d: -f2`
- case "$spanno" in
- $s)
- #echo >&2 "conf($attr_file): $spanno:$v"
- echo "$spanno:$v" > "$attr_file"
- ;;
- esac
- done
- done
-}
-
-set_spantypes() {
+set_all_devices() {
if [ ! -f "$DAHDISPANTYPESCONF" ]; then
echo >&2 "$0: Missing configuration '$DAHDISPANTYPESCONF'"
exit 1
fi
for device in $DEVICES
do
- device_set_spantype "$device"
+ devname=`echo "$device" | sed "s,$devbase/,,"`
+ cat "$device/spantype" | while read spantype; do
+ case "$spantype" in
+ *:[ETJ]1)
+ handle_span "$device" "$spantype"
+ ;;
+ *)
+ if [ "$dry_run" = 'true' -o "$verbose" = 'true' ]; then
+ echo >&2 "Skipping non-E1/T1/J1 span ($devname -- $spantype)"
+ fi
+ ;;
+ esac
+ done
done
}
@@ -260,7 +294,7 @@ dumpconfig)
dump_config
;;
set)
- set_spantypes
+ set_all_devices
;;
*)
usage
diff --git a/doc/dahdi_span_types.8 b/doc/dahdi_span_types.8
index c7d221d..4f39bf5 100644
--- a/doc/dahdi_span_types.8
+++ b/doc/dahdi_span_types.8
@@ -1,27 +1,46 @@
-.TH "SPAN_TYPES" "8" "13 Oct 2013" "" ""
+.TH "DAHDI_SPAN_TYPES" "8" "23 Jan 2014" "" ""
.SH NAME
-dahdi_span_types \- set DAHDI spans properties before registration (E1/T1)
+dahdi_span_types \- set line modes of DAHDI spans before assignment
.SH SYNOPSIS
-.B dahdi_span_types <list|dumpconfig|set> [\fIdevpath \fB[\fIdevpath \fB...]]
+.B dahdi_span_types [\fIoptions\fB] <list|dumpconfig|set> \fB[\fIdevpath \fB...]
.SH DESCRIPTION
-The span type (E1/T1/J1) must be set to a span before registering it
-with DAHDI, as E1 spans use more channels. \fBdahdi_span_types\fR applies the
-span type configuration to an unregistered span.
+The span type (the line mode: E1/T1/J1) must be set to a span before
+DAHDI assigns it a span number, as E1 spans use more channels.
+\fBdahdi_span_types\fR applies the span type configuration to an
+un-assigned span.
Using it only makes sense when the kernel module parameter
-\fBdahdi.auto_assign_span\fR is unset, otherwise the DAHDI spans register
-automatically.
+\fBdahdi.auto_assign_span\fR is unset, otherwise DAHDI automatically
+assign span numbers during device registration.
-.SH OPTIONS
.B dahdi_span_types
takes a command and an optional list of devices. If no device is given,
the command is applied to all devices.
The device is marked as a path in the SysFS tree.
+.SH OPTIONS
+
+.B -h|--help
+.RS
+Output usage message and exit
+.RE
+
+.B -n|--dry-run
+.RS
+During \fB"set"\fR operation, only show what would be done, without actually
+changing anything.
+.RE
+
+.B -v|--verbose
+.RS
+During \fB"set"\fR operation, show the actions that are being performed.
+.RE
+
+.SH SUB-COMMANDS
.B set
.RS
Reads settings from \fBspan-types.conf\fR and applies them to the
@@ -31,8 +50,8 @@ specified).
.B list
.RS
-List types for all spans in the system which may be set with dahdi_span_types
-(E1/T1/J1 spans).
+List line modes for all spans in the system which may be set with
+dahdi_span_types (E1/T1/J1 spans).
.RE
.B dumpconfig
@@ -46,8 +65,9 @@ uses this command internally.
.RE
.SH CONFIGURATION
+.SS General structure
.B span-types.conf
-is a file with lines specifying registration of spans.
+is a file with lines specifying line modes of spans.
Empty lines or lines beginning with '#' are ignored.
@@ -56,7 +76,7 @@ Each line is in the format of:
.I ID spanspec ...
The \fIID\fR field specifies the DAHDI device and the \fIspanspecs\fR
-define how to register its spans. A line may have multiple
+define the line modes of its spans. A line may have multiple
\fIspanspecs\fR in a single line (though dumpconfig generates a
configuration with one per line).
@@ -66,8 +86,8 @@ software readable serial number or whatever) or the location in which
it is installed on the system. The former makes it simpler to change
connector / slot whereas the latter makes it simpler to replace a unit.
-The value in this field is matched (when the commands \fBadd\fR and
-\fBremove\fR) are used) to the following values:
+The value in this field is matched (when the command \fBset\fR is
+used) to the following values:
\fIhwid\fR
\fB@\fIlocation\fR
@@ -75,22 +95,28 @@ The value in this field is matched (when the commands \fBadd\fR and
See above for their descriptions. The value may include shell wildcards:
*, ? and [], which are used in the match. The values to be matched are
-first cleaned up: '!' is replaced with '/' and any character beyond
-"a-zA-Z0-9/:.-" is removed.
+first cleaned up: '!' is replaced with '/' and any character not in
+"a-zA-Z0-9/:.-" is replaced by "_".
+
+Note that while span\-types.conf allows an arbitrarily-complex
+combination of E1, J1 and T1 ports, it would normally have just a single
+wildcard line setting the line mode (the first line in the example below).
.SS Span Specification
Each line should have one or more span specifications: this is the value
-used to register a span with DAHDI in the SysFS interface. A
-specification has three colon-separated numbers:
+used to set span type with DAHDI in the SysFS interface. A
+specification has two colon-separated fields:
.I rel_span_no:span_type
-for instance, the following are four span specifications specify ports 1 and 2 as E1 and ports 3 and 4 as T1: [12]:E1 [34]:T1 .
+for instance, the following are four span specifications specify ports 1
+and 2 as E1 and ports 3 and 4 as T1: [12]:E1 [34]:T1 .
.B rel_span_no
.RS
The relative number of the span in the device. E.g.: port number.
+This field may contain shell wildcards (*, ? and [])
.RE
.B span_type
@@ -98,6 +124,21 @@ The relative number of the span in the device. E.g.: port number.
E1/T1/J1
.RE
+.SS Multiple matches
+During \fBset\fR operation, the \fBdahdi_span_types\fR applies all
+matching settings to a span. This is done in the order of lines in the
+configuration files.
+
+Thus, if there are multiple matches to a span -- the last match
+will \fIwin\fR (all will be applied to the kernel in order. The last
+one in the file will be applied last).
+
+Example:
+.EX
+* *:T1 # All spans on all devices will be T1
+usb:X1234567 [34]:E1 # Except spans 3,4 on the device which will be E1
+.EE
+
.SH ENVIRONMENT
@@ -109,14 +150,14 @@ overridden from the environment.
.B DAHDISPANTYPESCONF
.RS
-The path to span-types.conf resides. /etc/dahdi/span-types.conf if
+The path to span-types.conf resides. /etc/dahdi/span\-types.conf if
not overridden from the environment.
.RE
.SH FILES
-.B /etc/dahdi/span-types.conf
+.B /etc/dahdi/span\-types.conf
.RS
The default location for the configuration file.
.RE
@@ -129,8 +170,8 @@ files, among others:
.B spantype
.RS
read/write file. Reading from it returns current configuration for spans
-of the device. Span-specifications can be written to it to change types
-(but only for a span that is not registered).
+of the device. Span-specifications can be written to it to change line
+modes (but only for a span that is not assigned yet).
.RE
commit 09fd3f53b1c3c4b7da5f1e68b59135083d047c74
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date: Thu Jan 23 15:07:31 2014 +0200
dahdi_span_assignments.8: s/register/assign/
* Use the term "assignment" instead of "registration" (for spans).
* Further fixes.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-By: Russ Meyerriecks <rmeyerriecks at digium.com>
diff --git a/doc/dahdi_span_assignments.8 b/doc/dahdi_span_assignments.8
index 9ba8a49..55d4f7a 100644
--- a/doc/dahdi_span_assignments.8
+++ b/doc/dahdi_span_assignments.8
@@ -1,55 +1,82 @@
-.TH "SPAN_ASSIGNMENTS" "8" "13 Oct 2013" "" ""
+.TH "DAHDI_SPAN_ASSIGNMENTS" "8" "23 Jan 2014" "" ""
.SH NAME
-dahdi_span_assignments \- handle DAHDI spans registration
+dahdi_span_assignments \- handle DAHDI spans assignments
.SH SYNOPSIS
-.B dahdi_span_assignments [\-v|\-\-verbose] [\-n|\-\-dry\-run] <add|remove> \fIdevpath
-\fB[\fIdevpath \fB...]
+.B dahdi_span_assignments [\-v|\-\-verbose] [\-n|\-\-dry\-run] <add|remove|auto> \fB[\fIdevpath\fB...]
-.B dahdi_span_assignments [\-v|\-\-verbose] [\-n|\-\-dry\-run] auto
-
-.B dahdi_span_assignments [\-v|\-\-verbose] list
+.B dahdi_span_assignments [\-v|\-\-verbose] list \fB[\fIdevpath\fB...]
.B dahdi_span_assignments [\-v|\-\-verbose] [\-k|\-\-key \fIkey\fB] dumpconfig
.B dahdi_span_assignments \-h|\-\-help
.SH DESCRIPTION
+Channels in DAHDI devices (such as DAHDI PCI cards) are groups to logical
+units called "spans" (for example: a port in a digital card is a span).
When the kernel module parameter \fBdahdi.auto_assign_span\fR is unset,
-DAHDI devices (such as DAHDI PCI cards) that register with DAHDI don't
-register their spans (e.g.: each digital port is normally a span) with
-DAHDI. This allows user-space to order DAHDI to register them to specific
-span and channel numbers. This allows registering different spans out of
-order.
+DAHDI devices that register with DAHDI don't cause their spans to be
+automatically assigned.
+
+This allows user-space to order DAHDI to assign them to specific span
+and channel numbers. That way, specific spans on specific DAHDI devices
+may be assigned with specific span and channel numbers \fBregardless\fR
+of the registration order of the hardware (or if all hardware is present
+at all).
.B dahdi_span_assignments
-is used to register those spans or to help creating the configuration
-file used in their registration:
+is used to assign those spans or to help creating the configuration
+file used in their assignment:
.B /etc/dahdi/assigned-spans.conf .
-.SH OPTIONS
+.SH SUB-COMMANDS
-There are several sub-commands:
+There are several sub-commands.
-.B add \fIdevpath \fB[\fIdevpath \fB...]
+All sub-commands take an optional list of paths to SysFS nodes of
+devices. If given, the command will only operate on those DAHDI
+devices. The default is to operate on all devices (which would normally
+be the sane case when running from the command-line).
+
+.B add \fB[\fIdevpath \fB...]
.RS
-Parameters are paths (in SysFS) to DAHDI devices with unregistered
-spans. The command will register with DAHDI according to according to
+Applies to all devices or to those listed on the command line.
+Parameters are paths (in SysFS) to DAHDI devices with unassigned
+spans.
+
+The command will assign spans with DAHDI according to
configuration in \fBassigned-spans.conf\fR.
+
+If no line matches the span, or if the assignment for it fails (it is
+not available) it will remain unassigned.
+
+If any of the span settings fails (the span number or range of channels
+is already in use), the program will print a message, but continue
+applying the others. In such a case you should fix assigned-spans.conf
+and re-run \fBadd\fR (or run \fBauto\fR to give those channels the
+first available range and regenerate the file with 'dahdi_genconf
+assignedspans').
.RE
-.B remove \fIdevpath \fB[\fIdevpath \fB...]
+.B remove \fB[\fIdevpath \fB...]
.RS
-Parameters are paths (in SysFS) to DAHDI devices with registered
-spans. The command will unregister with DAHDI.
+Applies to all devices or to those listed on the command line.
+Parameters are paths (in SysFS) to DAHDI devices with assigned
+spans.
+
+The command will un-assign them.
.RE
-.B auto
+.B auto \fB[\fIdevpath \fB...]
.RS
-Register all non-registered spans. Each span registers to first
-available span number and channel numbers, as if
-\fBdahdi.auto_assign_span\fR was set.
+Applies to all devices or to those listed on the command line.
+Parameters are paths (in SysFS) to DAHDI devices with unassigned
+spans.
+
+Each span is assigned to first available span number and channel
+numbers, as if \fBdahdi.auto_assign_span\fR was set. The configuration
+file doesn't affect these assignments.
.RE
.B list
@@ -59,14 +86,16 @@ List all spans in the system.
.B dumpconfig
.RS
-List all registered spans in the system in a format fit to be used in
-\fBassigned-spans.conf\fR. Use this to generate a configuration file after
-you have (perhaps manually) registered all existing spans.
+List all assigned spans in the system in a format fit to be used in
+\fBassigned\-spans.conf\fR. Use this to generate a configuration file after
+you have (automatically or manually) assigned all existing spans.
.B dahdi_genconf assignedspans
uses this command internally.
.RE
+.SH OPTIONS
+
.B \-v \-\-verbose
.RS
Verbose output.
@@ -74,7 +103,7 @@ Verbose output.
.B \-n \-\-dry\-run
.RS
-Don't register / unregister spans. Only print commands used to do so.
+Don't assign / un-assign spans. Only print commands used to do so.
.RE
.B \-k \fIkey
@@ -101,9 +130,9 @@ Path in SysFS to the device node.
.RE
.RE
-.SH CONFIGURATOIN
-.B assigned-spans.conf
-is a file with lines specifying registration of spans.
+.SH CONFIGURATION
+.B /etc/dahdi/assigned\-spans.conf
+is a file with lines specifying assignment of spans.
Empty lines or lines beginning with '#' are ignored.
@@ -112,7 +141,7 @@ Each line is in the format of:
.I ID spanspec ...
The \fIID\fR field specifies the DAHDI device and the \fIspanspecs\fR
-define how to register its spans. A line may have multiple
+define how to assign its spans. A line may have multiple
\fIspanspecs\fR in a single line (though dumpconfig generates a
configuration with one per line).
@@ -137,7 +166,7 @@ first cleaned up: '!' is replaced with '/' and any character beyond
.SS Span Specification
Each line should have one or more span specifications: this is the value
-used to register a span with DAHDI in the SysFS interface. A
+used to assign a span with DAHDI in the SysFS interface. A
specification has three colon-separated numbers:
.I rel_span_no:span_no:first_chan
@@ -159,7 +188,7 @@ The desired DAHDI span number. Must be available.
.B first_chan
.RS
The desired DAHDI channel number for the first DAHDI channel in the span.
-All channels of the span will be registered following it and hence that
+All channels of the span will be assigned following it and hence that
space must be available.
.RE
-----------------------------------------------------------------------
--
dahdi/tools.git
More information about the dahdi-commits
mailing list