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

Add support for offline firmware updates #244

Merged
merged 2 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Interfaces/FirmwareClient.vala
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ public class About.FirmwareClient {
return releases;
}

public static async bool install (Fwupd.Client client, string device_id, string path) throws GLib.Error {
public static async bool install (Fwupd.Client client, string device_id, string path, Fwupd.InstallFlags install_flags = Fwupd.InstallFlags.NONE) throws GLib.Error {
SourceFunc callback = install.callback;
GLib.Error error = null;
bool result = false;

new Thread<void> ("install", () => {
try {
result = client.install (device_id, path, Fwupd.InstallFlags.NONE);
result = client.install (device_id, path, install_flags);
} catch (Error e) {
error = e;
}
Expand Down
7 changes: 6 additions & 1 deletion src/Views/FirmwareView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,12 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {
var path = yield download_file (device, release.get_uri ());

try {
if (yield FirmwareClient.install (fwupd_client, device.get_id (), path)) {
var install_flags = Fwupd.InstallFlags.NONE;
if (device.has_flag (Fwupd.DEVICE_FLAG_ONLY_OFFLINE)) {
install_flags = Fwupd.InstallFlags.OFFLINE;
}

if (yield FirmwareClient.install (fwupd_client, device.get_id (), path, install_flags)) {
if (device.has_flag (Fwupd.DEVICE_FLAG_NEEDS_REBOOT)) {
show_reboot_dialog ();
} else if (device.has_flag (Fwupd.DEVICE_FLAG_NEEDS_SHUTDOWN)) {
Expand Down