Commit 49fd3ad8 authored by Tzafrir Cohen's avatar Tzafrir Cohen

Update upstream source from tag 'upstream/3.0.0'

Update to upstream version '3.0.0'
with Debian dir 746398f83e3ecbce6b2e581482c7f763a7a65bce
parents 3a3f5811 b262662b
......@@ -12,6 +12,7 @@
.libs
.dirstamp
.version
/.pc
Makefile
Makefile.in
auxdir/
......
......@@ -5,7 +5,7 @@ LEGACY_MAKE = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir)
CFLAGS = -g -Wall -O2 $(DAHDI_INCLUDE)
CFLAGS += -g -Wall -O2 $(DAHDI_INCLUDE)
if DAHDI_DEVMODE
CFLAGS += \
-Werror \
......
......@@ -86,7 +86,7 @@ install: all install-programs
@echo "### DAHDI tools installed successfully."
@echo "### If you have not done so before, install init scripts with:"
@echo "###"
@echo "### make config"
@echo "### make install-config"
@echo "###"
@echo "###################################################"
......
......@@ -48,7 +48,7 @@ __dahdi_span_types() {
has_cmd=0
for (( i=0; i < COMP_CWORD; i++)); do
case "${COMP_WORDS[$i]}" in
dumpconfig | list | set)
dumpconfig | list | set | compare)
has_cmd=1
break
;;
......@@ -69,7 +69,7 @@ __dahdi_span_types() {
grep -l '[EJT]1' /sys/devices/pci0000:00/0000:00:10.4/usb1/1-1/xbus-00/*/spantype 2>/dev/null | sed -e 's|/spantype||') )
else
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W \
'dumpconfig list set' -- $cur) )
'dumpconfig list set compare' -- $cur) )
fi
;;
esac
......
......@@ -66,6 +66,8 @@ usage() {
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 " matched - found spans matched in configuration"
echo >&2 " unmatched - found spans not matched in configuration"
echo >&2 " dumpconfig - dump current state as new configuration"
echo >&2 ""
echo >&2 " options:"
......@@ -109,7 +111,7 @@ while true ; do
break
;;
*)
echo "Internal error!"
echo >&2 "Internal error!"
exit 1
;;
esac
......@@ -215,10 +217,10 @@ unassign_all_spans() {
sort | while read spandir; do
local_spanno=`cat "$spandir/local_spanno"`
if [ "$dry_run" = true ]; then
echo "(dry-run) unassign $device $local_spanno"
echo >&2 "(dry-run) unassign $device $local_spanno"
continue
fi
echo "unassign $device $local_spanno"
echo >&2 "unassign $device $local_spanno"
if ! echo "$local_spanno" > "$device/unassign_span"; then
echo >&2 "$0: failed unassigning '$local_spanno' in '$device'"
fi
......@@ -245,12 +247,12 @@ assign_device_spans() {
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"
echo >&2 "WARNING: $span_local_spanno != $local_spanno"
fi
echo "$device [$local_spanno] already assigned to span $spanno. Skipping..."
echo >&2 "$device [$local_spanno] already assigned to span $spanno. Skipping..."
continue
fi
echo "assign $device: $s"
echo >&2 "assign $device: $s"
if ! echo "$s" > "$device/assign_span"; then
echo >&2 "$0: failed assigning '$s' to '$device'"
fi
......@@ -267,21 +269,21 @@ match_device() {
# 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"
[ "$verbose" = true ] && echo >&2 "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"
[ "$verbose" = true ] && echo >&2 "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"
[ "$verbose" = true ] && echo >&2 "match by devpath ($id ~ $devpath): $spanspecs"
assign_device_spans "$device"
;;
esac
......@@ -293,7 +295,7 @@ assign_devices() {
echo >&2 "$0: Missing '$DAHDISASSIGNEDSPANSCONF'"
exit 1
fi
echo "using '$DAHDISASSIGNEDSPANSCONF'"
echo >&2 "using '$DAHDISASSIGNEDSPANSCONF'"
for device in $DEVICES
do
match_device "$device"
......@@ -303,13 +305,71 @@ assign_devices() {
auto_assign_devices() {
for device in $DEVICES
do
echo "auto-assign $device"
echo >&2 "auto-assign $device"
if [ "$dry_run" != true ]; then
echo 1 > "$device/auto_assign"
fi
done
}
dev_match_conf() {
local devpath="$1"
local location="$2"
local hardware_id="$3"
local local_spanno="$4"
filter_conf | while read id spanspecs
do
spanno=`echo "$spanspecs" | cut -d: -f1`
match_dev=no
# We use case to enable shell-style globbing in configuration
case "$hardware_id" in
$id)
match_dev=yes
;;
esac
# We use case to enable shell-style globbing in configuration
case "$location" in
$id)
match_dev=yes
;;
esac
# We use case to enable shell-style globbing in configuration
case "$devpath" in
$id)
match_dev=yes
;;
esac
if [ "$match_dev" = 'yes' -a "$local_spanno" = "$spanno" ]; then
#printf "%-8s (%s) %-14s %s %s\n" "$local_spanno" "$spanno" "[$hardware_id]" "$location" "$devpath"
echo "[$hardware_id]:$local_spanno"
fi
done
}
list_devices() {
wanted="$1"
if [ ! -f "$DAHDISASSIGNEDSPANSCONF" ]; then
echo >&2 "$0: Missing '$DAHDISASSIGNEDSPANSCONF'"
exit 1
fi
echo >&2 "using '$DAHDISASSIGNEDSPANSCONF'"
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
found=`dev_match_conf "$devpath" "$location" "$hardware_id" "$local_spanno"`
if [ "$wanted" = "unmatched" ]; then
[ -z "$found" ] && echo "[$hardware_id]:$local_spanno"
else
[ -z "$found" ] || echo "[$hardware_id]:$local_spanno"
fi
done
done
}
case "$action" in
auto)
auto_assign_devices
......@@ -326,6 +386,12 @@ list)
dumpconfig)
dump_config
;;
matched)
list_devices "matched"
;;
unmatched)
list_devices "unmatched"
;;
*)
echo >&2 "Bad action='$action'"
usage
......
......@@ -69,6 +69,7 @@ usage() {
echo >&2 "Usage: $0 [options] action [devpath ...]"
echo >&2 " action:"
echo >&2 " set - set spans to E1/T1 according to /etc/dahdi/span-types.conf"
echo >&2 " compare - show config values that differ from system"
echo >&2 " list - human-readable list of all spans"
echo >&2 " dumpconfig - dump current state in /etc/dahdi/span-types.conf format"
echo >&2 ""
......@@ -88,6 +89,8 @@ if [ $? != 0 ]; then
usage
fi
compare=false
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
......@@ -321,13 +324,26 @@ handle_span() {
echo >&2 "Set $devname span $spanno = $val"
fi
if [ "$dry_run" != 'true' ]; then
echo "$spanno:$val" > "$attr_file"
if [ "$compare" = 'true' ]; then
config="$spanno:$val"
system=`grep "$spanno:" "$attr_file"`
if [ "$config" != "$system" ]; then
active_val=`echo $system | cut -d: -f2`
echo "$devname $spanno $val $active_val" >>"$compare_results_file"
fi
else
echo "$spanno:$val" > "$attr_file"
fi
fi
fi
done
}
set_all_devices() {
span_differs='false'
SPANS_DIFFER='false'
if [ ! -f "$DAHDISPANTYPESCONF" ]; then
echo >&2 "$0: Missing configuration '$DAHDISPANTYPESCONF'"
exit 1
......@@ -348,6 +364,16 @@ set_all_devices() {
esac
done
done
if [ "$compare" = 'true' ]; then
if [ -s "$compare_results_file" ]; then
echo "# Device Unit Config Active"
cat "$compare_results_file"
rm -f "$compare_results_file"
exit 5
fi
rm -f "$compare_results_file"
exit 0
fi
}
case "$action" in
......@@ -360,6 +386,11 @@ dumpconfig)
set)
set_all_devices
;;
compare)
compare=true
compare_results_file=`mktemp`
set_all_devices
;;
*)
usage
;;
......
......@@ -64,7 +64,7 @@ void hup_handler(int sig)
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",
printf("Cumulative Accuracy (not per pass): %0.3f\n",
pass ? accuracy : 0.0);
exit(0);
}
......
......@@ -4,7 +4,7 @@
dahdi_span_types \- set line modes of DAHDI spans before assignment
.SH SYNOPSIS
.B dahdi_span_types [\fIoptions\fB] <list|dumpconfig|set> \fB[\fIdevpath \fB...]
.B dahdi_span_types [\fIoptions\fB] <list|dumpconfig|compare|set> \fB[\fIdevpath \fB...]
.SH DESCRIPTION
The span type (the line mode: E1/T1/J1) must be set to a span before
......@@ -58,6 +58,16 @@ device(s) specified in the command line (or all devices, if none
specified).
.RE
.B compare
.RS
Compare the settings on the system to those in the configuration file.
For each line that applies to a device on the system, print it if the
value to be set and the active value on the system differ.
The exit status is 0 if there is no difference and non-zero if a
difference was detected.
.RE
.B list
.RS
List line modes for all spans in the system which may be set with
......
......@@ -7,7 +7,7 @@ dahdi_tool \- Shows status of DAHDI interfaces
.B dahdi_tool
.SH DESCRIPTION
dahdi_tool shows the current status the DAHDI inteface cards plugged
dahdi_tool shows the current status the DAHDI interface cards plugged
to the computer.
It displays values like Current Alarms, SyncSource, Tx/Rx
......
......@@ -33,7 +33,7 @@ is generated in the current directory.
fxotune just reads the settings from fxotune.conf into the FXO modules.
You are advised to run fxotune on all FXO ports you have that support
it and that are connected. Note that the tunning is affected by e.g.
it and that are connected. Note that the tuning is affected by e.g.
the physical parameters of the connection, and thus if it has been
radically changed, you may need to re-run fxotune.
......@@ -44,7 +44,7 @@ cards and clones) do not have the hardware to support such tuning.
The tuning process needs a clear line to do the tuning. In order to do
that, it runs in cycles of the following: sets the line off-hook, dials
a dial string (which should set the PSTN provider waiting for the next
digit), and then starts tuning. It has a limited ammount of time for
digit), and then starts tuning. It has a limited amount of time for
tuning before the PSTN gives up and gives a busy tone. So after a while
it hangs up and starts a new cycle.
......@@ -180,7 +180,7 @@ so if you stop it half-way, you may get a half-configured system. If you
have already tuned your FXO channels and wish to test-run fxotune again,
you are advised to backup /etc/fxotune.conf .
The default for \-m is 18 seconds. This asusmes that you get a clear line
The default for \-m is 18 seconds. This assumes that you get a clear line
for at least 18 seconds. It is advised that you test that timeout earlier
by connecting a phone to the FXO line, dialing 4 (or whatever dial string
you put with \-n) and see how much time of silence you have.
......
......@@ -22,4 +22,9 @@ devices_by_registration_time | \
done
# Now handle Astribanks
LC_ALL=C dahdi_registration -Rv on
unmatched="`dahdi_span_assignments unmatched`"
if [ -n "$unmatched" ]; then
# Only if astribanks are not matched in span-assignments.conf
# TODO: have dahdi_registration run only on "$unmatched"
LC_ALL=C dahdi_registration -Rv on
fi
#! /bin/sh
# Run xpp_sync whenever an Astribank is connected.
# May be set in /etc/dahdi/init.conf
XPP_SYNC=${XPP_SYNC:-auto}
case "$ACTION" in
add) ;;
*) exit 0 ;;
esac
case "${DEVPATH##*/}" in
astribanks:*) ;;
*) exit 0 ;;
esac
xpp_sync "$XPP_SYNC"
# A dracut.conf(5) snippet
# Disable loading the Astribank (xpp_usb) drivers. This is because
# it relies on files in the root filesystem:
# See https://issues.asterisk.org/jira/browse/DAHLIN-352
omit_drivers+=" xpp_usb "
......@@ -62,6 +62,9 @@ dist_sbin_SCRIPTS = $(perl_scripts)
man_MANS += $(perl_mans)
CLEANFILES = $(perl_checks) $(perl_mans)
dracutconfdir = @prefix@/lib/dracut/dracut.conf.d
dracutconf_DATA = 50-dahdi.conf
if PBX_USB
SUBDIRS += oct612x xtalk
......
......@@ -47,9 +47,9 @@ Apart from the standard DAHDI build requirements, you also need:
* *libusb development headers* to build the Astribank firmware tools
(astribank_tool, astribank_hexload, astribank_allow).
This is typically the package libusb-dev on Debian (and derivatives
like Ubuntu) or libusb-devel on RedHat (and derivatives like
CentOS/Trixbox).
This is typically the package libusb-1.0-0-dev on Debian (and
derivatives such as Ubuntu) or libusbx-devel on RedHat (and derivatives
such as CentOS).
* *Echo Canceller Module firmware*: If you have an Astribank with an
echo canceller module, see the following section.
......@@ -1257,8 +1257,8 @@ Astribanks Synchronization Source
If there is more than one Astribank on the system, all the Astribanks
keep their clock in sync. Optionally the Astribanks can synchronize
their clock to the master DAHDI device (in case it is a different DAHDI
device). Normally you just use the default init.d script or run
explicitly:
device). Normally it would be run automatically from the udev hooks
run on device plug (handle_device), but you can also run it explicitly:
xpp_sync auto
......@@ -1488,6 +1488,9 @@ other side.
current. That is: which ones are connected to an active FXS on the
other side.
===== /sys/bus/astribanks/devices/xbus-NN/NN:M:P/hwid
Prints <module type>.<module subtype>. Both are small numbers.
===== /sys/bus/astribanks/devices/xbus-NN/NN:M:P/offhook
Shows ports that are (1) or are not (0) off-hook. When a channel is
not off-hook. For BRI and E1/T1 the value is 1 if the span is in use.
......
......@@ -117,7 +117,7 @@ Examples:
1:T1,2:T1,*:E1 \- First and second ports are T1, the rest are E1.
.RE
If the \fB\-S\fR is not given, the PRI default is determined by the existance of the \fB\-A-fR option.
If the \fB\-S\fR is not given, the PRI default is determined by the existence of the \fB\-A-fR option.
.RE
.SH SEE ALSO
......
......@@ -94,22 +94,27 @@ wait_for_udev() {
UDEV_SETTLE_MAX_TIME=10
echo "Waiting for udev to settle down..."
if [ -x /sbin/udevsettle ]; then
# Old system, stand-alone udevsettle command
/sbin/udevsettle --timeout="$UDEV_SETTLE_MAX_TIME"
udevsettle_cmd=
if [ -x /bin/udevadm ]; then
udevsettle_cmd="/bin/udevadm settle"
elif [ -x /sbin/udevadm ]; then
# Assume modern system, udevadm has settle parameter
if ! /sbin/udevadm settle --timeout="$UDEV_SETTLE_MAX_TIME"
then
echo "udevadm failed ($?)."
echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
sleep "$UDEV_SETTLE_MAX_TIME"
fi
udevsettle_cmd="/sbin/udevadm settle"
elif [ -x /sbin/udevsettle ]; then
udevsettle_cmd="/sbin/udevsettle"
else
echo "No udevsettle/udevadm."
echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
sleep "$UDEV_SETTLE_MAX_TIME"
return
fi
if ! $udevsettle_cmd --timeout="$UDEV_SETTLE_MAX_TIME"
then
echo "udevadm failed ($?)."
echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
sleep "$UDEV_SETTLE_MAX_TIME"
fi
sleep 1 # Wait a bit more (races)
}
......
......@@ -83,7 +83,7 @@ Q: Why do you use a semaphore?
A: because, unlike the filesystem, it is writable at any given time.
.SH BUGS
Option ordering matter. The \fB\-v\fR and \fB\-d\fR options should preceed
Option ordering matter. The \fB\-v\fR and \fB\-d\fR options should precede
the actions (\fB\-a\fR, \fB\-r\fR and \fB\-w\fR).
The \fB\-t\fItimeout\fR option should preceed the \fB\-w\fR option.
......
......@@ -72,7 +72,7 @@ static int reset_kind(const char *arg)
if(strcasecmp(reset_kinds[i].name, arg) == 0)
return reset_kinds[i].type_code;
}
ERR("Uknown reset kind '%s'\n", arg);
ERR("Unknown reset kind '%s'\n", arg);
return -1;
}
......@@ -157,9 +157,9 @@ int main(int argc, char *argv[])
ERR("Bad reset kind '%s'\n", opt_reset);
return 1;
}
DBG("Reseting (%s)\n", opt_reset);
DBG("Resetting (%s)\n", opt_reset);
if((ret = mpp_reset(mpp, full_reset)) < 0) {
ERR("%s Reseting astribank failed: %d\n",
ERR("%s Resetting astribank failed: %d\n",
(full_reset) ? "Full" : "Half", ret);
}
goto out;
......
......@@ -109,9 +109,15 @@ foreach my $xbus (Dahdi::Xpp::xbuses($sorter)) {
system @cmd;
warn "Failed '@cmd' (status=$?)\n" if $?;
}
}
}
if (defined($on) && $on) {
if ($opts{'R'} || ! $default_auto_assign) {
# wait for UDEV to do its stuff
system "dahdi_waitfor_span_assignments assigned";
}
}
foreach my $xbus (Dahdi::Xpp::xbuses($sorter)) {
foreach my $xpd (Dahdi::Xpp::Xpd::telephony_devs($xbus->xpds())) {
my $spanno = $xpd->xpd_getattr('span');
myprintf "\t%-10s: ", $xpd->fqn;
......
......@@ -349,7 +349,7 @@ load_fw_device() {
echo "WARNING: ECHO burning was skipped (no capabilities)"
fi
fi
pic_files=`echo "$FIRMWARE_DIR"/PIC_TYPE_[1-4].hex`
pic_files=`echo "$FIRMWARE_DIR"/PIC_TYPE_[1-46].hex`
debug "PIC burning into $dev: begin $pic_files"
run_astribank_hexload -D "$dev" -p $pic_files
debug "PIC burning into $dev: end $pic_files"
......@@ -443,7 +443,7 @@ fpga_firmware_all_devices() {
reset_fpga() {
devices=`filter_devs 'e4e4/11[3456][124]/*'`
totaldevs=`numdevs 'e4e4/11[3456][124]/*'`
echo >&2 -- "Reseting devices [$totaldevs devices]"
echo >&2 -- "Resetting devices [$totaldevs devices]"
echo "$devices" | grep -v '^$' | while read id_str dev
do
(
......
......@@ -64,7 +64,7 @@ sub do_select(@) {
foreach my $xpd (@_) {
my $xbus = $xpd->xbus;
my $busnum = $xbus->name;
die "Uknown bus name" unless $busnum;
die "Unknown bus name" unless $busnum;
$busnum =~ s/XBUS-//;
die "bad bus name" unless $busnum =~ /^\d+$/;
#printf "Setting sync: %-10s (%s)\n", $xpd->fqn, $xpd->type;
......
......@@ -21,8 +21,7 @@ USB_NAME = libusb
endif
endif
noinst_PROGRAMS = xlist_test xusb_test xusb_test_bypath xtalk_test xtalk_raw_test
sbin_PROGRAMS = xtalk_send
noinst_PROGRAMS = xlist_test xusb_test xusb_test_bypath xtalk_test xtalk_raw_test xtalk_send
noinst_LTLIBRARIES = libxtalk.la
dist_noinst_HEADERS = \
xtalk_base.h \
......@@ -39,8 +38,6 @@ dist_noinst_HEADERS = \
include/xtalk/xtalk_iface.h \
#
man_MANS = xtalk_send.8
libxtalk_la_CFLAGS = \
$(COMMON_CFLAGS) \
-I$(srcdir)/include \
......
......@@ -183,7 +183,7 @@ int process_command(
}
DBG("REPLY OP: 0x%X [%s]\n", reply->header.op, reply_desc->name);
if (reply->header.op == XTALK_ACK) {
int status = CMD_FIELD(reply, XTALK, ACK, stat);
uint8_t status = CMD_FIELD(reply, XTALK, ACK, stat);
if (expected) {
ERR("Expected OP=0x%02X: Got ACK(%d): %s\n",
......
......@@ -215,7 +215,7 @@ int xusb_filter_bypath(const struct xusb_device *xusb_device, void *data)
assert(path != NULL);
p = path_tail(path);
if (strcmp(xusb_device->devpath_tail, p) != 0) {
DBG("%s: device path missmatch (!= '%s')\n",
DBG("%s: device path mismatch (!= '%s')\n",
xusb_device->devpath_tail, p);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment