diff options
-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 |