Commits (44)
image: gcc
include:
- project: freedesktop/ci-templates
ref: 290b79e0e78eab67a83766f4e9691be554fc4afd
file:
- templates/ubuntu.yml
stages:
- container prep
- build
before_script:
- apt update || true
- apt -y install autoconf automake libtool libgettextpo-dev libgirepository1.0-dev libglib2.0-dev libgudev-1.0-dev python3-dbus python3-gi autopoint xsltproc dbus autoconf-archive gettext
.common_variables:
variables:
FDO_UPSTREAM_REPO: mobile-broadband/ModemManager
FDO_DISTRIBUTION_VERSION: '20.04'
FDO_DISTRIBUTION_TAG: '2021-04-28.2'
FDO_DISTRIBUTION_PACKAGES: ca-certificates git gcc autoconf automake libtool
libgettextpo-dev libgirepository1.0-dev libglib2.0-dev
libgudev-1.0-dev python3-dbus python3-gi autopoint
xsltproc dbus autoconf-archive gettext gtk-doc-tools
libglib2.0-doc gobject-introspection libsystemd-dev
libpolkit-gobject-1-dev valac
build container:
extends:
- .fdo.container-build@ubuntu
- .common_variables
stage: container prep
only:
- master
- branches
- merge_requests
- tags
- pushes
build-no-qmi:
stage: build
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
only:
- master
- merge_requests
- tags
- schedules
script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- git clone --depth 1 --branch mbim-1-24 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- pushd libmbim
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr
- ./configure --prefix=/usr --disable-gtk-doc --disable-introspection
- make
- make install
- popd
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/tmp/build-no-qmi --disable-gtk-doc --without-qmi
- ./configure --prefix=/usr --disable-gtk-doc --disable-introspection --without-qmi
- make
- make check
- make install
build-no-mbim:
stage: build
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
only:
- master
- merge_requests
- tags
- schedules
script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- git clone --depth 1 --branch qmi-1-28 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr --disable-mbim-qmux --enable-collection=basic
......@@ -44,13 +75,16 @@ build-no-mbim:
- make install
- popd
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/tmp/build-no-mbim --disable-gtk-doc --without-mbim
- ./configure --prefix=/usr --disable-gtk-doc --disable-introspection --without-mbim
- make
- make check
- make install
build-no-qmi-no-mbim:
stage: build
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
only:
- master
- merge_requests
......@@ -58,45 +92,51 @@ build-no-qmi-no-mbim:
- schedules
script:
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/tmp/build-no-qmi-no-mbim --disable-gtk-doc --without-qmi --without-mbim
- ./configure --prefix=/usr --disable-gtk-doc --disable-introspection --without-qmi --without-mbim
- make
- make check
- make install
build-qmi-newest-commands:
stage: build
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
only:
- master
- merge_requests
- tags
- schedules
script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- git clone --depth 1 --branch qmi-1-28 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr --disable-mbim-qmux --enable-collection=basic
- ./configure --prefix=/usr --disable-gtk-doc --disable-introspection --disable-mbim-qmux --enable-collection=basic
- make
- make install
- popd
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/tmp/build-qmi-newest-commands --disable-gtk-doc --without-mbim CFLAGS="-DWITH_NEWEST_QMI_COMMANDS"
- ./configure --prefix=/usr --disable-gtk-doc --disable-introspection --without-mbim CFLAGS="-DWITH_NEWEST_QMI_COMMANDS"
- make
- make check
- make install
build-single-plugins:
stage: build
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
only:
- schedules
script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- git clone --depth 1 --branch mbim-1-24 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- pushd libmbim
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr
- ./configure --prefix=/usr --disable-gtk-doc --disable-introspection
- make
- make install
- popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- git clone --depth 1 --branch qmi-1-28 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr --enable-mbim-qmux --enable-collection=basic
......@@ -110,13 +150,16 @@ build-single-plugins:
novatel novatel-lte option option-hso pantech
qcom-soc quectel samsung sierra-legacy sierra simtech
telit thuraya tplink ublox via wavecom x22x zte; do
./configure --prefix=/usr --disable-gtk-doc --disable-all-plugins --enable-plugin-$plugin;
./configure --prefix=/usr --disable-gtk-doc --disable-introspection --disable-all-plugins --enable-plugin-$plugin;
make;
make clean;
done
build-default:
stage: build
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
only:
- master
- branches
......@@ -125,15 +168,14 @@ build-default:
- schedules
- pushes
script:
- apt -y install gtk-doc-tools libglib2.0-doc gobject-introspection libsystemd-dev libpolkit-gobject-1-dev valac
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- git clone --depth 1 --branch mbim-1-24 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- pushd libmbim
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr
- ./configure --prefix=/usr --disable-gtk-doc --enable-introspection
- make
- make install
- popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- git clone --depth 1 --branch qmi-1-28 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr --enable-mbim-qmux --enable-collection=basic
......@@ -141,7 +183,7 @@ build-default:
- make install
- popd
- NOCONFIGURE=1 ./autogen.sh
- ./configure --prefix=/usr --enable-gtk-doc --with-polkit=strict --with-suspend-resume=systemd --with-systemdsystemunitdir=/lib/systemd/system
- ./configure --prefix=/usr --enable-gtk-doc --enable-introspection --with-polkit=strict --with-suspend-resume=systemd --with-systemdsystemunitdir=/lib/systemd/system
- make
- make check
- make install
......
ModemManager 1.16.6
-------------------------------------------
* Build:
** Require libqmi >= 1.28.6 (for the optional QMI support).
** Fix error with GCC 11 and -Wincompatible-pointer-types.
** Fix warning with GCC 11 and -Wmaybe-uninitialized.
* QMI:
** Increased device open timeout to 45s.
** Added support to handle transfer-route messages.
* Base manager:
** Added support for Qualcomm based PCI devices in the new WWAN subsystem in
kernel 5.13.
** Fix segfault on rare conditions when ports reported don't have a proper
subsystem or name.
** Fix segfault when trying to create device id after device is already gone.
* plugins:
** foxconn: added support for the T99W175 module.
** foxconn: fix segfault when attempting to use parent location support.
** quectel: ignore QLWURC URCs.
* Several other minor improvements and fixes.
ModemManager 1.16.4
-------------------------------------------
......
......@@ -24,16 +24,16 @@ static const G@Type@Value @enum_name@_values[] = {
GType
@enum_name@_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"),
@enum_name@_values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
}
return g_define_type_id__volatile;
return g_define_type_id_initialized;
}
/**
......
......@@ -12,9 +12,9 @@
GType
@enum_name@_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
if (g_once_init_enter (&g_define_type_id_initialized))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
......@@ -28,10 +28,10 @@ GType
};
GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
}
return g_define_type_id__volatile;
return g_define_type_id_initialized;
}
/*** END value-tail ***/
......
......@@ -6,7 +6,7 @@ dnl
m4_define([mm_major_version], [1])
m4_define([mm_minor_version], [16])
m4_define([mm_micro_version], [4])
m4_define([mm_micro_version], [6])
m4_define([mm_version],
[mm_major_version.mm_minor_version.mm_micro_version])
......@@ -401,7 +401,7 @@ dnl-----------------------------------------------------------------------------
dnl QMI support (enabled by default)
dnl
LIBQMI_VERSION=1.28.0
LIBQMI_VERSION=1.28.6
AC_ARG_WITH(qmi, AS_HELP_STRING([--without-qmi], [Build without QMI support]), [], [with_qmi=yes])
AM_CONDITIONAL(WITH_QMI, test "x$with_qmi" = "xyes")
......
......@@ -721,25 +721,6 @@ cmp_allowed_auth (MMBearerAllowedAuth a,
return FALSE;
}
static gboolean
cmp_allow_roaming (gboolean a,
gboolean a_set,
gboolean b,
gboolean b_set,
MMBearerPropertiesCmpFlags flags)
{
/* Strict match */
if (a == b && a_set == b_set)
return TRUE;
/* Additional loose match UNSET == */
if (flags & MM_BEARER_PROPERTIES_CMP_FLAGS_LOOSE) {
if ((a == MM_BEARER_ALLOWED_AUTH_UNKNOWN && b == MM_BEARER_ALLOWED_AUTH_NONE) ||
(b == MM_BEARER_ALLOWED_AUTH_UNKNOWN && a == MM_BEARER_ALLOWED_AUTH_NONE))
return TRUE;
}
return FALSE;
}
/**
* mm_bearer_properties_cmp: (skip)
*/
......
......@@ -1320,6 +1320,7 @@ mm_get_int_from_str (const gchar *str,
gint *out)
{
glong num;
guint i;
guint eol = 0;
if (!str)
......@@ -1332,10 +1333,10 @@ mm_get_int_from_str (const gchar *str,
if (!str[0])
return FALSE;
for (num = 0; str[num]; num++) {
if (str[num] != '+' && str[num] != '-' && !g_ascii_isdigit (str[num])) {
for (i = 0; str[i]; i++) {
if (str[i] != '+' && str[i] != '-' && !g_ascii_isdigit (str[i])) {
/* ignore \r\n at the end of the string */
if ((str[num] == '\r') || (str[num] == '\n')) {
if ((str[i] == '\r') || (str[i] == '\n')) {
eol++;
continue;
}
......@@ -1346,7 +1347,7 @@ mm_get_int_from_str (const gchar *str,
return FALSE;
}
/* if all characters were eol, the string is not parseable */
if (eol == num)
if (eol == i)
return FALSE;
errno = 0;
......@@ -1694,7 +1695,7 @@ mm_utils_hexstr2bin (const gchar *hex,
{
const gchar *ipos = hex;
g_autofree guint8 *buf = NULL;
gsize i;
gssize i;
gint a;
guint8 *opos;
......
......@@ -2867,8 +2867,6 @@ mm_modem_command (MMModem *self,
g_return_if_fail (MM_IS_MODEM (self));
if (g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)) < timeout)
g_warning ("Requested command timeout is shorter than the default DBus timeout");
mm_gdbus_modem_call_command (MM_GDBUS_MODEM (self), cmd, timeout, cancellable, callback, user_data);
}
......@@ -2902,9 +2900,6 @@ mm_modem_command_sync (MMModem *self,
g_return_val_if_fail (MM_IS_MODEM (self), NULL);
if (g_dbus_proxy_get_default_timeout (G_DBUS_PROXY (self)) < timeout)
g_warning ("Requested command timeout is shorter than the default DBus timeout");
if (!mm_gdbus_modem_call_command_sync (MM_GDBUS_MODEM (self), cmd, timeout, &result, cancellable, error))
return NULL;
......
......@@ -429,8 +429,8 @@ if WITH_MBIM
pkglib_LTLIBRARIES += libmm-shared-foxconn.la
libmm_shared_foxconn_la_SOURCES = \
foxconn/mm-shared.c \
foxconn/mm-broadband-modem-foxconn-t77w968.c \
foxconn/mm-broadband-modem-foxconn-t77w968.h \
foxconn/mm-broadband-modem-mbim-foxconn.c \
foxconn/mm-broadband-modem-mbim-foxconn.h \
$(NULL)
libmm_shared_foxconn_la_CPPFLAGS = \
$(SHARED_COMMON_COMPILER_FLAGS) \
......@@ -716,11 +716,11 @@ libmm_plugin_foxconn_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
dist_udevrules_DATA += foxconn/77-mm-foxconn-port-types.rules
dist_pkgdata_DATA += foxconn/mm-foxconn-t77w968-carrier-mapping.conf
dist_pkgdata_DATA += foxconn/mm-foxconn-carrier-mapping.conf
AM_CFLAGS += \
-DTESTUDEVRULESDIR_FOXCONN=\"${srcdir}/foxconn\" \
-DTESTKEYFILE_FOXCONN_T77W968=\"${srcdir}/foxconn/mm-foxconn-t77w968-carrier-mapping.conf\" \
-DTESTKEYFILE_FOXCONN=\"${srcdir}/foxconn/mm-foxconn-carrier-mapping.conf\" \
$(NULL)
endif
......
......@@ -978,7 +978,7 @@ mm_cinterion_parse_smong_response (const gchar *response,
guint value = 0;
GError *inner_error = NULL;
g_autoptr(GMatchInfo) match_info = NULL;
g_autoptr(GRegex) regex;
g_autoptr(GRegex) regex = NULL;
/* The AT^SMONG command returns a cell info table, where the second
* column identifies the "GPRS status", which is exactly what we want.
......
......@@ -45,7 +45,7 @@
#if defined WITH_MBIM
#include "mm-broadband-modem-mbim.h"
#include "mm-broadband-modem-mbim-xmm.h"
#include "mm-broadband-modem-foxconn-t77w968.h"
#include "mm-broadband-modem-mbim-foxconn.h"
#endif
#define MAX_PORT_PROBE_TIMEOUTS 3
......@@ -396,11 +396,11 @@ create_modem (MMPlugin *self,
/* Specific implementation for the DW5821e */
if (vendor == 0x413c && (product == 0x81d7 || product == 0x81e0)) {
mm_obj_dbg (self, "MBIM-powered DW5821e (T77W968) modem found...");
return MM_BASE_MODEM (mm_broadband_modem_foxconn_t77w968_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
return MM_BASE_MODEM (mm_broadband_modem_mbim_foxconn_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
if (mm_port_probe_list_is_xmm (probes)) {
......
/* -*- 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-2019 Aleksander Morgado <aleksander@aleksander.es>
*/
#ifndef MM_BROADBAND_MODEM_FOXCONN_T77W968_H
#define MM_BROADBAND_MODEM_FOXCONN_T77W968_H
#include "mm-broadband-modem-mbim.h"
#define MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968 (mm_broadband_modem_foxconn_t77w968_get_type ())
#define MM_BROADBAND_MODEM_FOXCONN_T77W968(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968))
#define MM_BROADBAND_MODEM_FOXCONN_T77W968_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968Class))
#define MM_IS_BROADBAND_MODEM_FOXCONN_T77W968(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968))
#define MM_IS_BROADBAND_MODEM_FOXCONN_T77W968_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968))
#define MM_BROADBAND_MODEM_FOXCONN_T77W968_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968Class))
typedef struct _MMBroadbandModemFoxconnT77w968 MMBroadbandModemFoxconnT77w968;
typedef struct _MMBroadbandModemFoxconnT77w968Class MMBroadbandModemFoxconnT77w968Class;
typedef struct _MMBroadbandModemFoxconnT77w968Private MMBroadbandModemFoxconnT77w968Private;
struct _MMBroadbandModemFoxconnT77w968 {
MMBroadbandModemMbim parent;
MMBroadbandModemFoxconnT77w968Private *priv;
};
struct _MMBroadbandModemFoxconnT77w968Class{
MMBroadbandModemMbimClass parent;
};
GType mm_broadband_modem_foxconn_t77w968_get_type (void);
MMBroadbandModemFoxconnT77w968 *mm_broadband_modem_foxconn_t77w968_new (const gchar *device,
const gchar **driver,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id);
#endif /* MM_BROADBAND_MODEM_FOXCONN_T77W968_H */
......@@ -31,7 +31,7 @@
#include "mm-base-modem-at.h"
#include "mm-iface-modem.h"
#include "mm-iface-modem-location.h"
#include "mm-broadband-modem-foxconn-t77w968.h"
#include "mm-broadband-modem-mbim-foxconn.h"
#if defined WITH_QMI
# include "mm-iface-modem-firmware.h"
......@@ -41,13 +41,15 @@
static void iface_modem_location_init (MMIfaceModemLocation *iface);
#if defined WITH_QMI
static void iface_modem_init (MMIfaceModem *iface);
static void iface_modem_firmware_init (MMIfaceModemFirmware *iface);
#endif
static MMIfaceModemLocation *iface_modem_location_parent;
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemFoxconnT77w968, mm_broadband_modem_foxconn_t77w968, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimFoxconn, mm_broadband_modem_mbim_foxconn, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
#if defined WITH_QMI
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)
#endif
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init))
......@@ -58,10 +60,66 @@ typedef enum {
FEATURE_SUPPORTED
} FeatureSupport;
struct _MMBroadbandModemFoxconnT77w968Private {
struct _MMBroadbandModemMbimFoxconnPrivate {
FeatureSupport unmanaged_gps_support;
};
#if defined WITH_QMI
/*****************************************************************************/
/* FCC unlock (Modem interface) */
static gboolean
fcc_unlock_finish (MMIfaceModem *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
dms_foxconn_set_fcc_authentication_ready (QmiClientDms *client,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
g_autoptr(QmiMessageDmsFoxconnSetFccAuthenticationOutput) output = NULL;
output = qmi_client_dms_foxconn_set_fcc_authentication_finish (client, res, &error);
if (!output || !qmi_message_dms_foxconn_set_fcc_authentication_output_get_result (output, &error))
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
fcc_unlock (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
QmiClient *client = NULL;
g_autoptr(QmiMessageDmsFoxconnSetFccAuthenticationInput) input = NULL;
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
QMI_SERVICE_DMS, &client,
callback, user_data))
return;
task = g_task_new (self, NULL, callback, user_data);
input = qmi_message_dms_foxconn_set_fcc_authentication_input_new ();
qmi_message_dms_foxconn_set_fcc_authentication_input_set_value (input, 0x00, NULL);
qmi_client_dms_foxconn_set_fcc_authentication (QMI_CLIENT_DMS (client),
input,
5,
NULL,
(GAsyncReadyCallback)dms_foxconn_set_fcc_authentication_ready,
task);
}
/*****************************************************************************/
/* Firmware update settings
*
......@@ -70,8 +128,6 @@ struct _MMBroadbandModemFoxconnT77w968Private {
* report.
*/
#if defined WITH_QMI
static MMFirmwareUpdateSettings *
firmware_load_update_settings_finish (MMIfaceModemFirmware *self,
GAsyncResult *res,
......@@ -131,16 +187,23 @@ firmware_load_update_settings (MMIfaceModemFirmware *self,
NULL);
if (!client) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Unable to load T77w968 version info: no QMI DMS client available");
"Unable to load version info: no QMI DMS client available");
g_object_unref (task);
return;
}
input = qmi_message_dms_foxconn_get_firmware_version_input_new ();
qmi_message_dms_foxconn_get_firmware_version_input_set_version_type (
input,
QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG,
NULL);
/* 0x105b is the T99W175 module, T99W175 needs to compare the apps version. */
if (mm_base_modem_get_vendor_id (MM_BASE_MODEM (self)) == 0x105b)
qmi_message_dms_foxconn_get_firmware_version_input_set_version_type (
input,
QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG_APPS,
NULL);
else
qmi_message_dms_foxconn_get_firmware_version_input_set_version_type (
input,
QMI_DMS_FOXCONN_FIRMWARE_VERSION_TYPE_FIRMWARE_MCFG,
NULL);
qmi_client_dms_foxconn_get_firmware_version (
QMI_CLIENT_DMS (client),
input,
......@@ -159,7 +222,7 @@ firmware_load_update_settings (MMIfaceModemFirmware *self,
static MMModemLocationSource
location_load_capabilities_finish (MMIfaceModemLocation *self,
GAsyncResult *res,
GError **error)
GError **error)
{
GError *inner_error = NULL;
gssize value;
......@@ -172,6 +235,26 @@ location_load_capabilities_finish (MMIfaceModemLocation *self,
return (MMModemLocationSource)value;
}
static void
custom_location_load_capabilities (GTask *task,
MMModemLocationSource sources)
{
MMBroadbandModemMbimFoxconn *self;
self = g_task_get_source_object (task);
/* If we have a GPS port and an AT port, enable unmanaged GPS support */
if (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)) &&
mm_base_modem_peek_port_gps (MM_BASE_MODEM (self))) {
self->priv->unmanaged_gps_support = FEATURE_SUPPORTED;
sources |= MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED;
}
/* So we're done, complete */
g_task_return_int (task, sources);
g_object_unref (task);
}
static void
parent_load_capabilities_ready (MMIfaceModemLocation *self,
GAsyncResult *res,
......@@ -187,16 +270,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
return;
}
/* If we have a GPS port and an AT port, enable unmanaged GPS support */
if (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)) &&
mm_base_modem_peek_port_gps (MM_BASE_MODEM (self))) {
MM_BROADBAND_MODEM_FOXCONN_T77W968 (self)->priv->unmanaged_gps_support = FEATURE_SUPPORTED;
sources |= MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED;
}
/* So we're done, complete */
g_task_return_int (task, sources);
g_object_unref (task);
custom_location_load_capabilities (task, sources);
}
static void
......@@ -208,10 +282,18 @@ location_load_capabilities (MMIfaceModemLocation *self,
task = g_task_new (self, NULL, callback, user_data);
/* Chain up parent's setup */
iface_modem_location_parent->load_capabilities (self,
(GAsyncReadyCallback)parent_load_capabilities_ready,
task);
/* Chain up parent's setup, if any. If MM is built without QMI support,
* the MBIM modem won't have any location capabilities. */
if (iface_modem_location_parent &&
iface_modem_location_parent->load_capabilities &&
iface_modem_location_parent->load_capabilities_finish) {
iface_modem_location_parent->load_capabilities (self,
(GAsyncReadyCallback)parent_load_capabilities_ready,
task);
return;
}
custom_location_load_capabilities (task, MM_MODEM_LOCATION_SOURCE_NONE);
}
/*****************************************************************************/
......@@ -248,10 +330,19 @@ parent_disable_location_gathering (GTask *task)
self = MM_IFACE_MODEM_LOCATION (g_task_get_source_object (task));
source = GPOINTER_TO_UINT (g_task_get_task_data (task));
iface_modem_location_parent->disable_location_gathering (self,
source,
(GAsyncReadyCallback)parent_disable_location_gathering_ready,
task);
if (iface_modem_location_parent &&
iface_modem_location_parent->disable_location_gathering &&
iface_modem_location_parent->disable_location_gathering_finish) {
iface_modem_location_parent->disable_location_gathering (
self,
source,
(GAsyncReadyCallback)parent_disable_location_gathering_ready,
task);
return;
}
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
......@@ -276,8 +367,8 @@ disable_location_gathering (MMIfaceModemLocation *_self,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMBroadbandModemFoxconnT77w968 *self = MM_BROADBAND_MODEM_FOXCONN_T77W968 (_self);
GTask *task;
MMBroadbandModemMbimFoxconn *self = MM_BROADBAND_MODEM_MBIM_FOXCONN (_self);
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
g_task_set_task_data (task, GUINT_TO_POINTER (source), NULL);
......@@ -323,22 +414,15 @@ unmanaged_gps_enabled_ready (MMBaseModem *self,
}
static void
parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
GAsyncResult *res,
GTask *task)
custom_enable_location_gathering (GTask *task)
{
MMBroadbandModemFoxconnT77w968 *self = MM_BROADBAND_MODEM_FOXCONN_T77W968 (_self);
GError *error = NULL;
MMModemLocationSource source;
MMBroadbandModemMbimFoxconn *self;
MMModemLocationSource source;
if (!iface_modem_location_parent->enable_location_gathering_finish (_self, res, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
self = g_task_get_source_object (task);
source = GPOINTER_TO_UINT (g_task_get_task_data (task));
/* We only support Unmanaged GPS at this level */
source = GPOINTER_TO_UINT (g_task_get_task_data (task));
if ((self->priv->unmanaged_gps_support != FEATURE_SUPPORTED) ||
(source != MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED)) {
g_task_return_boolean (task, TRUE);
......@@ -346,7 +430,7 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
return;
}
mm_base_modem_at_command (MM_BASE_MODEM (_self),
mm_base_modem_at_command (MM_BASE_MODEM (self),
"^NV=30007,01,\"01\"",
3,
FALSE,
......@@ -354,6 +438,22 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
task);
}
static void
parent_enable_location_gathering_ready (MMIfaceModemLocation *self,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
if (!iface_modem_location_parent->enable_location_gathering_finish (self, res, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
custom_enable_location_gathering (task);
}
static void
enable_location_gathering (MMIfaceModemLocation *self,
MMModemLocationSource source,
......@@ -366,22 +466,30 @@ enable_location_gathering (MMIfaceModemLocation *self,
g_task_set_task_data (task, GUINT_TO_POINTER (source), NULL);
/* Chain up parent's gathering enable */
iface_modem_location_parent->enable_location_gathering (self,
source,
(GAsyncReadyCallback)parent_enable_location_gathering_ready,
task);
if (iface_modem_location_parent &&
iface_modem_location_parent->enable_location_gathering &&
iface_modem_location_parent->enable_location_gathering_finish) {
iface_modem_location_parent->enable_location_gathering (
self,
source,
(GAsyncReadyCallback)parent_enable_location_gathering_ready,
task);
return;
}
custom_enable_location_gathering (task);
}
/*****************************************************************************/
MMBroadbandModemFoxconnT77w968 *
mm_broadband_modem_foxconn_t77w968_new (const gchar *device,
const gchar **drivers,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id)
MMBroadbandModemMbimFoxconn *
mm_broadband_modem_mbim_foxconn_new (const gchar *device,
const gchar **drivers,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id)
{
return g_object_new (MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968,
return g_object_new (MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN,
MM_BASE_MODEM_DEVICE, device,
MM_BASE_MODEM_DRIVERS, drivers,
MM_BASE_MODEM_PLUGIN, plugin,
......@@ -391,15 +499,15 @@ mm_broadband_modem_foxconn_t77w968_new (const gchar *device,
MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED, FALSE,
MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS, TRUE,
MM_IFACE_MODEM_CARRIER_CONFIG_MAPPING, PKGDATADIR "/mm-foxconn-t77w968-carrier-mapping.conf",
MM_IFACE_MODEM_CARRIER_CONFIG_MAPPING, PKGDATADIR "/mm-foxconn-carrier-mapping.conf",
NULL);
}
static void
mm_broadband_modem_foxconn_t77w968_init (MMBroadbandModemFoxconnT77w968 *self)
mm_broadband_modem_mbim_foxconn_init (MMBroadbandModemMbimFoxconn *self)
{
/* Initialize private data */
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BROADBAND_MODEM_FOXCONN_T77W968, MMBroadbandModemFoxconnT77w968Private);
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconnPrivate);
self->priv->unmanaged_gps_support = FEATURE_SUPPORT_UNKNOWN;
}
......@@ -418,6 +526,13 @@ iface_modem_location_init (MMIfaceModemLocation *iface)
#if defined WITH_QMI
static void
iface_modem_init (MMIfaceModem *iface)
{
iface->fcc_unlock = fcc_unlock;
iface->fcc_unlock_finish = fcc_unlock_finish;
}
static void
iface_modem_firmware_init (MMIfaceModemFirmware *iface)
{
......@@ -428,9 +543,9 @@ iface_modem_firmware_init (MMIfaceModemFirmware *iface)
#endif
static void
mm_broadband_modem_foxconn_t77w968_class_init (MMBroadbandModemFoxconnT77w968Class *klass)
mm_broadband_modem_mbim_foxconn_class_init (MMBroadbandModemMbimFoxconnClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMBroadbandModemFoxconnT77w968Private));
g_type_class_add_private (object_class, sizeof (MMBroadbandModemMbimFoxconnPrivate));
}
/* -*- 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-2019 Aleksander Morgado <aleksander@aleksander.es>
*/
#ifndef MM_BROADBAND_MODEM_MBIM_FOXCONN_H
#define MM_BROADBAND_MODEM_MBIM_FOXCONN_H
#include "mm-broadband-modem-mbim.h"
#define MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN (mm_broadband_modem_mbim_foxconn_get_type ())
#define MM_BROADBAND_MODEM_MBIM_FOXCONN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconn))
#define MM_BROADBAND_MODEM_MBIM_FOXCONN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconnClass))
#define MM_IS_BROADBAND_MODEM_MBIM_FOXCONN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN))
#define MM_IS_BROADBAND_MODEM_MBIM_FOXCONN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN))
#define MM_BROADBAND_MODEM_MBIM_FOXCONN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_FOXCONN, MMBroadbandModemMbimFoxconnClass))
typedef struct _MMBroadbandModemMbimFoxconn MMBroadbandModemMbimFoxconn;
typedef struct _MMBroadbandModemMbimFoxconnClass MMBroadbandModemMbimFoxconnClass;
typedef struct _MMBroadbandModemMbimFoxconnPrivate MMBroadbandModemMbimFoxconnPrivate;
struct _MMBroadbandModemMbimFoxconn {
MMBroadbandModemMbim parent;
MMBroadbandModemMbimFoxconnPrivate *priv;
};
struct _MMBroadbandModemMbimFoxconnClass{
MMBroadbandModemMbimClass parent;
};
GType mm_broadband_modem_mbim_foxconn_get_type (void);
MMBroadbandModemMbimFoxconn *mm_broadband_modem_mbim_foxconn_new (const gchar *device,
const gchar **driver,
const gchar *plugin,
guint16 vendor_id,
guint16 product_id);
#endif /* MM_BROADBAND_MODEM_MBIM_FOXCONN_H */
......@@ -34,7 +34,7 @@
#endif
#if defined WITH_MBIM
#include "mm-broadband-modem-foxconn-t77w968.h"
#include "mm-broadband-modem-mbim-foxconn.h"
#endif
G_DEFINE_TYPE (MMPluginFoxconn, mm_plugin_foxconn, MM_TYPE_PLUGIN)
......@@ -66,22 +66,12 @@ create_modem (MMPlugin *self,
#if defined WITH_MBIM
if (mm_port_probe_list_has_mbim_port (probes)) {
/* Specific implementation for the T77W968 */
if (product == 0xe0b4 || product == 0xe0b5) {
mm_obj_dbg (self, "MBIM-powered T77W968 modem found...");
return MM_BASE_MODEM (mm_broadband_modem_foxconn_t77w968_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
mm_obj_dbg (self, "MBIM-powered Foxconn-branded modem found...");
return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
return MM_BASE_MODEM (mm_broadband_modem_mbim_foxconn_new (uid,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
#endif
......@@ -98,14 +88,17 @@ create_modem (MMPlugin *self,
G_MODULE_EXPORT MMPlugin *
mm_plugin_create (void)
{
static const gchar *subsystems[] = { "tty", "net", "usbmisc", NULL };
static const guint16 vendors[] = { 0x0489, 0 };
static const gchar *subsystems[] = { "tty", "net", "usbmisc", "wwan", NULL };
static const guint16 vendor_ids[] = {
0x0489, /* usb vid */
0x105b, /* pci vid */
0 };
return MM_PLUGIN (
g_object_new (MM_TYPE_PLUGIN_FOXCONN,
MM_PLUGIN_NAME, MM_MODULE_NAME,
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendors,
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
MM_PLUGIN_ALLOWED_AT, TRUE,
MM_PLUGIN_ALLOWED_QCDM, TRUE,
MM_PLUGIN_ALLOWED_QMI, TRUE,
......
......@@ -91,7 +91,7 @@ create_modem (MMPlugin *self,
G_MODULE_EXPORT MMPlugin *
mm_plugin_create (void)
{
static const gchar *subsystems[] = { "tty", "net", "usbmisc", NULL };
static const gchar *subsystems[] = { "tty", "net", "usbmisc", "wwan", NULL };
return MM_PLUGIN (
g_object_new (MM_TYPE_PLUGIN_GENERIC,
......
......@@ -50,12 +50,14 @@ typedef struct {
MMModemLocationSource enabled_sources;
FeatureSupport qgps_supported;
GRegex *qgpsurc_regex;
GRegex *qlwurc_regex;
} Private;
static void
private_free (Private *priv)
{
g_regex_unref (priv->qgpsurc_regex);
g_regex_unref (priv->qlwurc_regex);
g_slice_free (Private, priv);
}
......@@ -75,6 +77,7 @@ get_private (MMSharedQuectel *self)
priv->enabled_sources = MM_MODEM_LOCATION_SOURCE_NONE;
priv->qgps_supported = FEATURE_SUPPORT_UNKNOWN;
priv->qgpsurc_regex = g_regex_new ("\\r\\n\\+QGPSURC:.*", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
priv->qlwurc_regex = g_regex_new ("\\r\\n\\+QLWURC:.*", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
g_assert (MM_SHARED_QUECTEL_GET_INTERFACE (self)->peek_parent_broadband_modem_class);
priv->broadband_modem_class_parent = MM_SHARED_QUECTEL_GET_INTERFACE (self)->peek_parent_broadband_modem_class (self);
......@@ -120,6 +123,12 @@ mm_shared_quectel_setup_ports (MMBroadbandModem *self)
ports[i],
priv->qgpsurc_regex,
NULL, NULL, NULL);
/* Ignore +QLWURC */
mm_port_serial_at_add_unsolicited_msg_handler (
ports[i],
priv->qlwurc_regex,
NULL, NULL, NULL);
}
}
......
......@@ -56,9 +56,9 @@ test_dummy (void)
#if defined ENABLE_PLUGIN_FOXCONN
static void
test_foxconn_t77w968 (void)
test_foxconn (void)
{
common_test (TESTKEYFILE_FOXCONN_T77W968);
common_test (TESTKEYFILE_FOXCONN);
}
#endif
......@@ -72,7 +72,7 @@ int main (int argc, char **argv)
g_test_add_func ("/MM/test-keyfiles/dummy", test_dummy);
#if defined ENABLE_PLUGIN_FOXCONN
g_test_add_func ("/MM/test-keyfiles/foxconn/t77w968", test_foxconn_t77w968);
g_test_add_func ("/MM/test-keyfiles/foxconn", test_foxconn);
#endif
return g_test_run ();
......
......@@ -17,4 +17,16 @@ SUBSYSTEM=="tty", ENV{ID_MM_CANDIDATE}="1"
SUBSYSTEM=="net", ENV{ID_MM_CANDIDATE}="1"
KERNEL=="cdc-wdm[0-9]*", SUBSYSTEM=="usbmisc", ENV{ID_MM_CANDIDATE}="1"
# WWAN subsystem port handling
# - All USB devices ignored for now, only PCI devices expected
# - Only "wwan_port" device types processed (single ports); we fully ignore
# the "wwan_dev" device type (full device, not just one port)
SUBSYSTEMS=="usb", GOTO="mm_candidate_end"
SUBSYSTEM=="wwan", ENV{DEVTYPE}=="wwan_dev", GOTO="mm_candidate_end"
SUBSYSTEM=="wwan", ENV{ID_MM_CANDIDATE}="1"
SUBSYSTEM=="wwan", KERNEL=="*MBIM", ENV{ID_MM_PORT_TYPE_MBIM}="1"
SUBSYSTEM=="wwan", KERNEL=="*QMI", ENV{ID_MM_PORT_TYPE_QMI}="1"
SUBSYSTEM=="wwan", KERNEL=="*AT", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
SUBSYSTEM=="wwan", KERNEL=="*QCDM", ENV{ID_MM_PORT_TYPE_QCDM}="1"
LABEL="mm_candidate_end"