In each script where an IP address appears, you must of course replace it by the IP address displayed in the brick info menu.
Enabling SSH
Useful to copy your files on the brick and run some commands applications remotely. You'll need
expect to make it work:
spawn telnet 192.168.1.71
expect "login:"
send "root\r"
send "dropbear\r"
send "exit\r"
interact
Connection over Telnet
Connect to your EV3 without the extra cost of the SSH protocol:
spawn telnet 192.168.1.71
expect "login:"
send "root\r"
interact
Copy a program
Assuming you want to copy it to
/media/card/program/program
EV3_IP=192.168.1.71
if ! [[ $# -eq 1 ]]
then
echo "Missing parameter : PROJECT NAME"
else
PROJECT_NAME=$1
EV3_PROJECT_DIR="/media/card/$1"
if ! [[ -d $PROJECT_NAME ]]
then
echo "Project doesn't exist."
else
ssh root@$EV3_IP "mkdir $EV3_PROJECT_DIR"
scp $PROJECT_NAME/$PROJECT_NAME root@$EV3_IP:$EV3_PROJECT_DIR/$PROJECT_NAME
fi
fi
Run a program remotely
Run an application over SSH:
EV3_IP=192.168.1.71
if ! [[ $# -eq 1 ]]
then
echo "Missing parameter : PROJECT NAME"
else
PROJECT_NAME=$1
EV3_PROJECT_PATH="/media/card/$1/$1"
if ! [[ -d $PROJECT_NAME ]]
then
echo "Project doesn't exist."
else
ssh root@$EV3_IP \
"export QT_QPA_PLATFORM_PLUGIN_PATH=/media/card/lib/platforms && \
export QT_QPA_FONTDIR=/media/card/lib/fonts && \
$EV3_PROJECT_PATH -platform ev3linuxfb"
fi
fi
Copy libraries, fonts and platform plugin
Useless if you have a SD card drive on your computer:
EV3_IP=192.168.1.71
VERSION=5
FULL_VERSION=$VERSION.1.1
SOURCE_DIR=/home/user/Qt$FULL_VERSION
LIB_SUFFIX=_ev3
TARGET_DIR=/media/card/lib
TARGET_PLUGIN_DIR=$TARGET_DIR/plugins/platforms
scp $SOURCE_DIR/lib/libQt5Core$LIB_SUFFIX.so.$VERSION root@$EV3_IP:$TARGET_DIR
scp $SOURCE_DIR/lib/libQt5Gui$LIB_SUFFIX.so.$VERSION root@$EV3_IP:$TARGET_DIR
scp $SOURCE_DIR/lib/libQt5Network$LIB_SUFFIX.so.$VERSION root@$EV3_IP:$TARGET_DIR
scp -r $SOURCE_DIR/lib/fonts root@$EV3_IP:$TARGET_DIR
ssh root@$EV3_IP mkdir -p $TARGET_PLUGIN_DIR
scp $SOURCE_DIR/plugins/platforms/libev3linuxfb.so root@$EV3_IP:$TARGET_PLUGIN_DIR/