[dahdi-commits] dahdi/tools.git branch "master" updated.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri May 24 17:06:01 CDT 2013


branch "master" has been updated
       via  bab1ac48f552ba57495af1c5eb8cb2ed79b68778 (commit)
       via  3d1fd71af2221b3f3e21274ba800619feec439e1 (commit)
       via  ba3289ac9af880aa3a7ff5010433bb3d0d3badff (commit)
       via  79fff3e278ae2a20c17dff32227baa0627593c97 (commit)
      from  de23ca9c1a6055f187b16f059661691109a382c0 (commit)

Summary of changes:
 Makefile              |   12 +++
 configure             |  241 ++++++++++++++++++++++++++-----------------------
 configure.ac          |    9 ++
 dahdi.rules           |    3 +
 dahdi_cfg_device_args |   32 +++++++
 dahdi_map             |   39 ++++++++
 doc/dahdi_map.8       |   48 ++++++++++
 handle_device         |   50 ++++++++++
 makeopts.in           |    2 +
 pinned-spans.conf     |   56 ++++++++++++
 span_assignments      |  193 +++++++++++++++++++++++++++++++++++++++
 span_types            |  160 ++++++++++++++++++++++++++++++++
 spantype.conf         |   27 ++++++
 13 files changed, 760 insertions(+), 112 deletions(-)
 create mode 100644 dahdi.rules
 create mode 100755 dahdi_cfg_device_args
 create mode 100755 dahdi_map
 create mode 100644 doc/dahdi_map.8
 create mode 100755 handle_device
 create mode 100644 pinned-spans.conf
 create mode 100755 span_assignments
 create mode 100755 span_types
 create mode 100644 spantype.conf


- Log -----------------------------------------------------------------
commit bab1ac48f552ba57495af1c5eb8cb2ed79b68778
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Fri May 24 02:06:29 2013 +0300

    Update the configure script as well.
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/configure b/configure
index c7d2a09..c6b58e1 100755
--- a/configure
+++ b/configure
@@ -1,12 +1,10 @@
 #! /bin/sh
 # From configure.ac Revision.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -137,6 +135,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -170,7 +193,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -215,21 +239,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -331,6 +359,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -452,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -486,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -507,28 +547,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -623,6 +643,7 @@ DAHDI_DIR
 DAHDI_INCLUDE
 DAHDI_LIB
 DAHDI_DECLARATION_AFTER_STATEMENT
+DAHDI_PINNED
 DAHDI_DEVMODE
 DOWNLOAD
 FETCH
@@ -689,6 +710,7 @@ ac_subst_files=''
 ac_user_opts='
 enable_option_checking
 enable_dev_mode
+enable_pinned
 with_dahdi
 with_newt
 with_usb
@@ -1159,8 +1181,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1314,6 +1334,7 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-dev-mode    Turn on developer mode
+  --enable-pinned    Install pinned-spans support
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1401,9 +1422,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 configure
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 
@@ -1678,7 +1699,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1768,7 +1789,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2161,7 +2182,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2201,7 +2222,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2254,7 +2275,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2295,7 +2316,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -2353,7 +2374,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2397,7 +2418,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2843,8 +2864,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3084,7 +3104,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -3150,7 +3170,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -3357,8 +3377,8 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#	  define __EXTENSIONS__ 1
-	  $ac_includes_default
+#         define __EXTENSIONS__ 1
+          $ac_includes_default
 int
 main ()
 {
@@ -3421,7 +3441,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LD="${ac_tool_prefix}ld"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3461,7 +3481,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LD="ld"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3520,7 +3540,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3560,7 +3580,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3613,7 +3633,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3654,7 +3674,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -3712,7 +3732,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3756,7 +3776,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3952,8 +3972,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4241,7 +4260,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -4370,7 +4389,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4411,7 +4430,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_SHELL="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4452,7 +4471,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4494,7 +4513,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4538,7 +4557,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_FETCH="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4583,6 +4602,17 @@ fi
 
 
 
+# Check whether --enable-pinned was given.
+if test "${enable_pinned+set}" = set; then :
+  enableval=$enable_pinned; case "${enableval}" in
+	      y|ye|yes) DAHDI_PINNED=yes ;;
+	      n|no)  DAHDI_PINNED=no ;;
+	      *) as_fn_error $? "bad value ${enableval} for --enable-pinned" "$LINENO" 5  ;;
+	esac
+fi
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wdeclaration-after-statement support" >&5
 $as_echo_n "checking for -Wdeclaration-after-statement support... " >&6; }
 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
