#! /bin/sh # waitfor_xpds: wait until all Astribanks were initialized # Written by Oron Peled # Copyright (C) 2008, Xorcom # # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # set -e ab_list() { 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 } while if ! ab=`ab_list`; then exit 1 fi test "$oldab" != "$ab" do oldab="$ab" echo 1>&2 "Waiting for XPDS" cat $ab done