Remote software update

From edgertronic high speed video camera
Jump to navigation Jump to search

Background

The original use model for the edgertronic camera was a laptop connected to the camera. Two nodes on the network with the camera in easy reach. Every design decision was made to simplify using an edgertronic camera with this direct use model in mind.

The image quality, performance, and price have expanded the edgertronic camera to uses where there are many edgertronic cameras all connected to a network, permanently mounted, with the cameras difficult to access. Updating the camera by modifying the contents of the SD card is no longer practical.

At some point in the future, you will be able to update an edgertronic camera through CAMAPI or by using the web browser user interface.

Until then, since the edgertronic camera runs Linux, with all its amazing features and flexibility, there are a variety ways to update the camera over the network.

In summary, you simply need to transfer the software update file on the SD card and then cause the camera to reboot.

FTP

You can establish an ftp session (user: root, no password) with the camera to put the update file in the /mnt/sdcard directory.

To perform an FTP file transfer, you can use a GUI application, like Cyberduck (for OSX or Windows) or PuTTY (for Windows). I use Cyberduck all the time and years ago used PuTTY (when I had to use Windows).

Below is an example command line FTP session run on OSX 10.14.4 (after running brew install inetutils to install an ftp client application).

Commands:

cd /mnt/sdcard
put sanstreak_update.ssc.20190418204022.68.84d05bd9.e863e4.tar
quit

Session transcript (note: my cameras all have DNS assigned names - in this case I am uploading the update file to the camera I named sc3b):

bongo-lx:Downloads tfischer$ ftp sc3b.
Connected to sc3b.
220 Operation successful
Name (sc3b.:tfischer): root
230 Operation successful
ftp> cd /mnt/sdcard
250 Operation successful
ftp> put sanstreak_update.ssc.20190418204022.68.84d05bd9.e863e4.tar
200 Operation successful
150 Ok to send data
226 Operation successful
94362710 bytes sent in 35.5 seconds (2.53 Mbytes/s)
ftp> quit
221 Operation successful

Camera reboot

You can cause the camera to reboot using either the CAMAPI reboot() method or using your web browser fetching the URL:

 http://10.11.12.13/reboot

replacing 10.11.12.13 with your camera's IP address as necessary.

You can also cause the camera to reboot by establishing a telnet session (user: root, no password) and running the command

 reboot

The reboot process causes the camera to look for a [Edgertronic configuration files |long list of files] in the root directory of the SD card and take action based on the files found. On of these files is a properly formed, properly named software update file. If such a file is found in the SD card root directory, a software update will be performed.

Scripting

I wrote a couple of simple remote update scripts.

Shell script

I found ftp-upload command line utility made it easy when combined with the ever popular curl command line utility.

Here is the contents of edgertronic-update.sh:

#!/bin/sh
if [ $# -ne 2 ] ; then
   echo "usage: edgertronic-update.sh <update-file> <camera-ip-address>"
   exit 1
fi
set -x

ftp-upload -d /mnt/sdcard -h $2 $1
curl -m 1 -o /dev/null http://$2/reboot

Example session:

edgertronic-update.sh sanstreak_update.ssc.20191127205203.69.65961d8d.a46f2c.tar 10.11.12.13

+ ftp-upload -d /mnt/sdcard -h 10.11.12.13 sanstreak_update.ssc.20191127205203.69.65961d8d.a46f2c.tar
+ curl -m 1 -o /dev/null http://10.11.12.13/reboot
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
curl: (28) Operation timed out after 1000 milliseconds with 0 bytes received

And the camera then performed the update.

Python

Work in progress.