Update Qt application from USB stick

Hello,

I am working on an embedded device with a Qt application. I want to be able to update the application after production/when it’s in the field.

I am using OpenEmbedded with Qt5.7 on a Colibri iMX6

I was thinking about to following steps:

  1. File on USB stick
  2. Linux detects USB
  3. Linux scans USB for file
  4. updates application

I don’t expect a full solutions, but I wonder if you have any suggestions on how to do this.

Thanks in advance,

Jos

I’ve implemented a similar process using files in a networked folder. I would either create a custom callback (QFileSystemWatcher for example) and add the USB’s directory to the listener, or use one of the existing kernels/libraries which does this for you. Inotify appears to be a good place to start looking.

Thanks, I will have a look at it!

udev scripts can’t run long time , it is problem when you try this method.
You need start new service , this service call your update script

My solution:

  1. Create /lib/systemd/system/x_update.service

[Unit]
Description=UPDATE
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/userr/updateXTERM.sh start

[Install]
WantedBy=basic.target

  1. Modification in /etc/udev/scripts/mount.sh
    In “automount” add test
    “if file exists on USB then:
    – save into /tmp/magic_file location of update file
    – systemctl start x_update”

a) user put USB memory
b) udev call /etc/udev/scripts/mount.sh and “save update location in /tmp/magic_file” and start update service
c) update service call /home/userr/updateXTERM.sh and read location from /tmp/magic_file and kill old version , update files, start new version

Hi @JosB!

I do like this:

  1. On my sdcard from my embedded linux I created two partitions, one for the main Qt application and one with a specific update GUI application.
  2. On my master partition, I have my main application where I have a button for performing the master partition switching.
  3. After that, my application reinitializes the operating system and the update partition is accessed.
  4. At this point, I connect the pendrive and linux mounts to the specific path.
  5. Now my update application can access the mounted path and update the Qt program.
  6. Once the update is complete, the application changes the master partition again and reboots the operating system by accessing the updated Qt application.

NOTE: My update application mounts the main partition in a folder I set. This way I can access the file system stored on that partition.

Anyway, but this was the way I did it.
There may be a better way to do it, and I would love to know it.

hi @matheus_r

Thanks for your Input.

Hi @JosB: Did you try out what @matheus_r suggested?