@@ -5161,7 +5191,7 @@ fi
 
 
 
-ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts"
+ac_config_files="$ac_config_files makeopts"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -5570,16 +5600,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -5639,28 +5669,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -5682,7 +5700,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -5744,10 +5762,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -5836,7 +5854,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
@@ -5866,7 +5884,6 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "autoconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS autoconfig.h" ;;
-    "build_tools/menuselect-deps") CONFIG_FILES="$CONFIG_FILES build_tools/menuselect-deps" ;;
     "makeopts") CONFIG_FILES="$CONFIG_FILES makeopts" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;

commit 3d1fd71af2221b3f3e21274ba800619feec439e1
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Fri May 24 01:52:43 2013 +0300

    optionally install pinned files: --enable-pinned
    
    Add installation of the pinned-spans support to the Makefile. For the
    moment, however, they are not installed unless you use ./configure
    --enable-pinned or build with 'make DAHDI_PINNED=yes'
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/Makefile b/Makefile
index 322aff2..62f430a 100644
--- a/Makefile
+++ b/Makefile
@@ -88,6 +88,7 @@ BIN_DIR:=$(sbindir)
 LIB_DIR:=$(libdir)
 INC_DIR:=$(includedir)/dahdi
 MAN_DIR:=$(mandir)/man8
+DATA_DIR:=${datadir}/dahdi
 CONFIG_DIR:=$(sysconfdir)/dahdi
 CONFIG_FILE:=$(CONFIG_DIR)/system.conf
 
@@ -109,6 +110,11 @@ ifeq	(1,$(PBX_HDLC))
 endif
 MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8))
 
