Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9338d9b74 | ||
|
|
c0e19d47e8 | ||
|
|
ffced0cad2 | ||
|
|
e298eb1237 | ||
|
|
a97d373d95 | ||
|
|
c27664dc1b | ||
|
|
365a12f42a | ||
|
|
2a84216fe4 | ||
|
|
791a596c07 | ||
|
|
d145364c00 | ||
|
|
0afba16b2e | ||
|
|
c163caca00 | ||
|
|
c9e8ec7499 | ||
|
|
1356a55d77 | ||
|
|
10a6622774 | ||
|
|
a4217f6977 | ||
|
|
fb1a2b5572 | ||
|
|
6d10525863 | ||
|
|
a1d4355c20 | ||
|
|
b303802658 | ||
|
|
8d9a6bdd80 | ||
|
|
bb19620c52 | ||
|
|
11310bde53 | ||
|
|
b123bc87dd | ||
|
|
299d9d9d9c | ||
|
|
5e30a1401f | ||
|
|
2f688f83c4 | ||
|
|
680f3e1d1d | ||
|
|
60fca920bc | ||
|
|
c1e016fa33 | ||
|
|
dc5c7de9fc | ||
|
|
1e81ed14cf | ||
|
|
44a5285454 | ||
|
|
7a1e222309 | ||
|
|
52488d66fa | ||
|
|
00af777a97 | ||
|
|
025985d9b7 |
37
Makefile
37
Makefile
@@ -67,13 +67,7 @@ ifneq (,$(NETSCR_DIR))
|
||||
COPY_NETSCR := install -D ifup-hdlc $(NETSCR_TARGET)
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard .version),)
|
||||
TOOLSVERSION:=$(shell cat .version)
|
||||
else
|
||||
ifneq ($(wildcard .svn),)
|
||||
TOOLSVERSION=$(shell build_tools/make_version . dahdi/tools)
|
||||
endif
|
||||
endif
|
||||
TOOLSVERSION=$(shell build_tools/make_version . dahdi/tools)
|
||||
|
||||
LTZ_A:=libtonezone.a
|
||||
LTZ_A_OBJS:=zonedata.o tonezone.o version.o
|
||||
@@ -91,6 +85,7 @@ MAN_DIR:=$(mandir)/man8
|
||||
DATA_DIR:=${datadir}/dahdi
|
||||
CONFIG_DIR:=$(sysconfdir)/dahdi
|
||||
CONFIG_FILE:=$(CONFIG_DIR)/system.conf
|
||||
UDEVRULES_DIR:=$(sysconfdir)/udev/rules.d
|
||||
|
||||
# Utilities we build with a standard build procedure:
|
||||
UTILS = dahdi_tool dahdi_test dahdi_monitor dahdi_speed sethdlc dahdi_cfg \
|
||||
@@ -108,12 +103,12 @@ endif
|
||||
ifeq (1,$(PBX_HDLC))
|
||||
BINS += sethdlc
|
||||
endif
|
||||
MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8))
|
||||
ASSIGNED_DATA_SCRIPTS:=dahdi_handle_device dahdi_span_config
|
||||
ASSIGNED_UTILS:=dahdi_span_assignments dahdi_span_types
|
||||
ASSIGNED_CONF:=assigned-spans.conf.sample span-types.conf.sample
|
||||
|
||||
PINNED_DATA_SCRIPTS:=dahdi_cfg_device_args handle_device \
|
||||
span_assignments span_types
|
||||
PINNED_UTILS:=dahdi_map
|
||||
PINNED_CONF:=pinned-spans.conf spantype.conf
|
||||
MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8))
|
||||
MAN_PAGES:=$(wildcard $(ASSIGNED_UTILS:%=doc/%.8))
|
||||
|
||||
TEST_BINS:=patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest dahdi_maint
|
||||
# All the man pages. Not just installed ones:
|
||||
@@ -198,7 +193,8 @@ genconf_parameters.sample: xpp/genconf_parameters
|
||||
cp $< $@
|
||||
|
||||
README.html: README system.conf.asciidoc init.conf.asciidoc tonezones.txt \
|
||||
UPGRADE.txt genconf_parameters.asciidoc
|
||||
UPGRADE.txt genconf_parameters.asciidoc assigned-spans.conf.asciidoc \
|
||||
span-types.conf.asciidoc
|
||||
$(ASCIIDOC) -n -a toc -a toclevels=3 $<
|
||||
|
||||
README.Astribank.html: xpp/README.Astribank
|
||||
@@ -233,12 +229,10 @@ 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 $(ASSIGNED_DATA_SCRIPTS) $(DESTDIR)$(DATA_DIR)/
|
||||
install $(ASSIGNED_UTILS) $(DESTDIR)/$(BIN_DIR)/
|
||||
install -m 644 $(ASSIGNED_CONF) $(DESTDIR)/$(CONFIG_DIR)/
|
||||
|
||||
install-libs: libs
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)/$(LIB_DIR)
|
||||
@@ -301,6 +295,8 @@ endif
|
||||
ifeq (,$(wildcard $(DESTDIR)$(BLACKLIST_FILE)))
|
||||
$(INSTALL) -D -m 644 blacklist.sample $(DESTDIR)$(BLACKLIST_FILE)
|
||||
endif
|
||||
$(INSTALL) -d $(DESTDIR)$(UDEVRULES_DIR)
|
||||
$(INSTALL) -D -m 644 dahdi.rules $(DESTDIR)$(UDEVRULES_DIR)/
|
||||
ifneq (,$(COPY_NETSCR))
|
||||
$(COPY_NETSCR)
|
||||
endif
|
||||
@@ -335,6 +331,9 @@ update:
|
||||
echo "Not under version control"; \
|
||||
fi
|
||||
|
||||
dist:
|
||||
@./build_tools/make_dist "dahdi-tools" "$(TOOLSVERSION)"
|
||||
|
||||
clean:
|
||||
rm -f $(BINS) $(TEST_BINS)
|
||||
rm -f *.o dahdi_cfg tzdriver sethdlc
|
||||
@@ -367,7 +366,7 @@ config.status: configure
|
||||
@echo "****"
|
||||
@exit 1
|
||||
|
||||
.PHONY: distclean dist-clean clean all install programs tests devel data config update install-programs install-libs install-utils-subdirs utils-subdirs prereq
|
||||
.PHONY: distclean dist-clean clean all install programs tests devel data config update install-programs install-libs install-utils-subdirs utils-subdirs prereq dist
|
||||
|
||||
FORCE:
|
||||
|
||||
|
||||
10
README
10
README
@@ -133,6 +133,16 @@ FIXME: still not properly formatted.
|
||||
include::genconf_parameters.asciidoc[]
|
||||
|
||||
|
||||
Sample assigned-spans.conf
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
include::assigned-spans.conf.asciidoc[]
|
||||
|
||||
|
||||
Sample span-types.conf
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
include::span-types.conf.asciidoc[]
|
||||
|
||||
|
||||
Tonezones
|
||||
~~~~~~~~~
|
||||
The file zonedata.c contains the information about the tone zones used
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# /etc/dahdi/pinned-spans.conf:
|
||||
# /etc/dahdi/assigned-spans.conf:
|
||||
#
|
||||
# This file assigns span and channel numbers to dahdi devices
|
||||
#
|
||||
@@ -10,6 +10,7 @@
|
||||
# * The <id> field may be either:
|
||||
# hardware_id
|
||||
# @location
|
||||
# devpath (in sysfs)
|
||||
# * Shell-style globbing is allowed for the <id> field
|
||||
# * There may one or more of <spanspec>
|
||||
# * Each <spanspec> is composed as:
|
||||
@@ -44,13 +45,13 @@
|
||||
# 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
|
||||
#@usb-0000:00:1d.7-3 1:1:50
|
||||
#@usb-0000:00:1d.7-3 2:2:100
|
||||
#@usb-0000:00:1d.7-3 3:3:150
|
||||
#@usb-0000:00:1d.7-3 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
|
||||
#/sys/*/usb1/1-6/* 1:1:50
|
||||
#/sys/*/usb1/1-6/* 2:2:100
|
||||
#/sys/*/usb1/1-6/* 3:3:150
|
||||
#/sys/*/usb1/1-6/* 4:4:200
|
||||
@@ -12,6 +12,8 @@ blacklist wcfxo
|
||||
blacklist wctdm
|
||||
blacklist wctc4xxp
|
||||
blacklist wcb4xxp
|
||||
blacklist wcaxx
|
||||
blacklist wcte43x
|
||||
|
||||
# Some mISDN drivers may try to attach to cards supported by DAHDI. If you
|
||||
# have a card which is *not* supported by DAHDI but supported by one of the
|
||||
|
||||
26
build_tools/make_dist
Executable file
26
build_tools/make_dist
Executable file
@@ -0,0 +1,26 @@
|
||||
#! /bin/sh
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo >&2 "Usage: $0 <package> <version>"
|
||||
exit 1
|
||||
fi
|
||||
package="$1"
|
||||
version="$2"
|
||||
tarball_prefix="$package-$version"
|
||||
echo "I: Making dist tarball for $tarball_prefix"
|
||||
tarball_name="$tarball_prefix.tar.gz"
|
||||
|
||||
tmp_work_dir=".tmp"
|
||||
tmp_version_dir="$tmp_work_dir/$tarball_prefix"
|
||||
|
||||
if [ "$DESTDIR" != '' ]; then
|
||||
destdir="$DESTDIR/"
|
||||
fi
|
||||
output="$destdir$tarball_name"
|
||||
|
||||
mkdir -p "$tmp_version_dir"
|
||||
git archive --format tar HEAD | tar xf - -C "$tmp_version_dir"
|
||||
echo "$version" > "$tmp_version_dir/.version"
|
||||
tar czf "$output" -C "$tmp_work_dir" "$tarball_prefix"
|
||||
rm -rf "$tmp_work_dir"
|
||||
echo "I: tarball is ready: '$output'"
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f ${1}/.version ]; then
|
||||
cat ${1}.version
|
||||
cat ${1}/.version
|
||||
elif [ -f ${1}/.svnrevision ]; then
|
||||
echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision`
|
||||
elif [ -d .svn ]; then
|
||||
elif [ -d ${1}/.svn ]; then
|
||||
PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/${2}/:: | sed -e 's:/: :g'`
|
||||
BRANCH=0
|
||||
TEAM=0
|
||||
@@ -53,4 +53,70 @@ elif [ -d .svn ]; then
|
||||
done
|
||||
|
||||
echo SVN-${RESULT##-}-r${REV}
|
||||
elif [ -d ${1}/.git ]; then
|
||||
# If the first log commit messages indicates that this is checked into
|
||||
# subversion, we'll just use the SVN- form of the revision.
|
||||
MODIFIED=""
|
||||
SVN_REV=`git log --pretty=full -1 | grep -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"`
|
||||
if [ -z "$SVN_REV" ]; then
|
||||
VERSION=`git describe --tags --dirty=M 2> /dev/null | sed -e "s/^v\([0-9]\)/\1/"`
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ "`git ls-files -m | wc -l`" != "0" ]; then
|
||||
MODIFIED="M"
|
||||
fi
|
||||
# Some older versions of git do not support all the above
|
||||
# options.
|
||||
VERSION=GIT-`git rev-parse --short --verify HEAD`${MODIFIED}
|
||||
fi
|
||||
echo ${VERSION}
|
||||
else
|
||||
PARTS=`LANG=C git log --pretty=full | grep -F "git-svn-id:" | head -1 | awk '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`
|
||||
BRANCH=0
|
||||
TEAM=0
|
||||
|
||||
if [ "`git ls-files -m | wc -l`" != "0" ]; then
|
||||
MODIFIED="M"
|
||||
fi
|
||||
|
||||
if [ "${PARTS}" = "trunk" ]; then
|
||||
echo SVN-'trunk'-r${SVN_REV}${MODIFIED}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for PART in $PARTS
|
||||
do
|
||||
if [ ${BRANCH} != 0 ]; then
|
||||
RESULT="${RESULT}-${PART}"
|
||||
break
|
||||
fi
|
||||
|
||||
if [ ${TEAM} != 0 ]; then
|
||||
RESULT="${RESULT}-${PART}"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "branches" ]; then
|
||||
BRANCH=1
|
||||
RESULT="branch"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "tags" ]; then
|
||||
BRANCH=1
|
||||
RESULT="tag"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "team" ]; then
|
||||
TEAM=1
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
||||
echo SVN-${RESULT##-}-r${SVN_REV}${MODIFIED}
|
||||
fi
|
||||
else
|
||||
# Use the directory information in the absence of any other version
|
||||
# information
|
||||
pwd -P
|
||||
fi
|
||||
|
||||
66
configure
vendored
66
configure
vendored
@@ -1,7 +1,9 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac Revision.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69.
|
||||
# Generated by GNU Autoconf 2.69 for dahdi 2.8.0.
|
||||
#
|
||||
# Report bugs to <www.asterisk.org>.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
@@ -267,10 +269,11 @@ fi
|
||||
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
|
||||
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
|
||||
else
|
||||
$as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
|
||||
$0: including any error possibly output before this
|
||||
$0: message. Then install a modern shell, or manually run
|
||||
$0: the script under such a shell if you do have one."
|
||||
$as_echo "$0: Please tell bug-autoconf@gnu.org and www.asterisk.org
|
||||
$0: about your system, including any error possibly output
|
||||
$0: before this message. Then install a modern shell, or
|
||||
$0: manually run the script under such a shell if you do
|
||||
$0: have one."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
@@ -578,14 +581,13 @@ MFLAGS=
|
||||
MAKEFLAGS=
|
||||
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME=
|
||||
PACKAGE_TARNAME=
|
||||
PACKAGE_VERSION=
|
||||
PACKAGE_STRING=
|
||||
PACKAGE_BUGREPORT=
|
||||
PACKAGE_URL=
|
||||
PACKAGE_NAME='dahdi'
|
||||
PACKAGE_TARNAME='dahdi'
|
||||
PACKAGE_VERSION='2.8.0'
|
||||
PACKAGE_STRING='dahdi 2.8.0'
|
||||
PACKAGE_BUGREPORT='www.asterisk.org'
|
||||
PACKAGE_URL=''
|
||||
|
||||
ac_unique_file="dahdi"
|
||||
ac_unique_file="dahdi_cfg.c"
|
||||
# Factoring default headers for most tests.
|
||||
ac_includes_default="\
|
||||
@@ -643,7 +645,6 @@ DAHDI_DIR
|
||||
DAHDI_INCLUDE
|
||||
DAHDI_LIB
|
||||
DAHDI_DECLARATION_AFTER_STATEMENT
|
||||
DAHDI_PINNED
|
||||
DAHDI_DEVMODE
|
||||
DOWNLOAD
|
||||
FETCH
|
||||
@@ -710,7 +711,6 @@ ac_subst_files=''
|
||||
ac_user_opts='
|
||||
enable_option_checking
|
||||
enable_dev_mode
|
||||
enable_pinned
|
||||
with_dahdi
|
||||
with_newt
|
||||
with_usb
|
||||
@@ -766,7 +766,7 @@ sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE}'
|
||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||
infodir='${datarootdir}/info'
|
||||
htmldir='${docdir}'
|
||||
dvidir='${docdir}'
|
||||
@@ -1266,7 +1266,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures this package to adapt to many kinds of systems.
|
||||
\`configure' configures dahdi 2.8.0 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1314,7 +1314,7 @@ Fine tuning of the installation directories:
|
||||
--infodir=DIR info documentation [DATAROOTDIR/info]
|
||||
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
|
||||
--mandir=DIR man documentation [DATAROOTDIR/man]
|
||||
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
|
||||
--docdir=DIR documentation root [DATAROOTDIR/doc/dahdi]
|
||||
--htmldir=DIR html documentation [DOCDIR]
|
||||
--dvidir=DIR dvi documentation [DOCDIR]
|
||||
--pdfdir=DIR pdf documentation [DOCDIR]
|
||||
@@ -1326,7 +1326,9 @@ _ACEOF
|
||||
fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of dahdi 2.8.0:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
Optional Features:
|
||||
@@ -1334,7 +1336,6 @@ 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]
|
||||
@@ -1358,7 +1359,7 @@ Some influential environment variables:
|
||||
Use these variables to override the choices made by `configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
|
||||
Report bugs to the package provider.
|
||||
Report bugs to <www.asterisk.org>.
|
||||
_ACEOF
|
||||
ac_status=$?
|
||||
fi
|
||||
@@ -1421,7 +1422,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
configure
|
||||
dahdi configure 2.8.0
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@@ -1582,6 +1583,10 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
|
||||
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
|
||||
( $as_echo "## ------------------------------- ##
|
||||
## Report this to www.asterisk.org ##
|
||||
## ------------------------------- ##"
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
|
||||
@@ -1788,7 +1793,7 @@ cat >config.log <<_ACEOF
|
||||
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
|
||||
It was created by dahdi $as_me 2.8.0, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -4602,17 +4607,6 @@ 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
|
||||
@@ -5699,7 +5693,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by $as_me, which was
|
||||
This file was extended by dahdi $as_me 2.8.0, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -5755,13 +5749,13 @@ $config_files
|
||||
Configuration headers:
|
||||
$config_headers
|
||||
|
||||
Report bugs to the package provider."
|
||||
Report bugs to <www.asterisk.org>."
|
||||
|
||||
_ACEOF
|
||||
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
|
||||
dahdi config.status 2.8.0
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
@@ -79,15 +79,6 @@ 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)
|
||||
|
||||
@@ -286,8 +286,12 @@ case "$1" in
|
||||
$FXOTUNE -s || :
|
||||
fi
|
||||
|
||||
# Set the right Astribanks ticker:
|
||||
LC_ALL=C xpp_sync "$XPP_SYNC"
|
||||
# Do not try to call xpp_sync if there are no Astribank devices
|
||||
# installed.
|
||||
if test -e /sys/bus/astribanks; then
|
||||
# Set the right Astribanks ticker:
|
||||
LC_ALL=C xpp_sync "$XPP_SYNC"
|
||||
fi
|
||||
|
||||
hpec_start
|
||||
;;
|
||||
|
||||
17
dahdi.rules
17
dahdi.rules
@@ -1,3 +1,18 @@
|
||||
|
||||
ACTION!="add", GOTO="dahdi_add_end"
|
||||
|
||||
# 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"
|
||||
|
||||
# Backward compat names: /dev/dahdi/<channo>
|
||||
SUBSYSTEM=="dahdi_channels", SYMLINK+="dahdi/%m"
|
||||
|
||||
# Add persistant names as well
|
||||
SUBSYSTEM=="dahdi_channels", SYSFS{hardware_id}!="", SYMLINK+="dahdi/devices/%s{hardware_id}/%s{local_spanno}/%n"
|
||||
SUBSYSTEM=="dahdi_channels", SYSFS{location}!="", SYMLINK+="dahdi/devices/@%s{location}/%s{local_spanno}/%n"
|
||||
|
||||
LABEL="dahdi_add_end"
|
||||
|
||||
# hotplug scripts
|
||||
SUBSYSTEM=="dahdi_devices", RUN="%E{DAHDI_TOOLS_ROOTDIR}/usr/share/dahdi/dahdi_handle_device"
|
||||
SUBSYSTEM=="dahdi_spans", RUN="%E{DAHDI_TOOLS_ROOTDIR}/usr/share/dahdi/dahdi_span_config"
|
||||
|
||||
@@ -1500,7 +1500,10 @@ int main(int argc, char *argv[])
|
||||
error("Unable to open master device '%s'\n", MASTER_DEVICE);
|
||||
goto finish;
|
||||
}
|
||||
cf = fopen(filename, "r");
|
||||
if (strcmp(filename, "-") == 0)
|
||||
cf = fdopen(STDIN_FILENO, "r");
|
||||
else
|
||||
cf = fopen(filename, "r");
|
||||
if (cf) {
|
||||
while((buf = readline())) {
|
||||
if (*buf == 10) /* skip new line */
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#! /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
|
||||
80
dahdi_handle_device
Executable file
80
dahdi_handle_device
Executable file
@@ -0,0 +1,80 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# /usr/share/dahdi/dahdi_handle_device
|
||||
#
|
||||
# Called by UDEV when a dahdi device is added/removed
|
||||
#
|
||||
|
||||
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): '$*'"
|
||||
|
||||
# Do we have a configuration?
|
||||
if [ -f /etc/dahdi/init.conf ]; then
|
||||
. /etc/dahdi/init.conf
|
||||
fi
|
||||
|
||||
if [ "$DAHDI_UDEV_DISABLE_DEVICES" = 'yes' ]; then
|
||||
echo "DAHDI_UDEV_DISABLE_DEVICES=yes. Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if we can safely do our job
|
||||
if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then
|
||||
echo "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
if [ `cat /sys/module/dahdi/parameters/auto_assign_spans` -eq 1 ]; then
|
||||
echo "auto_assign_spans=1. Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Can we pass a different value so we can use
|
||||
# alternate (testing) configuration?
|
||||
# Meanwhile, make it hard-coded.
|
||||
DAHDICONFDIR='/etc/dahdi'
|
||||
export DAHDICONFDIR
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
# Can have alternate dahdi configuration directory for debugging
|
||||
# export DAHDICONFDIR="/tmp/xortel/dahdi"
|
||||
|
||||
# Don't block udev for too long
|
||||
(
|
||||
if [ -r "$DAHDICONFDIR/span-types.conf" ]; then
|
||||
dahdi_span_types set "/sys$DEVPATH"
|
||||
fi
|
||||
if [ -r "$DAHDICONFDIR/assigned-spans.conf" ]; then
|
||||
dahdi_span_assignments add "/sys$DEVPATH"
|
||||
else
|
||||
# No configuration. No order guaranteed
|
||||
dahdi_span_assignments auto
|
||||
fi
|
||||
) 2>&1 < /dev/null | $LOGGER &
|
||||
;;
|
||||
remove)
|
||||
# Nothing to do yet...
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
;;
|
||||
*)
|
||||
echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
|
||||
;;
|
||||
esac
|
||||
39
dahdi_map
39
dahdi_map
@@ -1,39 +0,0 @@
|
||||
#! /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
|
||||
333
dahdi_span_assignments
Executable file
333
dahdi_span_assignments
Executable file
@@ -0,0 +1,333 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# /usr/sbin/dahdi_span_assignments:
|
||||
#
|
||||
# this script can be used both from udev and
|
||||
# from the command line to assign/unassign and list
|
||||
# current span assignments.
|
||||
#
|
||||
# It uses a configuration file: $DAHDICONFDIR/assigned-spans.conf
|
||||
# (default DAHDICONFDIR=/etc/dahdi)
|
||||
#
|
||||
# The first argument is an action:
|
||||
# "auto" - trigger driver auto_assign attribute for given devices
|
||||
# (no configuration file is used)
|
||||
# "add" - assign (spans which are not already assigned), according
|
||||
# to /etc/dahdi/assigned-spans.conf configuration file
|
||||
# "remove" - unassign spans which are not already unassigned
|
||||
# "list" - human-readable list of all spans (with/without assignments)
|
||||
# "dumpconfig" - dump current assignments in a /etc/dahdi/assigned-spans.conf
|
||||
# compatible format
|
||||
#
|
||||
# Without further arguments, it operates on all existing spans
|
||||
# With one or more sysfs dahdi_devices it is limited to those.
|
||||
#
|
||||
# We may use alternative "keys" for device matching:
|
||||
# * Available keys:
|
||||
# - "hwid" - Hardware id attribute from sysfs
|
||||
# - "@location" - Location attribute from sysfs (embeded inside '<>')
|
||||
# - "/devpath" - The sysfs absolute devpath
|
||||
#
|
||||
# * 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
|
||||
# or the '{-k|--key} key' command line option.
|
||||
#
|
||||
# * During "add":
|
||||
# - Any key match is valid (hwid/location/devpath)
|
||||
# - Shell globs (wildcards: '*', '?', '[...]') may be optionally used.
|
||||
#
|
||||
# Command line options:
|
||||
# - The '-h|--help' show a usage message.
|
||||
# - The '-n|--dry-run' affects the "add" and "remove" operations.
|
||||
# - The '-v|--verbose' currently shows device matches during "add" operation.
|
||||
# - The '-k <key>|--key <key>' overrides the SPAN_ASSIGNMENTS_KEY environment
|
||||
# variable.
|
||||
#
|
||||
# Examples:
|
||||
# dahdi_span_assignments list
|
||||
# dahdi_span_assignments add # all unassigned devices
|
||||
# dahdi_span_assignments add /sys/bus/dahdi_devices/devices/astribanks:xbus-00
|
||||
# dahdi_span_assignments remove # all assigned devices
|
||||
# dahdi_span_assignments -k location dumpconfig
|
||||
#
|
||||
|
||||
devbase='/sys/bus/dahdi_devices/devices'
|
||||
DAHDICONFDIR="${DAHDICONFDIR:-/etc/dahdi}"
|
||||
DAHDISASSIGNEDSPANSCONF="${DAHDIASSIGNEDSPANSCONF:-"${DAHDICONFDIR}/assigned-spans.conf"}"
|
||||
SPAN_ASSIGNMENTS_KEY=${SPAN_ASSIGNMENTS_KEY:-hwid}
|
||||
dry_run=
|
||||
verbose=
|
||||
|
||||
usage() {
|
||||
echo >&2 "Usage: $0 [options] action [devpath ...]"
|
||||
echo >&2 " action:"
|
||||
echo >&2 " auto - trigger driver auto_assign attribute for given devices"
|
||||
echo >&2 " add - assign spans, according to /etc/dahdi/assigned-spans.conf"
|
||||
echo >&2 " remove - unassign spans"
|
||||
echo >&2 " list - human-readable list of all spans"
|
||||
echo >&2 " dumpconfig - dump current state as new configuration"
|
||||
echo >&2 ""
|
||||
echo >&2 " options:"
|
||||
echo >&2 " -h|--help - Show this help"
|
||||
echo >&2 " -n|--dry-run - For 'add/remove' actions"
|
||||
echo >&2 " -v|--versbose - Show matches during 'add' action"
|
||||
echo >&2 " -k|--key <k> - Override prefered key during dumpconfig action"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Parse command line options
|
||||
TEMP=`getopt -o hnvk: --long help,dry-run,verbose,key: -n "$0" -- "$@"`
|
||||
if [ $? != 0 ]; then
|
||||
echo >&2 "Bad options"
|
||||
usage
|
||||
fi
|
||||
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-n|--dry-run)
|
||||
dry_run='true'
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
verbose='true'
|
||||
shift
|
||||
;;
|
||||
-k|--key)
|
||||
SPAN_ASSIGNMENTS_KEY="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Internal error!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo >&2 "Missing action argument"
|
||||
usage
|
||||
fi
|
||||
action="$1"
|
||||
shift
|
||||
|
||||
# Validate SPAN_ASSIGNMENTS_KEY
|
||||
case "$SPAN_ASSIGNMENTS_KEY" in
|
||||
hwid|location|devpath)
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Bad SPAN_ASSIGNMENTS_KEY='$SPAN_ASSIGNMENTS_KEY' (should be: hwid|location|devpath)"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
||||
|
||||
# Beware of special characters in attributes
|
||||
attr_clean() {
|
||||
cat "$1" 2>/dev/null | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:.-' '_'
|
||||
}
|
||||
|
||||
show_devices() {
|
||||
|
||||
for device in $DEVICES
|
||||
do
|
||||
devpath=`cd "$device" && pwd -P`
|
||||
location='@'`attr_clean "$device/location"`
|
||||
hardware_id=`attr_clean "$device/hardware_id"`
|
||||
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 "%-8s %-14s %s %s\n" "$local_spanno:$spanno:$basechan" "[$hardware_id]" "$location" "$devpath"
|
||||
done | sort -n
|
||||
done
|
||||
}
|
||||
|
||||
dump_config() {
|
||||
echo '#'
|
||||
echo "# Autogenerated by $0 on `date`"
|
||||
echo "# Map devices + local spans to span + base channel number"
|
||||
echo ''
|
||||
for device in $DEVICES
|
||||
do
|
||||
devpath=`cd "$device" && pwd -P`
|
||||
location=`attr_clean "$device/location"`
|
||||
hardware_id=`attr_clean "$device/hardware_id"`
|
||||
if [ "$SPAN_ASSIGNMENTS_KEY" = 'hwid' -a "$hardware_id" != '' ]; then
|
||||
id="$hardware_id"
|
||||
elif [ "$SPAN_ASSIGNMENTS_KEY" = 'location' -a "$location" != '' ]; then
|
||||
id="@$location"
|
||||
else
|
||||
id="$devpath"
|
||||
fi
|
||||
echo "# Device: [$hardware_id] @$location $devpath"
|
||||
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"`
|
||||
printf "%-30s %s\n" "$id" "$local_spanno:$spanno:$basechan"
|
||||
else
|
||||
echo "# Skipped unassigned local span $local_spanno"
|
||||
fi
|
||||
done | sort
|
||||
echo ''
|
||||
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"`
|
||||
if [ "$dry_run" = true ]; then
|
||||
echo "(dry-run) unassign $device $local_spanno"
|
||||
continue
|
||||
fi
|
||||
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' "$DAHDISASSIGNEDSPANSCONF"
|
||||
}
|
||||
|
||||
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 [ "$dry_run" = true ]; then
|
||||
echo "(dry-run) assign $device: $s"
|
||||
continue
|
||||
fi
|
||||
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 span $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"
|
||||
devpath=`cd "$device" && pwd -P`
|
||||
location='@'`attr_clean "$device/location"`
|
||||
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 "$hardware_id" in
|
||||
$id)
|
||||
[ "$verbose" = true ] && echo "match by hwid ($id ~ $hardware_id): $spanspecs"
|
||||
assign_device_spans "$device"
|
||||
;;
|
||||
esac
|
||||
# We use case to enable shell-style globbing in configuration
|
||||
case "$location" in
|
||||
$id)
|
||||
[ "$verbose" = true ] && echo "match by location ($id ~ $location): $spanspecs"
|
||||
assign_device_spans "$device"
|
||||
;;
|
||||
esac
|
||||
# We use case to enable shell-style globbing in configuration
|
||||
case "$devpath" in
|
||||
$id)
|
||||
[ "$verbose" = true ] && echo "match by devpath ($id ~ $devpath): $spanspecs"
|
||||
assign_device_spans "$device"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
assign_devices() {
|
||||
if [ ! -f "$DAHDISASSIGNEDSPANSCONF" ]; then
|
||||
echo >&2 "$0: Missing '$DAHDISASSIGNEDSPANSCONF'"
|
||||
exit 1
|
||||
fi
|
||||
echo "using '$DAHDISASSIGNEDSPANSCONF'"
|
||||
for device in $DEVICES
|
||||
do
|
||||
match_device "$device"
|
||||
done
|
||||
}
|
||||
|
||||
auto_assign_devices() {
|
||||
for device in $DEVICES
|
||||
do
|
||||
echo "auto-assign $device"
|
||||
if [ "$dry_run" != true ]; then
|
||||
echo 1 > "$device/auto_assign"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
case "$action" in
|
||||
auto)
|
||||
auto_assign_devices
|
||||
;;
|
||||
add)
|
||||
assign_devices
|
||||
;;
|
||||
remove)
|
||||
unassign_all_spans
|
||||
;;
|
||||
list)
|
||||
show_devices
|
||||
;;
|
||||
dumpconfig)
|
||||
dump_config
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Bad action='$action'"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
99
dahdi_span_config
Executable file
99
dahdi_span_config
Executable file
@@ -0,0 +1,99 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# /usr/share/dahdi/dahdi_span_config
|
||||
#
|
||||
# Called by UDEV when a dahdi span is added/removed
|
||||
#
|
||||
|
||||
me=`basename $0`
|
||||
dir=`dirname $0`
|
||||
LOGGER="logger -i -t '$me'"
|
||||
NAME=`basename "$DEVPATH" | tr -c 'A-Za-z0-9-' '_'`
|
||||
|
||||
exec 2> /dev/null
|
||||
# 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/console
|
||||
## If you wish to trace this script:
|
||||
#exec 2> "/tmp/${me}.$NAME" 1>&2
|
||||
|
||||
# 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): '$*'"
|
||||
|
||||
# Do we have a configuration?
|
||||
if [ -f /etc/dahdi/init.conf ]; then
|
||||
. /etc/dahdi/init.conf
|
||||
fi
|
||||
|
||||
if [ "$DAHDI_UDEV_DISABLE_SPANS" = 'yes' ]; then
|
||||
echo "DAHDI_UDEV_DISABLE_SPANS=yes. Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Can we pass a different value so we can use
|
||||
# alternate (testing) configuration?
|
||||
# Meanwhile, make it hard-coded.
|
||||
DAHDICONFDIR='/etc/dahdi'
|
||||
export DAHDICONFDIR
|
||||
|
||||
run_dahdi_cfg() {
|
||||
echo "dahdi_cfg: span $spanno <$basechan-$endchan> ($DEVPATH)"
|
||||
dahdi_cfg -c "$cfg_file" -S "$spanno" -C "$basechan-$endchan"
|
||||
}
|
||||
|
||||
configure_span() {
|
||||
span_devpath="$1"
|
||||
# Sanity check
|
||||
checkit=`"dahdi_cfg" --help 2>&1 | grep -- '-S' | wc -l`
|
||||
if [ "$checkit" != 1 ]; then
|
||||
echo "Bad dahdi_cfg (no -S support). Skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set variables
|
||||
spanno=`echo "$span_devpath" | sed 's,.*/span-,,'`
|
||||
basechan=`cat "$span_devpath/basechan"`
|
||||
channels=`cat "$span_devpath/channels"`
|
||||
endchan=`expr "$basechan" + "$channels" - 1`
|
||||
|
||||
# Configure DAHDI
|
||||
cfg_file="$DAHDICONFDIR/system.conf"
|
||||
if [ -r "$cfg_file" ]; then
|
||||
run_dahdi_cfg
|
||||
else
|
||||
echo "Using auto-generated config for dahdi_cfg"
|
||||
cfg_file='-'
|
||||
DAHDI_CONF_FILE="$cfg_file" dahdi_genconf system | run_dahdi_cfg
|
||||
fi
|
||||
fxotune_cfg='/etc/fxotune.conf'
|
||||
if [ -r "$fxotune_cfg" ]; then
|
||||
echo "fxotune: span $spanno <$basechan-$endchan> ($DEVPATH)"
|
||||
fxotune -s -b "$basechan" -e "$endchan"
|
||||
fi
|
||||
|
||||
# Add to asterisk
|
||||
asterisk -rx "dahdi create channels $basechan $endchan"
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
# Can have alternate dahdi configuration directory for debugging
|
||||
# export DAHDICONFDIR="/tmp/xortel/dahdi"
|
||||
|
||||
configure_span "/sys$DEVPATH" 2>&1 | $LOGGER
|
||||
;;
|
||||
remove|online|offline)
|
||||
# Nothing to do yet...
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
;;
|
||||
*)
|
||||
echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
|
||||
;;
|
||||
esac
|
||||
|
||||
268
dahdi_span_types
Executable file
268
dahdi_span_types
Executable file
@@ -0,0 +1,268 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# /usr/sbin/dahdi_span_types
|
||||
#
|
||||
# This script can be used both from udev and
|
||||
# from the command line to manage PRI spans
|
||||
# type (E1/T1/J1).
|
||||
#
|
||||
# Span types can be set only *BEFORE* span are assigned.
|
||||
#
|
||||
# It uses a configuration file: $DAHDICONFDIR/span-types.conf
|
||||
# (default DAHDICONFDIR=/etc/dahdi)
|
||||
# (the format is documented inside that file)
|
||||
#
|
||||
# The first argument is an action:
|
||||
# "set" - actually write the setting to the driver
|
||||
# "list" - human-readable list of E1/T1/J1 types
|
||||
# "dumpconfig" - dump current assignments in a /etc/dahdi/span-types.conf
|
||||
# compatible format
|
||||
#
|
||||
# Without further arguments, it operates on all existing spans
|
||||
# With one or more sysfs dahdi_devices it is limited to those.
|
||||
#
|
||||
# We may use alternative "keys" for device matching:
|
||||
# * Available keys:
|
||||
# - "hwid" - Hardware id attribute from sysfs
|
||||
# - "@location" - Location attribute from sysfs (embeded inside '<>')
|
||||
# - "/devpath" - The sysfs absolute devpath
|
||||
#
|
||||
# * 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
|
||||
# or the '{-k|--key} key' command line option.
|
||||
#
|
||||
# Command line options:
|
||||
# - The '-h|--help' show a usage message.
|
||||
# - The '-k <key>|--key <key>' overrides the SPAN_ASSIGNMENTS_KEY environment
|
||||
# variable.
|
||||
#
|
||||
# Examples:
|
||||
# dahdi_span_types list
|
||||
# dahdi_span_types set # all devices
|
||||
# dahdi_span_types set /sys/bus/dahdi_devices/devices/astribanks:xbus-00
|
||||
# dahdi_span_types -k location dumpconfig
|
||||
#
|
||||
|
||||
|
||||
devbase='/sys/bus/dahdi_devices/devices'
|
||||
DAHDICONFDIR="${DAHDICONFDIR:-/etc/dahdi}"
|
||||
DAHDISPANTYPESCONF="${DAHDISPANTYPESCONF:-"${DAHDICONFDIR}/span-types.conf"}"
|
||||
SPAN_ASSIGNMENTS_KEY=${SPAN_ASSIGNMENTS_KEY:-hwid}
|
||||
|
||||
usage() {
|
||||
echo >&2 "Usage: $0 [options] action [devpath ...]"
|
||||
echo >&2 " action:"
|
||||
echo >&2 " set - set spans to E1/T1 according to configuration"
|
||||
echo >&2 " list - human-readable list of all spans"
|
||||
echo >&2 " dumpconfig - dump current state as new configuration"
|
||||
echo >&2 ""
|
||||
echo >&2 " options:"
|
||||
echo >&2 " -h|--help - Show this help"
|
||||
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" -- "$@"`
|
||||
if [ $? != 0 ]; then
|
||||
echo >&2 "Bad options"
|
||||
usage
|
||||
fi
|
||||
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-k|--key)
|
||||
SPAN_ASSIGNMENTS_KEY="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Internal error!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo >&2 "Missing action argument"
|
||||
usage
|
||||
fi
|
||||
action="$1"
|
||||
shift
|
||||
|
||||
# Validate SPAN_ASSIGNMENTS_KEY
|
||||
case "$SPAN_ASSIGNMENTS_KEY" in
|
||||
hwid|location|devpath)
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Bad SPAN_ASSIGNMENTS_KEY='$SPAN_ASSIGNMENTS_KEY' (should be: hwid|location|devpath)"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
||||
|
||||
# Beware of special characters in attributes
|
||||
attr_clean() {
|
||||
cat "$1" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:.-' '_'
|
||||
}
|
||||
|
||||
show_spantypes() {
|
||||
echo "# PRI span types (E1/T1/J1)"
|
||||
for device in $DEVICES
|
||||
do
|
||||
devpath=`cd "$device" && pwd -P`
|
||||
location='@'`attr_clean "$device/location"`
|
||||
hardware_id=`attr_clean "$device/hardware_id"`
|
||||
cat "$device/spantype" | while read st; do
|
||||
case "$st" in
|
||||
*:[ETJ]1)
|
||||
printf "%-10s %-20s %s\n" \
|
||||
"$st" "[$hardware_id]" "$location"
|
||||
;;
|
||||
esac
|
||||
done | sort -n
|
||||
done
|
||||
}
|
||||
|
||||
dump_config() {
|
||||
echo '#'
|
||||
echo "# Autogenerated by $0 on `date`"
|
||||
echo "# Map PRI DAHDI devices to span types for E1/T1/J1"
|
||||
echo ''
|
||||
fmt="%-65s %s\n"
|
||||
printf "$fmt" '# @location/hardware_id' 'span_type'
|
||||
for device in $DEVICES
|
||||
do
|
||||
devpath=`cd "$device" && pwd -P`
|
||||
location=`attr_clean "$device/location"`
|
||||
hardware_id=`attr_clean "$device/hardware_id"`
|
||||
if [ "$SPAN_ASSIGNMENTS_KEY" = 'hwid' -a "$hardware_id" != '' ]; then
|
||||
id="$hardware_id"
|
||||
elif [ "$SPAN_ASSIGNMENTS_KEY" = 'location' -a "$location" != '' ]; then
|
||||
id="@$location"
|
||||
else
|
||||
id="$devpath"
|
||||
fi
|
||||
echo "# Device: [$hardware_id] @$location $devpath"
|
||||
cat "$device/spantype" | while read st; do
|
||||
case "$st" in
|
||||
*:[ETJ]1)
|
||||
printf "$fmt" "$id" "$st"
|
||||
;;
|
||||
*)
|
||||
#echo "# Skipped local span `echo $st | sed 's/:/ -- /'`"
|
||||
;;
|
||||
esac
|
||||
done | sort -n
|
||||
#echo ''
|
||||
done
|
||||
}
|
||||
|
||||
# Allow comments and empty lines in config file
|
||||
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
|
||||
# GLOBBING
|
||||
case "$location" in
|
||||
$id)
|
||||
#echo >&2 "match($id): $spans"
|
||||
SPANS="$SPANS $spans"
|
||||
;;
|
||||
esac
|
||||
case "$hardware_id" in
|
||||
$id)
|
||||
#echo >&2 "match([$id]): $spans"
|
||||
SPANS="$SPANS $spans"
|
||||
;;
|
||||
esac
|
||||
case "$devpath" in
|
||||
$id)
|
||||
#echo >&2 "match([$id]): $spans"
|
||||
SPANS="$SPANS $spans"
|
||||
;;
|
||||
esac
|
||||
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() {
|
||||
if [ ! -f "$DAHDISPANTYPESCONF" ]; then
|
||||
echo >&2 "$0: Missing configuration '$DAHDISPANTYPESCONF'"
|
||||
exit 1
|
||||
fi
|
||||
for device in $DEVICES
|
||||
do
|
||||
device_set_spantype "$device"
|
||||
done
|
||||
}
|
||||
|
||||
case "$action" in
|
||||
list)
|
||||
show_spantypes
|
||||
;;
|
||||
dumpconfig)
|
||||
dump_config
|
||||
;;
|
||||
set)
|
||||
set_spantypes
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
@@ -24,6 +24,8 @@ the DAHDI init script.
|
||||
.RS
|
||||
Use an alternative configuration file instead of
|
||||
.I /etc/dahdi/system.conf
|
||||
|
||||
If \fICFG_FILE\fR is '\fB\-\fR', it is read from stdin.
|
||||
.RE
|
||||
|
||||
.B \-C \fICHANNELS
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
.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@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.
|
||||
222
doc/dahdi_span_assignments.8
Normal file
222
doc/dahdi_span_assignments.8
Normal file
@@ -0,0 +1,222 @@
|
||||
.TH "SPAN_ASSIGNMENTS" "8" "13 Oct 2013" "" ""
|
||||
|
||||
.SH NAME
|
||||
dahdi_span_assignments \- handle DAHDI spans registration
|
||||
.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] auto
|
||||
|
||||
.B dahdi_span_assignments [\-v|\-\-verbose] list
|
||||
|
||||
.B dahdi_span_assignments [\-v|\-\-verbose] [\-k|\-\-key \fIkey\fB] dumpconfig
|
||||
|
||||
.B dahdi_span_assignments \-h|\-\-help
|
||||
|
||||
.SH DESCRIPTION
|
||||
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.
|
||||
|
||||
.B dahdi_span_assignments
|
||||
is used to register those spans or to help creating the configuration
|
||||
file used in their registration:
|
||||
.B /etc/dahdi/assigned-spans.conf .
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
There are several sub-commands:
|
||||
|
||||
.B add \fIdevpath \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
|
||||
configuration in \fBassigned-spans.conf\fR.
|
||||
.RE
|
||||
|
||||
.B remove \fIdevpath \fB[\fIdevpath \fB...]
|
||||
.RS
|
||||
Parameters are paths (in SysFS) to DAHDI devices with registered
|
||||
spans. The command will unregister with DAHDI.
|
||||
.RE
|
||||
|
||||
.B auto
|
||||
.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.
|
||||
.RE
|
||||
|
||||
.B list
|
||||
.RS
|
||||
List all spans in the system.
|
||||
.RE
|
||||
|
||||
.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.
|
||||
|
||||
.B dahdi_genconf assignedspans
|
||||
uses this command internally.
|
||||
.RE
|
||||
|
||||
.B \-v \-\-verbose
|
||||
.RS
|
||||
Verbose output.
|
||||
.RE
|
||||
|
||||
.B \-n \-\-dry\-run
|
||||
.RS
|
||||
Don't register / unregister spans. Only print commands used to do so.
|
||||
.RE
|
||||
|
||||
.B \-k \fIkey
|
||||
.RS
|
||||
For \fBdumpconfig\fR \- The key by which to identify the hardware in the
|
||||
generated configuration. Legal values:
|
||||
|
||||
.B hwid
|
||||
.RS
|
||||
Hardware identifier (e.g.: software-readable serial number). This is the
|
||||
default. If the device has no hwid, devpath is used.
|
||||
.RE
|
||||
|
||||
.B location
|
||||
.RS
|
||||
The location field (file) in the SysFS device node (directory) for the
|
||||
DAHDI device. If not available (typically: DAHDI version <= 2.7.x),
|
||||
devpath is used.
|
||||
.RE
|
||||
|
||||
.B devpath
|
||||
.RS
|
||||
Path in SysFS to the device node.
|
||||
.RE
|
||||
.RE
|
||||
|
||||
.SH CONFIGURATOIN
|
||||
.B assigned-spans.conf
|
||||
is a file with lines specifying registration of spans.
|
||||
|
||||
Empty lines or lines beginning with '#' are ignored.
|
||||
|
||||
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
|
||||
\fIspanspecs\fR in a single line (though dumpconfig generates a
|
||||
configuration with one per line).
|
||||
|
||||
.SS Span Identifier
|
||||
A DAHDI device may be specified either by a hardware identifier (a
|
||||
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:
|
||||
|
||||
\fIhwid\fR
|
||||
\fB@\fIlocation\fR
|
||||
\fIdevpath\fR
|
||||
|
||||
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.
|
||||
|
||||
.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:
|
||||
|
||||
.I rel_span_no:span_no:first_chan
|
||||
|
||||
for instance, the following are four span specifications for a quad-E1
|
||||
device: 1:6:53 2:7:84 3:8:115 4:9:146 occupying spans 6-9 and channels
|
||||
53-176.
|
||||
|
||||
.B rel_span_no
|
||||
.RS
|
||||
The relative number of the span in the device. E.g.: port number.
|
||||
.RE
|
||||
|
||||
.B span_no
|
||||
.RS
|
||||
The desired DAHDI span number. Must be available.
|
||||
.RE
|
||||
|
||||
.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
|
||||
space must be available.
|
||||
.RE
|
||||
|
||||
|
||||
.SH ENVIRONMENT
|
||||
|
||||
.B DAHDICONFDIR
|
||||
.RS
|
||||
The directory in which assigned-spans.conf resides. /etc/dahdi if not
|
||||
overridden from the environment.
|
||||
.RE
|
||||
|
||||
.B DAHDISASSIGNEDSPANSCONF
|
||||
.RS
|
||||
The path to assigned-spans.conf resides. /etc/dahdi/assigned-spans.conf if
|
||||
not overridden from the environment.
|
||||
.RE
|
||||
|
||||
.B SPAN_ASSIGNMENTS_KEY
|
||||
.RS
|
||||
The default value for \-k . Defaults to "hwid" if not overridden from the
|
||||
environment.
|
||||
.RE
|
||||
|
||||
|
||||
.SH FILES
|
||||
|
||||
.B /etc/dahdi/assigned-spans.conf
|
||||
.RS
|
||||
The default location for the configuration file.
|
||||
.RE
|
||||
|
||||
.B /sys/bus/dahdi_devices/devices/\fIdevice\fR
|
||||
.RS
|
||||
SysFS node for the device. In this directory reside the following
|
||||
files, among others:
|
||||
|
||||
.B location
|
||||
.RS
|
||||
The value of the device's location field.
|
||||
.RE
|
||||
|
||||
.B assign_span, unassign_span, auto_assign
|
||||
.RS
|
||||
Write only files for the operations. Used by \fBadd\fR, \fBremove\fR and
|
||||
\fBauto\fR, respectively.
|
||||
.RE
|
||||
|
||||
.RE
|
||||
|
||||
.SH SEE ALSO
|
||||
dahdi_span_types(8), dahdi_genconf(8), dahdi_cfg(8)
|
||||
|
||||
.SH AUTHOR
|
||||
dahdi_span_assignments was written by Oron Peled. This manual page was
|
||||
written by Tzafrir Cohen. 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.
|
||||
|
||||
146
doc/dahdi_span_types.8
Normal file
146
doc/dahdi_span_types.8
Normal file
@@ -0,0 +1,146 @@
|
||||
.TH "SPAN_TYPES" "8" "13 Oct 2013" "" ""
|
||||
|
||||
.SH NAME
|
||||
dahdi_span_types \- set DAHDI spans properties before registration (E1/T1)
|
||||
.SH SYNOPSIS
|
||||
|
||||
.B dahdi_span_types <list|dumpconfig|set> [\fIdevpath \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.
|
||||
|
||||
Using it only makes sense when the kernel module parameter
|
||||
\fBdahdi.auto_assign_span\fR is unset, otherwise the DAHDI spans register
|
||||
automatically.
|
||||
|
||||
.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.
|
||||
|
||||
.B set
|
||||
.RS
|
||||
Reads settings from \fBspan-types.conf\fR and applies them to the
|
||||
device(s) specified in the command line (or all devices, if none
|
||||
specified).
|
||||
.RE
|
||||
|
||||
.B list
|
||||
.RS
|
||||
List types for all spans in the system which may be set with dahdi_span_types
|
||||
(E1/T1/J1 spans).
|
||||
.RE
|
||||
|
||||
.B dumpconfig
|
||||
.RS
|
||||
List types for the spans in a format fit to be used in
|
||||
\fBspan-types.conf\fR. Use this to generate a configuration file after
|
||||
you have (perhaps manually) set all existing spans.
|
||||
|
||||
.B dahdi_genconf spantypes
|
||||
uses this command internally.
|
||||
.RE
|
||||
|
||||
.SH CONFIGURATION
|
||||
.B span-types.conf
|
||||
is a file with lines specifying registration of spans.
|
||||
|
||||
Empty lines or lines beginning with '#' are ignored.
|
||||
|
||||
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
|
||||
\fIspanspecs\fR in a single line (though dumpconfig generates a
|
||||
configuration with one per line).
|
||||
|
||||
.SS Span Identifier
|
||||
A DAHDI device may be specified either by a hardware identifier (a
|
||||
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:
|
||||
|
||||
\fIhwid\fR
|
||||
\fB@\fIlocation\fR
|
||||
\fIdevpath\fR
|
||||
|
||||
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.
|
||||
|
||||
.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:
|
||||
|
||||
.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 .
|
||||
|
||||
.B rel_span_no
|
||||
.RS
|
||||
The relative number of the span in the device. E.g.: port number.
|
||||
.RE
|
||||
|
||||
.B span_type
|
||||
.RS
|
||||
E1/T1/J1
|
||||
.RE
|
||||
|
||||
|
||||
.SH ENVIRONMENT
|
||||
|
||||
.B DAHDICONFDIR
|
||||
.RS
|
||||
The directory in which span-types.conf resides. /etc/dahdi if not
|
||||
overridden from the environment.
|
||||
.RE
|
||||
|
||||
.B DAHDISPANTYPESCONF
|
||||
.RS
|
||||
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
|
||||
.RS
|
||||
The default location for the configuration file.
|
||||
.RE
|
||||
|
||||
.B /sys/bus/dahdi_devices/devices/\fIdevice\fR
|
||||
.RS
|
||||
SysFS node for the device. In this directory reside the following
|
||||
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).
|
||||
.RE
|
||||
|
||||
|
||||
.SH SEE ALSO
|
||||
dahdi_span_assignments(8), dahdi_genconf(8), dahdi_cfg(8)
|
||||
|
||||
.SH AUTHOR
|
||||
dahdi_span_types was written by Oron Peled. This manual page was
|
||||
written by Tzafrir Cohen. 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.
|
||||
|
||||
@@ -11,6 +11,7 @@ fxotune \- automatically tune DAHDI FXO channels
|
||||
\- dump mode
|
||||
|
||||
.B fxotune \-s
|
||||
.I [ options ]
|
||||
\- Startup mode
|
||||
.SH
|
||||
.SH DESCRIPTION
|
||||
|
||||
13
fxotune.c
13
fxotune.c
@@ -980,7 +980,7 @@ static int channel_open(int channo)
|
||||
*
|
||||
* @return 0 if successful, !0 otherwise
|
||||
*/
|
||||
static int do_set(char *configfilename)
|
||||
static int do_set(char *configfilename, int dev_range, int startdev, int stopdev)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
int res = 0;
|
||||
@@ -1007,6 +1007,8 @@ static int do_set(char *configfilename)
|
||||
if (res == EOF) {
|
||||
break;
|
||||
}
|
||||
if (dev_range && (mydahdi < startdev || mydahdi > stopdev))
|
||||
continue;
|
||||
|
||||
/* Check to be sure conversion is done correctly */
|
||||
if (OUT_OF_BOUNDS(myacim) || OUT_OF_BOUNDS(mycoef1)||
|
||||
@@ -1028,6 +1030,8 @@ static int do_set(char *configfilename)
|
||||
mycoefs.coef7 = mycoef7;
|
||||
mycoefs.coef8 = mycoef8;
|
||||
|
||||
if (debug >= 2)
|
||||
printf("fxotune: set channel %d\n", mydahdi);
|
||||
fd = channel_open(mydahdi);
|
||||
if (fd < 0) {
|
||||
return -1;
|
||||
@@ -1187,6 +1191,7 @@ int main(int argc , char **argv)
|
||||
{
|
||||
int startdev = 1; /* -b */
|
||||
int stopdev = 252; /* -e */
|
||||
int dev_range = 0; /* false */
|
||||
int calibtype = 2; /* -t */
|
||||
int waveformtype = -1; /* -w multi-tone by default. If > 0, single tone of specified frequency */
|
||||
int delaytosilence = 0; /* -l */
|
||||
@@ -1228,9 +1233,11 @@ int main(int argc , char **argv)
|
||||
continue;
|
||||
case 'b':
|
||||
startdev = moreargs ? atoi(argv[++i]) : startdev;
|
||||
dev_range = 1;
|
||||
break;
|
||||
case 'e':
|
||||
stopdev = moreargs ? atoi(argv[++i]) : stopdev;
|
||||
dev_range = 1;
|
||||
break;
|
||||
case 't':
|
||||
calibtype = moreargs ? atoi(argv[++i]) : calibtype;
|
||||
@@ -1300,13 +1307,13 @@ int main(int argc , char **argv)
|
||||
if (docalibrate){
|
||||
res = do_calibrate(startdev, stopdev, calibtype, configfile, dialstr, delaytosilence, silencegoodfor);
|
||||
if (!res)
|
||||
return do_set(configfile);
|
||||
return do_set(configfile, dev_range, startdev, stopdev);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (doset)
|
||||
return do_set(configfile);
|
||||
return do_set(configfile, dev_range, startdev, stopdev);
|
||||
|
||||
if (dodump){
|
||||
res = do_dump(startdev, dialstr, delaytosilence, silencegoodfor, waveformtype);
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#! /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
|
||||
|
||||
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
|
||||
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
|
||||
dahdi_cfg_device_args | while read args; do
|
||||
run_dahdi_cfg $args 2>&1 | $LOGGER
|
||||
done
|
||||
;;
|
||||
remove)
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
;;
|
||||
*)
|
||||
echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
|
||||
;;
|
||||
esac
|
||||
@@ -17,3 +17,7 @@
|
||||
#XPP_FIRMWARE_DIR=/usr/share/dahdi
|
||||
#XPP_HOTPLUG_DISABLED=yes
|
||||
#XPP_HOTPLUG_DAHDI=yes
|
||||
|
||||
# Disable udev handling:
|
||||
#DAHDI_UDEV_DISABLE_DEVICES=yes
|
||||
#DAHDI_UDEV_DISABLE_SPANS=yes
|
||||
|
||||
@@ -30,8 +30,6 @@ 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@
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
# Digium TE420: PCI-Express quad-port T1/E1/J1
|
||||
wct4xxp
|
||||
|
||||
# Digium TE435
|
||||
# Digium TE235
|
||||
wcte43x
|
||||
|
||||
# Digium TE120P: PCI single-port T1/E1/J1
|
||||
# Digium TE121: PCI-Express single-port T1/E1/J1
|
||||
# Digium TE122: PCI single-port T1/E1/J1
|
||||
@@ -34,6 +38,9 @@ wcte11xp
|
||||
# Digium TDM410P/AEX410: up to 4 analog ports
|
||||
wctdm24xxp
|
||||
|
||||
# Digium A4A/A4B/A8A/A8B
|
||||
wcaxx
|
||||
|
||||
# X100P - Single port FXO interface
|
||||
# X101P - Single port FXO interface
|
||||
wcfxo
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
# * The <id> field may be either:
|
||||
# hardware_id
|
||||
# @location
|
||||
# devpath (in sysfs)
|
||||
# * The <local_spanno> is the relative span number
|
||||
# in the device (starting from 1)
|
||||
# In this filed globbing rules apply. E.g:
|
||||
@@ -24,4 +25,4 @@
|
||||
|
||||
# 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
|
||||
#@usb-0000:00:1d.7-3 [12]:T1
|
||||
193
span_assignments
193
span_assignments
@@ -1,193 +0,0 @@
|
||||
#! /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
|
||||
160
span_types
160
span_types
@@ -1,160 +0,0 @@
|
||||
#! /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
|
||||
@@ -20,6 +20,8 @@ INSTALL_DATA = $(INSTALL) -m 644
|
||||
prefix ?= /usr
|
||||
datadir ?= $(prefix)/share
|
||||
mandir ?= $(datadir)/man
|
||||
sysconfdir ?= $(prefix)/etc
|
||||
udevrulesdir ?= $(sysconfdir)/udev/rules.d
|
||||
INSTALL ?= install
|
||||
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
@@ -102,6 +104,8 @@ install: all
|
||||
$(INSTALL) -d $(DESTDIR)$(DATADIR)
|
||||
$(INSTALL) xpp_fxloader astribank_hook $(DESTDIR)$(DATADIR)/
|
||||
$(INSTALL) waitfor_xpds $(DESTDIR)$(DATADIR)/
|
||||
$(INSTALL) -d $(DESTDIR)$(udevrulesdir)
|
||||
$(INSTALL_DATA) xpp.rules $(DESTDIR)$(udevrulesdir)/
|
||||
$(INSTALL) -d $(DESTDIR)$(MANDIR)
|
||||
$(INSTALL_DATA) $(MAN_INSTALL) $(DESTDIR)$(MANDIR)/
|
||||
$(INSTALL) -d $(DESTDIR)$(HOTPLUG_USB_DIR)
|
||||
|
||||
@@ -54,7 +54,7 @@ sub generator_list($) {
|
||||
}
|
||||
} else {
|
||||
# No files given. Use the defaults.
|
||||
@genlist = ('system', 'chandahdi');
|
||||
@genlist = ('spantypes', 'assignedspans', 'system', 'chandahdi');
|
||||
if($gconfig->{'pri_connection_type'} eq 'R2') {
|
||||
push @genlist, 'unicall';
|
||||
}
|
||||
|
||||
@@ -19,11 +19,27 @@ use Dahdi::Xpp::Xpd;
|
||||
use Getopt::Std;
|
||||
|
||||
sub usage {
|
||||
die "Usage: $0 [-s sort_order] [on|off|1|0]\n";
|
||||
die "Usage: $0 [-v] [-R] [-s sort_order] [on|off|1|0]\n";
|
||||
}
|
||||
|
||||
sub check_param {
|
||||
my $param = shift || die;
|
||||
open(F, $param) || return '';
|
||||
my $val = <F>;
|
||||
close F;
|
||||
chomp $val;
|
||||
return $val;
|
||||
}
|
||||
|
||||
my %opts;
|
||||
getopts('s:', \%opts) || usage;
|
||||
getopts('vRs:', \%opts) || usage;
|
||||
|
||||
my $dahdi_autoreg = check_param('/sys/module/xpp/parameters/dahdi_autoreg') eq 'Y';
|
||||
my $auto_assign_spans = check_param('/sys/module/dahdi/parameters/auto_assign_spans') eq '1';
|
||||
my $assigned_spans_config = $ENV{'ASSIGNED_SPANS_CONF_FILE'} || '/etc/dahdi/assigned-spans.conf';
|
||||
my $span_types_config = $ENV{'SPAN_TYPES_CONF_FILE'} || '/etc/dahdi/span-types.conf';
|
||||
my $have_assigned_spans_config = -f $assigned_spans_config || 0;
|
||||
my $have_span_types_config = -f $span_types_config || 0;
|
||||
|
||||
my $sorter;
|
||||
my $sort_order = $opts{'s'};
|
||||
@@ -41,9 +57,11 @@ if(defined $sort_order) {
|
||||
|
||||
@ARGV == 0 or @ARGV == 1 or usage;
|
||||
my $on = shift;
|
||||
my $verbose = 0;
|
||||
my $verbose = $opts{'v'};
|
||||
my $should_output = 1;
|
||||
|
||||
#print "dahdi_autoreg=$dahdi_autoreg auto_assign_spans=$auto_assign_spans have_assigned_spans_config='$have_assigned_spans_config' have_span_types_config='$have_span_types_config'\n";
|
||||
|
||||
if(defined($on)) { # Translate to booleans
|
||||
$on = uc($on);
|
||||
$on =~ /^(ON|OFF|1|0)$/ or usage;
|
||||
@@ -51,6 +69,8 @@ if(defined($on)) { # Translate to booleans
|
||||
$should_output = 0 unless $verbose;
|
||||
}
|
||||
|
||||
undef $on if $dahdi_autoreg and not $opts{'R'};
|
||||
|
||||
sub state2str($) {
|
||||
return (shift)?"on":"off";
|
||||
}
|
||||
@@ -80,6 +100,15 @@ foreach my $xbus (Dahdi::Xpp::xbuses($sorter)) {
|
||||
}
|
||||
myprintf "%3s ==> %3s\n", state2str($prev), state2str($on);
|
||||
}
|
||||
if (defined($on) && $on && ! $have_assigned_spans_config && ! $auto_assign_spans) {
|
||||
# Emulate /etc/dahdi/assigned-spans.conf:
|
||||
# - We iterate over $xbus according to /etc/dahdi/xpp_order
|
||||
# - We "auto" assign all spans of current $xbus
|
||||
my $devpath = sprintf "/sys/bus/dahdi_devices/devices/astribanks:xbus-%02d", $xbus->num;
|
||||
my @cmd = ('dahdi_span_assignments', 'auto', $devpath);
|
||||
system @cmd;
|
||||
warn "Failed '@cmd' (status=$?)\n" if $?;
|
||||
}
|
||||
}
|
||||
myprintf "# Sorted: $sort_order\n" if defined $sort_order;
|
||||
|
||||
@@ -91,7 +120,7 @@ dahdi_registration - Handle registration of Xorcom XPD modules in dahdi.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
dahdi_registration [-s sortorder] [on|off]
|
||||
dahdi_registration [-v] [-s sortorder] [-R] [on|off]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -105,6 +134,13 @@ Span registration should generally always succeed. Span unregistration may
|
||||
fail if channels from the span are in use by e.g. asterisk. In such a case
|
||||
you'll also see those channels as '(In use)' in the output of lsdahdi(8).
|
||||
|
||||
dahdi_registration is intended to be used when the kernel module parameter
|
||||
B<xpp.dahdi_autoreg> is false (and implicitly: when the module parameter
|
||||
B<dahdi.auto_assign_span> is true). See also the NOTES section regarding
|
||||
C<dahdi_span_assignments>.
|
||||
|
||||
If dahdi_autoreg is true, the program will normally do nothing.
|
||||
|
||||
=head2 Parameters
|
||||
|
||||
off -- deregisters all XPD's from dahdi.
|
||||
@@ -115,6 +151,15 @@ on -- registers all XPD's to dahdi.
|
||||
|
||||
=over
|
||||
|
||||
=item -v
|
||||
|
||||
verbose output.
|
||||
|
||||
=item -R
|
||||
|
||||
Force operations (on/off) even if the module parameter B<dahdi_autoreg>
|
||||
for xpp is enabled (which makes this program unneeded).
|
||||
|
||||
=item -s I<sort_order>
|
||||
|
||||
The sort order to use.
|
||||
@@ -165,3 +210,30 @@ This should allow you to register / unregister a specific XPD rather
|
||||
than all of them.
|
||||
|
||||
=back
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
dahdi_registration is intended to be used when the kernel module
|
||||
parameter B<xpp.dahdi_autoreg> is false (and implicitly: when the module
|
||||
parameter B<dahdi.auto_assign_span> is true), that is, Astribank devices
|
||||
as detected by XPP (xbus / xpd) do not register automatically with the
|
||||
DAHDI core. This tool is used to register tem in an explicit order. It
|
||||
works well, but only if you can arange for all of the Astribanks of the
|
||||
system to be available (and not already registered) at a specific point
|
||||
in time.
|
||||
|
||||
Newer versions of DAHDI added support for registering a span to a
|
||||
specific span/channelss numbers specification. This allows registering
|
||||
them out of order. To use this capability, the module parameter
|
||||
B<dahdi.auto_assign_span> should be unset (set to 0) and thus spans of
|
||||
detected DAHDI devices could be registered using C<dahdi_span_assignments>
|
||||
(which may also be run automatically from a udev hook).
|
||||
|
||||
In this case there is no point in delaying XPP device registration with
|
||||
dahdi and the parameter B<xpp.dahdi_autoreg> should be set.
|
||||
dahdi_registration will simply become a no-op.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
B<dahdi_cfg>(8), B<dahdi_span_assignments>(8).
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ sub new($$$$$$) {
|
||||
$type = "FXO"; # likely Rhino
|
||||
} elsif ($fqn =~ m{---/.*}) {
|
||||
$type = "EMPTY"; # likely Rhino, empty slot.
|
||||
} elsif ($fqn =~ m{\b(TE[24]|WCT1|WCT13x|Tor2|TorISA|WP[TE]1|cwain[12]|R[124]T1|AP40[124]|APE40[124])/.*}) {
|
||||
} elsif ($fqn =~ m{\b(WCTE|TE[24]|WCT1|WCT13x|Tor2|TorISA|WP[TE]1|cwain[12]|R[124]T1|AP40[124]|APE40[124])/.*}) {
|
||||
# TE[24]: Digium wct4xxp
|
||||
# WCT1: Digium single span card drivers?
|
||||
# Tor2: Tor PCI cards
|
||||
|
||||
63
xpp/perl_modules/Dahdi/Config/Gen/Assignedspans.pm
Normal file
63
xpp/perl_modules/Dahdi/Config/Gen/Assignedspans.pm
Normal file
@@ -0,0 +1,63 @@
|
||||
package Dahdi::Config::Gen::Assignedspans;
|
||||
use strict;
|
||||
|
||||
use Dahdi::Config::Gen qw(is_true);
|
||||
|
||||
sub new($$$) {
|
||||
my $pack = shift || die;
|
||||
my $gconfig = shift || die;
|
||||
my $genopts = shift || die;
|
||||
my $file = $ENV{ASSIGNED_SPANS_CONF_FILE} || "/etc/dahdi/assigned-spans.conf";
|
||||
my $self = {
|
||||
FILE => $file,
|
||||
GCONFIG => $gconfig,
|
||||
GENOPTS => $genopts,
|
||||
};
|
||||
bless $self, $pack;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub generate($$$) {
|
||||
my $self = shift || die;
|
||||
my $file = $self->{FILE};
|
||||
my $gconfig = $self->{GCONFIG};
|
||||
my $genopts = $self->{GENOPTS};
|
||||
my @spans = @_;
|
||||
|
||||
# If the span_types utilities were not installed we do not want to run
|
||||
# this generator or report any errors.
|
||||
system "which dahdi_span_assignments > /dev/null 2>&1";
|
||||
return if $?;
|
||||
|
||||
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_assignments dumpconfig > $file";
|
||||
system $cmd;
|
||||
die "Command failed (status=$?): '$cmd'" if $?;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dahdi - Generate configuration for dahdi drivers.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Dahdi::Config::Gen::Dahdi;
|
||||
|
||||
my $cfg = new Dahdi::Config::Gen::Dahdi(\%global_config, \%genopts);
|
||||
$cfg->generate(@span_list);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Generate the F</etc/dahdi/assigned-spans.conf>.
|
||||
This is the configuration for dahdi_span_assignments.
|
||||
|
||||
Its location may be overriden via the environment variable F<ASSIGNED_SPANS_CONF_FILE>.
|
||||
63
xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
Normal file
63
xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
Normal file
@@ -0,0 +1,63 @@
|
||||
package Dahdi::Config::Gen::Spantypes;
|
||||
use strict;
|
||||
|
||||
use Dahdi::Config::Gen qw(is_true);
|
||||
|
||||
sub new($$$) {
|
||||
my $pack = shift || die;
|
||||
my $gconfig = shift || die;
|
||||
my $genopts = shift || die;
|
||||
my $file = $ENV{SPAN_TYPES_CONF_FILE} || "/etc/dahdi/span-types.conf";
|
||||
my $self = {
|
||||
FILE => $file,
|
||||
GCONFIG => $gconfig,
|
||||
GENOPTS => $genopts,
|
||||
};
|
||||
bless $self, $pack;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub generate($$$) {
|
||||
my $self = shift || die;
|
||||
my $file = $self->{FILE};
|
||||
my $gconfig = $self->{GCONFIG};
|
||||
my $genopts = $self->{GENOPTS};
|
||||
my @spans = @_;
|
||||
|
||||
# If the dahdi_span_types utilities were not installed we do not want to run
|
||||
# this generator or report any errors.
|
||||
system "which dahdi_span_types > /dev/null 2>&1";
|
||||
return if $?;
|
||||
|
||||
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";
|
||||
system $cmd;
|
||||
die "Command failed (status=$?): '$cmd'" if $?;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dahdi - Generate configuration for dahdi drivers.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Dahdi::Config::Gen::Dahdi;
|
||||
|
||||
my $cfg = new Dahdi::Config::Gen::Dahdi(\%global_config, \%genopts);
|
||||
$cfg->generate(@span_list);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
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>.
|
||||
@@ -97,6 +97,15 @@ my %pci_ids = (
|
||||
'd161:800a' => { DRIVER => 'wcte13xp', DESCRIPTION => 'Wildcard TE133' },
|
||||
'd161:800b' => { DRIVER => 'wcte13xp', DESCRIPTION => 'Wildcard TE134' },
|
||||
|
||||
# from wcaxx
|
||||
'd161:800c' => { DRIVER => 'wcaxx', DESCRIPTION => 'Digium A8A' },
|
||||
'd161:800d' => { DRIVER => 'wcaxx', DESCRIPTION => 'Digium A8B' },
|
||||
'd161:800f' => { DRIVER => 'wcaxx', DESCRIPTION => 'Digium A4A' },
|
||||
'd161:8010' => { DRIVER => 'wcaxx', DESCRIPTION => 'Digium A4B' },
|
||||
|
||||
# from wcte435/235
|
||||
'd161:800e' => { DRIVER => 'wcte43x', DESCRIPTION => 'Wildcard TE435/235' },
|
||||
|
||||
# from wcb4xxp
|
||||
'd161:b410' => { DRIVER => 'wcb4xxp', DESCRIPTION => 'Digium Wildcard B410P' },
|
||||
|
||||
|
||||
@@ -147,6 +147,8 @@ my @pri_strings = (
|
||||
'Wildcard TE133', # wcte13xp
|
||||
'Wildcard TE134', # wcte13xp
|
||||
'T[248]XXP \(PCI\) Card ', # wct4xxp
|
||||
'WCTE43X \(PCI\) Card ', # wcte43xp
|
||||
'WCTE23X \(PCI\) Card ', # wcte43xp
|
||||
'R[24]T1 \(PCI\) Card', # rxt1
|
||||
'Rhino R1T1 (E1)/PRA Card', # r1t1
|
||||
'Rhino R1T1 (T1)/PRI Card', # r1t1
|
||||
|
||||
11
xpp/xpp.rules
Normal file
11
xpp/xpp.rules
Normal file
@@ -0,0 +1,11 @@
|
||||
# Load firmware into the Xorcom Astribank device:
|
||||
SUBSYSTEM=="usb", ACTION=="add", \
|
||||
ENV{PRODUCT}=="e4e4/11[3456][013]/*", ENV{DEVTYPE}!="usb_interface", \
|
||||
RUN+="/usr/share/dahdi/xpp_fxloader udev $env{PRODUCT}"
|
||||
|
||||
# Hotplug hook for Astribank up/down
|
||||
# If you need this functionality, copy the astribank_hook.sample
|
||||
# to $XPP_INIT_DIR/astribank_hook
|
||||
#
|
||||
# By default XPP_INIT_DIR="/usr/share/dahdi"
|
||||
KERNEL=="xbus*", RUN+="%E{XPP_INIT_DIR}/astribank_hook udev $kernel $sysfs{status} $sysfs{connector}"
|
||||
@@ -217,12 +217,14 @@ usb_firmware_device() {
|
||||
id_str="$1"
|
||||
devpath="$2"
|
||||
|
||||
bcd_device=`echo "$id_str" | cut -d/ -f3`
|
||||
|
||||
case "$id_str" in
|
||||
e4e4/11[3456]0/101|e4e4/1163/101)
|
||||
fw="USB_FW.hex"
|
||||
;;
|
||||
e4e4/116[03]/201)
|
||||
fw="USB_FW.201.hex"
|
||||
e4e4/116[03]/20?)
|
||||
fw="USB_FW.${bcd_device}.hex"
|
||||
;;
|
||||
e4e4/*)
|
||||
debug "No USB firmware for device $devpath ($id_str)"
|
||||
@@ -332,7 +334,7 @@ fpga_firmware_device() {
|
||||
e4e4/11[456]1/101)
|
||||
fw="FPGA_${id_product}.hex"
|
||||
;;
|
||||
e4e4/1161/201)
|
||||
e4e4/1161/20?)
|
||||
fw="FPGA_${id_product}.${bcd_device}.hex"
|
||||
;;
|
||||
e4e4/*)
|
||||
|
||||
Reference in New Issue
Block a user