Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hughsie/19x backport #7281

Merged
merged 11 commits into from
May 23, 2024
6 changes: 6 additions & 0 deletions docs/fwupd.conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ The `[fwupd]` section can contain the following parameters:

Ignore power levels of devices when running updates.

**IgnoreRequirements={{IgnoreRequirements}}**

Ignore some device requirements, for instance removing the generic GUID requirement of a CHID,
child, parent or sibling.
This is not recommended for production systems, although it may be useful for firmware development.

**OnlyTrusted={{OnlyTrusted}}**

Only support installing firmware signed with a trusted key.
Expand Down
24 changes: 13 additions & 11 deletions libfwupd/fwupd-enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -1011,21 +1011,23 @@ typedef guint64 FwupdPluginFlags;
* @FWUPD_INSTALL_FLAG_IGNORE_POWER: Ignore requirement of external power source
*(Deprecated since 1.7.0)
* @FWUPD_INSTALL_FLAG_NO_SEARCH: Do not use heuristics when parsing the image
* @FWUPD_INSTALL_FLAG_IGNORE_REQUIREMENTS: Ignore version requirement checks
*
* Flags to set when performing the firmware update or install.
**/
typedef enum {
FWUPD_INSTALL_FLAG_NONE = 0, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_OFFLINE = 1 << 0, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_ALLOW_REINSTALL = 1 << 1, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_ALLOW_OLDER = 1 << 2, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_FORCE = 1 << 3, /* Since: 0.7.1 */
FWUPD_INSTALL_FLAG_NO_HISTORY = 1 << 4, /* Since: 1.0.8 */
FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH = 1 << 5, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM = 1 << 6, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_IGNORE_VID_PID = 1 << 7, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_IGNORE_POWER = 1 << 8, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_NO_SEARCH = 1 << 9, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_NONE = 0, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_OFFLINE = 1 << 0, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_ALLOW_REINSTALL = 1 << 1, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_ALLOW_OLDER = 1 << 2, /* Since: 0.7.0 */
FWUPD_INSTALL_FLAG_FORCE = 1 << 3, /* Since: 0.7.1 */
FWUPD_INSTALL_FLAG_NO_HISTORY = 1 << 4, /* Since: 1.0.8 */
FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH = 1 << 5, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM = 1 << 6, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_IGNORE_VID_PID = 1 << 7, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_IGNORE_POWER = 1 << 8, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_NO_SEARCH = 1 << 9, /* Since: 1.5.0 */
FWUPD_INSTALL_FLAG_IGNORE_REQUIREMENTS = 1 << 10, /* Since: 1.9.21 */
/*< private >*/
FWUPD_INSTALL_FLAG_LAST
} FwupdInstallFlags;
Expand Down
3 changes: 2 additions & 1 deletion libfwupdplugin/fu-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ fu_device_add_internal_flag(FuDevice *self, FuDeviceInternalFlags flag)
GPtrArray *children = fu_device_get_children(self);
for (guint i = 0; i < children->len; i++) {
FuDevice *child_tmp = g_ptr_array_index(children, i);
fu_device_set_order(child_tmp, G_MAXINT);
fu_device_add_internal_flag(child_tmp,
FU_DEVICE_INTERNAL_FLAG_EXPLICIT_ORDER);
}
fu_device_set_order(self, G_MAXINT);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/dell-dock/fu-dell-dock-i2c-ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ fu_dell_dock_ec_write_fw(FuDevice *device,
g_info("writing EC firmware version %s", dynamic_version);

/* meet the minimum EC version */
if ((flags & FWUPD_INSTALL_FLAG_FORCE) == 0 &&
if ((flags & FWUPD_INSTALL_FLAG_IGNORE_REQUIREMENTS) == 0 &&
(fu_version_compare(dynamic_version,
self->ec_minimum_version,
FWUPD_VERSION_FORMAT_QUAD) < 0)) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/intel-usb4/fu-intel-usb4-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ fu_intel_usb4_device_prepare_firmware(FuDevice *device,
fw_vendor_id = fu_intel_thunderbolt_nvm_get_vendor_id(FU_INTEL_THUNDERBOLT_NVM(firmware));
fw_model_id = fu_intel_thunderbolt_nvm_get_model_id(FU_INTEL_THUNDERBOLT_NVM(firmware));
if (self->nvm_vendor_id != fw_vendor_id || self->nvm_model_id != fw_model_id) {
if ((flags & FWUPD_INSTALL_FLAG_FORCE) == 0) {
if ((flags & FWUPD_INSTALL_FLAG_IGNORE_VID_PID) == 0) {
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
Expand Down
4 changes: 2 additions & 2 deletions plugins/logitech-tap/fu-logitech-tap-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ fu_logitech_tap_device_init(FuLogitechTapDevice *self)
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_SIGNED_PAYLOAD);
fu_device_register_private_flag(FU_DEVICE(self),
FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_NEEDS_REBOOT,
"needs-reboot");
FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_SENSOR_NEEDS_REBOOT,
"sensor-needs-reboot");
}

static void
Expand Down
4 changes: 2 additions & 2 deletions plugins/logitech-tap/fu-logitech-tap-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ struct _FuLogitechTapDeviceClass {
};

/**
* FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_NEEDS_REBOOT:
* FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_SENSOR_NEEDS_REBOOT:
*
* Firmware updated for HDMI component, trigger composite device reboot
*/
#define FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_NEEDS_REBOOT (1ull << 1)
#define FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_SENSOR_NEEDS_REBOOT (1ull << 1)
3 changes: 2 additions & 1 deletion plugins/logitech-tap/fu-logitech-tap-hdmi-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ fu_logitech_tap_hdmi_device_write_fw(FuLogitechTapHdmiDevice *self,
return FALSE;

/* signal for sensor device to trigger composite device reboot */
fu_device_add_private_flag(FU_DEVICE(self), FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_NEEDS_REBOOT);
fu_device_add_private_flag(FU_DEVICE(self),
FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_SENSOR_NEEDS_REBOOT);
return TRUE;
}

Expand Down
5 changes: 3 additions & 2 deletions plugins/logitech-tap/fu-logitech-tap-plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ fu_logitech_tap_plugin_composite_cleanup(FuPlugin *plugin, GPtrArray *devices, G

if ((g_strcmp0(fu_device_get_plugin(dev), "logitech_tap") == 0) &&
(FU_IS_LOGITECH_TAP_HDMI_DEVICE(dev)) &&
(fu_device_has_private_flag(dev,
FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_NEEDS_REBOOT)) &&
(fu_device_has_private_flag(
dev,
FU_LOGITECH_TAP_HDMI_DEVICE_FLAG_SENSOR_NEEDS_REBOOT)) &&
self->hdmi_device != NULL) {
g_debug("device needs reboot");
if (!fu_logitech_tap_sensor_device_reboot_device(
Expand Down
2 changes: 1 addition & 1 deletion plugins/pixart-rf/fu-pxi-ble-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fu_pxi_ble_device_prepare_firmware(FuDevice *device,

/* check is compatible with hardware */
model_name = fu_pxi_firmware_get_model_name(FU_PXI_FIRMWARE(firmware));
if ((flags & FWUPD_INSTALL_FLAG_FORCE) == 0) {
if ((flags & FWUPD_INSTALL_FLAG_IGNORE_VID_PID) == 0) {
if (self->model_name == NULL || model_name == NULL) {
g_set_error_literal(error,
FWUPD_ERROR,
Expand Down
10 changes: 10 additions & 0 deletions plugins/wacom-usb/fu-wac-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "fu-wac-module-bluetooth-id9.h"
#include "fu-wac-module-bluetooth.h"
#include "fu-wac-module-scaler.h"
#include "fu-wac-module-sub-cpu.h"
#include "fu-wac-module-touch-id7.h"
#include "fu-wac-module-touch.h"
#include "fu-wac-struct.h"
Expand Down Expand Up @@ -790,6 +791,14 @@ fu_wac_device_add_modules(FuWacDevice *self, GError **error)
fu_device_set_summary(FU_DEVICE(module), "ID9");
fu_device_set_version_u16(FU_DEVICE(module), ver);
break;
case FU_WAC_MODULE_FW_TYPE_SUB_CPU:
module = fu_wac_module_sub_cpu_new(FU_DEVICE(self));
name = g_strdup_printf("%s [Sub CPU Module]",
fu_device_get_name(FU_DEVICE(self)));
fu_device_add_child(FU_DEVICE(self), FU_DEVICE(module));
fu_device_set_name(FU_DEVICE(module), name);
fu_device_set_version_raw(FU_DEVICE(module), ver);
break;
case FU_WAC_MODULE_FW_TYPE_MAIN:
fu_device_set_version_u16(FU_DEVICE(self), ver);
break;
Expand Down Expand Up @@ -873,6 +882,7 @@ fu_wac_device_init(FuWacDevice *self)
fu_device_add_icon(FU_DEVICE(self), "input-tablet");
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD);
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_MD_SET_FLAGS);
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_BCD);
fu_device_set_install_duration(FU_DEVICE(self), 10);
fu_device_set_remove_delay(FU_DEVICE(self), FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
Expand Down
Loading
Loading