summaryrefslogtreecommitdiff
path: root/zaptel.init
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-06-26 20:05:05 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-06-26 20:05:05 +0000
commit8eb3e091b1eda61b8780e37aa44b2fa7fb5f0778 (patch)
treee8efa8500c7bc64339192b608e47a39bedc255e5 /zaptel.init
parenta8b3f4a65c4c4e8c6fe0c4540948b974dfb12e14 (diff)
* Fix unloading of xpp modules.
* Add optional support for using the zaptel perl functions git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2670 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.init')
-rw-r--r--zaptel.init25
1 files changed, 25 insertions, 0 deletions
diff --git a/zaptel.init b/zaptel.init
index 1185620..d31fb79 100644
--- a/zaptel.init
+++ b/zaptel.init
@@ -51,6 +51,9 @@ unload_module() {
set -- $line
# $1: the original module, $2: size, $3: refcount, $4: deps list
mods=`echo $4 | tr , ' '`
+ # xpp_usb keeps the xpds below busy if an xpp hardware is
+ # connected. Hence must be removed before them:
+ case "$module" in xpd_*) mods="xpp_usb $mods";; esac
for mod in $mods; do
# run in a subshell, so it won't step over our vars:
(unload_module $mod)
@@ -60,6 +63,26 @@ unload_module() {
rmmod $module
}
+# Initialize the Xorcom Astribank (xpp/) using perl utiliites:
+# intended to replace all the the three functions below if user has
+# installed the zaptel-perl utilities.
+xpp_startup() {
+ # do nothing if the module xpp was not loaded
+ if [ ! -d /proc/xpp ]; then return 0; fi
+
+ echo "Waiting for Astribank devices to initialize:"
+ cat /proc/xpp/XBUS-[0-9]*/waitfor_xpds 2>/dev/null || true
+
+ # 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 zt_registration on
+
+ # this one could actually be run after ztcfg:
+ LC_ALL=C xpp_sync "$XPP_SYNC"
+}
+
+
# Wait for Astribank to initialize registers:
wait_for_xpp() {
if [ ! -d /proc/xpp ]; then return; fi
@@ -212,6 +235,8 @@ case "$1" in
done
sleep 3 # TODO: remove it
+ # If you have zaptel-perl, the three below can be replaced with:
+ #xpp_startup
wait_for_xpp
zap_reg_xpp
fix_asterisbank_sync # can actually be run after ztcfg