pmaports/temp/modemmanager/0006-base-modem-don-t-fail-if-sync-isn-t-implemented.patch

32 lines
1.2 KiB
Diff

From 053d3f84f0fe4b13ec4586b180cea4aba8fc01ea Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander@aleksander.es>
Date: Sun, 23 May 2021 12:23:59 +0200
Subject: [PATCH 06/39] base-modem: don't fail if sync() isn't implemented
---
src/mm-base-modem.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c
index 923f159a..28519ad4 100644
--- a/src/mm-base-modem.c
+++ b/src/mm-base-modem.c
@@ -530,8 +530,13 @@ mm_base_modem_sync (MMBaseModem *self,
task = g_task_new (self, NULL, callback, user_data);
- g_assert (MM_BASE_MODEM_GET_CLASS (self)->sync != NULL);
- g_assert (MM_BASE_MODEM_GET_CLASS (self)->sync_finish != NULL);
+ if (!MM_BASE_MODEM_GET_CLASS (self)->sync ||
+ !MM_BASE_MODEM_GET_CLASS (self)->sync_finish) {
+ g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Suspend/resume quick synchronization unsupported");
+ g_object_unref (task);
+ return;
+ }
MM_BASE_MODEM_GET_CLASS (self)->sync (self,
(GAsyncReadyCallback) sync_ready,
--
2.31.1