cellient: new generic plugin for Cellient modems with optional QMI

Simple plugin handling Cellient (vid 0x2692) modems. Optional QMI
through the WITH_QMI compile flag. Disables QMI WDS PCO for the
Qualcomm-branded MPL200 by setting the ID_MM_QMI_PCO_DISABLED udev
tag, effectively preventing a modem crash.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/842

Signed-off-by: Stig M. Baugstø <1129097-stigma@users.noreply.gitlab.freedesktop.org>
This commit is contained in:
Stig M. Baugstø
2024-10-24 15:21:57 +02:00
parent 78508b7dce
commit 0c167a5124
7 changed files with 146 additions and 0 deletions
+1
View File
@@ -327,6 +327,7 @@ plugins_options_reqs = {
'altair-lte': {'available': true, 'shared': []},
'anydata': {'available': true, 'shared': []},
'broadmobi': {'available': true, 'shared': []},
'cellient': {'available': true, 'shared': []},
'cinterion': {'available': true, 'shared': []},
'dell': {'available': true, 'shared': dell_shared_reqs},
'dlink': {'available': true, 'shared': []},
+1
View File
@@ -30,6 +30,7 @@ option('plugin_generic', type: 'feature', value: 'auto', description: 'enable ge
option('plugin_altair_lte', type: 'feature', value: 'auto', description: 'enable altair lte plugin support')
option('plugin_anydata', type: 'feature', value: 'auto', description: 'enable anydata plugin support')
option('plugin_broadmobi', type: 'feature', value: 'auto', description: 'enable broadmobi plugin support')
option('plugin_cellient', type: 'feature', value: 'auto', description: 'enable cellient plugin support')
option('plugin_cinterion', type: 'feature', value: 'auto', description: 'enable cinterion plugin support')
option('plugin_dell', type: 'feature', value: 'auto', description: 'enable dell plugin support')
option('plugin_dlink', type: 'feature', value: 'auto', description: 'enable dlink plugin support')
+18
View File
@@ -0,0 +1,18 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move|bind", GOTO="mm_cellient_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2692", GOTO="mm_cellient_generic"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", GOTO="mm_cellient_qualcomm"
GOTO="mm_cellient_end"
LABEL="mm_cellient_generic"
# Cellient MPL200: Disable QMI WDS PCO
ATTRS{idVendor}=="2692", ATTRS{idProduct}=="9025", ENV{ID_MM_QMI_PCO_DISABLED}="1"
GOTO="mm_cellient_end"
# Cellient products rebranded as Qualcomm
LABEL="mm_cellient_qualcomm"
# Cellient MPL200 (rebranded Qualcomm 05c6:9025): Disable QMI WDS PCO
ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9025", ENV{ID_MM_QMI_PCO_DISABLED}="1"
LABEL="mm_cellient_end"
+92
View File
@@ -0,0 +1,92 @@
/* -*- 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) 2024 Stig Magnus Baugstø <stig@peerconsulting.no>
*/
#define _LIBMM_INSIDE_MM
#include "mm-plugin-common.h"
#include "mm-log-object.h"
#if defined WITH_QMI
# include "mm-broadband-modem-qmi.h"
#else
# include "mm-broadband-modem.h"
#endif
#define MM_TYPE_PLUGIN_CELLIENT mm_plugin_cellient_get_type ()
MM_DEFINE_PLUGIN (CELLIENT, cellient, Cellient)
/*****************************************************************************/
static MMBaseModem *
create_modem (MMPlugin *self,
const gchar *uid,
const gchar *physdev,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) {
mm_obj_dbg (self, "QMI-powered Cellient modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (uid,
physdev,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
#endif
mm_obj_dbg (self, "Generic Cellient modem found...");
return MM_BASE_MODEM (mm_broadband_modem_new (uid,
physdev,
drivers,
mm_plugin_get_name (self),
vendor,
product));
}
/*****************************************************************************/
MM_PLUGIN_NAMED_CREATOR_SCOPE MMPlugin *
mm_plugin_create_cellient (void)
{
static const gchar *subsystems[] = { "tty", "net", "usbmisc", "wwan", NULL };
static const guint16 vendor_ids[] = { 0x2692, 0 };
return MM_PLUGIN (
g_object_new (MM_TYPE_PLUGIN_CELLIENT,
MM_PLUGIN_NAME, MM_MODULE_NAME,
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
MM_PLUGIN_ALLOWED_AT, TRUE,
MM_PLUGIN_ALLOWED_QMI, TRUE,
NULL));
}
static void
mm_plugin_cellient_init (MMPluginCellient *self)
{
}
static void
mm_plugin_cellient_class_init (MMPluginCellientClass *klass)
{
MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
plugin_class->create_modem = create_modem;
}
+17
View File
@@ -357,6 +357,23 @@ if plugins_options['broadmobi']
plugins_udev_rules += files('broadmobi/77-mm-broadmobi-port-types.rules')
endif
# plugin: cellient
if plugins_options['cellient']
test_udev_rules_dir_c_args = ['-DTESTUDEVRULESDIR_CELLIENT="@0@"'.format(plugins_dir / 'cellient')]
plugins_test_udev_rules_dir_c_args += test_udev_rules_dir_c_args
sources = files(
'cellient/mm-plugin-cellient.c',
)
plugins += {'plugin-cellient': {
'plugin': true,
'module': {'sources': sources, 'include_directories': plugins_incs, 'c_args': test_udev_rules_dir_c_args + ['-DMM_MODULE_NAME="cellient"']},
}}
plugins_udev_rules += files('cellient/77-mm-cellient.rules')
endif
# plugin: cinterion (previously siemens)
if plugins_options['cinterion']
test_udev_rules_dir_c_args = ['-DTESTUDEVRULESDIR_CINTERION="@0@"'.format(plugins_dir / 'cinterion')]
+6
View File
@@ -28,6 +28,9 @@ MMPlugin *mm_plugin_create_anydata (void);
#if defined ENABLE_PLUGIN_BROADMOBI
MMPlugin *mm_plugin_create_broadmobi (void);
#endif
#if defined ENABLE_PLUGIN_CELLIENT
MMPlugin *mm_plugin_create_cellient (void);
#endif
#if defined ENABLE_PLUGIN_CINTERION
MMPlugin *mm_plugin_create_cinterion (void);
#endif
@@ -163,6 +166,9 @@ mm_builtin_plugins_load (void)
#if defined ENABLE_PLUGIN_BROADMOBI
PREPEND_PLUGIN (broadmobi);
#endif
#if defined ENABLE_PLUGIN_CELLIENT
PREPEND_PLUGIN (cellient);
#endif
#if defined ENABLE_PLUGIN_CINTERION
PREPEND_PLUGIN (cinterion);
#endif
+11
View File
@@ -112,6 +112,14 @@ test_x22x (void)
}
#endif
#if defined ENABLE_PLUGIN_CELLIENT
static void
test_cellient (void)
{
common_test (TESTUDEVRULESDIR_CELLIENT);
}
#endif
#if defined ENABLE_PLUGIN_CINTERION
static void
test_cinterion (void)
@@ -238,6 +246,9 @@ int main (int argc, char **argv)
#if defined ENABLE_PLUGIN_X22X
g_test_add_func ("/MM/test-udev-rules/x22x", test_x22x);
#endif
#if defined ENABLE_PLUGIN_CELLIENT
g_test_add_func ("/MM/test-udev-rules/cellient", test_cellient);
#endif
#if defined ENABLE_PLUGIN_CINTERION
g_test_add_func ("/MM/test-udev-rules/cinterion", test_cinterion);
#endif