mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-24 04:48:51 +00:00
Remove the confusing ALLOW_OFFLINE and ALLOW_ONLINE flags
Over the months the original meaning of ALLOW_OFFLINE and ALLOW_ONLINE have be lost, and there is now a confusing mixture of uses in the source tree. With this commit we make it clear the UPDATABLE flag is used to specify when the device is updatable (e.g. from the desktop live session, or from the systemd offline updates mode, or both) and the NEEDS_REBOOT flag lets us know when the update is actually going to be done. For instance, a UEFI UpdateCapsule can be *scheduled* from either the desktop or from the update mode (but the latter would be a bit weird), but does require a reboot. Some devices might only be updatable outside the live session, for instance a hard drive update or a GPU update -- there's just too much going on with a live session and we want to tightly control what's running during the firmware flash. This also means we don't have to "retry" the update when scheduling an update that really can be scheduled whenever, but just requires a reboot to apply.
This commit is contained in:
parent
e116e2a6a6
commit
a785a1c2f6
@ -108,10 +108,10 @@ fwupd_device_flag_to_string (FwupdDeviceFlags device_flag)
|
|||||||
return "none";
|
return "none";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_INTERNAL)
|
if (device_flag == FWUPD_DEVICE_FLAG_INTERNAL)
|
||||||
return "internal";
|
return "internal";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_ALLOW_ONLINE)
|
if (device_flag == FWUPD_DEVICE_FLAG_UPDATABLE)
|
||||||
return "allow-online";
|
return "updatable";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_ALLOW_OFFLINE)
|
if (device_flag == FWUPD_DEVICE_FLAG_ONLY_OFFLINE)
|
||||||
return "allow-offline";
|
return "only-offline";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_REQUIRE_AC)
|
if (device_flag == FWUPD_DEVICE_FLAG_REQUIRE_AC)
|
||||||
return "require-ac";
|
return "require-ac";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_LOCKED)
|
if (device_flag == FWUPD_DEVICE_FLAG_LOCKED)
|
||||||
@ -122,6 +122,8 @@ fwupd_device_flag_to_string (FwupdDeviceFlags device_flag)
|
|||||||
return "needs-bootloader";
|
return "needs-bootloader";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_REGISTERED)
|
if (device_flag == FWUPD_DEVICE_FLAG_REGISTERED)
|
||||||
return "registered";
|
return "registered";
|
||||||
|
if (device_flag == FWUPD_DEVICE_FLAG_NEEDS_REBOOT)
|
||||||
|
return "needs-reboot";
|
||||||
if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
|
if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
|
||||||
return "unknown";
|
return "unknown";
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -144,10 +146,12 @@ fwupd_device_flag_from_string (const gchar *device_flag)
|
|||||||
return FWUPD_DEVICE_FLAG_NONE;
|
return FWUPD_DEVICE_FLAG_NONE;
|
||||||
if (g_strcmp0 (device_flag, "internal") == 0)
|
if (g_strcmp0 (device_flag, "internal") == 0)
|
||||||
return FWUPD_DEVICE_FLAG_INTERNAL;
|
return FWUPD_DEVICE_FLAG_INTERNAL;
|
||||||
if (g_strcmp0 (device_flag, "allow-online") == 0)
|
if (g_strcmp0 (device_flag, "updatable") == 0 ||
|
||||||
return FWUPD_DEVICE_FLAG_ALLOW_ONLINE;
|
g_strcmp0 (device_flag, "allow-online") == 0)
|
||||||
if (g_strcmp0 (device_flag, "allow-offline") == 0)
|
return FWUPD_DEVICE_FLAG_UPDATABLE;
|
||||||
return FWUPD_DEVICE_FLAG_ALLOW_OFFLINE;
|
if (g_strcmp0 (device_flag, "only-offline") == 0 ||
|
||||||
|
g_strcmp0 (device_flag, "allow-offline") == 0)
|
||||||
|
return FWUPD_DEVICE_FLAG_ONLY_OFFLINE;
|
||||||
if (g_strcmp0 (device_flag, "require-ac") == 0)
|
if (g_strcmp0 (device_flag, "require-ac") == 0)
|
||||||
return FWUPD_DEVICE_FLAG_REQUIRE_AC;
|
return FWUPD_DEVICE_FLAG_REQUIRE_AC;
|
||||||
if (g_strcmp0 (device_flag, "locked") == 0)
|
if (g_strcmp0 (device_flag, "locked") == 0)
|
||||||
@ -158,6 +162,8 @@ fwupd_device_flag_from_string (const gchar *device_flag)
|
|||||||
return FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER;
|
return FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER;
|
||||||
if (g_strcmp0 (device_flag, "registered") == 0)
|
if (g_strcmp0 (device_flag, "registered") == 0)
|
||||||
return FWUPD_DEVICE_FLAG_REGISTERED;
|
return FWUPD_DEVICE_FLAG_REGISTERED;
|
||||||
|
if (g_strcmp0 (device_flag, "needs-reboot") == 0)
|
||||||
|
return FWUPD_DEVICE_FLAG_NEEDS_REBOOT;
|
||||||
return FWUPD_DEVICE_FLAG_UNKNOWN;
|
return FWUPD_DEVICE_FLAG_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,13 +72,14 @@ typedef enum {
|
|||||||
* FwupdDeviceFlags:
|
* FwupdDeviceFlags:
|
||||||
* @FWUPD_DEVICE_FLAG_NONE: No flags set
|
* @FWUPD_DEVICE_FLAG_NONE: No flags set
|
||||||
* @FWUPD_DEVICE_FLAG_INTERNAL: Device cannot be removed easily
|
* @FWUPD_DEVICE_FLAG_INTERNAL: Device cannot be removed easily
|
||||||
* @FWUPD_DEVICE_FLAG_ALLOW_ONLINE: Is capable of 'live' updating
|
* @FWUPD_DEVICE_FLAG_UPDATABLE: Device is updatable
|
||||||
* @FWUPD_DEVICE_FLAG_ALLOW_OFFLINE: Is capable of 'offline' updating
|
* @FWUPD_DEVICE_FLAG_ONLY_OFFLINE: Update can only be done from offline mode
|
||||||
* @FWUPD_DEVICE_FLAG_REQUIRE_AC: Requires AC power
|
* @FWUPD_DEVICE_FLAG_REQUIRE_AC: Requires AC power
|
||||||
* @FWUPD_DEVICE_FLAG_LOCKED: Is locked and can be unlocked
|
* @FWUPD_DEVICE_FLAG_LOCKED: Is locked and can be unlocked
|
||||||
* @FWUPD_DEVICE_FLAG_SUPPORTED: Is found in current metadata
|
* @FWUPD_DEVICE_FLAG_SUPPORTED: Is found in current metadata
|
||||||
* @FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER: Requires a bootloader mode
|
* @FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER: Requires a bootloader mode
|
||||||
* @FWUPD_DEVICE_FLAG_REGISTERED: Has been registered with other plugins
|
* @FWUPD_DEVICE_FLAG_REGISTERED: Has been registered with other plugins
|
||||||
|
* @FWUPD_DEVICE_FLAG_NEEDS_REBOOT: Requires a reboot to apply firmware or to reload hardware
|
||||||
*
|
*
|
||||||
* FIXME: rename FU_DEVICE_ -> FWUPD_DEVICE_ when we break API
|
* FIXME: rename FU_DEVICE_ -> FWUPD_DEVICE_ when we break API
|
||||||
*
|
*
|
||||||
@ -86,31 +87,34 @@ typedef enum {
|
|||||||
**/
|
**/
|
||||||
#define FWUPD_DEVICE_FLAG_NONE (0u) /* Since: 0.1.3 */
|
#define FWUPD_DEVICE_FLAG_NONE (0u) /* Since: 0.1.3 */
|
||||||
#define FWUPD_DEVICE_FLAG_INTERNAL (1u << 0) /* Since: 0.1.3 */
|
#define FWUPD_DEVICE_FLAG_INTERNAL (1u << 0) /* Since: 0.1.3 */
|
||||||
#define FWUPD_DEVICE_FLAG_ALLOW_ONLINE (1u << 1) /* Since: 0.1.3 */
|
#define FWUPD_DEVICE_FLAG_UPDATABLE (1u << 1) /* Since: 0.9.7 */
|
||||||
#define FWUPD_DEVICE_FLAG_ALLOW_OFFLINE (1u << 2) /* Since: 0.1.3 */
|
#define FWUPD_DEVICE_FLAG_ONLY_OFFLINE (1u << 2) /* Since: 0.9.7 */
|
||||||
#define FWUPD_DEVICE_FLAG_REQUIRE_AC (1u << 3) /* Since: 0.6.3 */
|
#define FWUPD_DEVICE_FLAG_REQUIRE_AC (1u << 3) /* Since: 0.6.3 */
|
||||||
#define FWUPD_DEVICE_FLAG_LOCKED (1u << 4) /* Since: 0.6.3 */
|
#define FWUPD_DEVICE_FLAG_LOCKED (1u << 4) /* Since: 0.6.3 */
|
||||||
#define FWUPD_DEVICE_FLAG_SUPPORTED (1u << 5) /* Since: 0.7.1 */
|
#define FWUPD_DEVICE_FLAG_SUPPORTED (1u << 5) /* Since: 0.7.1 */
|
||||||
#define FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER (1u << 6) /* Since: 0.7.3 */
|
#define FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER (1u << 6) /* Since: 0.7.3 */
|
||||||
#define FWUPD_DEVICE_FLAG_REGISTERED (1u << 7) /* Since: 0.9.7 */
|
#define FWUPD_DEVICE_FLAG_REGISTERED (1u << 7) /* Since: 0.9.7 */
|
||||||
|
#define FWUPD_DEVICE_FLAG_NEEDS_REBOOT (1u << 8) /* Since: 0.9.7 */
|
||||||
#define FWUPD_DEVICE_FLAG_UNKNOWN G_MAXUINT64 /* Since: 0.7.3 */
|
#define FWUPD_DEVICE_FLAG_UNKNOWN G_MAXUINT64 /* Since: 0.7.3 */
|
||||||
typedef guint64 FwupdDeviceFlags;
|
typedef guint64 FwupdDeviceFlags;
|
||||||
|
|
||||||
/* deprecated names */
|
/* deprecated names */
|
||||||
#define FU_DEVICE_FLAG_NONE FWUPD_DEVICE_FLAG_NONE
|
#define FU_DEVICE_FLAG_NONE FWUPD_DEVICE_FLAG_NONE
|
||||||
#define FU_DEVICE_FLAG_INTERNAL FWUPD_DEVICE_FLAG_INTERNAL
|
#define FU_DEVICE_FLAG_INTERNAL FWUPD_DEVICE_FLAG_INTERNAL
|
||||||
#define FU_DEVICE_FLAG_ALLOW_ONLINE FWUPD_DEVICE_FLAG_ALLOW_ONLINE
|
#define FU_DEVICE_FLAG_ALLOW_ONLINE FWUPD_DEVICE_FLAG_UPDATABLE
|
||||||
#define FU_DEVICE_FLAG_ALLOW_OFFLINE FWUPD_DEVICE_FLAG_ALLOW_OFFLINE
|
#define FU_DEVICE_FLAG_ALLOW_OFFLINE FWUPD_DEVICE_FLAG_ONLY_OFFLINE
|
||||||
#define FU_DEVICE_FLAG_REQUIRE_AC FWUPD_DEVICE_FLAG_REQUIRE_AC
|
#define FU_DEVICE_FLAG_REQUIRE_AC FWUPD_DEVICE_FLAG_REQUIRE_AC
|
||||||
#define FU_DEVICE_FLAG_LOCKED FWUPD_DEVICE_FLAG_LOCKED
|
#define FU_DEVICE_FLAG_LOCKED FWUPD_DEVICE_FLAG_LOCKED
|
||||||
#define FU_DEVICE_FLAG_SUPPORTED FWUPD_DEVICE_FLAG_SUPPORTED
|
#define FU_DEVICE_FLAG_SUPPORTED FWUPD_DEVICE_FLAG_SUPPORTED
|
||||||
#define FU_DEVICE_FLAG_NEEDS_BOOTLOADER FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER
|
#define FU_DEVICE_FLAG_NEEDS_BOOTLOADER FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER
|
||||||
#define FU_DEVICE_FLAG_UNKNOWN FWUPD_DEVICE_FLAG_UNKNOWN
|
#define FU_DEVICE_FLAG_UNKNOWN FWUPD_DEVICE_FLAG_UNKNOWN
|
||||||
|
#define FWUPD_DEVICE_FLAG_ALLOW_ONLINE FWUPD_DEVICE_FLAG_UPDATABLE
|
||||||
|
#define FWUPD_DEVICE_FLAG_ALLOW_OFFLINE FWUPD_DEVICE_FLAG_ONLY_OFFLINE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FwupdInstallFlags:
|
* FwupdInstallFlags:
|
||||||
* @FWUPD_INSTALL_FLAG_NONE: No flags set
|
* @FWUPD_INSTALL_FLAG_NONE: No flags set
|
||||||
* @FWUPD_INSTALL_FLAG_OFFLINE: Perform this offline
|
* @FWUPD_INSTALL_FLAG_OFFLINE: Schedule this for next boot
|
||||||
* @FWUPD_INSTALL_FLAG_ALLOW_REINSTALL: Allow reinstalling the same version
|
* @FWUPD_INSTALL_FLAG_ALLOW_REINSTALL: Allow reinstalling the same version
|
||||||
* @FWUPD_INSTALL_FLAG_ALLOW_OLDER: Allow downgrading firmware
|
* @FWUPD_INSTALL_FLAG_ALLOW_OLDER: Allow downgrading firmware
|
||||||
*
|
*
|
||||||
|
@ -188,7 +188,7 @@ fwupd_result_func (void)
|
|||||||
dev = fwupd_result_get_device (result);
|
dev = fwupd_result_get_device (result);
|
||||||
fwupd_device_add_checksum (dev, "beefdead");
|
fwupd_device_add_checksum (dev, "beefdead");
|
||||||
fwupd_device_set_created (dev, 1);
|
fwupd_device_set_created (dev, 1);
|
||||||
fwupd_device_set_flags (dev, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
fwupd_device_set_flags (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fwupd_device_set_id (dev, "USB:foo");
|
fwupd_device_set_id (dev, "USB:foo");
|
||||||
fwupd_device_set_modified (dev, 60 * 60 * 24);
|
fwupd_device_set_modified (dev, 60 * 60 * 24);
|
||||||
fwupd_device_set_name (dev, "ColorHug2");
|
fwupd_device_set_name (dev, "ColorHug2");
|
||||||
@ -218,7 +218,7 @@ fwupd_result_func (void)
|
|||||||
" DeviceID: USB:foo\n"
|
" DeviceID: USB:foo\n"
|
||||||
" Guid: 2082b5e0-7a64-478a-b1b2-e3404fab6dad\n"
|
" Guid: 2082b5e0-7a64-478a-b1b2-e3404fab6dad\n"
|
||||||
" Guid: 00000000-0000-0000-0000-000000000000\n"
|
" Guid: 00000000-0000-0000-0000-000000000000\n"
|
||||||
" Flags: allow-offline|require-ac\n"
|
" Flags: updatable|require-ac\n"
|
||||||
" FirmwareHash: SHA1(beefdead)\n"
|
" FirmwareHash: SHA1(beefdead)\n"
|
||||||
" Created: 1970-01-01\n"
|
" Created: 1970-01-01\n"
|
||||||
" Modified: 1970-01-02\n"
|
" Modified: 1970-01-02\n"
|
||||||
|
@ -127,11 +127,11 @@ fu_plugin_verify (FuPlugin *plugin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *dev,
|
FuDevice *dev,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
fu_plugin_set_status (plugin, FWUPD_STATUS_DEVICE_WRITE);
|
fu_plugin_set_status (plugin, FWUPD_STATUS_DEVICE_WRITE);
|
||||||
if (!fu_device_altos_write_firmware (FU_DEVICE_ALTOS (dev),
|
if (!fu_device_altos_write_firmware (FU_DEVICE_ALTOS (dev),
|
||||||
|
@ -225,11 +225,11 @@ fu_plugin_verify (FuPlugin *plugin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *device,
|
FuDevice *device,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
FuPluginItem *item;
|
FuPluginItem *item;
|
||||||
@ -444,8 +444,7 @@ fu_plugin_colorhug_device_added_cb (GUsbContext *ctx,
|
|||||||
fu_device_set_equivalent_id (item->device,
|
fu_device_set_equivalent_id (item->device,
|
||||||
g_usb_device_get_platform_id (device));
|
g_usb_device_get_platform_id (device));
|
||||||
fu_device_add_guid (item->device, ch_device_get_guid (device));
|
fu_device_add_guid (item->device, ch_device_get_guid (device));
|
||||||
fu_device_add_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
fu_device_add_flag (item->device, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_add_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
|
||||||
|
|
||||||
/* try to get the serial number -- if opening failed then
|
/* try to get the serial number -- if opening failed then
|
||||||
* poll until the device is not busy */
|
* poll until the device is not busy */
|
||||||
|
@ -258,9 +258,10 @@ fu_plugin_dock_node (FuPlugin *plugin, GUsbDevice *device,
|
|||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
||||||
if (version != NULL) {
|
if (version != NULL) {
|
||||||
fu_device_set_version (dev, version);
|
fu_device_set_version (dev, version);
|
||||||
if (fu_plugin_dell_capsule_supported (plugin))
|
if (fu_plugin_dell_capsule_supported (plugin)) {
|
||||||
fu_device_add_flag (dev,
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fu_plugin_device_add (plugin, dev);
|
fu_plugin_device_add (plugin, dev);
|
||||||
@ -605,8 +606,10 @@ fu_plugin_dell_detect_tpm (FuPlugin *plugin, GError **error)
|
|||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
||||||
if (out->flashes_left > 0) {
|
if (out->flashes_left > 0) {
|
||||||
if (fu_plugin_dell_capsule_supported (plugin))
|
if (fu_plugin_dell_capsule_supported (plugin)) {
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
|
||||||
|
}
|
||||||
fu_device_set_flashes_left (dev, out->flashes_left);
|
fu_device_set_flashes_left (dev, out->flashes_left);
|
||||||
}
|
}
|
||||||
fu_plugin_device_add (plugin, dev);
|
fu_plugin_device_add (plugin, dev);
|
||||||
@ -687,7 +690,7 @@ fu_plugin_unlock (FuPlugin *plugin, FuDevice *device, GError **error)
|
|||||||
/* clone the info from real device but prevent it from being flashed */
|
/* clone the info from real device but prevent it from being flashed */
|
||||||
device_flags_alt = fu_device_get_flags (device_alt);
|
device_flags_alt = fu_device_get_flags (device_alt);
|
||||||
fu_device_set_flags (device, device_flags_alt);
|
fu_device_set_flags (device, device_flags_alt);
|
||||||
fu_device_set_flags (device_alt, device_flags_alt & ~FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
fu_device_set_flags (device_alt, device_flags_alt & ~FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
|
|
||||||
/* make sure that this unlocked device can be updated */
|
/* make sure that this unlocked device can be updated */
|
||||||
fu_device_set_version (device, "0.0.0.0");
|
fu_device_set_version (device, "0.0.0.0");
|
||||||
@ -696,11 +699,11 @@ fu_plugin_unlock (FuPlugin *plugin, FuDevice *device, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_offline (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *device,
|
FuDevice *device,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
g_autoptr (fwup_resource_iter) iter = NULL;
|
g_autoptr (fwup_resource_iter) iter = NULL;
|
||||||
|
@ -106,7 +106,7 @@ fu_plugin_dell_tpm_func (void)
|
|||||||
|
|
||||||
/* make sure not allowed to flash 1.2 */
|
/* make sure not allowed to flash 1.2 */
|
||||||
flags = fu_device_get_flags (device_alt);
|
flags = fu_device_get_flags (device_alt);
|
||||||
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, !=, 1);
|
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_UPDATABLE, !=, 1);
|
||||||
|
|
||||||
/* try to unlock 2.0 */
|
/* try to unlock 2.0 */
|
||||||
ret = fu_plugin_runner_unlock (plugin, device, &error);
|
ret = fu_plugin_runner_unlock (plugin, device, &error);
|
||||||
@ -138,7 +138,7 @@ fu_plugin_dell_tpm_func (void)
|
|||||||
|
|
||||||
/* make sure allowed to flash 1.2 */
|
/* make sure allowed to flash 1.2 */
|
||||||
flags = fu_device_get_flags (device_alt);
|
flags = fu_device_get_flags (device_alt);
|
||||||
g_assert_cmpint(flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, >, 0);
|
g_assert_cmpint(flags & FWUPD_DEVICE_FLAG_UPDATABLE, >, 0);
|
||||||
|
|
||||||
/* try to unlock 2.0 */
|
/* try to unlock 2.0 */
|
||||||
ret = fu_plugin_runner_unlock (plugin, device, &error);
|
ret = fu_plugin_runner_unlock (plugin, device, &error);
|
||||||
@ -170,9 +170,9 @@ fu_plugin_dell_tpm_func (void)
|
|||||||
|
|
||||||
/* make sure allowed to flash 1.2 but not 2.0 */
|
/* make sure allowed to flash 1.2 but not 2.0 */
|
||||||
flags = fu_device_get_flags (device_alt);
|
flags = fu_device_get_flags (device_alt);
|
||||||
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, >, 0);
|
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_UPDATABLE, >, 0);
|
||||||
flags = fu_device_get_flags (device);
|
flags = fu_device_get_flags (device);
|
||||||
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, ==, 0);
|
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_UPDATABLE, ==, 0);
|
||||||
|
|
||||||
/* try to unlock 2.0 */
|
/* try to unlock 2.0 */
|
||||||
ret = fu_plugin_runner_unlock (plugin, device, &error);
|
ret = fu_plugin_runner_unlock (plugin, device, &error);
|
||||||
@ -181,9 +181,9 @@ fu_plugin_dell_tpm_func (void)
|
|||||||
|
|
||||||
/* make sure no longer allowed to flash 1.2 but can flash 2.0 */
|
/* make sure no longer allowed to flash 1.2 but can flash 2.0 */
|
||||||
flags = fu_device_get_flags (device_alt);
|
flags = fu_device_get_flags (device_alt);
|
||||||
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, ==, 0);
|
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_UPDATABLE, ==, 0);
|
||||||
flags = fu_device_get_flags (device);
|
flags = fu_device_get_flags (device);
|
||||||
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, >, 0);
|
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_UPDATABLE, >, 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
fu_plugin_device_remove (plugin, device_alt);
|
fu_plugin_device_remove (plugin, device_alt);
|
||||||
@ -209,21 +209,20 @@ fu_plugin_dell_tpm_func (void)
|
|||||||
|
|
||||||
/* make sure allowed to flash 2.0 but not 1.2 */
|
/* make sure allowed to flash 2.0 but not 1.2 */
|
||||||
flags = fu_device_get_flags (device_alt);
|
flags = fu_device_get_flags (device_alt);
|
||||||
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, >, 0);
|
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_UPDATABLE, >, 0);
|
||||||
flags = fu_device_get_flags (device);
|
flags = fu_device_get_flags (device);
|
||||||
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_ALLOW_OFFLINE, ==, 0);
|
g_assert_cmpint (flags & FWUPD_DEVICE_FLAG_UPDATABLE, ==, 0);
|
||||||
|
|
||||||
/* With one flash left we need an override */
|
/* With one flash left we need an override */
|
||||||
ret = fu_plugin_runner_update (plugin, device_alt, NULL, NULL,
|
ret = fu_plugin_runner_update (plugin, device_alt, NULL, NULL,
|
||||||
FWUPD_INSTALL_FLAG_OFFLINE, &error);
|
FWUPD_INSTALL_FLAG_NONE, &error);
|
||||||
g_assert (!ret);
|
g_assert (!ret);
|
||||||
g_assert_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED);
|
g_assert_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
|
||||||
/* test override */
|
/* test override */
|
||||||
ret = fu_plugin_runner_update (plugin, device_alt, NULL, NULL,
|
ret = fu_plugin_runner_update (plugin, device_alt, NULL, NULL,
|
||||||
FWUPD_INSTALL_FLAG_FORCE |
|
FWUPD_INSTALL_FLAG_FORCE, &error);
|
||||||
FWUPD_INSTALL_FLAG_OFFLINE, &error);
|
|
||||||
g_assert (ret);
|
g_assert (ret);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
|
@ -56,10 +56,8 @@ fu_plugin_dfu_device_update (FuPlugin *plugin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check capabilities */
|
/* check capabilities */
|
||||||
if (dfu_device_can_download (device)) {
|
if (dfu_device_can_download (device))
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* needs a manual action */
|
/* needs a manual action */
|
||||||
if (dfu_device_has_quirk (device, DFU_DEVICE_QUIRK_NO_DFU_RUNTIME)) {
|
if (dfu_device_has_quirk (device, DFU_DEVICE_QUIRK_NO_DFU_RUNTIME)) {
|
||||||
@ -212,11 +210,11 @@ fu_plugin_dfu_percentage_changed_cb (DfuDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *dev,
|
FuDevice *dev,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
DfuDevice *device;
|
DfuDevice *device;
|
||||||
|
@ -102,11 +102,11 @@ ebitdo_write_progress_cb (goffset current, goffset total, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *dev,
|
FuDevice *dev,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GUsbContext *usb_ctx = fu_plugin_get_usb_context (plugin);
|
GUsbContext *usb_ctx = fu_plugin_get_usb_context (plugin);
|
||||||
const gchar *platform_id;
|
const gchar *platform_id;
|
||||||
|
@ -142,11 +142,11 @@ fu_plugin_raspberrypi_parse_firmware (FuDevice *device, const gchar *fn, GError
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *device,
|
FuDevice *device,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
g_autofree gchar *fwfn = NULL;
|
g_autofree gchar *fwfn = NULL;
|
||||||
@ -220,8 +220,7 @@ fu_plugin_coldplug (FuPlugin *plugin, GError **error)
|
|||||||
fu_device_add_guid (device, "raspberrypi");
|
fu_device_add_guid (device, "raspberrypi");
|
||||||
fu_device_set_name (device, "Raspberry Pi");
|
fu_device_set_name (device, "Raspberry Pi");
|
||||||
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_INTERNAL);
|
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_INTERNAL);
|
||||||
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
|
||||||
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
||||||
|
|
||||||
/* get the VC build info */
|
/* get the VC build info */
|
||||||
|
@ -110,7 +110,7 @@ fu_plugin_synaptics_add_device (FuPlugin *plugin,
|
|||||||
/* create the device */
|
/* create the device */
|
||||||
dev = fu_device_new ();
|
dev = fu_device_new ();
|
||||||
fu_device_set_id (dev, dev_id_str);
|
fu_device_set_id (dev, dev_id_str);
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_set_name (dev, name);
|
fu_device_set_name (dev, name);
|
||||||
fu_device_set_version (dev, synapticsmst_device_get_version (device));
|
fu_device_set_version (dev, synapticsmst_device_get_version (device));
|
||||||
fu_device_add_guid (dev, guid_str);
|
fu_device_add_guid (dev, guid_str);
|
||||||
@ -281,11 +281,11 @@ fu_synapticsmst_write_progress_cb (goffset current, goffset total, gpointer user
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *dev,
|
FuDevice *dev,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_autoptr(SynapticsMSTDevice) device = NULL;
|
g_autoptr(SynapticsMSTDevice) device = NULL;
|
||||||
const gchar *device_id;
|
const gchar *device_id;
|
||||||
|
@ -64,7 +64,7 @@ fu_plugin_coldplug (FuPlugin *plugin, GError **error)
|
|||||||
fu_device_set_id (device, "FakeDevice");
|
fu_device_set_id (device, "FakeDevice");
|
||||||
fu_device_add_guid (device, "b585990a-003e-5270-89d5-3705a17f9a43");
|
fu_device_add_guid (device, "b585990a-003e-5270-89d5-3705a17f9a43");
|
||||||
fu_device_set_name (device, "Integrated_Webcam(TM)");
|
fu_device_set_name (device, "Integrated_Webcam(TM)");
|
||||||
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_set_description (device, "A fake webcam");
|
fu_device_set_description (device, "A fake webcam");
|
||||||
fu_device_set_vendor (device, "ACME Corp.");
|
fu_device_set_vendor (device, "ACME Corp.");
|
||||||
fu_device_set_vendor_id (device, "USB:0x046D");
|
fu_device_set_vendor_id (device, "USB:0x046D");
|
||||||
@ -113,18 +113,12 @@ fu_plugin_verify (FuPlugin *plugin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *device,
|
FuDevice *device,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (flags & FWUPD_INSTALL_FLAG_OFFLINE) {
|
|
||||||
g_set_error_literal (error,
|
|
||||||
FWUPD_ERROR,
|
|
||||||
FWUPD_ERROR_INTERNAL,
|
|
||||||
"cannot handle offline");
|
|
||||||
}
|
|
||||||
fu_plugin_set_status (plugin, FWUPD_STATUS_DECOMPRESSING);
|
fu_plugin_set_status (plugin, FWUPD_STATUS_DECOMPRESSING);
|
||||||
for (guint i = 1; i <= 100; i++) {
|
for (guint i = 1; i <= 100; i++) {
|
||||||
g_usleep (1000);
|
g_usleep (1000);
|
||||||
|
@ -237,7 +237,7 @@ fu_plugin_thunderbolt_add (FuPlugin *plugin, GUdevDevice *device)
|
|||||||
fu_device_add_guid (dev, device_id);
|
fu_device_add_guid (dev, device_id);
|
||||||
if (version != NULL)
|
if (version != NULL)
|
||||||
fu_device_set_version (dev, version);
|
fu_device_set_version (dev, version);
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
if (is_host)
|
if (is_host)
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
|
||||||
if (is_safemode)
|
if (is_safemode)
|
||||||
@ -710,11 +710,11 @@ fu_plugin_coldplug (FuPlugin *plugin, GError **error)
|
|||||||
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *dev,
|
FuDevice *dev,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
const gchar *devpath;
|
const gchar *devpath;
|
||||||
|
@ -170,11 +170,11 @@ fu_plugin_get_results (FuPlugin *plugin, FuDevice *device, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_offline (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *device,
|
FuDevice *device,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) error_local = NULL;
|
g_autoptr(GError) error_local = NULL;
|
||||||
fwup_resource *re = NULL;
|
fwup_resource *re = NULL;
|
||||||
@ -336,7 +336,7 @@ fu_plugin_coldplug (FuPlugin *plugin, GError **error)
|
|||||||
fu_device_set_id (dev, "UEFI-dummy-dev0");
|
fu_device_set_id (dev, "UEFI-dummy-dev0");
|
||||||
fu_device_add_guid (dev, "2d47f29b-83a2-4f31-a2e8-63474f4d4c2e");
|
fu_device_add_guid (dev, "2d47f29b-83a2-4f31-a2e8-63474f4d4c2e");
|
||||||
fu_device_set_version (dev, "0");
|
fu_device_set_version (dev, "0");
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_LOCKED);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_LOCKED);
|
||||||
fu_plugin_device_add (plugin, dev);
|
fu_plugin_device_add (plugin, dev);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -405,10 +405,12 @@ fu_plugin_coldplug (FuPlugin *plugin, GError **error)
|
|||||||
}
|
}
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
|
||||||
if (g_file_test ("/sys/firmware/efi/efivars", G_FILE_TEST_IS_DIR) ||
|
if (g_file_test ("/sys/firmware/efi/efivars", G_FILE_TEST_IS_DIR) ||
|
||||||
g_file_test ("/sys/firmware/efi/vars", G_FILE_TEST_IS_DIR))
|
g_file_test ("/sys/firmware/efi/vars", G_FILE_TEST_IS_DIR)) {
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
else
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
|
||||||
|
} else {
|
||||||
g_warning ("Kernel support for EFI variables missing");
|
g_warning ("Kernel support for EFI variables missing");
|
||||||
|
}
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
|
||||||
fu_plugin_device_add (plugin, dev);
|
fu_plugin_device_add (plugin, dev);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ fu_plugin_unifying_device_added (FuPlugin *plugin,
|
|||||||
/* create new FuDevice */
|
/* create new FuDevice */
|
||||||
dev = fu_device_new ();
|
dev = fu_device_new ();
|
||||||
if (lu_device_has_flag (device, LU_DEVICE_FLAG_CAN_FLASH))
|
if (lu_device_has_flag (device, LU_DEVICE_FLAG_CAN_FLASH))
|
||||||
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_ONLINE);
|
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||||
fu_device_set_id (dev, lu_device_get_platform_id (device));
|
fu_device_set_id (dev, lu_device_get_platform_id (device));
|
||||||
fu_device_set_name (dev, lu_device_get_product (device));
|
fu_device_set_name (dev, lu_device_get_product (device));
|
||||||
fu_device_set_vendor (dev, lu_device_get_vendor (device));
|
fu_device_set_vendor (dev, lu_device_get_vendor (device));
|
||||||
@ -140,11 +140,11 @@ fu_plugin_unifying_attach_cb (gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_update_online (FuPlugin *plugin,
|
fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *dev,
|
FuDevice *dev,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
g_autoptr(LuDevice) device = NULL;
|
g_autoptr(LuDevice) device = NULL;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Richard Hughes <richard@hughsie.com>
|
* Copyright (C) 2015-2017 Richard Hughes <richard@hughsie.com>
|
||||||
*
|
*
|
||||||
* Licensed under the GNU General Public License Version 2
|
* Licensed under the GNU General Public License Version 2
|
||||||
*
|
*
|
||||||
|
@ -905,7 +905,7 @@ fu_engine_get_item_by_wildcard (FuEngine *self, AsStore *store, GError **error)
|
|||||||
* @device_id: A device ID
|
* @device_id: A device ID
|
||||||
* @store: The #AsStore with the firmware metadata
|
* @store: The #AsStore with the firmware metadata
|
||||||
* @blob_cab: The #GBytes of the .cab file
|
* @blob_cab: The #GBytes of the .cab file
|
||||||
* @flags: The #FwupdInstallFlags, e.g. %FWUPD_DEVICE_FLAG_ALLOW_ONLINE
|
* @flags: The #FwupdInstallFlags, e.g. %FWUPD_DEVICE_FLAG_UPDATABLE
|
||||||
* @error: A #GError, or %NULL
|
* @error: A #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Installs a specfic firmware file on a device.
|
* Installs a specfic firmware file on a device.
|
||||||
@ -960,8 +960,7 @@ fu_engine_install (FuEngine *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* no update abilities */
|
/* no update abilities */
|
||||||
if (!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE) &&
|
if (!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_UPDATABLE)) {
|
||||||
!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_ONLINE)) {
|
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
FWUPD_ERROR_INTERNAL,
|
FWUPD_ERROR_INTERNAL,
|
||||||
@ -970,24 +969,14 @@ fu_engine_install (FuEngine *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called with online update, test if device is supposed to allow this */
|
|
||||||
if (!(flags & FWUPD_INSTALL_FLAG_OFFLINE) &&
|
|
||||||
!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_ONLINE)) {
|
|
||||||
g_set_error(error,
|
|
||||||
FWUPD_ERROR,
|
|
||||||
FWUPD_ERROR_NOT_SUPPORTED,
|
|
||||||
"Device %s does not allow online updates",
|
|
||||||
device_id);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called with offline update, test if device is supposed to allow this */
|
/* called with online update, test if device is supposed to allow this */
|
||||||
if (flags & FWUPD_INSTALL_FLAG_OFFLINE &&
|
if ((flags & FWUPD_INSTALL_FLAG_OFFLINE) == 0 &&
|
||||||
!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE)) {
|
fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_ONLY_OFFLINE)) {
|
||||||
g_set_error(error,
|
g_set_error(error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
FWUPD_ERROR_NOT_SUPPORTED,
|
FWUPD_ERROR_NOT_SUPPORTED,
|
||||||
"Device %s does not allow offline updates",
|
"Device %s only allows offline updates",
|
||||||
device_id);
|
device_id);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1243,7 +1232,7 @@ fu_engine_get_item_by_id_fallback_pending (FuEngine *self, const gchar *id, GErr
|
|||||||
* @self: A #FuEngine
|
* @self: A #FuEngine
|
||||||
* @device_id: A device ID
|
* @device_id: A device ID
|
||||||
* @store: The #AsStore with the firmware metadata
|
* @store: The #AsStore with the firmware metadata
|
||||||
* @flags: The #FwupdInstallFlags, e.g. %FWUPD_DEVICE_FLAG_ALLOW_ONLINE
|
* @flags: The #FwupdInstallFlags, e.g. %FWUPD_DEVICE_FLAG_UPDATABLE
|
||||||
* @error: A #GError, or %NULL
|
* @error: A #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Gets the PolicyKit action ID to use for the install operation.
|
* Gets the PolicyKit action ID to use for the install operation.
|
||||||
@ -1665,9 +1654,8 @@ fu_engine_get_updates_item_update (FuEngine *self, FuDeviceItem *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* only show devices that can be updated */
|
/* only show devices that can be updated */
|
||||||
if (!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE) &&
|
if (!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_UPDATABLE)) {
|
||||||
!fu_device_has_flag (item->device, FWUPD_DEVICE_FLAG_ALLOW_ONLINE)) {
|
g_debug ("ignoring %s [%s] as not updatable",
|
||||||
g_debug ("ignoring %s [%s] as not updatable live or offline",
|
|
||||||
fu_device_get_id (item->device),
|
fu_device_get_id (item->device),
|
||||||
fu_device_get_name (item->device));
|
fu_device_get_name (item->device));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Richard Hughes <richard@hughsie.com>
|
* Copyright (C) 2016-2017 Richard Hughes <richard@hughsie.com>
|
||||||
*
|
*
|
||||||
* Licensed under the GNU General Public License Version 2
|
* Licensed under the GNU General Public License Version 2
|
||||||
*
|
*
|
||||||
@ -37,12 +37,7 @@ gboolean fu_plugin_coldplug_prepare (FuPlugin *plugin,
|
|||||||
GError **error);
|
GError **error);
|
||||||
gboolean fu_plugin_coldplug_cleanup (FuPlugin *plugin,
|
gboolean fu_plugin_coldplug_cleanup (FuPlugin *plugin,
|
||||||
GError **error);
|
GError **error);
|
||||||
gboolean fu_plugin_update_online (FuPlugin *plugin,
|
gboolean fu_plugin_update (FuPlugin *plugin,
|
||||||
FuDevice *dev,
|
|
||||||
GBytes *blob_fw,
|
|
||||||
FwupdInstallFlags flags,
|
|
||||||
GError **error);
|
|
||||||
gboolean fu_plugin_update_offline (FuPlugin *plugin,
|
|
||||||
FuDevice *dev,
|
FuDevice *dev,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Richard Hughes <richard@hughsie.com>
|
* Copyright (C) 2016-2017 Richard Hughes <richard@hughsie.com>
|
||||||
*
|
*
|
||||||
* Licensed under the GNU General Public License Version 2
|
* Licensed under the GNU General Public License Version 2
|
||||||
*
|
*
|
||||||
@ -919,15 +919,14 @@ fu_plugin_runner_unlock (FuPlugin *plugin, FuDevice *device, GError **error)
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_plugin_runner_update (FuPlugin *plugin,
|
fu_plugin_runner_update (FuPlugin *plugin,
|
||||||
FuDevice *device,
|
FuDevice *device,
|
||||||
GBytes *blob_cab,
|
GBytes *blob_cab,
|
||||||
GBytes *blob_fw,
|
GBytes *blob_fw,
|
||||||
FwupdInstallFlags flags,
|
FwupdInstallFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuPluginPrivate *priv = GET_PRIVATE (plugin);
|
FuPluginPrivate *priv = GET_PRIVATE (plugin);
|
||||||
FuPluginUpdateFunc func_online;
|
FuPluginUpdateFunc update_func;
|
||||||
FuPluginUpdateFunc func_offline;
|
|
||||||
g_autoptr(FuPending) pending = NULL;
|
g_autoptr(FuPending) pending = NULL;
|
||||||
g_autoptr(FwupdResult) res_pending = NULL;
|
g_autoptr(FwupdResult) res_pending = NULL;
|
||||||
GError *error_update = NULL;
|
GError *error_update = NULL;
|
||||||
@ -938,18 +937,21 @@ fu_plugin_runner_update (FuPlugin *plugin,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* optional */
|
/* optional */
|
||||||
g_module_symbol (priv->module, "fu_plugin_update_online", (gpointer *) &func_online);
|
g_module_symbol (priv->module, "fu_plugin_update", (gpointer *) &update_func);
|
||||||
g_module_symbol (priv->module, "fu_plugin_update_offline", (gpointer *) &func_offline);
|
if (update_func == NULL) {
|
||||||
|
g_set_error_literal (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_NOT_SUPPORTED,
|
||||||
|
"No update possible");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* schedule for next reboot, or handle in the plugin */
|
/* just schedule this for the next reboot */
|
||||||
if (flags & FWUPD_INSTALL_FLAG_OFFLINE) {
|
if (flags & FWUPD_INSTALL_FLAG_OFFLINE) {
|
||||||
if (func_offline == NULL) {
|
return fu_plugin_runner_schedule_update (plugin,
|
||||||
return fu_plugin_runner_schedule_update (plugin,
|
device,
|
||||||
device,
|
blob_cab,
|
||||||
blob_cab,
|
error);
|
||||||
error);
|
|
||||||
}
|
|
||||||
return func_offline (plugin, device, blob_fw, flags, error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cancel the pending action */
|
/* cancel the pending action */
|
||||||
@ -957,16 +959,9 @@ fu_plugin_runner_update (FuPlugin *plugin,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* online */
|
/* online */
|
||||||
if (func_online == NULL) {
|
|
||||||
g_set_error_literal (error,
|
|
||||||
FWUPD_ERROR,
|
|
||||||
FWUPD_ERROR_NOT_SUPPORTED,
|
|
||||||
"No online update possible");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
pending = fu_pending_new ();
|
pending = fu_pending_new ();
|
||||||
res_pending = fu_pending_get_device (pending, fu_device_get_id (device), NULL);
|
res_pending = fu_pending_get_device (pending, fu_device_get_id (device), NULL);
|
||||||
if (!func_online (plugin, device, blob_fw, flags, &error_update)) {
|
if (!update_func (plugin, device, blob_fw, flags, &error_update)) {
|
||||||
/* save the error to the database */
|
/* save the error to the database */
|
||||||
if (res_pending != NULL) {
|
if (res_pending != NULL) {
|
||||||
fu_pending_set_error_msg (pending, FWUPD_RESULT (device),
|
fu_pending_set_error_msg (pending, FWUPD_RESULT (device),
|
||||||
|
Loading…
Reference in New Issue
Block a user