Skip to content

Instantly share code, notes, and snippets.

@Khobalt
Created May 12, 2017 21:39
Show Gist options
  • Save Khobalt/0ba643a31ddbc0f9691f782aae62a1e8 to your computer and use it in GitHub Desktop.
Save Khobalt/0ba643a31ddbc0f9691f782aae62a1e8 to your computer and use it in GitHub Desktop.
This gist demonstrates how to safely move a firmware update file to the root of the card from the pool
msqPort = createObject("roMessagePort")
'Defer the watchdog because the system may be tied up for a little while as the transfer commences
msgPort.DeferWatchdog(120)
newSync = createObject("roSyncSpec")
newSync.readFromFile("path/to/newSyncSpec.xml")
assetCollection = newSync.GetAssets("download")
path$ ="/fwUpdate/path/to/pool"
pool = CreateObject("roAssetPool", path$)
realizer = CreateObject("roAssetRealizer", pool, "/")
event = realizer.Realize(assetCollection)
' check return value
if event.GetEvent() <> m.stateMachine.EVENT_REALIZE_SUCCESS then
print "### Realize failed " + stri(event.GetEvent()) + chr(9) + event.GetName() + chr(9) + event.GetFailureReason()
else
print "Success!"
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment