Compare commits

..

28 Commits

Author SHA1 Message Date
Shaun Ruffell
c4a840c6dc Use autotagged externals
git-svn-id: http://svn.astersk.org/svn/dahdi/tools/tags/2.5.1@10674 17933a7a-c749-41c5-a318-cba88f637d49
2012-04-18 17:17:50 +00:00
Shaun Ruffell
df996bf1c8 Importing files for 2.5.1 release.
git-svn-id: http://svn.astersk.org/svn/dahdi/tools/tags/2.5.1@10673 17933a7a-c749-41c5-a318-cba88f637d49
2012-04-18 17:17:37 +00:00
Shaun Ruffell
b71ef5c784 Creating tag for the release of dahdi-tools-2.5.1
git-svn-id: http://svn.astersk.org/svn/dahdi/tools/tags/2.5.1@10672 17933a7a-c749-41c5-a318-cba88f637d49
2012-04-18 17:17:08 +00:00
Oron Peled
c4fe52e769 xpp: astribank_hook: wait for udev to settle
When running the astribank_hook (only on Astribanks, in XPP_HOTPLUG_DAHDI
mode), wait for all other Astribanks to create all the required device
files.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10585

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10595 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-22 18:58:39 +00:00
Tzafrir Cohen
c57672cd88 xpp: astribank_allow: useless debug on write
Remove a useless debug message in the "write" operation.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10549

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10554 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-20 11:43:35 +00:00
Tzafrir Cohen
c256218779 xpp: fix build warnings
Unlike original: also fixed fpga_load.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10543

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10546 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-20 06:02:41 +00:00
Tzafrir Cohen
261869a437 xpp: oct612x: fix build warnings
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10542

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10545 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-20 05:54:32 +00:00
Oron Peled
57749f1c26 xpp: Update product ID's in Dahdi::Hardware::USB
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10505

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10514 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-15 21:22:05 +00:00
Oron Peled
6da1f767e5 xpp: fix manpage of astribank_hexload
* Fixed 'astribanks_tool' string

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10503

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10513 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-15 21:21:27 +00:00
Oron Peled
3a147a35c2 xpp: Customizable license markers
* License strings markers (BEGIN.../END...) can be customized
* By default, generate a "generic" license markers
* We accept any (paired) markers from the valid list

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10502

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10512 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-15 21:21:06 +00:00
Oron Peled
a8c8435ea8 xpp: bugfix: handle echo_loader errors
* I/O errors of the device were not propagated up by echo_loader
* As a result, Octasic load failure did not prevented USB renumeration
* Make consistent return values:
  - In our functions: ret < 0 is error
  - In Octasic functions (UINT32): return Octasic error codes
* All error paths prints error messages (so we see how the error propagates)
* Also changed error order testing in init_octasic():
  Return status should be tested before the values of by-reference parameters

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10499

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10510 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-15 21:19:34 +00:00
Oron Peled
0124097dfc xpp: echo_loader.c: add AB id to messages
* Define new macros AB_INFO(), AB_ERR() that prefix their message
  with the astribank information (usb device + serial number)
* Replace all INFO()/ERR() messages in echo_loader.c with the new macros

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10498

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10509 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-15 21:18:10 +00:00
Oron Peled
a09b124790 xpp: xpp_fxloader: improve output
* Replaced (almost) all $LOGGER to echo:
  - In interactive use -- that what we want anyway
  - When called from UDEV, the subprocess stdout/stderr is piped to
    $LOGGER anyway (at the end of the script)
  - No need for many $LOGGER instances (each with its own pid)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10495

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10508 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-15 21:17:46 +00:00
Oron Peled
c5b905b1bf xpp: clean 'Extrainfo' EEPROM field
* Extrainfo field contains junk data
* Caused by:
  - The field is initialized to 0xFF values
  - There was no null termination (and no room to add it)
* New code:
  - Ensure that show_extrainfo() have null termination even if EEPROM
    field is full.
  - Replace trailing 0xFF characters with '\0' when reading this field
  - Since our default burned EEPROM contain Extrainfo field full of
    0xFF characters, this would make them look as null filled.

Internal Issue-Id: #1341
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10491

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10507 17933a7a-c749-41c5-a318-cba88f637d49
2012-03-15 21:17:10 +00:00
Oron Peled
e0485bafc0 xpp: improved waitfor_xpds
* Fix an issue due to long firmware load time:
  - When one Astribank has an echo canceler (long firmware loading) and
    and another one does not.
  - The EC-less Astribank finishes initialization before the Astribank
    with EC is detected.
  - Thus waitfor_xpds terminates too early.

* We now iteratively build two sets of serial numbers:
  - One from wha we see in all Xorcom (e4e4:11[3456]x) USB devices.
  - The other is those that were detected in the driver.
  - Only when the two sets are equal (and > 0) we know we are done.
  - This is resilient to many problems (e.g: disconnect/reconnect of
    same device during initialization).

* The progress output was also improved: Now each detected AB
  show the total number so far.

* The timeout was also increased to 100sec

* Woraround for an Astribank with no serial (but just a single one on
  the system).

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10465

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10467 17933a7a-c749-41c5-a318-cba88f637d49
2012-02-22 20:23:16 +00:00
Tzafrir Cohen
d6dafbdcea xpp: two extra product IDs: 1112, 1164
Two extra USB product IDs used in some odd maintenance scenarios.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10371 17933a7a-c749-41c5-a318-cba88f637d49
2011-12-04 17:26:14 +00:00
Tzafrir Cohen
d1d22bf4f6 xpp: xpp_fxloader: regressions from r10355
* Avoid a duplicated run of udev on some systems.
* Fix usage of astribank_tool's output.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10370 17933a7a-c749-41c5-a318-cba88f637d49
2011-12-04 17:25:49 +00:00
Tzafrir Cohen
cdbea31d0b Fix GCC 4.6 "set but not used" warnings
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10357 17933a7a-c749-41c5-a318-cba88f637d49
2011-11-30 10:27:19 +00:00
Tzafrir Cohen
b229de1beb xpp: recovery firmware in xpp_fxloader
USB_RECOV.hex is an extra firmware that may be useful for recovering
from certain Astribank hardware faults in some scenarios. This adds
support for either loading it manually
('/usr/share/dahdi/xpp_fxloader recover-sb') or through udev, *if*
the required udev rules were set on the system.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10356 17933a7a-c749-41c5-a318-cba88f637d49
2011-11-30 10:25:40 +00:00
Tzafrir Cohen
04d6bc2893 xpp: Serialized Parallel load; E-Main-3 firmware
This introduces support for loading multiple firmwares in parallel also
for the case of a manual load. This is anyway the case for an automatic
load from udev.

* libusb needs to scan the bus all too often. This causes occasional
  failures for opening devices.
* Thus introduce a semaphore to serialize uses of libusb.

E-Main-3 firmware differs by a different value of bcdDevice:

* Read this from the sysfs devices tree.
* Fall back to lsusb -v (much slower) is sysfs not available.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10355 17933a7a-c749-41c5-a318-cba88f637d49
2011-11-30 10:25:16 +00:00
Tzafrir Cohen
ff25216d3a xpp: astribank_hexload: we need more lines
* Newer firmwares may have more lines.
* While we're at it, add better debug printing.
* Remove some unused debugging code.

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10354 17933a7a-c749-41c5-a318-cba88f637d49
2011-11-30 10:23:44 +00:00
Shaun Ruffell
2f10cda05a dahdi_genconf: Use 'dahdi_scan' to determine span_type for B410P cards.
The wcb4xxp driver does not put enough information in the proc filesystem to
determine if the ports are in TE or NT mode.  Previously the ports would
always just setup the dahdi-channels.conf file in TE mode. After this change
the dahdi_scan utility is used to detect if the ports are in TE or NT mode and
setup dahdi-channels.conf appropriately.

Internal-Issue-ID: DAHTOOL-54
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10214

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10256 17933a7a-c749-41c5-a318-cba88f637d49
2011-10-21 22:12:49 +00:00
Shaun Ruffell
e9ea988620 dahdi_genconf: Assume spans with unknown term types are software selectable.
Resolves a regression on the 2.5 branch that would result in:

  $ dahdi_genconf
  dahdi_genconf: missing default group (termtype=UNKNOWN)

E1 / T1 spans use software configuration to set CPE / NET mode. This
patch will just assume that a termtype is software selectable if it was
"UNKNOWN" when first scanning the span.

Internal-Issue-ID: DAHTOOL-55
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Tested-by: David Purdue <support@noojee.com.au>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10213

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10255 17933a7a-c749-41c5-a318-cba88f637d49
2011-10-21 22:12:45 +00:00
Tzafrir Cohen
0245fef736 xpp: waitfor_xpds: higher and configurable timeout
On several pathological cases we may need to wait more than 40 seconds.
Make that timeout configurable.

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10188 17933a7a-c749-41c5-a318-cba88f637d49
2011-09-07 07:11:14 +00:00
Tzafrir Cohen
e8c7b0042e README.Astribank: HWEC and build instructions
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10187 17933a7a-c749-41c5-a318-cba88f637d49
2011-09-07 07:10:53 +00:00
Tzafrir Cohen
ff04c5db31 xpp: pri_termtype: match complete SPAN patterns
Match complete span patterns, to avoid pattern 'SPAN/1' from matching
e.g. span 12 (SPAN/12).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10186 17933a7a-c749-41c5-a318-cba88f637d49
2011-09-07 07:10:28 +00:00
Tzafrir Cohen
b3824291d5 Extra README fixes: 'th' and ztcfg
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10185 17933a7a-c749-41c5-a318-cba88f637d49
2011-09-07 07:09:47 +00:00
Tzafrir Cohen
58afc8f173 Create a branch for 2.5
git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10108 17933a7a-c749-41c5-a318-cba88f637d49
2011-08-10 17:22:00 +00:00
25 changed files with 2003 additions and 988 deletions

1
.version Normal file
View File

@@ -0,0 +1 @@
2.5.1

1855
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -176,9 +176,6 @@ $(LTZ_SO): $(LTZ_SO_OBJS)
dahdi_cfg: $(LTZ_A)
dahdi_cfg: LIBS+=-lm
dahdi_pcap:
$(CC) $(CFLAGS) dahdi_pcap.c -lpcap -o $@ $<
fxstest: $(LTZ_SO)
fxstest: LIBS+=-lm
@@ -348,7 +345,6 @@ clean:
rm -f core
rm -f dahdi_cfg-shared fxstest
rm -rf $(GENERATED_DOCS) *.asciidoc tonezones.txt
rm -f dahdi_pcap
distclean: dist-clean

View File

