DfuTarget

DfuTarget — Object representing a DFU-capable target

Functions

Signals

void action-changed Run Last
void percentage-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── DfuTarget

Description

This object allows uploading and downloading an image onto a specific DFU-capable target.

You only need to use this in preference to DfuDevice if you only want to update one target on the device. Most users will want to update all the targets on the device at the same time.

See also: DfuDevice, DfuImage

Functions

dfu_target_get_sectors ()

GPtrArray *
dfu_target_get_sectors (DfuTarget *target);

Gets the sectors exported by the device.

Parameters

target

a GUsbDevice

 

Returns

sectors.

[transfer none][element-type DfuSector]

Since: 0.5.4


dfu_target_get_alt_setting ()

guint8
dfu_target_get_alt_setting (DfuTarget *target);

Gets the alternate setting to use for this interface.

Parameters

target

a DfuTarget

 

Returns

the alternative setting, typically zero

Since: 0.5.4


dfu_target_get_alt_name ()

const gchar *
dfu_target_get_alt_name (DfuTarget *target,
                         GError **error);

Gets the alternate setting name to use for this interface.

Parameters

target

a DfuTarget

 

error

a GError, or NULL

 

Returns

the alternative setting name, typically NULL

Since: 0.5.4


dfu_target_upload ()

DfuImage *
dfu_target_upload (DfuTarget *target,
                   DfuTargetTransferFlags flags,
                   GCancellable *cancellable,
                   GError **error);

Uploads firmware from the target to the host.

Parameters

target

a DfuTarget

 

flags

flags to use, e.g. DFU_TARGET_TRANSFER_FLAG_VERIFY

 

cancellable

a GCancellable, or NULL

 

error

a GError, or NULL

 

Returns

the uploaded image, or NULL for error.

[transfer full]

Since: 0.5.4


dfu_target_download ()

gboolean
dfu_target_download (DfuTarget *target,
                     DfuImage *image,
                     DfuTargetTransferFlags flags,
                     GCancellable *cancellable,
                     GError **error);

Downloads firmware from the host to the target, optionally verifying the transfer.

Parameters

target

a DfuTarget

 

image

a DfuImage

 

flags

flags to use, e.g. DFU_TARGET_TRANSFER_FLAG_VERIFY

 

cancellable

a GCancellable, or NULL

 

error

a GError, or NULL

 

Returns

TRUE for success

Since: 0.5.4


dfu_target_get_cipher_kind ()

DfuCipherKind
dfu_target_get_cipher_kind (DfuTarget *target);

Gets the cipher used for data sent to this interface.

Parameters

target

a DfuTarget

 

Returns

the cipher, typically DFU_CIPHER_KIND_NONE

Since: 0.5.4

Types and Values

DFU_TYPE_TARGET

#define DFU_TYPE_TARGET (dfu_target_get_type ())

struct DfuTargetClass

struct DfuTargetClass {
	GUsbDeviceClass		 parent_class;
	void			(*percentage_changed) (DfuTarget *target,
							 guint		 percentage);
	void			(*action_changed) (DfuTarget *target,
							 DfuAction	 action);
};

enum DfuTargetTransferFlags

The optional flags used for transfering firmware.

Members

DFU_TARGET_TRANSFER_FLAG_NONE

No flags set

 

DFU_TARGET_TRANSFER_FLAG_VERIFY

Verify the download once complete

 

DFU_TARGET_TRANSFER_FLAG_DETACH

If required, detach from runtime mode

 

DFU_TARGET_TRANSFER_FLAG_ATTACH

Attach the device back to runtime after completion

 

DFU_TARGET_TRANSFER_FLAG_WAIT_RUNTIME

Wait for runtime to load after completion

 

DFU_TARGET_TRANSFER_FLAG_WILDCARD_VID

Allow downloading images with wildcard VIDs

 

DFU_TARGET_TRANSFER_FLAG_WILDCARD_PID

Allow downloading images with wildcard PIDs

 

DFU_TARGET_TRANSFER_FLAG_ANY_CIPHER

Allow any cipher kinds to be downloaded

 

DfuTarget

typedef struct _DfuTarget DfuTarget;

Signal Details

The “action-changed” signal

void
user_function (DfuTarget *device,
               guint      action,
               gpointer   user_data)

The ::action-changed signal is emitted when the high level action changes.

Parameters

device

the DfuTarget instance that emitted the signal

 

action

the new DfuAction

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 0.7.5


The “percentage-changed” signal

void
user_function (DfuTarget *device,
               guint      percentage,
               gpointer   user_data)

The ::percentage-changed signal is emitted when the percentage changes.

Parameters

device

the DfuTarget instance that emitted the signal

 

percentage

the new percentage

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 0.5.4