mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-09 09:55:39 +00:00
dfu: Fix attaching AVR32 devices like the XMEGA
Also, add a self test that uses the XMEGA A3BU XPLAINED board, see https://github.com/hughsie/fwupd-test-firmware/tree/master/AVR/XMEGA-A3BU-XPLAINED-1.23 for more details about how to build the bootloader and firmware.
This commit is contained in:
parent
44e8f5a906
commit
4713f23f7f
@ -85,6 +85,12 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
tests = []
|
tests = []
|
||||||
|
|
||||||
|
# DFU A3BU XPLAINED Mouse
|
||||||
|
test = Test('DfuXmegaA3BU-Xplained', '80478b9a-3643-5e47-ab0f-ed28abe1019d')
|
||||||
|
test.add_file('90c381f1c5932a7f9505372305a615ca000e68df-a3bu-xplained123.cab', '1.23')
|
||||||
|
test.add_file('24d838541efe0340bf67e1cc5a9b95526e4d3702-a3bu-xplained124.cab', '1.24')
|
||||||
|
tests.append(test)
|
||||||
|
|
||||||
# DFU AT90USBKEY Mouse
|
# DFU AT90USBKEY Mouse
|
||||||
test = Test('DfuAT90USBKEY', 'c1874c52-5f6a-5864-926d-ea84bcdc82ea')
|
test = Test('DfuAT90USBKEY', 'c1874c52-5f6a-5864-926d-ea84bcdc82ea')
|
||||||
test.add_file('b6bef375597e848971f230cf992c9740f7bf5b92-at90usbkey123.cab', '1.23')
|
test.add_file('b6bef375597e848971f230cf992c9740f7bf5b92-at90usbkey123.cab', '1.23')
|
||||||
|
@ -110,23 +110,37 @@ dfu_target_avr_mass_erase (DfuTarget *target,
|
|||||||
static gboolean
|
static gboolean
|
||||||
dfu_target_avr_attach (DfuTarget *target, GCancellable *cancellable, GError **error)
|
dfu_target_avr_attach (DfuTarget *target, GCancellable *cancellable, GError **error)
|
||||||
{
|
{
|
||||||
g_autoptr(GBytes) data_in = NULL;
|
|
||||||
guint8 buf[3];
|
guint8 buf[3];
|
||||||
|
g_autoptr(GBytes) data_empty = NULL;
|
||||||
|
g_autoptr(GBytes) data_in = NULL;
|
||||||
g_autoptr(GError) error_local = NULL;
|
g_autoptr(GError) error_local = NULL;
|
||||||
|
|
||||||
/* format buffer */
|
/* format buffer */
|
||||||
buf[0] = DFU_AVR32_GROUP_EXEC;
|
buf[0] = DFU_AVR32_GROUP_EXEC;
|
||||||
buf[1] = DFU_AVR32_CMD_START_APPLI;
|
buf[1] = DFU_AVR32_CMD_START_APPLI;
|
||||||
buf[2] = 0x00;
|
buf[2] = DFU_AVR32_START_APPLI_RESET;
|
||||||
data_in = g_bytes_new_static (buf, sizeof(buf));
|
data_in = g_bytes_new_static (buf, sizeof(buf));
|
||||||
if (!dfu_target_download_chunk (target, 0, data_in, cancellable, &error_local)) {
|
if (!dfu_target_download_chunk (target, 0, data_in, cancellable, &error_local)) {
|
||||||
if (g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED)) {
|
if (g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED)) {
|
||||||
g_debug ("ignoring as device rebooting: %s", error_local->message);
|
g_debug ("ignoring as device rebooting: %s", error_local->message);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
g_prefix_error (error, "cannot attach: ");
|
g_prefix_error (error, "cannot start application reset attach: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* do zero-sized download to initiate the reset */
|
||||||
|
data_empty = g_bytes_new (NULL, 0);
|
||||||
|
if (!dfu_target_download_chunk (target, 0, data_empty, cancellable, &error_local)) {
|
||||||
|
if (g_error_matches (error_local, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED)) {
|
||||||
|
g_debug ("ignoring as device rebooting: %s", error_local->message);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
g_prefix_error (error, "cannot initiate reset for attach: ");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user