diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-07-02 15:07:26 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-07-02 15:07:26 +0000 |
commit | bae2e420fa7ea75b37e258acac30d06559817a0a (patch) | |
tree | c75215d1db226a2abcae8dbf014f4f35c422dbcd | |
parent | 695ff33dbddd222e8dff4317d18bc945f0f52f28 (diff) |
* Fix unloading of xpp modules.
* Add optional support for using the zaptel perl functions.
(From branches/1.2 changesset:2670 and changeset:2673)
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@2674 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r-- | zaptel.init | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/zaptel.init b/zaptel.init index dd42fa6..87d2b11 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 there are no astribank devices: + if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; 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 @@ -224,6 +247,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 |