mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 16:11:00 +00:00
trivial: Define the default replug timeout in a central place
Some users were using 2000ms and some the more sane 5000ms.
This commit is contained in:
parent
a6778df664
commit
93a6edf2c6
@ -30,6 +30,8 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define DFU_DEVICE_REPLUG_TIMEOUT 5000 /* ms */
|
||||
|
||||
/**
|
||||
* DfuDeviceQuirks:
|
||||
* @DFU_DEVICE_QUIRK_NONE: No device quirks
|
||||
|
@ -1525,7 +1525,10 @@ dfu_device_upload (DfuDevice *device,
|
||||
/* detach and USB reset */
|
||||
if (!dfu_device_detach (device, NULL, error))
|
||||
return NULL;
|
||||
if (!dfu_device_wait_for_replug (device, 5000, NULL, error))
|
||||
if (!dfu_device_wait_for_replug (device,
|
||||
DFU_DEVICE_REPLUG_TIMEOUT,
|
||||
cancellable,
|
||||
error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1572,7 +1575,10 @@ dfu_device_upload (DfuDevice *device,
|
||||
dfu_device_set_state (device, DFU_STATE_APP_DETACH);
|
||||
|
||||
/* DFU -> APP */
|
||||
if (!dfu_device_wait_for_replug (device, 2000, cancellable, error))
|
||||
if (!dfu_device_wait_for_replug (device,
|
||||
DFU_DEVICE_REPLUG_TIMEOUT,
|
||||
cancellable,
|
||||
error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1678,7 +1684,10 @@ dfu_device_download (DfuDevice *device,
|
||||
g_debug ("detaching");
|
||||
if (!dfu_device_detach (device, NULL, error))
|
||||
return FALSE;
|
||||
if (!dfu_device_wait_for_replug (device, 5000, NULL, error))
|
||||
if (!dfu_device_wait_for_replug (device,
|
||||
DFU_DEVICE_REPLUG_TIMEOUT,
|
||||
NULL,
|
||||
error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1732,7 +1741,10 @@ dfu_device_download (DfuDevice *device,
|
||||
dfu_device_set_state (device, DFU_STATE_APP_DETACH);
|
||||
|
||||
/* DFU -> APP */
|
||||
if (!dfu_device_wait_for_replug (device, 2000, cancellable, error))
|
||||
if (!dfu_device_wait_for_replug (device,
|
||||
DFU_DEVICE_REPLUG_TIMEOUT,
|
||||
cancellable,
|
||||
error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ dfu_colorhug_plus_func (void)
|
||||
g_assert (ret);
|
||||
|
||||
/* wait for it to come back as 273f:1005 */
|
||||
ret = dfu_device_wait_for_replug (device2, 2000, NULL, &error);
|
||||
ret = dfu_device_wait_for_replug (device2, 5000, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret);
|
||||
|
||||
@ -435,7 +435,7 @@ dfu_colorhug_plus_func (void)
|
||||
g_assert (ret);
|
||||
|
||||
/* wait for it to come back as 273f:1004 */
|
||||
ret = dfu_device_wait_for_replug (device, 2000, NULL, &error);
|
||||
ret = dfu_device_wait_for_replug (device, 5000, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (ret);
|
||||
|
||||
|
@ -1092,7 +1092,10 @@ dfu_target_upload (DfuTarget *target,
|
||||
/* boot to runtime */
|
||||
if (flags & DFU_TARGET_TRANSFER_FLAG_BOOT_RUNTIME) {
|
||||
g_debug ("booting to runtime");
|
||||
if (!dfu_device_wait_for_replug (priv->device, 2000, cancellable, error))
|
||||
if (!dfu_device_wait_for_replug (priv->device,
|
||||
DFU_DEVICE_REPLUG_TIMEOUT,
|
||||
cancellable,
|
||||
error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1370,7 +1373,10 @@ dfu_target_download (DfuTarget *target, DfuImage *image,
|
||||
/* boot to runtime */
|
||||
if (flags & DFU_TARGET_TRANSFER_FLAG_BOOT_RUNTIME) {
|
||||
g_debug ("booting to runtime to set auto-boot");
|
||||
if (!dfu_device_wait_for_replug (priv->device, 2000, cancellable, error))
|
||||
if (!dfu_device_wait_for_replug (priv->device,
|
||||
DFU_DEVICE_REPLUG_TIMEOUT,
|
||||
cancellable,
|
||||
error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user