Recovery mode

This page documents an earlier firmware release. Read this page for the latest release

Check whether the sensor is in recovery mode and why, and boot the installed firmware again. In the WebGUI, see Recovery mode.

The examples use the Python library and sign in with an application key. Replace qb2-xxxxxxxxx with the hostname or IP address of your sensor and application-key-for-qb2-xxxxxxxxx with the secret of your key.

Check if the sensor is in recovery mode

The method Get tells whether the sensor is in recovery mode, and why.

import blickfeld_qb2

def get_recovery_state() -> None:
    # Create token factory using an application key
    token_factory = blickfeld_qb2.TokenFactory(
      application_key_secret="application-key-for-qb2-xxxxxxxxx"
      )

    # Open a secure connection to the sensor
    with blickfeld_qb2.Channel("qb2-xxxxxxxxx", token=token_factory) as channel:
        # Use recovery service
        service = blickfeld_qb2.hardware.services.Recovery(channel)

        # Get the information from the recovery service
        response = service.get()

        # Print the response
        print(response)

get_recovery_state()

Output of a sensor that is not in recovery mode, which has no reason:

RecoveryGetResponse(recovery=Recovery())

In recovery mode, reason is one of the reasons defined in the Recovery object, for example Recovery(reason=2):

Value Reason Next step

1

REASON_BOOT_ATTEMPTS_EXCEEDED

Try to boot the installed firmware again, see Boot the installed firmware again.

2

REASON_FIRMWARE_UPDATE_FAILED

Install a firmware from recovery mode.

Boot the installed firmware again

With the reason REASON_BOOT_ATTEMPTS_EXCEEDED, the method AttemptBoot tries to boot the installed firmware again. With any other reason, the sensor refuses the call with FAILED_PRECONDITION; install a firmware instead.

import blickfeld_qb2

def attempt_boot_from_recovery() -> None:
    # Create token factory using an application key
    token_factory = blickfeld_qb2.TokenFactory(
      application_key_secret="application-key-for-qb2-xxxxxxxxx"
      )

    # Open a secure connection to the sensor
    with blickfeld_qb2.Channel("qb2-xxxxxxxxx", token=token_factory) as channel:
        # Use Recovery service
        service = blickfeld_qb2.hardware.services.Recovery(channel)

        # Call the service to attempt a boot into the existing firmware
        service.attempt_boot()

attempt_boot_from_recovery()