mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-08 14:06:43 +00:00
trivial: Move the UNREACHABLE inhibit to common code
This commit is contained in:
parent
75ba49ebf0
commit
b4e88bae49
@ -2955,6 +2955,8 @@ fu_device_remove_flag(FuDevice *self, FwupdDeviceFlags flag)
|
|||||||
/* allow it to be updatable again */
|
/* allow it to be updatable again */
|
||||||
if (flag & FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION)
|
if (flag & FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION)
|
||||||
fu_device_uninhibit(self, "needs-activation");
|
fu_device_uninhibit(self, "needs-activation");
|
||||||
|
if (flag & FWUPD_DEVICE_FLAG_UNREACHABLE)
|
||||||
|
fu_device_uninhibit(self, "unreachable");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2996,6 +2998,10 @@ fu_device_add_flag(FuDevice *self, FwupdDeviceFlags flag)
|
|||||||
/* don't let devices be updated until activated */
|
/* don't let devices be updated until activated */
|
||||||
if (flag & FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION)
|
if (flag & FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION)
|
||||||
fu_device_inhibit(self, "needs-activation", "Pending activation");
|
fu_device_inhibit(self, "needs-activation", "Pending activation");
|
||||||
|
|
||||||
|
/* do not let devices be updated until back in range */
|
||||||
|
if (flag & FWUPD_DEVICE_FLAG_UNREACHABLE)
|
||||||
|
fu_device_inhibit(self, "unreachable", "Device is unreachable");
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -188,7 +188,6 @@ fu_logitech_hidpp_device_ping(FuLogitechHidPpDevice *self, GError **error)
|
|||||||
}
|
}
|
||||||
if (g_error_matches(error_local, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE)) {
|
if (g_error_matches(error_local, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE)) {
|
||||||
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UNREACHABLE);
|
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UNREACHABLE);
|
||||||
fu_device_inhibit(FU_DEVICE(self), "unreachable", "device is unreachable");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
g_propagate_error(error, g_steal_pointer(&error_local));
|
g_propagate_error(error, g_steal_pointer(&error_local));
|
||||||
@ -197,12 +196,10 @@ fu_logitech_hidpp_device_ping(FuLogitechHidPpDevice *self, GError **error)
|
|||||||
|
|
||||||
/* device no longer asleep */
|
/* device no longer asleep */
|
||||||
fu_device_remove_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UNREACHABLE);
|
fu_device_remove_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UNREACHABLE);
|
||||||
fu_device_uninhibit(FU_DEVICE(self), "unreachable");
|
|
||||||
children = fu_device_get_children(FU_DEVICE(self));
|
children = fu_device_get_children(FU_DEVICE(self));
|
||||||
for (guint i = 0; i < children->len; i++) {
|
for (guint i = 0; i < children->len; i++) {
|
||||||
FuDevice *radio = g_ptr_array_index(children, i);
|
FuDevice *radio = g_ptr_array_index(children, i);
|
||||||
fu_device_remove_flag(radio, FWUPD_DEVICE_FLAG_UNREACHABLE);
|
fu_device_remove_flag(radio, FWUPD_DEVICE_FLAG_UNREACHABLE);
|
||||||
fu_device_uninhibit(radio, "unreachable");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the device index is unset, grab it from the reply */
|
/* if the device index is unset, grab it from the reply */
|
||||||
|
@ -139,12 +139,10 @@ fu_logitech_hidpp_runtime_bolt_update_paired_device(FuLogitechHidPpRuntimeBolt *
|
|||||||
GPtrArray *children = NULL;
|
GPtrArray *children = NULL;
|
||||||
/* any successful 'ping' will clear this */
|
/* any successful 'ping' will clear this */
|
||||||
fu_device_add_flag(FU_DEVICE(child), FWUPD_DEVICE_FLAG_UNREACHABLE);
|
fu_device_add_flag(FU_DEVICE(child), FWUPD_DEVICE_FLAG_UNREACHABLE);
|
||||||
fu_device_inhibit(FU_DEVICE(child), "unreachable", "device is unreachable");
|
|
||||||
children = fu_device_get_children(FU_DEVICE(child));
|
children = fu_device_get_children(FU_DEVICE(child));
|
||||||
for (guint i = 0; i < children->len; i++) {
|
for (guint i = 0; i < children->len; i++) {
|
||||||
FuDevice *radio = g_ptr_array_index(children, i);
|
FuDevice *radio = g_ptr_array_index(children, i);
|
||||||
fu_device_add_flag(radio, FWUPD_DEVICE_FLAG_UNREACHABLE);
|
fu_device_add_flag(radio, FWUPD_DEVICE_FLAG_UNREACHABLE);
|
||||||
fu_device_inhibit(radio, "unreachable", "device is unreachable");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (reachable) {
|
} else if (reachable) {
|
||||||
|
Loading…
Reference in New Issue
Block a user