For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Update firmware

Applies to: Instinct and xSys. Not available on xBud.

The firmware feature performs over-the-air updates and manages boot partitions. It is declared by anthriq-instinct and not by xBud.

Operation
Purpose

get_partitions

List the device's boot partitions

boot_partition

Select the partition to boot from

start_update

Begin an over-the-air update

update_progress

Subscription reporting update phases

Inspect the partitions

The device holds firmware in two partitions and boots from one of them. An update writes to the partition that is not running, so a failed write cannot brick a device that is currently working: the previous image is still intact and bootable.

That is why start_update accepts target: "auto" — it resolves to the inactive partition.

const response = await client.features.executeOperation("firmware", "get_partitions", {});

if (response.success) {
  console.log(response.data);
}
response = await client.execute_operation("firmware", "get_partitions", {})

if response.success:
    print(response.data)

Subscribe before starting

Subscribe to update_progress before calling start_update. The update begins immediately and early phases are missed by a subscription attached afterwards.

const phases = new Set<string>();
let finished = false;
let succeeded = false;

await client.features.subscribeToOperation("firmware", "update_progress", (update) => {
  const details = update?.data ?? {};
  const phase = details.phase ?? details.details?.phase;
  const percent = details.percent ?? details.details?.percent;
  const done = details.done ?? details.details?.done;

  if (phase) {
    phases.add(phase);
    console.log(`${phase} ${percent ?? ""}`);
  }

  if (done === "true") {
    finished = true;
    succeeded = (details.success ?? details.details?.success) === "true";
  }
}, {});
phases = set()
finished = False
succeeded = False

def on_progress(update):
    global finished, succeeded
    details = update.data or {}
    inner = details.get("details", {})
    phase = details.get("phase") or inner.get("phase")
    percent = details.get("percent") or inner.get("percent")
    done = details.get("done") or inner.get("done")

    if phase:
        phases.add(phase)
        print(phase, percent or "")

    if done == "true":
        finished = True
        succeeded = (details.get("success") or inner.get("success")) == "true"

await client.subscribe_to_operation("firmware", "update_progress", on_progress, {})

Note: Progress fields arrive as strings, not numbers or booleans. Compare done and success against "true" rather than testing truthiness, since the string "false" is truthy in JavaScript.

Start the update

Field
Type
Description

filePath

string

Path to the firmware image, readable by the bridge

target

string

Partition to write; "auto" selects the inactive one

The path is resolved by the bridge, not by your process. A path that exists locally but not where the bridge runs fails at transfer.

start_update returns as soon as the update is accepted. Completion arrives through the subscription.

Follow the phases

An update passes through six phases in order:

Phase
Meaning

boot

Preparing the bootloader

root

Establishing the update session

transfer

Sending the image to the device

erase

Erasing the target partition

flash

Writing the image

done

Finished; success reports the outcome

Treat the update as complete only on done, and as successful only when success is "true". Reaching flash is not a result.

Checking for missing phases catches an update that reported done without having written anything, which a success flag alone would not reveal.

Warning: Do not disconnect the device or shut the client down during an update. Interrupting the transfer or flash phase can leave the target partition incomplete and require recovery through the other partition.

Allow enough time

A full update takes several seconds against an emulator and longer against hardware over a real link. Size the wait against the image and the connection rather than the default request timeout, which governs only the start_update acknowledgement.

Select the boot partition

Re-query capabilities after an update that changes what the device supports:

See Read device information.

Next steps

Last updated

Was this helpful?