api,modem: new 'IgnoredPorts' property
Expose a new list of 'IgnoredPorts' via D-Bus and therefore remove the use of `MM_MODEM_PORT_TYPE_IGNORED` Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
This commit is contained in:
@@ -316,8 +316,11 @@ print_modem_info (void)
|
||||
MMModemBand *bands = NULL;
|
||||
guint n_bands = 0;
|
||||
MMModemPortInfo *ports = NULL;
|
||||
MMModemPortInfo *ignored_ports = NULL;
|
||||
guint n_ports = 0;
|
||||
guint n_ignored_ports = 0;
|
||||
gchar *ports_string;
|
||||
gchar *ignored_ports_string;
|
||||
MMUnlockRetries *unlock_retries;
|
||||
guint signal_quality = 0;
|
||||
gboolean signal_quality_recent = FALSE;
|
||||
@@ -343,6 +346,8 @@ print_modem_info (void)
|
||||
g_free (bands);
|
||||
mm_modem_get_ports (ctx->modem, &ports, &n_ports);
|
||||
ports_string = mm_common_build_ports_string (ports, n_ports);
|
||||
mm_modem_get_ignored_ports (ctx->modem, &ignored_ports, &n_ignored_ports);
|
||||
ignored_ports_string = mm_common_build_ports_string (ignored_ports, n_ignored_ports);
|
||||
mm_modem_port_info_array_free (ports, n_ports);
|
||||
if (mm_modem_get_current_modes (ctx->modem, &allowed_modes, &preferred_mode)) {
|
||||
allowed_modes_string = mm_modem_mode_build_string_from_mask (allowed_modes);
|
||||
@@ -376,6 +381,7 @@ print_modem_info (void)
|
||||
mmcli_output_string (MMC_F_SYSTEM_PLUGIN, mm_modem_get_plugin (ctx->modem));
|
||||
mmcli_output_string (MMC_F_SYSTEM_PRIMARY_PORT, mm_modem_get_primary_port (ctx->modem));
|
||||
mmcli_output_string_list (MMC_F_SYSTEM_PORTS, ports_string);
|
||||
mmcli_output_string_list (MMC_F_SYSTEM_IGNORED_PORTS, ignored_ports_string);
|
||||
|
||||
mmcli_output_string_array (MMC_F_NUMBERS_OWN, (const gchar **) mm_modem_get_own_numbers (ctx->modem), FALSE);
|
||||
|
||||
@@ -540,6 +546,7 @@ print_modem_info (void)
|
||||
mmcli_output_dump ();
|
||||
|
||||
g_free (ports_string);
|
||||
g_free (ignored_ports_string);
|
||||
g_free (supported_ip_families_string);
|
||||
g_free (current_bands_string);
|
||||
g_free (supported_bands_string);
|
||||
|
||||
@@ -120,6 +120,7 @@ static FieldInfo field_infos[] = {
|
||||
[MMC_F_SYSTEM_PLUGIN] = { "modem.generic.plugin", "plugin", MMC_S_MODEM_SYSTEM, },
|
||||
[MMC_F_SYSTEM_PRIMARY_PORT] = { "modem.generic.primary-port", "primary port", MMC_S_MODEM_SYSTEM, },
|
||||
[MMC_F_SYSTEM_PORTS] = { "modem.generic.ports", "ports", MMC_S_MODEM_SYSTEM, },
|
||||
[MMC_F_SYSTEM_IGNORED_PORTS] = { "modem.generic.ignored-ports", "ignored ports", MMC_S_MODEM_SYSTEM, },
|
||||
[MMC_F_NUMBERS_OWN] = { "modem.generic.own-numbers", "own", MMC_S_MODEM_NUMBERS, },
|
||||
[MMC_F_STATUS_LOCK] = { "modem.generic.unlock-required", "lock", MMC_S_MODEM_STATUS, },
|
||||
[MMC_F_STATUS_UNLOCK_RETRIES] = { "modem.generic.unlock-retries", "unlock retries", MMC_S_MODEM_STATUS, },
|
||||
|
||||
@@ -114,6 +114,7 @@ typedef enum {
|
||||
MMC_F_SYSTEM_PLUGIN,
|
||||
MMC_F_SYSTEM_PRIMARY_PORT,
|
||||
MMC_F_SYSTEM_PORTS,
|
||||
MMC_F_SYSTEM_IGNORED_PORTS,
|
||||
/* Numbers section */
|
||||
MMC_F_NUMBERS_OWN,
|
||||
/* Status section */
|
||||
|
||||
@@ -2822,6 +2822,8 @@ mm_gdbus_modem_get_primary_port
|
||||
mm_gdbus_modem_dup_primary_port
|
||||
mm_gdbus_modem_get_ports
|
||||
mm_gdbus_modem_dup_ports
|
||||
mm_gdbus_modem_get_ignored_ports
|
||||
mm_gdbus_modem_dup_ignored_ports
|
||||
mm_gdbus_modem_get_revision
|
||||
mm_gdbus_modem_dup_revision
|
||||
mm_gdbus_modem_get_carrier_configuration
|
||||
@@ -2908,6 +2910,7 @@ mm_gdbus_modem_set_own_numbers
|
||||
mm_gdbus_modem_set_plugin
|
||||
mm_gdbus_modem_set_primary_port
|
||||
mm_gdbus_modem_set_ports
|
||||
mm_gdbus_modem_set_ignored_ports
|
||||
mm_gdbus_modem_set_revision
|
||||
mm_gdbus_modem_set_carrier_configuration
|
||||
mm_gdbus_modem_set_carrier_configuration_revision
|
||||
|
||||
@@ -973,15 +973,27 @@
|
||||
<!--
|
||||
Ports:
|
||||
|
||||
The list of ports in the modem, given as an array of string and unsigned
|
||||
integer pairs. The string is the port name or path, and the integer is
|
||||
the port type given as a
|
||||
The list of used ports in the modem, given as an array of string and
|
||||
unsigned integer pairs. The string is the port name or path, and the
|
||||
integer is the port type given as a
|
||||
<link linkend="MMModemPortType">MMModemPortType</link> value.
|
||||
|
||||
Since: 1.0
|
||||
-->
|
||||
<property name="Ports" type="a(su)" access="read" />
|
||||
|
||||
<!--
|
||||
IgnoredPorts:
|
||||
|
||||
The list of ignored ports in the modem, given as an array of string and
|
||||
unsigned integer pairs. The string is the port name or path, and the
|
||||
integer is the port type given as a
|
||||
<link linkend="MMModemPortType">MMModemPortType</link> value.
|
||||
|
||||
Since: 1.26
|
||||
-->
|
||||
<property name="IgnoredPorts" type="a(su)" access="read" />
|
||||
|
||||
<!--
|
||||
EquipmentIdentifier:
|
||||
|
||||
|
||||
+42
-1
@@ -47,6 +47,7 @@ struct _MMModemPrivate {
|
||||
GMutex mutex;
|
||||
|
||||
PROPERTY_ARRAY_DECLARE (ports)
|
||||
PROPERTY_ARRAY_DECLARE (ignored_ports)
|
||||
PROPERTY_ARRAY_DECLARE (supported_modes)
|
||||
PROPERTY_ARRAY_DECLARE (supported_capabilities)
|
||||
PROPERTY_ARRAY_DECLARE (supported_bands)
|
||||
@@ -984,7 +985,7 @@ mm_modem_dup_primary_port (MMModem *self)
|
||||
* mm_modem_port_info_array_free() when no longer needed.
|
||||
* @n_ports: (out): Return location for the number of values in @ports.
|
||||
*
|
||||
* Gets the list of ports in the modem.
|
||||
* Gets the list of used ports in the modem.
|
||||
*
|
||||
* Returns: %TRUE if @ports and @n_ports are set, %FALSE otherwise.
|
||||
*
|
||||
@@ -999,6 +1000,44 @@ PROPERTY_ARRAY_DEFINE_DEEP (ports,
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_modem_peek_ignored_ports:
|
||||
* @self: A #MMModem.
|
||||
* @ports: (out) (array length=n_ports) (transfer none): Return location for the
|
||||
* array of #MMModemPortInfo values. Do not free the returned value, it is
|
||||
* owned by @self.
|
||||
* @n_ports: (out): Return location for the number of values in @ports.
|
||||
*
|
||||
* Gets the list of ignored ports in the modem.
|
||||
*
|
||||
* Returns: %TRUE if @ports and @n_ports are set, %FALSE otherwise.
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
|
||||
/**
|
||||
* mm_modem_get_ignored_ports:
|
||||
* @self: A #MMModem.
|
||||
* @ports: (out) (array length=n_ports): Return location for the array of
|
||||
* #MMModemPortInfo values. The returned array should be freed with
|
||||
* mm_modem_port_info_array_free() when no longer needed.
|
||||
* @n_ports: (out): Return location for the number of values in @ports.
|
||||
*
|
||||
* Gets the list of ignored ports in the modem.
|
||||
*
|
||||
* Returns: %TRUE if @ports and @n_ports are set, %FALSE otherwise.
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
|
||||
PROPERTY_ARRAY_DEFINE_DEEP (ignored_ports,
|
||||
Modem, modem, MODEM,
|
||||
MMModemPortInfo,
|
||||
mm_common_ports_variant_to_garray,
|
||||
mm_common_ports_garray_to_array)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_modem_get_equipment_identifier:
|
||||
* @self: A #MMModem.
|
||||
@@ -3430,6 +3469,7 @@ mm_modem_init (MMModem *self)
|
||||
g_mutex_init (&self->priv->mutex);
|
||||
|
||||
PROPERTY_INITIALIZE (ports, "ports")
|
||||
PROPERTY_INITIALIZE (ignored_ports, "ignored-ports")
|
||||
PROPERTY_INITIALIZE (supported_modes, "supported-modes")
|
||||
PROPERTY_INITIALIZE (supported_capabilities, "supported-capabilities")
|
||||
PROPERTY_INITIALIZE (supported_bands, "supported-bands")
|
||||
@@ -3445,6 +3485,7 @@ finalize (GObject *object)
|
||||
g_mutex_clear (&self->priv->mutex);
|
||||
|
||||
PROPERTY_ARRAY_FINALIZE (ports)
|
||||
PROPERTY_ARRAY_FINALIZE (ignored_ports)
|
||||
PROPERTY_ARRAY_FINALIZE (supported_modes)
|
||||
PROPERTY_ARRAY_FINALIZE (supported_capabilities)
|
||||
PROPERTY_ARRAY_FINALIZE (supported_bands)
|
||||
|
||||
@@ -138,6 +138,14 @@ gboolean mm_modem_get_ports (MMModem *self,
|
||||
MMModemPortInfo **ports,
|
||||
guint *n_ports);
|
||||
|
||||
gboolean mm_modem_peek_ignored_ports (MMModem *self,
|
||||
const MMModemPortInfo **ports,
|
||||
guint *n_ports);
|
||||
|
||||
gboolean mm_modem_get_ignored_ports (MMModem *self,
|
||||
MMModemPortInfo **ports,
|
||||
guint *n_ports);
|
||||
|
||||
const gchar *mm_modem_get_equipment_identifier (MMModem *self);
|
||||
gchar *mm_modem_dup_equipment_identifier (MMModem *self);
|
||||
|
||||
|
||||
+41
-12
@@ -190,11 +190,13 @@ port_timed_out_cb (MMPort *port,
|
||||
|
||||
static MMPort *
|
||||
base_modem_create_ignored_port (MMBaseModem *self,
|
||||
MMPortType ptype,
|
||||
const gchar *name)
|
||||
{
|
||||
return MM_PORT (g_object_new (MM_TYPE_PORT,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_IGNORED,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_IGNORED,
|
||||
MM_PORT_TYPE, ptype,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -326,6 +328,7 @@ base_modem_create_wwan_port (MMBaseModem *self,
|
||||
return MM_PORT (g_object_new (MM_TYPE_PORT,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_WWAN,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_XMMRPC,
|
||||
NULL));
|
||||
|
||||
@@ -343,6 +346,7 @@ static MMPort *
|
||||
base_modem_internal_grab_port (MMBaseModem *self,
|
||||
MMKernelDevice *kernel_device,
|
||||
gboolean link_port,
|
||||
MMPortGroup pgroup,
|
||||
MMPortType ptype,
|
||||
MMPortSerialAtFlag at_pflags,
|
||||
GError **error)
|
||||
@@ -377,8 +381,8 @@ base_modem_internal_grab_port (MMBaseModem *self,
|
||||
|
||||
/* Explicitly ignored ports, grab them but explicitly flag them as ignored
|
||||
* right away, all the same way (i.e. regardless of subsystem). */
|
||||
if (ptype == MM_PORT_TYPE_IGNORED)
|
||||
port = base_modem_create_ignored_port (self, name);
|
||||
if (pgroup == MM_PORT_GROUP_IGNORED)
|
||||
port = base_modem_create_ignored_port (self, ptype, name);
|
||||
else if (g_str_equal (subsys, "net"))
|
||||
port = base_modem_create_net_port (self, name);
|
||||
else if (g_str_equal (subsys, "tty"))
|
||||
@@ -403,6 +407,7 @@ base_modem_internal_grab_port (MMBaseModem *self,
|
||||
}
|
||||
|
||||
/* Setup consecutive ports and removal watchers in all control ports */
|
||||
if (pgroup == MM_PORT_GROUP_USED) {
|
||||
if (MM_IS_PORT_SERIAL_AT (port)) {
|
||||
mm_obj_dbg (port, "port monitoring enabled in AT port");
|
||||
port_monitoring = TRUE;
|
||||
@@ -422,6 +427,7 @@ base_modem_internal_grab_port (MMBaseModem *self,
|
||||
port_monitoring = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (port_monitoring) {
|
||||
if (self->priv->max_timeouts > 0)
|
||||
@@ -487,13 +493,14 @@ base_modem_internal_grab_port (MMBaseModem *self,
|
||||
gboolean
|
||||
mm_base_modem_grab_port (MMBaseModem *self,
|
||||
MMKernelDevice *kernel_device,
|
||||
MMPortGroup pgroup,
|
||||
MMPortType ptype,
|
||||
MMPortSerialAtFlag at_pflags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GError) inner_error = NULL;
|
||||
|
||||
if (!base_modem_internal_grab_port (self, kernel_device, FALSE, ptype, at_pflags, &inner_error)) {
|
||||
if (!base_modem_internal_grab_port (self, kernel_device, FALSE, pgroup, ptype, at_pflags, &inner_error)) {
|
||||
/* If the port was REQUIRED via udev tags and we failed to grab it, we will report
|
||||
* a fatal error. */
|
||||
if (mm_kernel_device_get_property_as_boolean (kernel_device, ID_MM_REQUIRED)) {
|
||||
@@ -540,6 +547,7 @@ mm_base_modem_grab_link_port (MMBaseModem *self,
|
||||
port = base_modem_internal_grab_port (self,
|
||||
kernel_device,
|
||||
TRUE,
|
||||
MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE_NET,
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE,
|
||||
error);
|
||||
@@ -1264,25 +1272,28 @@ port_info_cmp (const MMModemPortInfo *a,
|
||||
return g_strcmp0 (a->name, b->name);
|
||||
}
|
||||
|
||||
MMModemPortInfo *
|
||||
mm_base_modem_get_port_infos (MMBaseModem *self,
|
||||
guint *n_port_infos)
|
||||
static MMModemPortInfo *
|
||||
parse_port_infos (GHashTable *ports,
|
||||
guint *n_port_infos,
|
||||
MMPortGroup pgroup_filter)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
GArray *port_infos;
|
||||
MMPort *port;
|
||||
|
||||
if (!self->priv->ports) {
|
||||
if (!ports) {
|
||||
*n_port_infos = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*n_port_infos = g_hash_table_size (self->priv->ports);
|
||||
port_infos = g_array_sized_new (FALSE, FALSE, sizeof (MMModemPortInfo), *n_port_infos);
|
||||
g_hash_table_iter_init (&iter, self->priv->ports);
|
||||
port_infos = g_array_new (FALSE, FALSE, sizeof (MMModemPortInfo));
|
||||
g_hash_table_iter_init (&iter, ports);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer)&port)) {
|
||||
MMModemPortInfo port_info;
|
||||
|
||||
if (mm_port_get_port_group (port) != pgroup_filter)
|
||||
continue;
|
||||
|
||||
port_info.name = g_strdup (mm_port_get_device (port));
|
||||
switch (mm_port_get_port_type (port)) {
|
||||
case MM_PORT_TYPE_NET:
|
||||
@@ -1321,11 +1332,25 @@ mm_base_modem_get_port_infos (MMBaseModem *self,
|
||||
g_array_append_val (port_infos, port_info);
|
||||
}
|
||||
|
||||
g_assert (*n_port_infos == port_infos->len);
|
||||
*n_port_infos = port_infos->len;
|
||||
g_array_sort (port_infos, (GCompareFunc) port_info_cmp);
|
||||
return (MMModemPortInfo *) g_array_free (port_infos, FALSE);
|
||||
}
|
||||
|
||||
MMModemPortInfo *
|
||||
mm_base_modem_get_port_infos (MMBaseModem *self,
|
||||
guint *n_port_infos)
|
||||
{
|
||||
return parse_port_infos (self->priv->ports, n_port_infos, MM_PORT_GROUP_USED);
|
||||
}
|
||||
|
||||
MMModemPortInfo *
|
||||
mm_base_modem_get_ignored_port_infos (MMBaseModem *self,
|
||||
guint *n_port_infos)
|
||||
{
|
||||
return parse_port_infos (self->priv->ports, n_port_infos, MM_PORT_GROUP_IGNORED);
|
||||
}
|
||||
|
||||
static gint
|
||||
port_cmp (MMPort *a,
|
||||
MMPort *b)
|
||||
@@ -1467,6 +1492,10 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
|
||||
g_hash_table_iter_init (&iter, self->priv->ports);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &candidate)) {
|
||||
/* Skip ports that should not be used */
|
||||
if (mm_port_get_port_group (candidate) != MM_PORT_GROUP_USED)
|
||||
continue;
|
||||
|
||||
switch (mm_port_get_port_type (candidate)) {
|
||||
|
||||
case MM_PORT_TYPE_AT:
|
||||
|
||||
@@ -137,6 +137,7 @@ guint mm_base_modem_get_dbus_id (MMBaseModem *self);
|
||||
|
||||
gboolean mm_base_modem_grab_port (MMBaseModem *self,
|
||||
MMKernelDevice *kernel_device,
|
||||
MMPortGroup pgroup,
|
||||
MMPortType ptype,
|
||||
MMPortSerialAtFlag at_pflags,
|
||||
GError **error);
|
||||
@@ -183,6 +184,8 @@ GList *mm_base_modem_get_data_ports (MMBaseModem *self);
|
||||
|
||||
MMModemPortInfo *mm_base_modem_get_port_infos (MMBaseModem *self,
|
||||
guint *n_port_infos);
|
||||
MMModemPortInfo *mm_base_modem_get_ignored_port_infos (MMBaseModem *self,
|
||||
guint *n_port_infos);
|
||||
|
||||
GList *mm_base_modem_find_ports (MMBaseModem *self,
|
||||
MMPortSubsys subsys,
|
||||
|
||||
@@ -5718,6 +5718,14 @@ interface_initialization_step (GTask *task)
|
||||
mm_gdbus_modem_set_ports (ctx->skeleton, mm_common_ports_array_to_variant (port_infos, n_port_infos));
|
||||
mm_modem_port_info_array_free (port_infos, n_port_infos);
|
||||
}
|
||||
if (!mm_gdbus_modem_get_ignored_ports (ctx->skeleton)) {
|
||||
MMModemPortInfo *port_infos;
|
||||
guint n_port_infos;
|
||||
|
||||
port_infos = mm_base_modem_get_ignored_port_infos (MM_BASE_MODEM (self), &n_port_infos);
|
||||
mm_gdbus_modem_set_ignored_ports (ctx->skeleton, mm_common_ports_array_to_variant (port_infos, n_port_infos));
|
||||
mm_modem_port_info_array_free (port_infos, n_port_infos);
|
||||
}
|
||||
ctx->step++;
|
||||
/* fall-through */
|
||||
|
||||
|
||||
+13
-17
@@ -974,16 +974,17 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
GError *inner_error = NULL;
|
||||
MMPortProbe *probe;
|
||||
gboolean grabbed = FALSE;
|
||||
gboolean force_ignored = FALSE;
|
||||
const gchar *subsys;
|
||||
const gchar *name;
|
||||
const gchar *driver;
|
||||
MMPortGroup port_group;
|
||||
MMPortType port_type;
|
||||
|
||||
probe = MM_PORT_PROBE (l->data);
|
||||
|
||||
subsys = mm_port_probe_get_port_subsys (probe);
|
||||
name = mm_port_probe_get_port_name (probe);
|
||||
port_group = mm_port_probe_get_port_group (probe);
|
||||
port_type = mm_port_probe_get_port_type (probe);
|
||||
|
||||
driver = mm_kernel_device_get_driver (mm_port_probe_peek_port (probe));
|
||||
@@ -1003,9 +1004,8 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
}
|
||||
|
||||
/* Ports that are explicitly ignored will be grabbed as ignored */
|
||||
if (mm_port_probe_is_ignored (probe)) {
|
||||
if (port_group == MM_PORT_GROUP_IGNORED) {
|
||||
mm_obj_dbg (self, "port %s is explicitly ignored", name);
|
||||
force_ignored = TRUE;
|
||||
goto grab_port;
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
g_strcmp0 (driver, "qmi_wwan") != 0) {
|
||||
/* Non-QMI net ports are ignored in QMI modems */
|
||||
mm_obj_dbg (self, "ignoring non-QMI net port %s in QMI modem", name);
|
||||
force_ignored = TRUE;
|
||||
port_group = MM_PORT_GROUP_IGNORED;
|
||||
goto grab_port;
|
||||
}
|
||||
|
||||
@@ -1026,7 +1026,7 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
g_strcmp0 (driver, "qmi_wwan") == 0) {
|
||||
/* QMI net ports are ignored in non-QMI modems */
|
||||
mm_obj_dbg (self, "ignoring QMI net port %s in non-QMI modem", name);
|
||||
force_ignored = TRUE;
|
||||
port_group = MM_PORT_GROUP_IGNORED;
|
||||
goto grab_port;
|
||||
}
|
||||
#else
|
||||
@@ -1034,7 +1034,7 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
g_strcmp0 (driver, "qmi_wwan") == 0) {
|
||||
/* QMI net ports are ignored if QMI support not built */
|
||||
mm_obj_dbg (self, "ignoring QMI net port %s as QMI support isn't available", name);
|
||||
force_ignored = TRUE;
|
||||
port_group = MM_PORT_GROUP_IGNORED;
|
||||
goto grab_port;
|
||||
}
|
||||
#endif
|
||||
@@ -1048,7 +1048,7 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
g_strcmp0 (driver, "cdc_mbim") != 0) {
|
||||
/* Non-MBIM net ports are ignored in MBIM modems */
|
||||
mm_obj_dbg (self, "ignoring non-MBIM net port %s in MBIM modem", name);
|
||||
force_ignored = TRUE;
|
||||
port_group = MM_PORT_GROUP_IGNORED;
|
||||
goto grab_port;
|
||||
}
|
||||
|
||||
@@ -1057,27 +1057,21 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
g_strcmp0 (driver, "cdc_mbim") == 0) {
|
||||
/* MBIM net ports are ignored in non-MBIM modems */
|
||||
mm_obj_dbg (self, "ignoring MBIM net port %s in non-MBIM modem", name);
|
||||
force_ignored = TRUE;
|
||||
port_group = MM_PORT_GROUP_IGNORED;
|
||||
goto grab_port;
|
||||
}
|
||||
#else
|
||||
if (port_type == MM_PORT_TYPE_NET &&
|
||||
g_strcmp0 (driver, "cdc_mbim") == 0) {
|
||||
mm_obj_dbg (self, "ignoring MBIM net port %s as MBIM support isn't available", name);
|
||||
force_ignored = TRUE;
|
||||
port_group = MM_PORT_GROUP_IGNORED;
|
||||
goto grab_port;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
grab_port:
|
||||
if (force_ignored)
|
||||
grabbed = mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
MM_PORT_TYPE_IGNORED,
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE,
|
||||
&inner_error);
|
||||
else if (MM_PLUGIN_GET_CLASS (self)->grab_port)
|
||||
if (port_group != MM_PORT_GROUP_IGNORED && MM_PLUGIN_GET_CLASS (self)->grab_port)
|
||||
grabbed = MM_PLUGIN_GET_CLASS (self)->grab_port (MM_PLUGIN (self),
|
||||
modem,
|
||||
probe,
|
||||
@@ -1085,7 +1079,8 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
else
|
||||
grabbed = mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
mm_port_probe_get_port_type (probe),
|
||||
port_group,
|
||||
port_type,
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE,
|
||||
&inner_error);
|
||||
|
||||
@@ -1128,6 +1123,7 @@ mm_plugin_create_modem (MMPlugin *self,
|
||||
g_clear_error (&inner_error);
|
||||
} else if (!mm_base_modem_grab_port (modem,
|
||||
kernel_device,
|
||||
MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE_AT,
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE,
|
||||
&inner_error)) {
|
||||
|
||||
@@ -940,6 +940,7 @@ mm_port_mbim_new (const gchar *name,
|
||||
return MM_PORT_MBIM (g_object_new (MM_TYPE_PORT_MBIM,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, subsys,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_MBIM,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ mm_port_net_new (const gchar *name)
|
||||
return MM_PORT_NET (g_object_new (MM_TYPE_PORT_NET,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_NET,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_NET,
|
||||
NULL));
|
||||
}
|
||||
|
||||
+11
-8
@@ -2002,6 +2002,17 @@ mm_port_probe_list_has_xmmrpc_port (GList *list)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MMPortGroup
|
||||
mm_port_probe_get_port_group (MMPortProbe *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_PORT_PROBE (self), MM_PORT_GROUP_UNKNOWN);
|
||||
|
||||
if (self->priv->is_ignored)
|
||||
return MM_PORT_GROUP_IGNORED;
|
||||
|
||||
return MM_PORT_GROUP_USED;
|
||||
}
|
||||
|
||||
MMPortType
|
||||
mm_port_probe_get_port_type (MMPortProbe *self)
|
||||
{
|
||||
@@ -2144,14 +2155,6 @@ mm_port_probe_list_is_xmm (GList *probes)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_port_probe_is_ignored (MMPortProbe *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_PORT_PROBE (self), FALSE);
|
||||
|
||||
return self->priv->is_ignored;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
mm_port_probe_get_port_name (MMPortProbe *self)
|
||||
{
|
||||
|
||||
+1
-1
@@ -140,6 +140,7 @@ gboolean mm_port_probe_run_early_at_probe_finish (MMPortProbe *self,
|
||||
GError **error);
|
||||
|
||||
/* Probing result getters */
|
||||
MMPortGroup mm_port_probe_get_port_group (MMPortProbe *self);
|
||||
MMPortType mm_port_probe_get_port_type (MMPortProbe *self);
|
||||
gboolean mm_port_probe_is_at (MMPortProbe *self);
|
||||
gboolean mm_port_probe_is_qcdm (MMPortProbe *self);
|
||||
@@ -150,7 +151,6 @@ const gchar *mm_port_probe_get_vendor (MMPortProbe *self);
|
||||
const gchar *mm_port_probe_get_product (MMPortProbe *self);
|
||||
gboolean mm_port_probe_is_icera (MMPortProbe *self);
|
||||
gboolean mm_port_probe_is_xmm (MMPortProbe *self);
|
||||
gboolean mm_port_probe_is_ignored (MMPortProbe *self);
|
||||
|
||||
/* Additional helpers */
|
||||
gboolean mm_port_probe_list_has_at_port (GList *list);
|
||||
|
||||
@@ -2842,6 +2842,7 @@ mm_port_qmi_new (const gchar *name,
|
||||
return MM_PORT_QMI (g_object_new (MM_TYPE_PORT_QMI,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, subsys,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_QMI,
|
||||
NULL));
|
||||
}
|
||||
@@ -2855,6 +2856,7 @@ mm_port_qmi_new_from_node (const gchar *name,
|
||||
"node", node,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_QRTR,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_QMI,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -526,6 +526,7 @@ mm_port_serial_at_new (const char *name,
|
||||
return MM_PORT_SERIAL_AT (g_object_new (MM_TYPE_PORT_SERIAL_AT,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, subsys,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_AT,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ mm_port_serial_gps_new (const char *name)
|
||||
return MM_PORT_SERIAL_GPS (g_object_new (MM_TYPE_PORT_SERIAL_GPS,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_TTY,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_GPS,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -372,6 +372,7 @@ mm_port_serial_qcdm_new (const char *name,
|
||||
return MM_PORT_SERIAL_QCDM (g_object_new (MM_TYPE_PORT_SERIAL_QCDM,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, subsys,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_QCDM,
|
||||
MM_PORT_SERIAL_SEND_DELAY, (guint64) 0,
|
||||
NULL));
|
||||
@@ -387,6 +388,7 @@ mm_port_serial_qcdm_new_fd (int fd)
|
||||
port = MM_PORT_SERIAL_QCDM (g_object_new (MM_TYPE_PORT_SERIAL_QCDM,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_TTY,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_QCDM,
|
||||
MM_PORT_SERIAL_FD, fd,
|
||||
MM_PORT_SERIAL_SEND_DELAY, (guint64) 0,
|
||||
|
||||
@@ -1895,6 +1895,7 @@ mm_port_serial_new (const char *name, MMPortType ptype)
|
||||
return MM_PORT_SERIAL (g_object_new (MM_TYPE_PORT_SERIAL,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, MM_PORT_SUBSYS_TTY,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, ptype,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_DEVICE,
|
||||
PROP_SUBSYS,
|
||||
PROP_GROUP,
|
||||
PROP_TYPE,
|
||||
PROP_CONNECTED,
|
||||
PROP_KERNEL_DEVICE,
|
||||
@@ -49,6 +50,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
||||
struct _MMPortPrivate {
|
||||
gchar *device;
|
||||
MMPortSubsys subsys;
|
||||
MMPortGroup pgroup;
|
||||
MMPortType ptype;
|
||||
gboolean connected;
|
||||
MMKernelDevice *kernel_device;
|
||||
@@ -74,6 +76,15 @@ mm_port_get_subsys (MMPort *self)
|
||||
return self->priv->subsys;
|
||||
}
|
||||
|
||||
MMPortGroup
|
||||
mm_port_get_port_group (MMPort *self)
|
||||
{
|
||||
g_return_val_if_fail (self != NULL, MM_PORT_GROUP_UNKNOWN);
|
||||
g_return_val_if_fail (MM_IS_PORT (self), MM_PORT_GROUP_UNKNOWN);
|
||||
|
||||
return self->priv->pgroup;
|
||||
}
|
||||
|
||||
MMPortType
|
||||
mm_port_get_port_type (MMPort *self)
|
||||
{
|
||||
@@ -151,6 +162,10 @@ set_property (GObject *object,
|
||||
/* Construct only */
|
||||
self->priv->subsys = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_GROUP:
|
||||
/* Construct only */
|
||||
self->priv->pgroup = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_TYPE:
|
||||
/* Construct only */
|
||||
self->priv->ptype = g_value_get_uint (value);
|
||||
@@ -182,6 +197,9 @@ get_property (GObject *object, guint prop_id,
|
||||
case PROP_SUBSYS:
|
||||
g_value_set_uint (value, self->priv->subsys);
|
||||
break;
|
||||
case PROP_GROUP:
|
||||
g_value_set_uint (value, self->priv->pgroup);
|
||||
break;
|
||||
case PROP_TYPE:
|
||||
g_value_set_uint (value, self->priv->ptype);
|
||||
break;
|
||||
@@ -254,6 +272,16 @@ mm_port_class_init (MMPortClass *klass)
|
||||
MM_PORT_SUBSYS_UNKNOWN,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_GROUP,
|
||||
g_param_spec_uint (MM_PORT_GROUP,
|
||||
"Group",
|
||||
"Group",
|
||||
MM_PORT_GROUP_UNKNOWN,
|
||||
MM_PORT_GROUP_LAST,
|
||||
MM_PORT_GROUP_UNKNOWN,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_TYPE,
|
||||
g_param_spec_uint (MM_PORT_TYPE,
|
||||
|
||||
@@ -34,6 +34,13 @@ typedef enum { /*< underscore_name=mm_port_subsys >*/
|
||||
MM_PORT_SUBSYS_LAST = MM_PORT_SUBSYS_WWAN /*< skip >*/
|
||||
} MMPortSubsys;
|
||||
|
||||
typedef enum { /*< underscore_name=mm_port_group >*/
|
||||
MM_PORT_GROUP_UNKNOWN = 0x0,
|
||||
MM_PORT_GROUP_USED,
|
||||
MM_PORT_GROUP_IGNORED,
|
||||
MM_PORT_GROUP_LAST = MM_PORT_GROUP_IGNORED /*< skip >*/
|
||||
} MMPortGroup;
|
||||
|
||||
typedef enum { /*< underscore_name=mm_port_type >*/
|
||||
MM_PORT_TYPE_UNKNOWN = 0x0,
|
||||
MM_PORT_TYPE_IGNORED,
|
||||
@@ -57,6 +64,7 @@ typedef enum { /*< underscore_name=mm_port_type >*/
|
||||
|
||||
#define MM_PORT_DEVICE "device"
|
||||
#define MM_PORT_SUBSYS "subsys"
|
||||
#define MM_PORT_GROUP "group"
|
||||
#define MM_PORT_TYPE "type"
|
||||
#define MM_PORT_CONNECTED "connected"
|
||||
#define MM_PORT_KERNEL_DEVICE "kernel-device"
|
||||
@@ -86,6 +94,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMPort, g_object_unref)
|
||||
|
||||
const gchar *mm_port_get_device (MMPort *self);
|
||||
MMPortSubsys mm_port_get_subsys (MMPort *self);
|
||||
MMPortGroup mm_port_get_port_group (MMPort *self);
|
||||
MMPortType mm_port_get_port_type (MMPort *self);
|
||||
gboolean mm_port_get_connected (MMPort *self);
|
||||
void mm_port_set_connected (MMPort *self, gboolean connected);
|
||||
|
||||
@@ -204,6 +204,7 @@ grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
mm_port_probe_get_port_group (probe),
|
||||
ptype,
|
||||
pflags,
|
||||
error);
|
||||
|
||||
@@ -493,6 +493,7 @@ grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
mm_port_probe_get_port_group (probe),
|
||||
mm_port_probe_get_port_type (probe),
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE,
|
||||
error);
|
||||
|
||||
@@ -241,6 +241,7 @@ mm_port_mbim_fibocom_new (const gchar *name,
|
||||
return MM_PORT_MBIM_FIBOCOM (g_object_new (MM_TYPE_PORT_MBIM_FIBOCOM,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, subsys,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_MBIM,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -693,6 +693,7 @@ grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
port,
|
||||
mm_port_probe_get_port_group (probe),
|
||||
port_type,
|
||||
pflags,
|
||||
error);
|
||||
|
||||
@@ -159,6 +159,7 @@ grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
mm_port_probe_get_port_group (probe),
|
||||
port_type,
|
||||
pflags,
|
||||
error);
|
||||
|
||||
@@ -81,6 +81,7 @@ grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
port,
|
||||
mm_port_probe_get_port_group (probe),
|
||||
MM_PORT_TYPE_AT, /* we only allow AT ports here */
|
||||
pflags,
|
||||
error);
|
||||
|
||||
@@ -123,6 +123,7 @@ grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
mm_port_probe_get_port_group (probe),
|
||||
ptype,
|
||||
pflags,
|
||||
error);
|
||||
|
||||
@@ -250,6 +250,7 @@ mm_port_mbim_quectel_new (const gchar *name,
|
||||
return MM_PORT_MBIM_QUECTEL (g_object_new (MM_TYPE_PORT_MBIM_QUECTEL,
|
||||
MM_PORT_DEVICE, name,
|
||||
MM_PORT_SUBSYS, subsys,
|
||||
MM_PORT_GROUP, MM_PORT_GROUP_USED,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_MBIM,
|
||||
NULL));
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ mm_common_sierra_grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
mm_port_probe_get_port_group (probe),
|
||||
ptype,
|
||||
pflags,
|
||||
error);
|
||||
|
||||
@@ -42,11 +42,13 @@ telit_grab_port (MMPlugin *self,
|
||||
{
|
||||
MMKernelDevice *port;
|
||||
MMDevice *device;
|
||||
MMPortGroup pgroup;
|
||||
MMPortType ptype;
|
||||
MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
|
||||
const gchar *subsys;
|
||||
|
||||
port = mm_port_probe_peek_port (probe);
|
||||
pgroup = mm_port_probe_get_port_group (probe);
|
||||
ptype = mm_port_probe_get_port_type (probe);
|
||||
device = mm_port_probe_peek_device (probe);
|
||||
subsys = mm_port_probe_get_port_subsys (probe);
|
||||
@@ -76,12 +78,13 @@ telit_grab_port (MMPlugin *self,
|
||||
mm_port_probe_get_port_name (probe));
|
||||
ptype = MM_PORT_TYPE_GPS;
|
||||
} else
|
||||
ptype = MM_PORT_TYPE_IGNORED;
|
||||
pgroup = MM_PORT_GROUP_IGNORED;
|
||||
}
|
||||
|
||||
out:
|
||||
return mm_base_modem_grab_port (modem,
|
||||
port,
|
||||
pgroup,
|
||||
ptype,
|
||||
pflags,
|
||||
error);
|
||||
|
||||
@@ -139,6 +139,7 @@ grab_port (MMPlugin *self,
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
port,
|
||||
mm_port_probe_get_port_group (probe),
|
||||
ptype,
|
||||
MM_PORT_SERIAL_AT_FLAG_NONE,
|
||||
error);
|
||||
|
||||
@@ -202,6 +202,7 @@ PM_DRIVERS = "Drivers"
|
||||
PM_PLUGIN = "Plugin"
|
||||
PM_PRIMARY_PORT = "PrimaryPort"
|
||||
PM_PORTS = "Ports"
|
||||
PM_IGNORED_PORTS = "IgnoredPorts"
|
||||
PM_EQUIPMENT_IDENTIFIER = "EquipmentIdentifier"
|
||||
PM_UNLOCK_REQUIRED = "UnlockRequired"
|
||||
PM_UNLOCK_RETRIES = "UnlockRetries"
|
||||
@@ -259,6 +260,7 @@ class Modem(ExportedObj):
|
||||
#props[PM_PLUGIN] = None
|
||||
#props[PM_PRIMARY_PORT] = None
|
||||
#props[PM_PORTS] = None
|
||||
#props[PM_IGNORED_PORTS] = None
|
||||
#props[PM_EQUIPMENT_IDENTIFIER] = None
|
||||
#props[PM_UNLOCK_RETRIES] = dbus.UInt32(0)
|
||||
#props[PM_ACCESS_TECHNOLOGIES] = None
|
||||
|
||||
Reference in New Issue
Block a user