aboutsummaryrefslogtreecommitdiff
path: root/plugins/quectel/mm-shared-quectel.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-06-30 13:11:17 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-06-30 13:12:25 +0200
commit23f8b580c3f394c10404ea346202cbe8997026db (patch)
tree27ac72a70837fa493cf82ce8a26dc59c4e9ffbad /plugins/quectel/mm-shared-quectel.c
parentffca45d9cc416879881b75fb93880aee8c7563d2 (diff)
quectel,shared: implement custom time support check
We require CTZU=3 during the time support check, instead of CTZU=1, so that the Quectel modem reports localtime instead of UTC time in +CCLK. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/233
Diffstat (limited to 'plugins/quectel/mm-shared-quectel.c')
-rw-r--r--plugins/quectel/mm-shared-quectel.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/plugins/quectel/mm-shared-quectel.c b/plugins/quectel/mm-shared-quectel.c
index e10d581d..cdb7dab3 100644
--- a/plugins/quectel/mm-shared-quectel.c
+++ b/plugins/quectel/mm-shared-quectel.c
@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
+ * Copyright (C) 2018-2020 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
@@ -574,6 +574,39 @@ mm_shared_quectel_disable_location_gathering (MMIfaceModemLocation *self,
g_object_unref (task);
}
+/*****************************************************************************/
+
+/* Custom time support check because Quectel modems require +CTZU=3 in order to
+ * have the CCLK? time reported in localtime, instead of UTC time. */
+static const MMBaseModemAtCommand time_check_sequence[] = {
+ { "+CTZU=3", 3, TRUE, mm_base_modem_response_processor_no_result_continue },
+ { "+CCLK?", 3, TRUE, mm_base_modem_response_processor_string },
+ { NULL }
+};
+
+gboolean
+mm_shared_quectel_time_check_support_finish (MMIfaceModemTime *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ return !!mm_base_modem_at_sequence_finish (MM_BASE_MODEM (self), res, NULL, error);
+}
+
+void
+mm_shared_quectel_time_check_support (MMIfaceModemTime *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ mm_base_modem_at_sequence (MM_BASE_MODEM (self),
+ time_check_sequence,
+ NULL, /* response_processor_context */
+ NULL, /* response_processor_context_free */
+ callback,
+ user_data);
+}
+
+/*****************************************************************************/
+
static void
shared_quectel_init (gpointer g_iface)
{