summaryrefslogtreecommitdiff
path: root/dahdi.init
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-10-04 13:53:01 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-10-04 13:53:01 +0000
commit55b5a9cc5ea6f7f634a3b6b667c39b7c5cb02a8f (patch)
treecc9d34e3b8d8f4b00750c9ed8f144b0345e57158 /dahdi.init
parent6815e5932f1a6aa0d7301f728351fd9b85f2a854 (diff)
Add XPP_HOTPLUG_DAHDI mode: cfg initiated mostly from hotplug
If XPP_HOTPLUG_DAHDI=yes is set in /etc/dahdi/init.conf (which is not the default), the normal run of the 'start' operation of the dahdi init script will only be responsible for loading modules. The rest will be done (if there are indeed Astribanks on the system) by a second call to the init script once all of them have connected. The astribank_hook has also been mostly rewritten. Most of the functionality of twinstar_hook moved to it. The current twinstar_hook is a simple example script. XPP_HOTPLUG_DAHDI mode assumes that all Astribanks on the system are listed in /etc/dahdi/xpp_order (which can be generated using, e.g. 'dahdi_genconf xpporder') git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7335 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'dahdi.init')
-rwxr-xr-xdahdi.init27
1 files changed, 26 insertions, 1 deletions
diff --git a/dahdi.init b/dahdi.init
index a0882a8..a5ed780 100755
--- a/dahdi.init
+++ b/dahdi.init
@@ -86,11 +86,34 @@ unload_module() {
rmmod $module
}
+# In (xpp) hotplug mode, if we're called from udev, skip loading
+# modules:
+hotplug_skip_modprobe() {
+ if [ "$XPP_HOTPLUG_DAHDI" = yes -a "$CALLED_FROM_ATRIBANK_HOOK" = '' ]
+ then
+ return 1
+ fi
+ return 0
+}
+
+# In (xpp) hotplug mode: quit after we loaded modules.
+# Make sure that this is only called if there is an Astribank on the
+# system, which will call the rest of the script from the
+# astribank_hook.
+hotplug_exit_after_load() {
+ if [ "$XPP_HOTPLUG_DAHDI" = yes -a "$CALLED_FROM_ATRIBANK_HOOK" != '' ]
+ then
+ exit 0
+ fi
+}
+
# Initialize the Xorcom Astribank (xpp/) using perl utiliites:
xpp_startup() {
# do nothing if there are no astribank devices:
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:
@@ -184,7 +207,9 @@ RETVAL=0
# See how we were called.
case "$1" in
start)
- load_modules
+ if ! hotplug_skip_modprobe; then
+ load_modules
+ fi
TMOUT=$DAHDI_DEV_TIMEOUT # max secs to wait