@@ -1,142 +0,0 @@
#! /usr/bin/perl
#
# Written by Oron Peled <oron@actcom.co.il>
# Copyright (C) 2012, Xorcom
# This program is free software; you can redistribute and/or
# modify it under the same terms as Perl itself.
#
#dahdi_sysfs_copy: Short perl script to copy dahdi related sysfs trees
# into a designated directory.
#
# $Id: $
#
use strict;
use warnings;
use File::Path qw(mkpath);
use File::Copy;
use Cwd qw(realpath);
my $destdir = shift || die "Usage: $0 <destdir>\n";
my %symlinks;
my %walk_ups;
my %inode_cash;
# Starting points for recursion
my @toplevels = qw(
/sys/bus/dahdi_devices
/sys/bus/astribanks
/sys/class/dahdi
);
# Loop prevention (by inode number lookup)
sub seen {
my $ino = shift || die;
my $path = shift || die;
if(defined $inode_cash{$ino}) {
#print STDERR "DEBUG($ino): $path\n";
return 1;
}
$inode_cash{$ino}++;
return 0;
}
# Walk up a path and copy readable attributes from any
# directory level.
sub walk_up {
my $path = shift || die;
my $curr = $path;
# Walk up
for (my $curr = $path; $curr; $curr =~ s'/?[^/]+$'') {
my ($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($curr);
next if seen($ino, $curr); # Skip visited directories
# Scan directory
opendir(my $d, $curr) || die "Failed opendir($curr): $!\n";
my @entries = readdir $d;
foreach my $entry (@entries) {
next if $entry =~ /^[.][.]?$/;
my $file = "$curr/$entry";
my ($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($file);
# Copy file
if (-f _ && ($mode & 0004)) { # The '-r _' is buggy
copy($file, "$destdir$file") ||
die "Failed to copy '$file': $!\n";
}
}
closedir $d;
}
}
# Handle a given path (directory,symlink,regular-file)
sub handle_path {
my $path = shift || die;
my ($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($path);
# Save attributes before recursion starts
my $isdir = -d _;
my $islink = -l _;
my $isreadable = $mode & 00004; # The '-r _' was buggy
return if seen($ino, $path); # Loop prevention
my $dest = "$destdir/$path";
if ($isdir) {
mkpath("$dest");
scan_directory($path);
} elsif ($islink) {
# We follow links (the seen() protect us from loops)
my $target = readlink($path) ||
die "Failed readlink($path): $!\n";
my $follow = $target;
if ($target !~ m{^/}) { # fix relative symlinks
my $dir = $path;
$dir =~ s,/[^/]*$,,;
$follow = realpath("$dir/$target");
}
# Save symlink details, so we create them after all
# destination tree (subdirectories, files) is ready
die "Duplicate entry '$dest'\n" if exists $symlinks{$dest};
$symlinks{$dest} = "$target";
# Now follow symlink
handle_path($follow);
$walk_ups{$follow}++;
} elsif ($isreadable) {
copy($path, "$dest") ||
die "Failed to copy '$path': $!\n";
}
}
# Scan a given directory (calling handle_path for recursion)
sub scan_directory {
my $dir = shift || die;
my $entry;
opendir(my $d, $dir) || die "Failed opendir($dir): $!\n";
my @dirs = readdir $d;
foreach my $entry (@dirs) {
next if $entry =~ /^[.][.]?$/;
handle_path("$dir/$entry");
}
closedir $d;
}
# Filter out non-existing toplevels
my @scan = grep { lstat($_) } @toplevels;
# Recurse all trees, creating subdirectories and copying files
foreach my $path (@scan) {
handle_path($path);
}
# Now, that all sub-directories were created, we can
# create the wanted symlinks
for my $dest (keys %symlinks) {
my $link = $symlinks{$dest};
die "Missing link for '$dest'\n" unless defined $link;
unlink $dest if -l $dest;
symlink($link,$dest) ||
die "Failed symlink($link,$dest): $!\n";
}
# Walk up directories that were symlink destinations
# and fill their attributes
foreach my $dir (keys %walk_ups) {
walk_up($dir);
}

View File

@@ -31,46 +31,117 @@
# # And then later:
# DAHDI_VIRT_TOP="$PWD/my_sys_state" dahdi_genconf
mydir=`dirname $0`
dahdi_sysfs_copy="$mydir/dahdi_sysfs_copy"
name=dahdi_sys_state_dump
usage() {
echo "$0: dump system data for Dahdi-Perl"
echo "Usage: $0 [<name>]]"
echo ""
echo "<name>: name of directory/tarball to create. Default: $name"
}
output_tar() {
gzip -9 >$name.tar.gz
}
output_cpio() {
gzip -9 >$name.cpio.gz
}
output_dir() {
rm -rf $name
mkdir -p $name
cd $name
#tar xf -
cpio -id
}
# Give usage message on expected texts
case $1 in
help | -* ) usage; exit 1;;
esac
if [ "$#" -ne 0 ]; then
echo >&2 "Usage: $0"
exit 1
if [ "$1" != '' ]; then
name="$1"
fi
id="sys_dump.`hostname`_`date +%F_%H.%M.%S`"
tarball="$id.tar.gz"
# funky permissions on procfs. Sadly rm -f does not kill them.
if [ -d "$name" ]; then
chmod -R u+w "$name"
fi
rm -rf "$name"
mkdir -p "$name"
tmpdir=`mktemp -td 'dahdi_dump.XXXXXX'`
echo -n >&2 "Creating ... "
trap "[ -d '$tmpdir' ] && rm -rf '$tmpdir'" 0 1 2 15
topdir="$tmpdir/$id"
# delete a (potentially empty) list of files
rm_files() {
xargs rm -f rm_files_non_existing_file
}
if [ -r /proc/bus/usb/devices ]; then
mkdir -p "$topdir/proc/bus/usb"
cp -a /proc/bus/usb/devices "$topdir/proc/bus/usb/"
mkdir -p "$name/proc/bus/usb"
cp -a /proc/bus/usb/devices "$name/proc/bus/usb/"
fi
if [ -d /proc/dahdi ]; then
mkdir -p "$topdir/proc/dahdi"
mkdir -p "$name/proc/dahdi"
if find /proc/dahdi -type f >/dev/null; then
cp -a /proc/dahdi/* "$topdir/proc/dahdi/"
cp -a /proc/dahdi/* "$name/proc/dahdi/"
fi
fi
if [ -d /proc/xpp ]; then
mkdir -p "$topdir/proc/xpp"
mkdir -p "$name/proc/xpp"
if find /proc/xpp -type f >/dev/null; then
cp -a /proc/xpp/* "$topdir/proc/xpp/"
find "$topdir/proc/xpp" -type f -name command -exec rm -f '{}' ';'
cp -a /proc/xpp/* "$name/proc/xpp/"
find "$name/proc/xpp" -type f -name command | rm_files
fi
fi
"$dahdi_sysfs_copy" "$topdir"
echo -n >&2 "tarball ... "
( cd "$tmpdir" && tar czf - . ) > "$tarball";
echo >&2 "ready in '$tarball'"
# FIXME: the following grab tons of files from sysfs. Any way to do with
# less information?
pci_dev_pat='/sys/devices/pci*'
mkdir -p "$name/sys/devices"
cp -a $pci_dev_pat "$name/sys/devices/" 2>/dev/null
for bus in astribanks xpds pci pci_express usb; do
if [ -d /sys/bus/$bus ]; then
mkdir -p "$name/sys/bus/"
cp -a /sys/bus/$bus "$name/sys/bus/" 2>/dev/null
fi
done
# Remove PCI devices of irelevan classes:
irrelevant_devs() {
grep . "$name"/$pci_dev_pat/0*/class "$name"/$pci_dev_pat/0*/0*/class \
| perl -n -e '# Perl provides commented regexes:
next unless m{/class:( # The following is a list of device classes
# that can be safely removed:
0x060000 | # Host bridge
0x030000 | # VGA compatible controller
0x038000 | # Display controller
0x040300 | # Audio device
0x060401 | # PCI bridge
0x060100 | # ISA bridge
0x01018a | # IDE interface
0x01018f | # IDE interface
0x0c0500 | # SMBus
0x060700 | # CardBus bridge
0x0c0010 | # FireWire (IEEE 1394)
# The following are not to be removed:
#0x0c0300 | # USB Controller (UHCI?)
#0x060400 | # PCI bridge
#0x0c0320 | # USB Controller (EHCI?)
#0x020000 | # Ethernet controller
#0x0c0010 | # Network controller: (Wifi?)
)$}x;
# Leave out just the name of the node:
s{/[^/]*$}{};
print;
print "\n"
'
}
# FIXME: deleting those seems to remove common 'vendor' directories
# and mess things up. Skip it for now.
#rm -rf `irrelevant_devs`

View File

@@ -85,13 +85,6 @@ static struct dahdi_lineconfig lc[DAHDI_MAX_SPANS];
static struct dahdi_chanconfig cc[DAHDI_MAX_CHANNELS];
static int current_span = 0;
static int only_span = 0;
static int restrict_channels = 0;
static int selected_channels[DAHDI_MAX_CHANNELS];
static int chan2span[DAHDI_MAX_CHANNELS];
static int declared_spans[DAHDI_MAX_SPANS];
static struct dahdi_attach_echocan ae[DAHDI_MAX_CHANNELS];
static struct dahdi_dynamic_span zds[NUM_DYNAMIC];
@@ -235,35 +228,6 @@ static char *trim(char *buf)
return buf;
}
static int skip_channel(int x)
{
int spanno = chan2span[x];
if (restrict_channels) {
if (!selected_channels[x])
return 1;
/* sanity check */
if (only_span) {
if (spanno != 0 && only_span != spanno) {
fprintf(stderr,
"Only span %d. Skip selected channel %d from span %d\n",
only_span, x, spanno);
return 1;
}
}
} else {
if (only_span && !declared_spans[only_span]) {
fprintf(stderr,
"Error: analog span %d given to '-S', without '-C' restriction.\n",
only_span);
exit(1);
}
if (only_span && only_span != spanno)
return 1;
}
return 0;
}
static int parseargs(char *input, char *output[], int maxargs, char sep)
{
char *c;
@@ -346,8 +310,6 @@ int spanconfig(char *keyword, char *args)
error("Span number should be a valid span number, not '%s'\n", realargs[0]);
return -1;
}
current_span = span;
declared_spans[span] = 1;
res = sscanf(realargs[1], "%d", &timing);
if ((res != 1) || (timing < 0) || (timing > MAX_TIMING)) {
error("Timing should be a number from 0 to %d, not '%s'\n",
@@ -519,7 +481,6 @@ static int chanconfig(char *keyword, char *args)
int master=0;
int dacschan = 0;
char *idle;
int is_digital;
bzero(chans, sizeof(chans));
strtok(args, ":");
idle = strtok(NULL, ":");
@@ -531,7 +492,6 @@ static int chanconfig(char *keyword, char *args)
if (res <= 0)
return -1;
for (x=1;x<DAHDI_MAX_CHANNELS;x++) {
is_digital = 0;
if (chans[x]) {
if (slineno[x]) {
error("Channel %d already configured as '%s' at line %d\n", x, sig[x], slineno[x]);
@@ -577,7 +537,6 @@ static int chanconfig(char *keyword, char *args)
return -1;
cc[x].sigtype = DAHDI_SIG_CAS;
sig[x] = sigtype_to_str(cc[x].sigtype);
is_digital = 1;
} else if (!strcasecmp(keyword, "dacs")) {
/* Setup channel for monitor */
cc[x].idlebits = dacschan;
@@ -588,7 +547,6 @@ static int chanconfig(char *keyword, char *args)
cc[dacschan].sigtype = DAHDI_SIG_DACS;
sig[x] = sigtype_to_str(cc[dacschan].sigtype);
dacschan++;
is_digital = 1;
} else if (!strcasecmp(keyword, "dacsrbs")) {
/* Setup channel for monitor */
cc[x].idlebits = dacschan;
@@ -598,7 +556,6 @@ static int chanconfig(char *keyword, char *args)
cc[dacschan].idlebits = x;
cc[dacschan].sigtype = DAHDI_SIG_DACS_RBS;
sig[x] = sigtype_to_str(cc[dacschan].sigtype);
is_digital = 1;
dacschan++;
} else if (!strcasecmp(keyword, "unused")) {
cc[x].sigtype = 0;
@@ -606,7 +563,6 @@ static int chanconfig(char *keyword, char *args)
} else if (!strcasecmp(keyword, "indclear") || !strcasecmp(keyword, "bchan")) {
cc[x].sigtype = DAHDI_SIG_CLEAR;
sig[x] = sigtype_to_str(cc[x].sigtype);
is_digital = 1;
} else if (!strcasecmp(keyword, "clear")) {
sig[x] = sigtype_to_str(DAHDI_SIG_CLEAR);
if (master) {
@@ -616,7 +572,6 @@ static int chanconfig(char *keyword, char *args)
cc[x].sigtype = DAHDI_SIG_CLEAR;
master = x;
}
is_digital = 1;
} else if (!strcasecmp(keyword, "rawhdlc")) {
sig[x] = sigtype_to_str(DAHDI_SIG_HDLCRAW);
if (master) {
@@ -626,7 +581,6 @@ static int chanconfig(char *keyword, char *args)
cc[x].sigtype = DAHDI_SIG_HDLCRAW;
master = x;
}
is_digital = 1;
} else if (!strcasecmp(keyword, "nethdlc")) {
sig[x] = sigtype_to_str(DAHDI_SIG_HDLCNET);
memset(cc[x].netdev_name, 0, sizeof(cc[x].netdev_name));
@@ -640,7 +594,6 @@ static int chanconfig(char *keyword, char *args)
}
master = x;
}
is_digital = 1;
} else if (!strcasecmp(keyword, "fcshdlc")) {
sig[x] = sigtype_to_str(DAHDI_SIG_HDLCFCS);
if (master) {
@@ -650,26 +603,18 @@ static int chanconfig(char *keyword, char *args)
cc[x].sigtype = DAHDI_SIG_HDLCFCS;
master = x;
}
is_digital = 1;
} else if (!strcasecmp(keyword, "dchan")) {
sig[x] = "D-channel";
cc[x].sigtype = DAHDI_SIG_HDLCFCS;
is_digital = 1;
} else if (!strcasecmp(keyword, "hardhdlc")) {
sig[x] = "Hardware assisted D-channel";
cc[x].sigtype = DAHDI_SIG_HARDHDLC;
is_digital = 1;
} else if (!strcasecmp(keyword, "mtp2")) {
sig[x] = "MTP2";
cc[x].sigtype = DAHDI_SIG_MTP2;
is_digital = 1;
} else {
fprintf(stderr, "Huh? (%s)\n", keyword);
}
if (is_digital)
chan2span[x] = current_span;
else
current_span = 0;
}
}
return 0;
@@ -721,8 +666,6 @@ static void apply_fiftysix(void)
int chanfd;
for (x = 1; x < DAHDI_MAX_CHANNELS; x++) {
if (skip_channel(x))
continue;
chanfd = open("/dev/dahdi/channel", O_RDWR);
if (chanfd == -1) {
fprintf(stderr,
@@ -1271,8 +1214,6 @@ static void printconfig(int fd)
"Configuration\n"
"======================\n\n", vi.version, vi.echo_canceller);
for (x = 0; x < spans; x++) {
if (only_span && only_span != x)
continue;
printf("SPAN %d: %3s/%4s Build-out: %s\n",
lc[x].span,
(lc[x].lineconfig & DAHDI_CONFIG_D4 ? "D4" :
@@ -1290,8 +1231,6 @@ static void printconfig(int fd)
if (verbose > 1) {
printf("\nChannel map:\n\n");
for (x=1;x<DAHDI_MAX_CHANNELS;x++) {
if (skip_channel(x))
continue;
if ((cc[x].sigtype != DAHDI_SIG_SLAVE) && (cc[x].sigtype)) {
configs++;
ps = 0;
@@ -1315,8 +1254,6 @@ static void printconfig(int fd)
}
} else {
for (x=1;x<DAHDI_MAX_CHANNELS;x++) {
if (skip_channel(x))
continue;
if (cc[x].sigtype)
configs++;
}
@@ -1411,39 +1348,11 @@ static void usage(char *argv0, int exitcode)
" -h -- Generate this help statement\n"
" -s -- Shutdown spans only\n"
" -t -- Test mode only, do not apply\n"
" -C <chan_list> -- Only configure specified channels\n"
" -S <spanno> -- Only configure specified span\n"
" -v -- Verbose (more -v's means more verbose)\n"
,c);
exit(exitcode);
}
static int chan_restrict(char *str)
{
if (apply_channels(selected_channels, str) < 0)
return 0;
restrict_channels = 1;
return 1;
}
static int span_restrict(char *str)
{
long spanno;
char *endptr;
spanno = strtol(str, &endptr, 10);
if (endptr == str) {
fprintf(stderr, "Missing valid span number after '-S'\n");
return 0;
}
if (*endptr != '\0') {
fprintf(stderr, "Extra garbage after span number in '-S'\n");
return 0;
}
only_span = spanno;
return 1;
}
int main(int argc, char *argv[])
{
int c;
@@ -1451,7 +1360,7 @@ int main(int argc, char *argv[])
char *key, *value;
int x,found;
while((c = getopt(argc, argv, "fthc:vsd::C:S:")) != -1) {
while((c = getopt(argc, argv, "fthc:vsd::")) != -1) {
switch(c) {
case 'c':
filename=optarg;
@@ -1474,14 +1383,6 @@ int main(int argc, char *argv[])
case 's':
stopmode = 1;
break;
case 'C':
if (!chan_restrict(optarg))
usage(argv[0], 1);
break;
case 'S':
if (!span_restrict(optarg))
usage(argv[0], 1);
break;
case 'd':
if (optarg)
debug = atoi(optarg);
@@ -1564,8 +1465,6 @@ finish:
}
if (stopmode) {
for (x=0;x<spans;x++) {
if (only_span && x != only_span)
continue;
if (ioctl(fd, DAHDI_SHUTDOWN, &lc[x].span)) {
fprintf(stderr, "DAHDI shutdown failed: %s\n", strerror(errno));
close(fd);
@@ -1575,8 +1474,6 @@ finish:
exit(1);
}
for (x=0;x<spans;x++) {
if (only_span && x != only_span)
continue;
if (ioctl(fd, DAHDI_SPANCONFIG, lc + x)) {
fprintf(stderr, "DAHDI_SPANCONFIG failed on span %d: %s (%d)\n", lc[x].span, strerror(errno), errno);
close(fd);
@@ -1594,14 +1491,7 @@ finish:
struct dahdi_params current_state;
int master;
int needupdate = force;
if (skip_channel(x)) {
if (debug & DEBUG_APPLY) {
printf("Skip device %d\n", x);
fflush(stdout);
}
continue;
}
if (debug & DEBUG_APPLY) {
printf("Configuring device %d\n", x);
fflush(stdout);
@@ -1754,8 +1644,6 @@ finish:
}
}
for (x=0;x<spans;x++) {
if (only_span && x != only_span)
continue;
if (ioctl(fd, DAHDI_STARTUP, &lc[x].span)) {
fprintf(stderr, "DAHDI startup failed: %s\n", strerror(errno));
close(fd);

View File

@@ -53,14 +53,12 @@ void display_help(char *argv0, int exitcode)
fprintf(stderr, " -h, --help display help\n");
fprintf(stderr, " -s, --span <span num> specify the span\n");
fprintf(stderr, " -l, --loopback <localhost|networkline|"\
"networkpayload|loopup|"\
"loopdown|off>\n"\
"networkpayload|off>\n"\
"\t\tlocalhost - loop back towards host\n"\
"\t\tnetworkline - network line loopback\n"\
"\t\tnetworkpayload - network payload loopback\n"\
"\t\tloopup - transmit loopup signal\n"\
"\t\tloopdown - transmit loopdown signal\n"\
"\t\toff - end loopback mode\n");
"\t\tloopdown - transmit loopdown signal\n");
fprintf(stderr, " -i, --insert <fas|multi|crc|cas|prbs|bipolar>"\
"\n\t\tinsert an error of a specific type\n");
fprintf(stderr, " -r, --reset "\
@@ -108,10 +106,10 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hj:l:p:s:i:g:r",
long_options, &option_index)) != -1) {
switch (c) {
case 'h':
case 'h': /* local host loopback */
display_help(argv[0], 0);
break;
case 'l': /* loopback */
case 'l': /* network line loopback */
larg = optarg;
doloopback = 1;
break;
@@ -140,7 +138,7 @@ int main(int argc, char *argv[])
if (!(doloopback || iflag || gflag || rflag)) {
s.spanno = span;
res = ioctl(ctl, DAHDI_SPANSTAT, &s);
if (res || ((__u32)-1 == s.fecount))
if (res)
printf("Error counters not supported by the driver"\
" for this span\n");
printf("Span %d:\n", span);

View File

@@ -1,332 +0,0 @@
/*
* Capturing a pcap from the DAHDI interface
*
* Copyright (C) 2011 Torrey Searle
*
* ISDN support added by Horacio Peña
* Command line cleanups by Sverker Abrahamsson
*
* Requirements:
* - pcap development library
* - DAHDI_MIRROR ioctl which isn't enabled by default in dahdi-linux
* To enable this unsupported feature, #define CONFIG_DAHDI_MIRROR
* in dahdi-linux
* - To build this program call the 'make dahdi_pcap' target
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*/
#include <stdio.h>
#include <fcntl.h>
#include <dahdi/user.h>
#include <sys/time.h>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <pcap.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <getopt.h>
#define BLOCK_SIZE 512
#define MAX_CHAN 16
//char ETH_P_LAPD[2] = {0x00, 0x30};
struct mtp2_phdr {
u_int8_t sent;
u_int8_t annex_a_used;
u_int16_t link_number;
};
struct lapd_sll_hdr {
u_int16_t sll_pkttype; /* packet type */
u_int16_t sll_hatype;
u_int16_t sll_halen;
u_int8_t sll_addr[8];
u_int8_t sll_protocol[2]; /* protocol, should be ETH_P_LAPD */
};
struct chan_fds {
int rfd;
int tfd;
int chan_id;
int proto;
char tx_buf[BLOCK_SIZE * 4];
int tx_len;
char rx_buf[BLOCK_SIZE * 4];
int rx_len;
};
int make_mirror(long type, int chan)
{
int res = 0;
int fd = 0;
struct dahdi_bufferinfo bi;
fd = open("/dev/dahdi/pseudo", O_RDONLY);
memset(&bi, 0, sizeof(bi));
bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = 32;
bi.bufsize = BLOCK_SIZE;
ioctl(fd, DAHDI_SET_BUFINFO, &bi);
res = ioctl(fd, type, &chan);
if(res)
{
printf("error setting channel err=%d!\n", res);
return -1;
}
return fd;
}
int log_packet(struct chan_fds * fd, char is_read, pcap_dumper_t * dump)
{
unsigned char buf[BLOCK_SIZE * 4];
int res = 0;
struct pcap_pkthdr hdr;
struct mtp2_phdr * mtp2 = (struct mtp2_phdr *)buf;
struct lapd_sll_hdr * lapd = (struct lapd_sll_hdr *)buf;
unsigned char *dataptr = buf;
int datasize = sizeof(buf);
if(fd->proto == DLT_LINUX_LAPD)
{
dataptr += sizeof(struct lapd_sll_hdr);
datasize -= sizeof(struct lapd_sll_hdr);
}
else
{
dataptr += sizeof(struct mtp2_phdr);
datasize -= sizeof(struct mtp2_phdr);
}
memset(buf, 0, sizeof(buf));
if(is_read)
{
res = read(fd->rfd, dataptr, datasize);
if(fd->rx_len > 0 && res == fd->rx_len && !memcmp(fd->rx_buf, dataptr, res) )
{
//skipping dup
return 0;
}
memcpy(fd->rx_buf, dataptr, res);
fd->rx_len = res;
}
else
{
res = read(fd->tfd, dataptr, datasize);
if(fd->tx_len > 0 && res == fd->tx_len && !memcmp(fd->tx_buf, dataptr, res) )
{
//skipping dup
return 0;
}
memcpy(fd->tx_buf, dataptr, res);
fd->tx_len = res;
}
gettimeofday(&hdr.ts, NULL);
if(res > 0)
{
if(fd->proto == DLT_LINUX_LAPD)
{
hdr.caplen = res+sizeof(struct lapd_sll_hdr)-2;
hdr.len = res+sizeof(struct lapd_sll_hdr)-2;
lapd->sll_pkttype = 3;
lapd->sll_hatype = 0;
lapd->sll_halen = res;
// lapd->sll_addr = ???
lapd->sll_protocol[0] = 0x00;
lapd->sll_protocol[1] = 0x30;
}
else
{
hdr.caplen = res+sizeof(struct mtp2_phdr);
hdr.len = res+sizeof(struct mtp2_phdr);
if(is_read)
{
mtp2->sent = 0;
mtp2->annex_a_used = 0;
}
else
{
mtp2->sent = 1;
mtp2->annex_a_used = 0;
}
mtp2->link_number = htons(fd->chan_id);
}
pcap_dump((u_char*)dump, &hdr, buf);
pcap_dump_flush(dump);
}
return 1;
}
void usage()
{
printf("Usage: dahdi_pcap [OPTIONS]\n");
printf("Capture packets from DAHDI channels to pcap file\n\n");
printf("Options:\n");
printf(" -p, --proto=[mtp2|lapd] The protocol to capture, default mtp2\n");
printf(" -c, --chan=<channels> Comma separated list of channels to capture from, max %d. Mandatory\n", MAX_CHAN);
printf(" -f, --file=<filename> The pcap file to capture to. Mandatory\n");
printf(" -h, --help Display this text\n");
}
int main(int argc, char **argv)
{
struct chan_fds chans[MAX_CHAN];
char *filename = NULL;
int num_chans = 0;
int max_fd = 0;
int proto = DLT_MTP2_WITH_PHDR;
int i;
int packetcount;
int c;
while (1) {
int option_index = 0;
static struct option long_options[] = {
{"proto", required_argument, 0, 'p'},
{"chan", required_argument, 0, 'c'},
{"file", required_argument, 0, 'f'},
{"help", 0, 0, 'h'},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "p:c:f:?",
long_options, &option_index);
if (c == -1)
break;
switch (c) {
case 'p':
// Protocol
if(strcasecmp("LAPD", optarg)==0)
{
proto = DLT_LINUX_LAPD;
}
else if(argc > 0 && strcasecmp("MTP2", argv[1])==0)
{
proto = DLT_MTP2_WITH_PHDR;
}
break;
case 'c':
// TODO Should it be possible to override protocol per channel?
// Channels, comma separated list
while(optarg != NULL && num_chans < MAX_CHAN)
{
int chan = atoi(strsep(&optarg, ","));
chans[num_chans].tfd = make_mirror(DAHDI_TXMIRROR, chan);
chans[num_chans].rfd = make_mirror(DAHDI_RXMIRROR, chan);
chans[num_chans].chan_id = chan;
chans[num_chans].proto = proto;
if(chans[num_chans].tfd > max_fd)
{
max_fd = chans[num_chans].tfd;
}
if(chans[num_chans].rfd > max_fd)
{
max_fd = chans[num_chans].rfd;
}
num_chans++;
}
max_fd++;
break;
case 'f':
// File to capture to
filename=optarg;
break;
case 'h':
default:
// Usage
usage();
exit(0);
}
}
if((num_chans == 0) || (filename == NULL)) {
usage();
exit(0);
}
else
{
printf("Capturing protocol %s on channels ", (proto == DLT_MTP2_WITH_PHDR ? "mtp2":"lapd"));
for(i = 0; i < num_chans; i++)
{
printf("%d", chans[i].chan_id);
if(i<num_chans-1)
{
printf(", ");
}
}
printf(" to file %s\n", filename);
}
pcap_t * pcap = pcap_open_dead(chans[0].proto, BLOCK_SIZE*4);
pcap_dumper_t * dump = pcap_dump_open(pcap, filename);
packetcount=0;
while(1)
{
fd_set rd_set;
FD_ZERO(&rd_set);
for(i = 0; i < num_chans; i++)
{
FD_SET(chans[i].tfd, &rd_set);
FD_SET(chans[i].rfd, &rd_set);
}
select(max_fd, &rd_set, NULL, NULL, NULL);
for(i = 0; i < num_chans; i++)
{
if(FD_ISSET(chans[i].rfd, &rd_set))
{
packetcount += log_packet(&chans[i], 1, dump);
}
if(FD_ISSET(chans[i].tfd, &rd_set))
{
packetcount += log_packet(&chans[i], 0, dump);
}
}
printf("Packets captured: %d\r", packetcount);
fflush(stdout);
}
return 0;
}

View File

@@ -40,32 +40,17 @@
#define SIZE 8000
static int verbose;
static int pass = 0;
static float best = 0.0;
static float worst = 100.0;
static double total = 0.0;
static double total_time = 0.0;
static double total_count = 0.0;
static inline float _fmin(float a, float b)
{
return (a < b) ? a : b;
}
static double calculate_accuracy(double count, double ms)
{
return ((count - _fmin(count, fabs(count - ms))) / count) * 100.0;
}
static double delay_total = 0.0;
void hup_handler(int sig)
{
double accuracy = calculate_accuracy(total_count, total_time);
printf("\n--- Results after %d passes ---\n", pass);
printf("Best: %.3f%% -- Worst: %.3f%% -- Average: %f%%\n",
best, worst, pass ? total/pass : 100.00);
printf("Cummulative Accuracy (not per pass): %0.3f\n",
pass ? accuracy : 0.0);
printf("Best: %.3f -- Worst: %.3f -- Average: %f, Difference: %f\n",
best, worst, pass ? total/pass : 100.00, pass ? delay_total/pass : 100);
exit(0);
}
@@ -94,7 +79,9 @@ int main(int argc, char *argv[])
int count = 0;
int seconds = 0;
int curarg = 1;
int verbose = 0;
char buf[8192];
float score;
float ms;
struct timeval start, now;
fd = open("/dev/dahdi/pseudo", O_RDWR);
@@ -153,23 +140,23 @@ int main(int argc, char *argv[])
ms += (now.tv_sec - start.tv_sec) * 8000;
ms += (now.tv_usec - start.tv_usec) / 125.0;
if (count >= SIZE) {
const double percent = calculate_accuracy(count, ms);
double percent = 100.0 * (count - ms) / count;
if (verbose) {
printf("\n%d samples in %0.3f system clock sample intervals (%.3f%%)",
count, ms, percent);
count, ms, 100 - percent);
} else if (pass > 0 && (pass % 8) == 0) {
printf("\n");
}
if (percent > best)
best = percent;
if (percent < worst)
worst = percent;
score = 100.0 - fabs(percent);
if (score > best)
best = score;
if (score < worst)
worst = score;
if (!verbose)
printf("%.3f%% ", percent);
total += percent;
printf("%.3f%% ", score);
total += score;
delay_total += 100 - percent;
fflush(stdout);
total_count += count;
total_time += ms;
count = 0;
pass++;
}

View File

@@ -4,7 +4,7 @@
dahdi_cfg \- configures DAHDI kernel modules from /etc/dahdi/system.conf
.SH SYNOPSIS
.B dahdi_cfg [\-c \fICFG_FILE\fB] [\-S\fINUM\fB [-S\fICHANS\fB]] [\-s] [\-f] [\-t] [\-v [\-v ... ] ]
.B dahdi_cfg [\-c \fICFG_FILE\fB] [\-s] [\-f] [\-t] [\-v [\-v ... ] ]
.B dahdi_cfg \-h
@@ -26,25 +26,11 @@ Use an alternative configuration file instead of
.I /etc/dahdi/system.conf
.RE
.B \-C \fICHANNELS
.RS
Only apply changes to channels in the specified range. Only
applicable when \-S is in use.
.RE
.B \-s
.RS
Only shutdown spans.
.RE
.B \-S \fISPAN
.RS
Only apply changes to span no. \fISPAN\fR. For a digital span (with
a 'span=' line in the configuration file) this will do. For an analog
span you'll have to explicitly tell dahdi_cfg the range of channels,
using \-C .
.RE
.B \-f
.RS
Always configure every channel, even if it appears not to have changed.

View File

@@ -1,62 +0,0 @@
.TH "DAHDI_MAINT" "8" "9 Sep 2011" "" ""
.SH NAME
dahdi_maint \- Sets Dahdi spans into maintenance mode, e.g.: loopback
.SH SYNOPSIS
.B dahdi_maint \-s \fInum\fB [options]
.B dahdi_maint <\-h|\-\-help>
.SH DESCRIPTION
dahdi_maint uses the DAHDI_MAINT interface to set a Dahdi span (port
of a Dahdi adapter card) into loopback mode or similar maintenance mode.
.SH OPTIONS
.B \-s \-\-span \fInum\fR
.RS
The span number. Required.
.RE
.B \-l \-\-loopback <localhost|networkline|networkpayload|loopup|loopdown|off>
.RS
Loopback type. One of:
.IP localhost 4
loop back towards host
.IP networkline 4
network line loopback
.IP networkpayload 4
network payload loopback
.IP loopup 4
transmit loopup signal
.IP loopdown 4
transmit loopdown signal
.IP off 4
end loopback mode
.RE
.B \-i \-\-insert <fas|multi|crc|cas|prbs|bipolar>
.RS
Insert an error of a specific type
.RE
.SH EXAMPLES
Enable network line loopback on span 1:
dahdi_maint -s 1 --loopback networkline
Disable network line loopback on span 1:
dahdi_maint -s 1 --loopback off
.SH SEE ALSO
.PP
dahdi_tool(8), dahdi_cfg(8), asterisk(8).
.SH AUTHOR
.PP
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.

View File

@@ -1,139 +1,37 @@
.TH "DAHDI_MONITOR" "8" "9 Sep 2011" "" ""
.TH "DAHDI_MONITOR" "8" "16 June 2008" "" ""
.SH NAME
dahdi_monitor \- checks the Rx/Tx levels of a DAHDI channels
dahdi_monitor \- checks the rx/tx levels of DAHDI channels
.SH SYNOPSIS
.B dahdi_monitor \fInum\fB [\-v[v]]
.B dahdi_monitor \fInum\fB [\-o] [<\-f|\-F> \fIFILE\fB]
.B dahdi_monitor \fInum\fB [[<\-r|\-R> \fIFILE\fB]] [[<\-t|\-T> \fIFILE\fB]]
.B dahdi_monitor \fIchannel number\fB [\-v] [\-f \fIFILE\fB]
.SH DESCRIPTION
dahdi_monitor monitors a Dahdi channel. It can record the output to a
file, play it to the speaker, or visualize the audio levels on the
terminal.
Recorded audio files are by default raw signed linear PCM. If the file
name ends with ".wav", the recorded file will be a WAV file.
The visual display shows the current audio level at both the Rx
(audio Received by Asterisk) and
Tx (audio Transmitted by Asterisk)
To exit the program, press Ctrl-C.
dahdi_monitor monitors a DAHDI channel. It gives you a visual
representation of the sound strengths and makes it easy to see if
the received or transmitted signals are too high or out of
balance
.SH OPTIONS
The first (mandatory) parameter is the number of the channel
to monitor.
.B \-m
.RS
Multiple channels. Don't multiplex both Rx and Tx in a single channel.
Normally there's a different option that you need that implies it.
.RE
.B \-o
.RS
Plays the output to OSS (/dev/dsp). Requires -m not to be used.
.RE
.B \-v
.RS
Display Visual audio levels. With two v-s, Verbose mode is enabled, that
shows the actual levels as numbers. Note that this requires a terminal
wider than 80 columns to be properly displayed.
Implies -m.
Display visual audio levels.
.RE
.B \-f \fIFILE
.RS
Record the content of the channel (Tx + Rx) to a file.
Write output to FILE
.RE
.B \-F \fIFILE
.RS
Record the content of the channel (Tx + Rx) before the echo canceler
to a file.
.RE
.B \-r \fIFILE
.RS
Record the content of the Rx channel to a file.
Implies -m.
.RE
.B \-R \fIFILE
.RS
Record the content of the R channel before the echo canceler to a file.
Implies -m.
.RE
.B \-s \fIFILE
.RS
Record the content of the Tx and Rx of the channel to a file.
.RE
.B \-S \fIFILE
.RS
Records a stereo of both Tx and Rx of the channel before the echo
canceler to a file.
.RE
.B \-t \fIFILE
.RS
Record the content of the Tx channel to a file.
Implies -m.
.RE
.B \-T \fIFILE
.RS
Record the content of the Tx channel before the echo canceler to a file.
Implies -m.
.RE
.SH EXAMPLES
Visualize audio levels on DAHDI channel 2:
dahdi_monitor 2 -v
Record channel 3 to a file:
dahdi_monitor 3 -f output.raw
This will create a raw PCM file (signed-linear, 8kHz, mono, 16 bits per
sample). Both the Tx and Rx will be multiplexed in a single channel.
It can be converted to a WAV file using e.g.:
sox -s -c1 -2 -r8000 output.raw output.wav
Record Tx and Rx of channel 5 to separate files. This time directly to
WAV files:
dahdi_monitor 5 -r output_rx.wav -t output_tx.wav
Record channel 8 to a stereo file (Tx and Rx on its two channels):
dahdi_monitor 8 -s output.raw
Converting it to a WAV file:
sox -s -c2 -2 -r8000 output.raw output.wav
Some extra, yet undocumented, options.
.SH SEE ALSO
.PP
dahdi_tool(8), dahdi_cfg(8).
dahdi_tool(8), dahdi_cfg(8), asterisk(8).
.SH AUTHOR
.PP

View File

@@ -634,13 +634,7 @@ Asterisk Level Information
* the chan_dahdi.so file exists but it is not loaded. Try to load it manually:
asterisk -rx 'module load chan_dahdi.so'
* In some cases chan_dahdi failed to load properly and needs to be unloaded
before re-loading:
asterisk -rx 'module unload chan_dahdi.so'
asterisk -rx 'module load chan_dahdi.so'
asterisk -rx 'load module chan_dahdi.so'
- You see "pseudo" channel only. It means that you have not configured any
channels. If you have configured channels in chan_dahdi.conf, you may

View File

@@ -33,7 +33,7 @@ information used by Xorcom to generate/modify licensed capabilities.
Required. The device to read from/write to. This is
\fIbus_num\fR/\fIdevice_num\fR, where \fIbus_num\fR and \fIdevice_num\fR
are the first two numbers in the output of lsusb(8) or dahdi_hardware(8).
On older versions of this tool you needed a complete path to the device,
On older versions of this toolyou needed a complete path to the device,
which would be /dev/bus/usb/\fIbus_num\fR/\fIdevice_num\fR, or
/proc/bus/usb/\fIbus_num\fR/\fIdevice_num\fR.
.RE

View File

@@ -31,7 +31,7 @@ firmware. It is normally run by the script xpp_fxloader.
Required. The device to read from/write to. This is
\fIbus_num\fR/\fIdevice_num\fR, where \fIbus_num\fR and \fIdevice_num\fR
are the first two numbers in the output of lsusb(8) or dahdi_hardware(8).
On older versions of this tool you needed a complete path to the device,
On older versions of this toolyou needed a complete path to the device,
which would be /dev/bus/usb/\fIbus_num\fR/\fIdevice_num\fR, or
/proc/bus/usb/\fIbus_num\fR/\fIdevice_num\fR.
.RE

View File

@@ -20,7 +20,7 @@ to the \-D command line option).
Required. The device to read from/write to. This is
\fIbus_num\fR/\fIdevice_num\fR, where \fIbus_num\fR and \fIdevice_num\fR
are the first two numbers in the output of lsusb(8) or dahdi_hardware(8).
On older versions of this tool you needed a complete path to the device,
On older versions of this toolyou needed a complete path to the device,
which would be /dev/bus/usb/\fIbus_num\fR/\fIdevice_num\fR, or
/proc/bus/usb/\fIbus_num\fR/\fIdevice_num\fR.
.RE

View File

@@ -111,7 +111,7 @@ __END__
=head1 NAME
dahdi_genconf - Generate configuration for Dahdi channels.
dahdi_genconf - Generate configuration for dahdi channels.
=head1 SYNOPSIS
@@ -126,7 +126,7 @@ It uses two information sources:
=item Hardware
The actual Dahdi hardware is automatically detected on the host.
The actual dahdi hardware is automatically detected on the host.
=item /etc/dahdi/genconf_parameters
@@ -137,7 +137,7 @@ variable.
=back
The dahdi_genconf script can generate various kinds of configuration files
as specified by the generator arguments. Each generator is a perl class
as specificed by the generator arguments. Each generator is a perl classes
in Dahdi::Config::Gen namespace. The generator names on the command line
are the class names in lowercase.
@@ -177,14 +177,14 @@ Currently, chandahdi is affected.
=item *
F<genconf_parameters> parsing is done via C<Dahdi::Config::Params>.
An object representing the parsed data is instantiated by:
An object representing the parsed data is instanciated by:
C<Dahdi::Config::Params-E<gt>new()>.
The C<item()> method of this object contains all the hard coded
defaults of the configuration directives.
=item *
A configuration object is instantiated by C<Dahdi::Config::Gen-E<gt>new($params)>.
A configuration object is instanciated by C<Dahdi::Config::Gen-E<gt>new($params)>.
The mapping of configuration directives into semantic configuration is
done in the constructor.

View File

@@ -72,7 +72,7 @@ sub show_disconnected(%) {
# FIXME: For verbose display we also need to see the XPP devices.
# If no spans are registered, this won't happen. A brute-force
# method for making it happen:
# methood for making it happe:
Dahdi::Xpp::xbuses if ($opts{'v'});
my @devices = Dahdi::Hardware->device_list;
@@ -139,7 +139,7 @@ dahdi_hardware [-v][-x]
=item -v
Verbose output - show spans used by each device etc. Currently only
Verbose ouput - show spans used by each device etc. Currently only
implemented for the Xorcom Astribank.
=item -x
@@ -150,7 +150,7 @@ Show disconnected Astribank unit, if any.
=head1 DESCRIPTION
Show all Dahdi hardware devices. Devices are recognized according to
Show all dahdi hardware devices. Devices are recognized according to
lists of PCI and USB IDs in Dahdi::Hardware::PCI.pm and
Dahdi::Hardware::USB.pm . For PCI it is possible to detect by
sub-vendor and sub-product ID as well.

View File

@@ -48,7 +48,7 @@ __END__
=head1 NAME
lsdahdi - List all Dahdi channels with their types and spans.
lsdahdi - List all dahdi channels with their types and spans.
=head1 SYNOPSIS

View File

@@ -168,7 +168,7 @@ sub gen_channel($$) {
die "missing context for chan #$num type $type" unless $context;
$callerid = ($type eq 'FXO')
? 'asreceived'
: sprintf "\"Channel %d\" <%d>", $num, $exten;
: sprintf "\"Channel %d\" <%04d>", $num, $exten;
if($type eq 'IN') {
$immediate = 'yes';
}
@@ -182,7 +182,7 @@ sub gen_channel($$) {
printf ";;; line=\"%d %s%s%s\"\n", $num, $chan->fqn, $signalling, $info;
printf "signalling=$sig\n";
printf "callerid=$callerid\n";
printf "mailbox=%d\n", $exten unless $type eq 'FXO';
printf "mailbox=%04d\n", $exten unless $type eq 'FXO';
if(defined $group) {
printf "group=$group\n";
}

View File

@@ -1,116 +0,0 @@
package Dahdi::Config::Gen::Freepbxdb;
# Written by Tzafrir Cohen <tzafrir.cohen@xorcom.com>
# Copyright (C) 2011, Xorcom
# This program is free software; you can redistribute and/or
# modify it under the same terms as Perl itself.
use strict;
use Socket;
use Dahdi::Config::Gen qw(is_true);
sub new($$$) {
my $pack = shift || die;
my $gconfig = shift || die;
my $genopts = shift || die;
my $self = {
GCONFIG => $gconfig,
GENOPTS => $genopts,
};
bless $self, $pack;
return $self;
}
sub gen_channel($$) {
my $self = shift || die;
my $chan = shift || die;
my $gconfig = $self->{GCONFIG};
my $type = $chan->type;
my $num = $chan->num;
die "channel $num type $type is not an analog channel\n" if $chan->span->is_digital();
my $exten = $gconfig->{'base_exten'} + $num;
my $callerid = sprintf "\"Channel %d\" <%04d>", $num, $exten;
my @cmds = ();
#push @cmds, "database put DEVICE/$exten default_user $exten";
#push @cmds, "database put DEVICE/$exten dial ZAP/$num";
push @cmds, "database put DEVICE/$exten dial DAHDI/$num";
#push @cmds, "database put DEVICE/$exten type fixed";
push @cmds, "database put DEVICE/$exten user $exten";
push @cmds, "database put AMPUSER/$exten device $exten";
push @cmds, "database put AMPUSER/$exten cidname $callerid";
return @cmds;
}
sub generate($) {
my $self = shift || die;
my $gconfig = $self->{GCONFIG};
my $genopts = $self->{GENOPTS};
#$gconfig->dump;
my $ast_sock = '/var/run/asterisk/asterisk.ctl';
my @spans = @_;
my @cmds = ();
warn "Empty configuration -- no spans\n" unless @spans;
print "Configuring FXSs for FreePBX\n" if $genopts->{verbose};
foreach my $span (@spans) {
next if $span->is_digital;
foreach my $chan ($span->chans()) {
next unless ($chan->type eq 'FXS');
push @cmds, $self->gen_channel($chan);
}
}
#open(CMDS,"|$command >/dev/null") or
socket(SOCK, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!";
connect(SOCK, sockaddr_un($ast_sock)) ||
die "$0: Freepbxdb: Failed connecting to $ast_sock\n: $!";
foreach (@cmds) {
# Note: commands are NULL-terminated:
print SOCK "$_\0";
sleep 0.001;
}
close(SOCK) or
die "$0: Freepbxdb: Failed sending commands ($ast_sock): $!\n";
}
1;
__END__
=head1 NAME
freepbxdb - Generate astdb configuration required by FreePBX
=head1 SYNOPSIS
use Dahdi::Config::Gen::Freepbxdb;
my $cfg = new Dahdi::Config::Gen::Freepbxdb(\%global_config, \%genopts);
$cfg->generate(@span_list);
=head1 DESCRIPTION
Updates the Asterisk DB entries for FXS channels detected. Requires
Asterisk running.
The configuration generated here bypasses FreePBX's standard configuration
and allows using a simple dialplan snippet such as:
[from-internal-custom](+)
exten => _4XXX,1,Dial(DAHDI/${EXTEN:1})
This may come in handy in testing. At least until FreePBX will provide a
simple automated interface to do the same.
=head1 OPTIONS
None, so far.
=head1 FILES
=over
=item C</var/run/asterisk/asterisk.sock>
The socket to which commands are sent. FIXME: make this a parameter.
=back

View File

@@ -30,7 +30,7 @@ sub get_sorted_xbuses(@) {
my @sorted_xbuses;
foreach my $xbus (@xbuses) {
my $last_spanno;
foreach my $xpd (Dahdi::Xpp::Xpd::telephony_devs($xbus->xpds())) {
foreach my $xpd ($xbus->xpds) {
my $spanno = $xpd->spanno;
if(!$spanno) {
printf STDERR "%s: Is not registered. Skipping.\n", $xpd->fqn;

View File

@@ -41,7 +41,6 @@ my %pci_ids = (
'd161:0210/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P (3rd Gen)' },
'd161:0205' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE205P ' },
'd161:0210' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P ' },
'd161:1820' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE820 (5th Gen)' },
# from wctdm24xxp
'd161:2400' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM2400P' },
@@ -134,7 +133,7 @@ my %pci_ids = (
'0b0b:0105' => { DRIVER => 'r1t1', DESCRIPTION => 'Rhino R1T1' },
'0b0b:0205' => { DRIVER => 'r4fxo', DESCRIPTION => 'Rhino R14FXO' },
'0b0b:0206' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB4FXO 4-channel FXO analog telphony card' },
'0b0b:0305' => { DRIVER => 'rxt1', DESCRIPTION => 'Rhino R4T1' },
'0b0b:0305' => { DRIVER => 'r1t1', DESCRIPTION => 'Rhino R1T1' },
'0b0b:0405' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R8FXX' },
'0b0b:0406' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB8FXX 8-channel modular analog telphony card' },
'0b0b:0505' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R24FXX' },
@@ -204,7 +203,7 @@ sub scan_devices($) {
$pci_devs{$name}{DRIVER} = '';
}
while(<$Dahdi::sys_base/bus/pci/drivers/*/[0-9]*>) {
while(</sys/bus/pci/drivers/*/[0-9]*>) {
m,^(.*?)/([^/]+)/([^/]+)$,;
my $prefix = $1;
my $drvname = $2;

View File

@@ -184,7 +184,6 @@ sub scan_devices($) {
my @lines = split(/\n/);
my ($tline) = grep(/^T/, @lines);
my ($pline) = grep(/^P/, @lines);
my ($dline) = grep(/^I/, @lines);
my ($sline) = grep(/^S:.*SerialNumber=/, @lines);
my ($busnum,$devnum) = ($tline =~ /Bus=(\w+)\W.*Dev#=\s*(\w+)\W/);
my $devname = sprintf("%03d/%03d", $busnum, $devnum);
@@ -195,10 +194,6 @@ sub scan_devices($) {
$serial = $1;
#$serial =~ s/[[:^print:]]/_/g;
}
my $loaded;
if ($dline =~ /Driver=(\w+)/) {
$loaded = $1;
}
my $model = $usb_ids{"$vendor:$product"};
next unless defined $model;
my $d = Dahdi::Hardware::USB->new(
@@ -209,7 +204,6 @@ sub scan_devices($) {
SERIAL => $serial,
DESCRIPTION => $model->{DESCRIPTION},
DRIVER => $model->{DRIVER},
LOADED => $loaded,
);
push(@devices, $d);
}

View File

@@ -144,7 +144,7 @@ my @pri_strings = (
'Wildcard TE120P', # wcte12xp
'Wildcard TE121', # wcte12xp
'Wildcard TE122', # wcte12xp
'T[248]XXP \(PCI\) Card ', # wct4xxp
'T[24]XXP \(PCI\) Card ', # wct4xxp
'R[24]T1 \(PCI\) Card', # rxt1
'Rhino R1T1 (E1)/PRA Card', # r1t1
'Rhino R1T1 (T1)/PRI Card', # r1t1