Changeset 598
- Timestamp:
- 06/05/09 14:09:02 (4 years ago)
- Location:
- branches/livecd/LiveTools
- Files:
-
- 2 modified
-
btconnect (modified) (2 diffs)
-
transfermotorcontroltonxt.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/livecd/LiveTools/btconnect
r597 r598 35 35 fi 36 36 37 # if device name is given, check if it's already used 38 39 if [ $# = 2 ]; then 40 (( DEVICE=$2 )) 41 if [ -e /dev/rfcomm$DEVICE -o -e /dev/bluetooth/rfcomm$DEVICE ]; then 42 echo "rfcomm$DEVICE is already in use!" 43 exit 3 44 fi 45 fi 46 37 47 # if hardware address is given, we're all set. otherwise, perform a scan 38 48 39 if [[ $1 =~ '^([[:digit:]a-fA-F]{2}:){5}[[:digit:]a-fA-F]{2}$']]; then49 if [[ $1 =~ ^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$ ]]; then 40 50 MAC=$1 41 51 else 42 $NAME="$( echo $1 )"52 NAME=$1 43 53 echo -n "Scanning for '$NAME' ... " >&2 44 MAC=$( hcitool scan | awk -F '[[:space:]]+' '$2 ~ /([[:digit:]a-fA-F]{2}:){5}[[:digit:]a-fA-F]{2}/ && $3 == "'"$NAME"'" && $NF == 3 / { print( $2 )}' )54 MAC=$( hcitool scan | awk '$1 ~ /^([0-9a-fA-F]+:)+[0-9a-fA-F]+$/ && $2 == "'"$NAME"'" { print $1 }' ) 45 55 if [ -z $MAC ]; then 46 56 echo "not found." >&2 47 57 exit 1 48 58 fi 49 if [[ $MAC = ~ ' ']]; then59 if [[ $MAC == *\ * ]]; then 50 60 echo "found multiple devices:" >&2 51 61 echo >&2 … … 60 70 fi 61 71 62 if [ $# = 2 ]; then 63 DEVICE=$(( $2 )) 64 else 65 DEVICE=0 66 INUSE=$( rfcomm | cut -f 1 ) 67 while [[ $INUSE =~ "rfcomm$DEVICE:" ]]; do 72 # if device is not given, find first unused device 73 74 if [ -z $DEVICE ]; then 75 (( DEVICE=0 )) 76 while [ -e /dev/rfcomm$DEVICE -o -e /dev/bluetooth/rfcomm$DEVICE ]; do 68 77 (( DEVICE++ )) 69 78 done -
branches/livecd/LiveTools/transfermotorcontroltonxt.sh
r597 r598 11 11 read 12 12 13 nbc -d -S=usb /opt/mindstorms/ matlab/MotorControl/MotorControl.nxc13 nbc -d -S=usb /opt/mindstorms/MotorControl/MotorControl.nxc
