-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added script to wirelessly transfer compiled firmware script #294
base: main
Are you sure you want to change the base?
Conversation
scripts/canflash/cantransfer.sh
Outdated
|
||
# Perform file transfer | ||
echo "Transferring $BIN_FILES files to $PI_USERNAME@$HOST:$DESTINATION_PATH.." | ||
scp -r "$BIN_FILES/*" "$PI_USERNAME@$HOST:$DESTINATION_PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only want to transfer a single binary file, not the whole folder
Changes have been made as requested. Let me know if you need anything else from me. |
@CameronBeneteau can you test this on the Pi? You should be able to transfer a file from your laptop to the Pi with it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file transfer works, but it's not as robust as we would like. Here are a few suggestions that will make it better:
I tested it with the pi and the current behaviour is as follows:
- The command fails when the destination path is a path (since it doesn't exist on the pi)
- The command fails when the destination path is left blank
- If the destination path is a file, the transferred file on the pi is named to this
I would recommend changing it for the following behaviour:
- A blank destination path will transfer the file (with the same name) to the pi's home directory
- A destination path that is a file name (not a directory) will transfer the file with the same name to the pi's home directory
- A destination path that is a directory will transfer the file to the same directory on the pi (this will require calling
mkdir
on the pi before the transfer
If you would like to test your changes and functionality on the pi please send me a message on teams and I can provide you with login information.
A little confused on what you meant by this. If the destination path is a file name is the bin file transferred to the pi's home directory or is a file on the computer with the same name transferred to the home directory? |
scripts/canflash/cantransfer.sh
Outdated
if [ -d "3SM4" ]; then | ||
DESTINATION_PATH=$4 | ||
elif [ -f "3SM4" ]; then | ||
DESTINATION_PATH="/home/$PI_USERNAME" | ||
else | ||
DESTINATION_PATH="/home/$PI_USERNAME" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for home/username
as the script can only transfer files within this directory. There will be a permission error if you try to transfer a file to a directory that isn't under home/username
. For scp
, it is assumed the destination directory is relative to /home/username
.
i.e. sh cantransfer.sh test.txt username IP new-directory
will transfer the file to home/username/new-directory/test.txt
Let's simplify and assume the file will not be renamed on transfer, so the destination path will always be a path. The required behaviour will be reduced to the following:
Please see #294 (comment) about |
After testing the CAN flash transfer with the Pi, it should work as intended. Let me know if anything else is needed from me |
I have added the script for wireless transfer as well as a readme file with instructions.
Please test out the script and let me know if there are any changes to be made.