#!/usr/bin/env bash ############################################################################### # # Copyright (C) 2009-2013 Nintendo. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # ############################################################################### # NOTE: this script sets two variables # that are to be visible by outside cripts: # CAFERUN_HOSTBRIDGE_VERSION # CAFERUN_FW_VERSION source getbridgetype ############################################################################### # compute_flat_version ############################################################################### compute_flat_version() { IFS="." local v=( $1 ) echo $((${v[0]} * 1000000 + ${v[1]} * 10000 + ${v[2]} * 1000 + ${v[3]})) } check_host_bridge_version() { if [ "$BRIDGE_TYPE" == "Mion" ] then local min_fw_ver="0.0.14.74" local min_sw_ver="3.2.6.1" else local min_sw_ver="2.9.1.5" local min_fw_ver="2.8.0.13" # firmware version installed by above software installer fi if [ ! -n "$SDIO_BRIDGE_TOOLS" ] then if [ ! -n "$MION_BRIDGE_TOOLS" ] then echo "caferun failed: Please install at least HostBridgeSetup_$min_sw_ver.exe and restart cafe.bat" exit 2 fi fi if [ "$BRIDGE_TYPE" == "Mion" ] then # FSEmul -ver is safe to call here since it's guaranteed that Host Bridge is connected (checked by cafestop in caferun) local fw_ver=`"$MION_BRIDGE_TOOLS/FSEmul" -ver -ip $BRIDGE_CURRENT_IP_ADDRESS | grep Firmware | tr -d '\r\n' | cut -d' ' -f4` local sw_ver=`"$MION_BRIDGE_TOOLS/FSEmul" -ver -ip $BRIDGE_CURRENT_IP_ADDRESS | grep Software | tr -d '\r\n' | cut -d' ' -f4` else # FSEmul -ver is safe to call here since it's guaranteed that Host Bridge is connected (checked by cafestop in caferun) local fw_ver=`"$SDIO_BRIDGE_TOOLS/FSEmul" -ver | grep Firmware | tr -d '\r\n' | cut -d' ' -f4` local sw_ver=`"$SDIO_BRIDGE_TOOLS/FSEmul" -ver | grep Software | tr -d '\r\n' | cut -d' ' -f4` fi if [ -z "$fw_ver" -o -z "$sw_ver" ] then echo "caferun failed: Cannot check Host Bridge version. Please cafestop and try again" exit 2 fi # keep them so other scripts can check CAFERUN_HOSTBRIDGE_VERSION=$sw_ver CAFERUN_FW_VERSION=$fw_ver local fw_ver_flat=$(compute_flat_version $fw_ver) local sw_ver_flat=$(compute_flat_version $sw_ver) local min_sw_ver_flat=$(compute_flat_version $min_sw_ver) local min_fw_ver_flat=$(compute_flat_version $min_fw_ver) if [ $sw_ver_flat -lt $min_sw_ver_flat -o $fw_ver_flat -lt $min_fw_ver_flat ] then echo "caferun failed: Please install at least HostBridgeSetup_$min_sw_ver.exe and restart cafe.bat" echo " Current software version is $sw_ver (need $min_sw_ver)" echo " Current firmware version is $fw_ver (need $min_fw_ver)" exit 3 fi } check_host_bridge_version