Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1292ea9078 | ||
|
|
cfee27106b | ||
|
|
066fa2aff3 | ||
|
|
bce5afacf1 | ||
|
|
dd752529f0 | ||
|
|
27d07446ef | ||
|
|
8e2a5def27 |
1
Makefile
1
Makefile
@@ -108,6 +108,7 @@ endif
|
||||
ASSIGNED_DATA_SCRIPTS:=\
|
||||
dahdi_handle_device \
|
||||
dahdi_span_config \
|
||||
dahdi_auto_assign_compat \
|
||||
span_config.d/10-dahdi-cfg \
|
||||
span_config.d/20-fxotune \
|
||||
span_config.d/50-asterisk \
|
||||
|
||||
@@ -148,11 +148,6 @@ xpp_startup() {
|
||||
if ! /usr/share/dahdi/waitfor_xpds; then return 0; fi
|
||||
|
||||
hotplug_exit_after_load
|
||||
|
||||
# overriding locales for the above two, as perl can be noisy
|
||||
# when locales are missing.
|
||||
# No register all the devices if they didn't auto-register:
|
||||
LC_ALL=C dahdi_registration on
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +258,9 @@ case "$1" in
|
||||
|
||||
xpp_startup
|
||||
|
||||
# Assign all spans that weren't handled via udev + /etc/dahdi/assigned-spans.conf
|
||||
/usr/share/dahdi/dahdi_auto_assign_compat
|
||||
|
||||
if [ $system = debian ]; then
|
||||
echo -n "Running dahdi_cfg: "
|
||||
$DAHDI_CFG_CMD 2> /dev/null && echo -n "done"
|
||||
|
||||
@@ -1672,13 +1672,13 @@ finish:
|
||||
|
||||
lock = sem_open(SEM_NAME, O_CREAT, O_RDWR, 1);
|
||||
if (SEM_FAILED == lock) {
|
||||
error("Unable to create 'dahdi_cfg' mutex.\n");
|
||||
perror("Unable to create 'dahdi_cfg' mutex");
|
||||
exit_code = 1;
|
||||
goto release_sem;
|
||||
}
|
||||
|
||||
if (-1 == sem_wait(lock)) {
|
||||
error("Failed to wait for dahdi_cfg mutex.\n");
|
||||
perror("Failed to wait for 'dahdi_cfg' mutex");
|
||||
exit_code = 1;
|
||||
goto unlink_sem;
|
||||
}
|
||||
@@ -1730,7 +1730,7 @@ finish:
|
||||
}
|
||||
|
||||
if (-1 == sem_wait(lock)) {
|
||||
error("Failed to wait for dahdi_cfg mutex after creating dynamic spans.\n");
|
||||
perror("Failed to wait for 'dahdi_cfg' mutex after creating dynamic spans");
|
||||
exit_code = 1;
|
||||
goto unlink_sem;
|
||||
}
|
||||
|
||||
25
hotplug/dahdi_auto_assign_compat
Executable file
25
hotplug/dahdi_auto_assign_compat
Executable file
@@ -0,0 +1,25 @@
|
||||
#! /bin/sh
|
||||
|
||||
devdir='/sys/bus/dahdi_devices/devices'
|
||||
|
||||
# DAHDI is loaded?
|
||||
if [ ! -d "$devdir" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
devices_by_registration_time() {
|
||||
grep -H '' $devdir/*/registration_time 2>/dev/null | \
|
||||
sed 's,/registration_time:,\t,' | \
|
||||
sort -k 2,2
|
||||
}
|
||||
|
||||
# First assign non-Astribank devices
|
||||
devices_by_registration_time | \
|
||||
grep -v '/astribanks:' | \
|
||||
while read devpath time; do
|
||||
echo >&2 "D: auto '$devpath'"
|
||||
dahdi_span_assignments auto "$devpath"
|
||||
done
|
||||
|
||||
# Now handle Astribanks
|
||||
LC_ALL=C dahdi_registration -Rv on
|
||||
@@ -36,16 +36,6 @@ if [ "$DAHDI_UDEV_DISABLE_DEVICES" = 'yes' ]; then
|
||||
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.
|
||||
@@ -72,12 +62,24 @@ run_parts() {
|
||||
case "$ACTION" in
|
||||
add)
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
|
||||
# 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` -ne 0 ]; then
|
||||
echo "auto_assign_spans=1. Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Background run -- don't block udev
|
||||
run_parts 2>&1 < /dev/null | $LOGGER &
|
||||
;;
|
||||
remove)
|
||||
# Nothing to do yet...
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
# Background run -- don't block udev
|
||||
run_parts 2>&1 < /dev/null | $LOGGER &
|
||||
;;
|
||||
*)
|
||||
echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
|
||||
|
||||
@@ -62,6 +62,20 @@ run_parts() {
|
||||
case "$ACTION" in
|
||||
add)
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
|
||||
# Old driver. These scripts probably won't work anyway.
|
||||
if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then
|
||||
if [ -f /sys/module/dahdi ]; then
|
||||
$LOGGER "Old driver (no auto_assign_spans parameter). Skip $DEVPATH"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $(cat /sys/module/dahdi/parameters/auto_assign_spans) -ne 0 ]; then
|
||||
$LOGGER "auto_assign_spans=1. Skip $DEVPATH"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set variables
|
||||
span_devpath="/sys$DEVPATH"
|
||||
SPANNO=`echo "$span_devpath" | sed 's,.*/span-,,'`
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#! /bin/sh
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
esac
|
||||
|
||||
if [ -r "$DAHDICONFDIR/span-types.conf" ]; then
|
||||
dahdi_span_types set "/sys$DEVPATH"
|
||||
fi
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
#! /bin/sh
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
esac
|
||||
|
||||
# For now, handle only spans in assigned-spans.conf
|
||||
# We leave other cases to /etc/init.d/dahdi, so
|
||||
# legacy ordering can be preserved.
|
||||
if [ -r "$DAHDICONFDIR/assigned-spans.conf" ]; then
|
||||
dahdi_span_assignments add "/sys$DEVPATH"
|
||||
else
|
||||
# No configuration. No order guaranteed
|
||||
dahdi_span_assignments auto "/sys$DEVPATH"
|
||||
fi
|
||||
|
||||
@@ -35,7 +35,7 @@ my %opts;
|
||||
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 $auto_assign_spans = check_param('/sys/module/dahdi/parameters/auto_assign_spans') ne '0';
|
||||
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;
|
||||
|
||||
@@ -72,6 +72,10 @@ waitfor_ab_initialization() {
|
||||
fi
|
||||
test "$oldab" != "$ab"
|
||||
do
|
||||
if [ "$ab" = '' ]; then
|
||||
echo >&2 "Astribanks disappeared"
|
||||
break
|
||||
fi
|
||||
oldab="$ab"
|
||||
cat $ab
|
||||
#echo -n 1>&2 "_"
|
||||
|
||||
Reference in New Issue
Block a user