+PINNED_DATA_SCRIPTS:=dahdi_cfg_device_args handle_device \
+	span_assignments span_types
+PINNED_UTILS:=dahdi_map
+PINNED_CONF:=pinned-spans.conf spantype.conf
+
 TEST_BINS:=patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest dahdi_maint
 # All the man pages. Not just installed ones:
 GROFF_PAGES	:= $(wildcard doc/*.8 xpp/*.8)
@@ -227,6 +233,12 @@ ifeq (,$(wildcard $(DESTDIR)$(CONFIG_FILE)))
 	$(INSTALL) -d $(DESTDIR)$(CONFIG_DIR)
 	$(INSTALL) -m 644 system.conf.sample $(DESTDIR)$(CONFIG_FILE)
 endif
+ifeq ($(DAHDI_PINNED),yes)
+	install -d $(DESTDIR)$(DATA_DIR)
+	install $(PINNED_DATA_SCRIPTS) $(DESTDIR)$(DATA_DIR)/
+	install $(PINNED_UTILS) $(DESTDIR)/$(BIN_DIR)/
+	install -m 644 $(PINNED_CONF) $(DESTDIR)/$(CONFIG_DIR)/
+endif
 
 install-libs: libs
 	$(INSTALL) -d -m 755 $(DESTDIR)/$(LIB_DIR)
diff --git a/configure.ac b/configure.ac
index 4fa396b..d970365 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,15 @@ AC_ARG_ENABLE(dev-mode,
 	esac])
 AC_SUBST(DAHDI_DEVMODE)
 
+AC_ARG_ENABLE(pinned,
+	[  --enable-pinned    Install pinned-spans support],
+	[case "${enableval}" in
+	      y|ye|yes) DAHDI_PINNED=yes ;;
+	      n|no)  DAHDI_PINNED=no ;;
+	      *) AC_MSG_ERROR(bad value ${enableval} for --enable-pinned)  ;;
+	esac])
+AC_SUBST(DAHDI_PINNED)
+
 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
 	AC_MSG_RESULT(yes)
diff --git a/makeopts.in b/makeopts.in
index a892a76..ebda941 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -30,6 +30,8 @@ DOWNLOAD=@DOWNLOAD@
 DAHDI_DEVMODE=@DAHDI_DEVMODE@
 DAHDI_DECLARATION_AFTER_STATEMENT=@DAHDI_DECLARATION_AFTER_STATEMENT@
 
+DAHDI_PINNED=@DAHDI_PINNED@
+
 PBX_NEWT=@PBX_NEWT@
 NEWT_LIB=@NEWT_LIB@
 NEWT_INCLUDE=@NEWT_INCLUDE@

commit ba3289ac9af880aa3a7ff5010433bb3d0d3badff
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Oct 6 21:03:03 2011 +0200

    Make udev run dahdi_cfg on each device:
    
     * New script: dahdi_cfg_device_args:
       - Just like span_assignments, span_types: may be given
         one or more sysfs devpath's
       - Output the required options for dahdi_cfg. E.g:
           "-S 8 -C 15-28"
       - This may be passed (with any other wanted options)
         to the new dahdi_cfg (which supports '-S' and '-C')
    
     * Use dahdi_cfg_device_args in handle_device so we configure
       each span from udev.
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/dahdi_cfg_device_args b/dahdi_cfg_device_args
new file mode 100755
index 0000000..de5d557
--- /dev/null
+++ b/dahdi_cfg_device_args
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+devbase='/sys/bus/dahdi_devices/devices'
+
+# Use given devices or otherwise, all existing devices
+if [ "$#" -gt 0 ]; then
+	DEVICES="$@"
+else
+	DEVICES=`echo $devbase/*`
+fi
+
+run_action_spans() {
+	device="$1"
+	for span in $device/span-*
+	do
+		spanno=`echo "$span" | sed 's,.*/span-,,'`
+		spantype=`cat "$span/spantype"`
+		basechan=`cat "$span/basechan"`
+		channels=`cat "$span/channels"`
+		endchan=`expr "$basechan" + "$channels" - 1`
+		echo "-S $spanno -C $basechan-$endchan"
+	done
+}
+
+run_action() {
+	for device in $DEVICES
+	do
+		run_action_spans "$device"
+	done
+}
+
+run_action
diff --git a/handle_device b/handle_device
index 180a163..59d0f62 100755
--- a/handle_device
+++ b/handle_device
@@ -22,6 +22,12 @@ PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin"
 
 set -e
 
+run_dahdi_cfg() {
+	args="-c $DAHDICONFDIR/system.conf $@"
+	echo "Running dahdi_cfg $args"
+	dahdi_cfg $args
+}
+
 echo >&2 "$0($ACTION): DEBUG($# args): '$*'"
 
 case "$ACTION" in
@@ -31,6 +37,9 @@ add)
 	#export DAHDICONFDIR="/tmp/xortel/dahdi"
 	span_types set "/sys/$DEVPATH" 2>&1 | $LOGGER
 	span_assignments add "/sys/$DEVPATH" 2>&1 | $LOGGER
+	dahdi_cfg_device_args | while read args; do
+			run_dahdi_cfg $args 2>&1 | $LOGGER
+		done
 	;;
 remove)
 	echo "$ACTION: $DEVPATH" | $LOGGER

commit 79fff3e278ae2a20c17dff32227baa0627593c97
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Oct 6 21:03:00 2011 +0200

    basic user-space for pinned-spans
    
    handle_device is the basic script intended to be called from udev.
    
    It will call span_types on the span to apply optional
    /etc/dahdi/spantype.conf onfiguration settings that need to be applied
    before assignment (currently "pri" port types: E1/T1/J1).
    
    Next it assigns span numbers to spans: if configured in
    /etc/dahdi/pinned-spans.conf - use those settings. If not: by the order
    of loading.
    
    span_types and span_assignments can also be used to report the settings
    they are used to configure.
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/dahdi.rules b/dahdi.rules
new file mode 100644
index 0000000..ef08fd3
--- /dev/null
+++ b/dahdi.rules
@@ -0,0 +1,3 @@
+# DAHDI devices with ownership/permissions for running as non-root
+SUBSYSTEM=="dahdi",		OWNER="asterisk", GROUP="asterisk", MODE="0660"
+SUBSYSTEM=="dahdi_devices",	RUN="/usr/share/dahdi/handle_device"
diff --git a/dahdi_map b/dahdi_map
new file mode 100755
index 0000000..a95ebae
--- /dev/null
+++ b/dahdi_map
@@ -0,0 +1,39 @@
+#! /bin/sh
+#
+# Show a map of dahdi devices with the following fields:
+#  - spanno (or '-' if not assigned yet)
+#  - (vendor assigned) name
+#  - local spanno
+#  - hardware_id (or empty if none)
+#  - location (prefixed by '@')
+
+devbase="/sys/bus/dahdi_devices/devices"
+
+[ -d "$devbase" ] || {
+	echo >&2 "$0: Missing '$devbase' (Old driver?)"
+	exit 1
+}
+
+fmt="%-4s %-17s %-3s     %-12s %s\n"
+
+printf "$fmt" 'SPAN' 'NAME' '#' 'HARDWARE_ID' 'LOCATION'
+
+DEVICES=`echo $devbase/*`
+
+for device in $DEVICES
+do
+	hw_id=`cat "$device/hardware_id"`
+	location=`cd "$device" && pwd -P | sed 's,/sys/devices/,,'`
+	for local_spanno in `cut -d: -f1 "$device/spantype"`
+	do
+		span=`grep 2>/dev/null -Hw "$local_spanno" "$device/span-"*"/local_spanno" | \
+			sed -e 's,/local_spanno:.*,,' -e 's,.*/,,'`
+		if [ "$span" != '' ]; then
+			spanno=`echo $span | sed 's/^.*-//'`
+			name=`cat 2>/dev/null "$device/$span/name"`
+		else
+			spanno='-'
+		fi
+		printf "$fmt" "$spanno" "$name" "($local_spanno)" "[$hw_id]" "@$location"
+	done | sort -n
+done
diff --git a/doc/dahdi_map.8 b/doc/dahdi_map.8
new file mode 100644
index 0000000..80d5d8f
--- /dev/null
+++ b/doc/dahdi_map.8
@@ -0,0 +1,48 @@
+.TH dahdi_test 8 "2013-05-24" 
+.SH "NAME" 
+dahdi_map \(em List hardware IDs and locations of DAHDI spans
+.SH "SYNOPSIS" 
+.B dahdi_map
+
+.SH DESCRIPTION 
+.B dahdi_map
+prints a list of hardware IDs and locations of any DAHDI span on the system
+(possibly not yet assigned).
+
+It takes no extra options or parameters.
+
+Example output:
+.EX
+SPAN NAME              #       HARDWARE_ID  LOCATION
+5    XBUS-00/XPD-00    (1)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+6    XBUS-00/XPD-01    (2)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+7    XBUS-00/XPD-02    (3)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+8    XBUS-00/XPD-03    (4)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+9    XBUS-00/XPD-04    (5)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+10   XBUS-00/XPD-05    (6)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+11   XBUS-00/XPD-06    (7)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+12   XBUS-00/XPD-07    (8)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+13   XBUS-00/XPD-10    (9)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+14   XBUS-00/XPD-20    (10)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+15   XBUS-00/XPD-30    (11)     [usb:INT06380] @pci0000:00/0000:00:10.4/usb1/1-3/xbus-00/astribanks:xbus-00
+16   XBUS-01/XPD-00    (1)     []           @pci0000:00/0000:00:10.4/usb1/1-4/xbus-01/astribanks:xbus-01
+1    XBUS-02/XPD-00    (1)     [usb:XILINX_4] @pci0000:00/0000:00:10.4/usb1/1-1/xbus-02/astribanks:xbus-02
+2    XBUS-02/XPD-10    (2)     [usb:XILINX_4] @pci0000:00/0000:00:10.4/usb1/1-1/xbus-02/astribanks:xbus-02
+3    XBUS-02/XPD-20    (3)     [usb:XILINX_4] @pci0000:00/0000:00:10.4/usb1/1-1/xbus-02/astribanks:xbus-02
+4    XBUS-02/XPD-30    (4)     [usb:XILINX_4] @pci0000:00/0000:00:10.4/usb1/1-1/xbus-02/astribanks:xbus-02
+.EE
+
+.SH FILES
+.B /sys/bus/dahdi_devices/devices
+.RS
+Information taken from that area in SysFS.
+.RE
+
+.SH SEE ALSO 
+dahdi_cfg(8)
+
+.SH AUTHOR 
+This manual page was written by Tzafrir Cohen <tzafrir.cohen at xorcom.com> 
+Permission is granted to copy, distribute and/or modify this document under 
+the terms of the GNU General Public License, Version 2 any  
+later version published by the Free Software Foundation. 
diff --git a/handle_device b/handle_device
new file mode 100755
index 0000000..180a163
--- /dev/null
+++ b/handle_device
@@ -0,0 +1,41 @@
+#! /bin/sh
+#
+# /usr/share/dahdi/handle_device
+#
+# Called by UDEV when a span goes online/offline to assign spans
+
+me=`basename $0`
+dir=`dirname $0`
+LOGGER="logger -i -t '$me'"
+NAME=`basename "$DEVPATH" | tr -c 'A-Za-z0-9-' '_'`
+
+# Always redirect stderr somewhere, otherwise the shell script will die
+# when it tries to do I/O related stuff on closed file descriptor.
+# Our default is to throw it down the bit-bucket.
+exec 2> /dev/null
+# If you wish to trace this script:
+#exec 2> "/tmp/${me}.$NAME" 1>&2
+#exec 2> /dev/console
+
+# Our directory in the beginning, so we can use local lab setup
+PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin"
+
+set -e
+
+echo >&2 "$0($ACTION): DEBUG($# args): '$*'"
+
+case "$ACTION" in
+add)
+	echo "$ACTION: $DEVPATH" | $LOGGER
+	# FIXME: need a way to add custom environment here:
+	#export DAHDICONFDIR="/tmp/xortel/dahdi"
+	span_types set "/sys/$DEVPATH" 2>&1 | $LOGGER
+	span_assignments add "/sys/$DEVPATH" 2>&1 | $LOGGER
+	;;
+remove)
+	echo "$ACTION: $DEVPATH" | $LOGGER
+	;;
+*)
+	echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
+	;;
+esac
diff --git a/pinned-spans.conf b/pinned-spans.conf
new file mode 100644
index 0000000..a9145bb
--- /dev/null
+++ b/pinned-spans.conf
@@ -0,0 +1,56 @@
+#
+# /etc/dahdi/pinned-spans.conf:
+#
+# This file assigns span and channel numbers to dahdi devices
+#
+# Built as a table keyed by <id>:
+#  <id>    <spanspec>....
+#
+# Where:
+#  * The <id> field may be either:
+#         hardware_id
+#         @location
+#  * Shell-style globbing is allowed for the <id> field
+#  * There may one or more of <spanspec>
+#  * Each <spanspec> is composed as:
+#    <local_spanno>:<assigned_spanno>:<base_channo>
+#
+# Examples:
+
+# Astribank with two spans:
+#    FXS * 8 channels + 4 digital inputs 2 digital outputs
+#    FXO * 8 channels
+#usb:QA-1		1:1:1
+#usb:QA-1		2:2:15
+
+# Same Astribank in one-liner
+#usb:QA-1		1:1:1 2:2:15
+
+# Astribank with 4*PRI spans and 3*FXS*8 spans
+# Note that channels are NOT globally contigous
+# each span get its own 50 numbers. Also, skip
+# Channel number 250...
+#usb:INT03165		1:1:1	# E1
+#usb:INT03165		2:2:51	# E1
+#usb:INT03165		3:3:151	# E1
+#usb:INT03165		4:4:201	# E1
+#usb:INT03165		5:5:301	# FXS * 8 channels
+#usb:INT03165		6:6:351	# FXS * 8 channels
+#usb:INT03165		7:7:401	# FXS * 8 channels
+
+# Alternatively -- all in one-line
+#usb:INT03165		1:1:1 2:2:51 3:3:151 4:4:201 5:5:301 6:6:351 7:7:401
+
+# Astribank with 4*BRI without hardware_id :-(
+# We use the location on the bus (ie: where it is physically
+# located). Note the '@' prefix that indicate the location key.
+#@pci0000:00/0000:00:03.3/usb1/1-6/xbus-01/astribanks:xbus-01	1:1:50
+#@pci0000:00/0000:00:03.3/usb1/1-6/xbus-01/astribanks:xbus-01	2:2:100
+#@pci0000:00/0000:00:03.3/usb1/1-6/xbus-01/astribanks:xbus-01	3:3:150
+#@pci0000:00/0000:00:03.3/usb1/1-6/xbus-01/astribanks:xbus-01	4:4:200
+
+# Same configuration with globbing:
+#@*/usb1/1-6/*	1:1:50
+#@*/usb1/1-6/*	2:2:100
+#@*/usb1/1-6/*	3:3:150
+#@*/usb1/1-6/*	4:4:200
diff --git a/span_assignments b/span_assignments
new file mode 100755
index 0000000..0f4e006
--- /dev/null
+++ b/span_assignments
@@ -0,0 +1,193 @@
+#! /bin/sh
+#
+# /usr/share/dahdi/span_assignments:
+#
+# this script can be used both from udev and
+# from the command line to assign/unassign and list
+# current assignments.
+#
+# The first argument is an action:
+#   "add" to assign (spans which are not already assigned)
+#   "remove" to unassign (spans which are not already unassigned)
+#   "list" to show all spans (with/without assignments)
+#
+# Without further arguments, it operates on all existing spans
+# With one or more sysfs dahdi_devices it is limited to those.
+#
+# Examples:
+#    span_assignments list
+#    span_assignments add	# all
+#    span_assignments add /sys/bus/dahdi_devices/devices/astribanks:xbus-00
+#    span_assignments remove	# all
+#
+
+devbase='/sys/bus/dahdi_devices/devices'
+DAHDICONFDIR="${DAHDICONFDIR:-/etc/dahdi}"
+pinned_spans_conf="$DAHDICONFDIR/pinned-spans.conf"
+
+usage() {
+	echo >&2 "Usage: $0 {add|remove|list} [devpath ...]"
+	exit 1
+}
+
+if [ "$#" -eq 0 ]; then
+	usage
+fi
+action="$1"
+shift
+
+if [ ! -d "$devbase" ]; then
+	echo >&2 "$0: Missing '$devbase' (DAHDI driver unloaded?)"
+	exit 1
+fi
+
+# Use given devices or otherwise, all existing devices
+if [ "$#" -gt 0 ]; then
+	DEVICES="$@"
+else
+	DEVICES=`echo $devbase/*`
+fi
+
+show_devices() {
+
+	for device in $DEVICES
+	do
+		hw_id=`cat "$device/hardware_id"`
+		location=`cd "$device" && pwd -P | sed 's,/sys/devices/,,'`
+		for local_spanno in `cut -d: -f1 "$device/spantype"`
+		do
+			span=`grep 2>/dev/null -Hw "$local_spanno" "$device/span-"*"/local_spanno" | \
+				sed -e 's,/local_spanno:.*,,' -e 's,.*/,,'`
+			if [ "$span" != '' ]; then
+				spanno=`echo $span | sed 's/^.*-//'`
+				name=`cat 2>/dev/null "$device/$span/name"`
+				basechan=`cat 2>/dev/null "$device/$span/basechan"`
+			else
+				spanno='-'
+				basechan='-'
+			fi
+			printf "%-4s %-12s %s\n" "$local_spanno:$spanno:$basechan" "[$hw_id]" "@$location"
+		done | sort -n
+	done
+}
+
+dump_config() {
+
+	for device in $DEVICES
+	do
+		hw_id=`cat "$device/hardware_id"`
+		location=`cd "$device" && pwd -P | sed 's,/sys/devices/,,'`
+		if [ "$hw_id" != '' ]; then
+			id="$hw_id"
+		else
+			id="@$location"
+		fi
+		for local_spanno in `cut -d: -f1 "$device/spantype"`
+		do
+			span=`grep 2>/dev/null -Hw "$local_spanno" "$device/span-"*"/local_spanno" | \
+				sed -e 's,/local_spanno:.*,,' -e 's,.*/,,'`
+			if [ "$span" != '' ]; then
+				spanno=`echo $span | sed 's/^.*-//'`
+				name=`cat 2>/dev/null "$device/$span/name"`
+				basechan=`cat 2>/dev/null "$device/$span/basechan"`
+			else
+				spanno='-'
+			fi
+			printf "%-30s %s\n" "$id" "$local_spanno:$spanno:$basechan"
+		done | sort -n
+	done
+}
+
+unassign_all_spans() {
+	for device in $DEVICES
+	do
+		find "$device" -follow -maxdepth 1 -name 'span-*' -type d | \
+			sort | while read spandir; do
+			local_spanno=`cat "$spandir/local_spanno"`
+			echo "unassign $device $local_spanno"
+			if ! echo "$local_spanno" > "$device/unassign_span"; then
+				echo >&2 "$0: failed unassigning '$local_spanno' in '$device'"
+			fi
+		done
+	done
+}
+
+# Allow comments and empty lines in config file
+filter_conf() {
+	sed -e 's/#.*//' -e '/^[ \t]*$/d' "$pinned_spans_conf"
+}
+
+# Beware of special characters in attributes
+attr_clean() {
+	cat "$1" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:.-' '_'
+}
+
+assign_device_spans() {
+	device="$1"
+	for s in $spanspecs
+	do
+		local_spanno=`echo "$s" | cut -d: -f1`
+		spanno=`echo "$s" | cut -d: -f2`
+		span="$device/span-$spanno"
+		if [ -d "$span" ]; then
+			span_local_spanno=`cat "$span/local_spanno"`
+			if [ "$span_local_spanno" != "$local_spanno" ]; then
+				echo "WARNING: $span_local_spanno != $local_spanno"
+			fi
+			echo "$device [$local_spanno] already assigned to $spanno. Skipping..."
+			continue
+		fi
+		echo "assign $device: $s"
+		if ! echo "$s" > "$device/assign_span"; then
+			echo >&2 "$0: failed assigning '$s' to '$device'"
+		fi
+	done
+}
+
+match_device() {
+	device="$1"
+	location='@'`cd "$device" && pwd -P | sed 's,/sys/devices/,,'`
+	hardware_id=`attr_clean "$device/hardware_id"`
+	filter_conf | while read id spanspecs
+	do
+		# We use case to enable shell-style globbing in configuration
+		case "$location" in
+		$id)
+			#echo "match location($id ~ $location): $spanspecs"
+			assign_device_spans "$device"
+			;;
+		esac
+		# We use case to enable shell-style globbing in configuration
+		case "$hardware_id" in
+		$id)
+			#echo "match hardware_id([$id] ~ $hardware_id): $spanspecs"
+			assign_device_spans "$device"
+			;;
+		esac
+	done
+}
+
+assign_devices() {
+	for device in $DEVICES
+	do
+		match_device "$device"
+	done
+}
+
+case "$action" in
+list)
+	show_devices
+	;;
+dump)
+	dump_config
+	;;
+add)
+	assign_devices
+	;;
+remove)
+	unassign_all_spans
+	;;
+*)
+	usage
+	;;
+esac
diff --git a/span_types b/span_types
new file mode 100755
index 0000000..cf7c70d
--- /dev/null
+++ b/span_types
@@ -0,0 +1,160 @@
+#! /bin/sh
+#
+# /usr/share/dahdi/span_types:
+#
+# this script can be used both from udev and
+# from the command line for spantype management.
+#
+# It use a configuration file /etc/dahdi/spantype.conf
+# (the format is documented inside this file)
+#
+# The first argument is an action:
+#   "list" to show existing E1/T1/J1 types
+#   "dump" the same, but in a format (almost) suitable for
+#          the configuration file
+#          FIXME: we currently don't have the base channo in sysfs.
+#   "set"  actually write the setting to the driver
+#
+# Examples:
+#    span_types list
+#    span_types dump
+#    span_types set	# all
+#    span_types set /sys/bus/dahdi_devices/devices/astribanks:xbus-00
+#
+
+
+devbase='/sys/bus/dahdi_devices/devices'
+DAHDICONFDIR="${DAHDICONFDIR:-/etc/dahdi}"
+spantype_conf="$DAHDICONFDIR/spantype.conf"
+
+usage() {
+	echo >&2 "Usage: $0 {list|dump|set} [devpath ...]"
+	exit 1
+}
+
+if [ "$#" -eq 0 ]; then
+	usage
+fi
+action="$1"
+shift
+
+# Use given devices or otherwise, all existing devices
+if [ "$#" -gt 0 ]; then
+	DEVICES="$@"
+else
+	DEVICES=`echo $devbase/*`
+fi
+
+show_spantypes() {
+	for device in $DEVICES
+	do
+		hw_id=`cat "$device/hardware_id"`
+		location='@'`cd "$device" && pwd -P | sed 's,/sys/devices/,,'`
+		cat "$device/spantype" | while read st; do
+			printf "%-10s %-20s %s\n" "$st" "[$hw_id]" "$location"
+		done | sort -n
+	done
+}
+
+dump_config() {
+	fmt="%-65s %s\n"
+	echo "# Map of dahdi_devices to span types for E1/T1/J1"
+	printf "$fmt" '# @location/hardware_id' 'span_type'
+	for device in $DEVICES
+	do
+		hw_id=`cat "$device/hardware_id"`
+		location='@'`cd "$device" && pwd -P | sed 's,/sys/devices/,,'`
+		if [ -n "$hw_id" ]; then
+			id="$hw_id"
+		else
+			id="$location"
+		fi
+		cat "$device/spantype" | while read st; do
+			case "$st" in
+			*:[ETJ]1)
+				printf "$fmt" "$id" "$st"
+				;;
+			esac
+		done | sort -n
+	done
+}
+
+# Allow comments and empty lines in config file
+filter_conf() {
+	sed -e 's/#.*//' -e '/^[ \t]*$/d' "$spantype_conf"
+}
+
+conf_spans() {
+	hw_id="$1"
+	location="$2"
+	filter_conf | (
+		# Collect device spans
+		# in a subshell, so $SPANS is not lost
+		SPANS=''
+		while read id spans; do
+			# GLOBBING
+			case "$location" in
+			$id)
+				#echo >&2 "match($id): $spans"
+				SPANS="$SPANS $spans"
+				;;
+			esac
+			case "$hw_id" in
+			$id)
+				#echo >&2 "match([$id]): $spans"
+				SPANS="$SPANS $spans"
+				;;
+			esac
+		done
+		echo "$SPANS"
+	)
+}
+
+# Beware of special characters in attributes
+attr_clean() {
+	cat "$1" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:.-' '_'
+}
+
+device_set_spantype() {
+	device="$1"
+	attr_file="$device/spantype"
+	hw_id=`attr_clean "$device/hardware_id"`
+	location='@'`cd "$device" && pwd -P | sed 's,/sys/devices/,,'`
+	spanspecs=`conf_spans "$hw_id" "$location"`
+	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() {
+	for device in $DEVICES
+	do
+		device_set_spantype "$device"
+	done
+}
+
+case "$action" in
+list)
+	show_spantypes
+	;;
+dump)
+	dump_config
+	;;
+set)
+	set_spantypes
+	;;
+*)
+	usage
+	;;
+esac
diff --git a/spantype.conf b/spantype.conf
new file mode 100644
index 0000000..e639fe5
--- /dev/null
+++ b/spantype.conf
@@ -0,0 +1,27 @@
+#
+# /etc/dahdi/spantype.conf: Set E1/T1/J1 per-device
+#
+# Built as a table of two columns:
+#  <id>    <local_spanno>:<type>
+#
+# Where:
+#  * The <id> field may be either:
+#         hardware_id
+#         @location
+#  * The <local_spanno> is the relative span number 
+#    in the device (starting from 1)
+#    In this filed globbing rules apply. E.g:
+#        - * are all the spans in this device
+#        - [12] are the first two spans in this device
+#  * The <type> may be E1, T1 or J1
+#
+# Examples:
+#  Set the first two spans of a specific Astribank to T1
+#usb:000156 [12]:T1
+
+#  Set all spans of another Astribank to T1
+#usb:INT03165		*:E1
+
+#  Set the first two spans of an Astribank to T1. The
+#  Astribanks is specified by its location instead of hardware_id
+#@pci0000:00/0000:00:03.3/usb1/1-5/xbus-01/astribanks:xbus-01 [12]:T1

-----------------------------------------------------------------------


-- 
dahdi/tools.git



More information about the dahdi-commits mailing list