diff options
Diffstat (limited to 'xpp/waitfor_xpds')
-rwxr-xr-x | xpp/waitfor_xpds | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/xpp/waitfor_xpds b/xpp/waitfor_xpds index ebac3a0..71c5187 100755 --- a/xpp/waitfor_xpds +++ b/xpp/waitfor_xpds @@ -26,22 +26,32 @@ set -e ab_list() { + # Only check /sys info (don't use /proc anymore). ab=`find /sys/bus/astribanks/devices/xbus-*/ -name waitfor_xpds 2> /dev/null || :` - if [ "$ab" = "" ]; then - ab=`find /proc/xpp/XBUS-[0-9]*/ -name waitfor_xpds 2> /dev/null || :` - procfiles=1 - fi - if [ "$ab" = "" ]; then - echo 1>&2 "$0: No XBUSES to wait for. Aborting..." - exit 1 - fi - if [ -n "$procfiles" ]; then - echo 1>&2 "$0: No /sys attributes, fallback to /proc interface..." - fi echo $ab } +# Any hardware? +if [ "`dahdi_hardware | grep xpp_usb`" = "" ]; then + exit 0 +fi + +# Wait for driver and first device +echo -n 1>&2 "Astribanks detection " +tries=10 +while [ ! -e "/sys/bus/astribanks/devices/xbus-00" ] +do + if [ "$tries" -le 0 ]; then + exit 1 + fi + echo -n 1>&2 "." + sleep 1 + ((tries--)) +done +echo "" +# Wait for device to stabilize and XPD's to finish initalizations +echo 1>&2 "Astribanks initalization " while if ! ab=`ab_list`; then exit 1 @@ -49,6 +59,5 @@ while test "$oldab" != "$ab" do oldab="$ab" - echo 1>&2 "Waiting for XPDS" cat $ab done |