quectel: report fastboot-based firmware update method and settings
We'll check for AT+QFASTBOOT support during runtime.
This commit is contained in:
committed by
Dan Williams
parent
4b21546f53
commit
fc02b1320c
@@ -1075,7 +1075,17 @@ pkglib_LTLIBRARIES += libmm-plugin-quectel.la
|
||||
libmm_plugin_quectel_la_SOURCES = \
|
||||
quectel/mm-plugin-quectel.c \
|
||||
quectel/mm-plugin-quectel.h \
|
||||
quectel/mm-shared-quectel.c \
|
||||
quectel/mm-shared-quectel.h \
|
||||
quectel/mm-broadband-modem-quectel.c \
|
||||
quectel/mm-broadband-modem-quectel.h \
|
||||
$(NULL)
|
||||
if WITH_QMI
|
||||
libmm_plugin_quectel_la_SOURCES += \
|
||||
quectel/mm-broadband-modem-qmi-quectel.c \
|
||||
quectel/mm-broadband-modem-qmi-quectel.h \
|
||||
$(NULL)
|
||||
endif
|
||||
libmm_plugin_quectel_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
||||
libmm_plugin_quectel_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "mm-broadband-modem-qmi-quectel.h"
|
||||
#include "mm-shared-quectel.h"
|
||||
#include "mm-iface-modem-firmware.h"
|
||||
|
||||
static void shared_quectel_init (MMSharedQuectel *iface);
|
||||
static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemQmiQuectel, mm_broadband_modem_qmi_quectel, MM_TYPE_BROADBAND_MODEM_QMI, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_QUECTEL, shared_quectel_init))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMBroadbandModemQmiQuectel *
|
||||
mm_broadband_modem_qmi_quectel_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id)
|
||||
{
|
||||
return g_object_new (MM_TYPE_BROADBAND_MODEM_QMI_QUECTEL,
|
||||
MM_BASE_MODEM_DEVICE, device,
|
||||
MM_BASE_MODEM_DRIVERS, drivers,
|
||||
MM_BASE_MODEM_PLUGIN, plugin,
|
||||
MM_BASE_MODEM_VENDOR_ID, vendor_id,
|
||||
MM_BASE_MODEM_PRODUCT_ID, product_id,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_qmi_quectel_init (MMBroadbandModemQmiQuectel *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_firmware_init (MMIfaceModemFirmware *iface)
|
||||
{
|
||||
iface->load_update_settings = mm_shared_quectel_firmware_load_update_settings;
|
||||
iface->load_update_settings_finish = mm_shared_quectel_firmware_load_update_settings_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_quectel_init (MMSharedQuectel *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_qmi_quectel_class_init (MMBroadbandModemQmiQuectelClass *klass)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_MODEM_QMI_QUECTEL_H
|
||||
#define MM_BROADBAND_MODEM_QMI_QUECTEL_H
|
||||
|
||||
#include "mm-broadband-modem-qmi.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_QMI_QUECTEL (mm_broadband_modem_qmi_quectel_get_type ())
|
||||
#define MM_BROADBAND_MODEM_QMI_QUECTEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_QMI_QUECTEL, MMBroadbandModemQmiQuectel))
|
||||
#define MM_BROADBAND_MODEM_QMI_QUECTEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_QMI_QUECTEL, MMBroadbandModemQmiQuectelClass))
|
||||
#define MM_IS_BROADBAND_MODEM_QMI_QUECTEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_QMI_QUECTEL))
|
||||
#define MM_IS_BROADBAND_MODEM_QMI_QUECTEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_QMI_QUECTEL))
|
||||
#define MM_BROADBAND_MODEM_QMI_QUECTEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_QMI_QUECTEL, MMBroadbandModemQmiQuectelClass))
|
||||
|
||||
typedef struct _MMBroadbandModemQmiQuectel MMBroadbandModemQmiQuectel;
|
||||
typedef struct _MMBroadbandModemQmiQuectelClass MMBroadbandModemQmiQuectelClass;
|
||||
|
||||
struct _MMBroadbandModemQmiQuectel {
|
||||
MMBroadbandModemQmi parent;
|
||||
};
|
||||
|
||||
struct _MMBroadbandModemQmiQuectelClass{
|
||||
MMBroadbandModemQmiClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_modem_qmi_quectel_get_type (void);
|
||||
|
||||
MMBroadbandModemQmiQuectel *mm_broadband_modem_qmi_quectel_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_QMI_QUECTEL_H */
|
||||
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "mm-broadband-modem-quectel.h"
|
||||
#include "mm-shared-quectel.h"
|
||||
#include "mm-iface-modem-firmware.h"
|
||||
|
||||
static void shared_quectel_init (MMSharedQuectel *iface);
|
||||
static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemQuectel, mm_broadband_modem_quectel, MM_TYPE_BROADBAND_MODEM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_QUECTEL, shared_quectel_init))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMBroadbandModemQuectel *
|
||||
mm_broadband_modem_quectel_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id)
|
||||
{
|
||||
return g_object_new (MM_TYPE_BROADBAND_MODEM_QUECTEL,
|
||||
MM_BASE_MODEM_DEVICE, device,
|
||||
MM_BASE_MODEM_DRIVERS, drivers,
|
||||
MM_BASE_MODEM_PLUGIN, plugin,
|
||||
MM_BASE_MODEM_VENDOR_ID, vendor_id,
|
||||
MM_BASE_MODEM_PRODUCT_ID, product_id,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_firmware_init (MMIfaceModemFirmware *iface)
|
||||
{
|
||||
iface->load_update_settings = mm_shared_quectel_firmware_load_update_settings;
|
||||
iface->load_update_settings_finish = mm_shared_quectel_firmware_load_update_settings_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_quectel_init (MMBroadbandModemQuectel *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
shared_quectel_init (MMSharedQuectel *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_quectel_class_init (MMBroadbandModemQuectelClass *klass)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_MODEM_QUECTEL_H
|
||||
#define MM_BROADBAND_MODEM_QUECTEL_H
|
||||
|
||||
#include "mm-broadband-modem.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_QUECTEL (mm_broadband_modem_quectel_get_type ())
|
||||
#define MM_BROADBAND_MODEM_QUECTEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_QUECTEL, MMBroadbandModemQuectel))
|
||||
#define MM_BROADBAND_MODEM_QUECTEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_QUECTEL, MMBroadbandModemQuectelClass))
|
||||
#define MM_IS_BROADBAND_MODEM_QUECTEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_QUECTEL))
|
||||
#define MM_IS_BROADBAND_MODEM_QUECTEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_QUECTEL))
|
||||
#define MM_BROADBAND_MODEM_QUECTEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_QUECTEL, MMBroadbandModemQuectelClass))
|
||||
|
||||
typedef struct _MMBroadbandModemQuectel MMBroadbandModemQuectel;
|
||||
typedef struct _MMBroadbandModemQuectelClass MMBroadbandModemQuectelClass;
|
||||
|
||||
struct _MMBroadbandModemQuectel {
|
||||
MMBroadbandModem parent;
|
||||
};
|
||||
|
||||
struct _MMBroadbandModemQuectelClass{
|
||||
MMBroadbandModemClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_modem_quectel_get_type (void);
|
||||
|
||||
MMBroadbandModemQuectel *mm_broadband_modem_quectel_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_QUECTEL_H */
|
||||
@@ -10,7 +10,7 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2017 Aleksander Morgado <aleksander@aleksander.es>
|
||||
* Copyright (C) 2017-2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
#include "mm-log.h"
|
||||
#include "mm-plugin-quectel.h"
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-broadband-modem-quectel.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
#include "mm-broadband-modem-qmi.h"
|
||||
#include "mm-broadband-modem-qmi-quectel.h"
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE (MMPluginQuectel, mm_plugin_quectel, MM_TYPE_PLUGIN)
|
||||
@@ -46,19 +46,19 @@ create_modem (MMPlugin *self,
|
||||
#if defined WITH_QMI
|
||||
if (mm_port_probe_list_has_qmi_port (probes)) {
|
||||
mm_dbg ("QMI-powered Quectel modem found...");
|
||||
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
|
||||
return MM_BASE_MODEM (mm_broadband_modem_qmi_quectel_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
#endif
|
||||
|
||||
return MM_BASE_MODEM (mm_broadband_modem_quectel_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
#endif
|
||||
|
||||
return MM_BASE_MODEM (mm_broadband_modem_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-iface-modem-firmware.h"
|
||||
#include "mm-base-modem.h"
|
||||
#include "mm-base-modem-at.h"
|
||||
#include "mm-shared-quectel.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Firmware update settings loading (Firmware interface) */
|
||||
|
||||
MMFirmwareUpdateSettings *
|
||||
mm_shared_quectel_firmware_load_update_settings_finish (MMIfaceModemFirmware *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return g_task_propagate_pointer (G_TASK (res), error);
|
||||
}
|
||||
|
||||
static void
|
||||
qfastboot_test_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMFirmwareUpdateSettings *update_settings;
|
||||
|
||||
if (!mm_base_modem_at_command_finish (self, res, NULL))
|
||||
update_settings = mm_firmware_update_settings_new (MM_MODEM_FIRMWARE_UPDATE_METHOD_UNKNOWN);
|
||||
else {
|
||||
update_settings = mm_firmware_update_settings_new (MM_MODEM_FIRMWARE_UPDATE_METHOD_FASTBOOT);
|
||||
mm_firmware_update_settings_set_fastboot_at (update_settings, "AT+QFASTBOOT");
|
||||
}
|
||||
|
||||
g_task_return_pointer (task, update_settings, g_object_unref);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
void
|
||||
mm_shared_quectel_firmware_load_update_settings (MMIfaceModemFirmware *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"AT+QFASTBOOT=?",
|
||||
3,
|
||||
TRUE,
|
||||
(GAsyncReadyCallback)qfastboot_test_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
shared_quectel_init (gpointer g_iface)
|
||||
{
|
||||
}
|
||||
|
||||
GType
|
||||
mm_shared_quectel_get_type (void)
|
||||
{
|
||||
static GType shared_quectel_type = 0;
|
||||
|
||||
if (!G_UNLIKELY (shared_quectel_type)) {
|
||||
static const GTypeInfo info = {
|
||||
sizeof (MMSharedQuectel), /* class_size */
|
||||
shared_quectel_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
};
|
||||
|
||||
shared_quectel_type = g_type_register_static (G_TYPE_INTERFACE, "MMSharedQuectel", &info, 0);
|
||||
g_type_interface_add_prerequisite (shared_quectel_type, MM_TYPE_IFACE_MODEM_FIRMWARE);
|
||||
}
|
||||
|
||||
return shared_quectel_type;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#ifndef MM_SHARED_QUECTEL_H
|
||||
#define MM_SHARED_QUECTEL_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-firmware.h"
|
||||
|
||||
#define MM_TYPE_SHARED_QUECTEL (mm_shared_quectel_get_type ())
|
||||
#define MM_SHARED_QUECTEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SHARED_QUECTEL, MMSharedQuectel))
|
||||
#define MM_IS_SHARED_QUECTEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SHARED_QUECTEL))
|
||||
#define MM_SHARED_QUECTEL_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_SHARED_QUECTEL, MMSharedQuectel))
|
||||
|
||||
typedef struct _MMSharedQuectel MMSharedQuectel;
|
||||
|
||||
struct _MMSharedQuectel {
|
||||
GTypeInterface g_iface;
|
||||
};
|
||||
|
||||
GType mm_shared_quectel_get_type (void);
|
||||
|
||||
void mm_shared_quectel_firmware_load_update_settings (MMIfaceModemFirmware *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
MMFirmwareUpdateSettings *mm_shared_quectel_firmware_load_update_settings_finish (MMIfaceModemFirmware *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_SHARED_QUECTEL_H */
|
||||
Reference in New Issue
Block a user