Quectel emits "+QUSIM: 1" after eUICC reinitialization. Detect it and perform SIM swap check if one is encountered. The motivation here is that M2M eUICC profile switch causes eUICC reset and this is one way to detect and handle profile switches properly on Quectel modems. The existing SIM hot swap mechanism is used as it appears to be suitable for handling profile switches as well as physical swapping of SIM cards.
77 lines
2.8 KiB
C
77 lines
2.8 KiB
C
/* -*- 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 iface_modem_init (MMIfaceModem *iface);
|
|
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, iface_modem_init)
|
|
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
|
|
iface_modem_init (MMIfaceModem *iface)
|
|
{
|
|
iface->setup_sim_hot_swap = mm_shared_quectel_setup_sim_hot_swap;
|
|
iface->setup_sim_hot_swap_finish = mm_shared_quectel_setup_sim_hot_swap_finish;
|
|
}
|
|
|
|
static void
|
|
shared_quectel_init (MMSharedQuectel *iface)
|
|
{
|
|
}
|
|
|
|
static void
|
|
mm_broadband_modem_quectel_class_init (MMBroadbandModemQuectelClass *klass)
|
|
{
|
|
}
|