api,modem: new 'PrimaryPort' property
We do need to specify which is the primary port being used for controlling the modem. This allows us to match the device with an already existing bluetooth device in NetworkManager.
This commit is contained in:
@@ -323,10 +323,12 @@ print_modem_info (void)
|
|||||||
g_print (" -------------------------\n"
|
g_print (" -------------------------\n"
|
||||||
" System | device: '%s'\n"
|
" System | device: '%s'\n"
|
||||||
" | drivers: '%s'\n"
|
" | drivers: '%s'\n"
|
||||||
" | plugin: '%s'\n",
|
" | plugin: '%s'\n"
|
||||||
|
" | primary port: '%s'\n",
|
||||||
VALIDATE_UNKNOWN (mm_modem_get_device (ctx->modem)),
|
VALIDATE_UNKNOWN (mm_modem_get_device (ctx->modem)),
|
||||||
VALIDATE_UNKNOWN (drivers_string),
|
VALIDATE_UNKNOWN (drivers_string),
|
||||||
VALIDATE_UNKNOWN (mm_modem_get_plugin (ctx->modem)));
|
VALIDATE_UNKNOWN (mm_modem_get_plugin (ctx->modem)),
|
||||||
|
VALIDATE_UNKNOWN (mm_modem_get_primary_port (ctx->modem)));
|
||||||
|
|
||||||
/* Numbers related stuff */
|
/* Numbers related stuff */
|
||||||
g_print (" -------------------------\n"
|
g_print (" -------------------------\n"
|
||||||
|
@@ -89,6 +89,8 @@ mm_modem_get_drivers
|
|||||||
mm_modem_dup_drivers
|
mm_modem_dup_drivers
|
||||||
mm_modem_get_plugin
|
mm_modem_get_plugin
|
||||||
mm_modem_dup_plugin
|
mm_modem_dup_plugin
|
||||||
|
mm_modem_get_primary_port
|
||||||
|
mm_modem_dup_primary_port
|
||||||
mm_modem_get_device
|
mm_modem_get_device
|
||||||
mm_modem_dup_device
|
mm_modem_dup_device
|
||||||
mm_modem_get_equipment_identifier
|
mm_modem_get_equipment_identifier
|
||||||
@@ -1389,6 +1391,8 @@ mm_gdbus_modem_get_own_numbers
|
|||||||
mm_gdbus_modem_dup_own_numbers
|
mm_gdbus_modem_dup_own_numbers
|
||||||
mm_gdbus_modem_get_plugin
|
mm_gdbus_modem_get_plugin
|
||||||
mm_gdbus_modem_dup_plugin
|
mm_gdbus_modem_dup_plugin
|
||||||
|
mm_gdbus_modem_get_primary_port
|
||||||
|
mm_gdbus_modem_dup_primary_port
|
||||||
mm_gdbus_modem_get_preferred_mode
|
mm_gdbus_modem_get_preferred_mode
|
||||||
mm_gdbus_modem_get_revision
|
mm_gdbus_modem_get_revision
|
||||||
mm_gdbus_modem_dup_revision
|
mm_gdbus_modem_dup_revision
|
||||||
@@ -1447,6 +1451,7 @@ mm_gdbus_modem_set_model
|
|||||||
mm_gdbus_modem_set_modem_capabilities
|
mm_gdbus_modem_set_modem_capabilities
|
||||||
mm_gdbus_modem_set_own_numbers
|
mm_gdbus_modem_set_own_numbers
|
||||||
mm_gdbus_modem_set_plugin
|
mm_gdbus_modem_set_plugin
|
||||||
|
mm_gdbus_modem_set_primary_port
|
||||||
mm_gdbus_modem_set_preferred_mode
|
mm_gdbus_modem_set_preferred_mode
|
||||||
mm_gdbus_modem_set_revision
|
mm_gdbus_modem_set_revision
|
||||||
mm_gdbus_modem_set_signal_quality
|
mm_gdbus_modem_set_signal_quality
|
||||||
|
@@ -296,6 +296,13 @@
|
|||||||
-->
|
-->
|
||||||
<property name="Plugin" type="s" access="read" />
|
<property name="Plugin" type="s" access="read" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
PrimaryPort:
|
||||||
|
|
||||||
|
The name of the primary port using to control the modem.
|
||||||
|
-->
|
||||||
|
<property name="PrimaryPort" type="s" access="read" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
EquipmentIdentifier:
|
EquipmentIdentifier:
|
||||||
|
|
||||||
|
@@ -537,6 +537,47 @@ mm_modem_dup_plugin (MMModem *self)
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_modem_get_primary_port:
|
||||||
|
* @self: A #MMModem.
|
||||||
|
*
|
||||||
|
* Gets the name of the primary port controlling this #MMModem.
|
||||||
|
*
|
||||||
|
* <warning>The returned value is only valid until the property changes so
|
||||||
|
* it is only safe to use this function on the thread where
|
||||||
|
* @self was constructed. Use mm_modem_dup_primary_port() if on another
|
||||||
|
* thread.</warning>
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): The name of the primary port. Do not free the returned value, it belongs to @self.
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
mm_modem_get_primary_port (MMModem *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_MODEM (self), NULL);
|
||||||
|
|
||||||
|
RETURN_NON_EMPTY_CONSTANT_STRING (
|
||||||
|
mm_gdbus_modem_get_primary_port (MM_GDBUS_MODEM (self)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_modem_dup_primary_port:
|
||||||
|
* @self: A #MMModem.
|
||||||
|
*
|
||||||
|
* Gets a copy of the name of the primary port controlling this #MMModem.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): The name of the primary port. The returned value should be freed with g_free().
|
||||||
|
*/
|
||||||
|
gchar *
|
||||||
|
mm_modem_dup_primary_port (MMModem *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_MODEM (self), NULL);
|
||||||
|
|
||||||
|
RETURN_NON_EMPTY_STRING (
|
||||||
|
mm_gdbus_modem_dup_primary_port (MM_GDBUS_MODEM (self)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mm_modem_get_equipment_identifier:
|
* mm_modem_get_equipment_identifier:
|
||||||
* @self: A #MMModem.
|
* @self: A #MMModem.
|
||||||
|
@@ -102,6 +102,9 @@ gchar **mm_modem_dup_drivers (MMModem *self);
|
|||||||
const gchar *mm_modem_get_plugin (MMModem *self);
|
const gchar *mm_modem_get_plugin (MMModem *self);
|
||||||
gchar *mm_modem_dup_plugin (MMModem *self);
|
gchar *mm_modem_dup_plugin (MMModem *self);
|
||||||
|
|
||||||
|
const gchar *mm_modem_get_primary_port (MMModem *self);
|
||||||
|
gchar *mm_modem_dup_primary_port (MMModem *self);
|
||||||
|
|
||||||
const gchar *mm_modem_get_equipment_identifier (MMModem *self);
|
const gchar *mm_modem_get_equipment_identifier (MMModem *self);
|
||||||
gchar *mm_modem_dup_equipment_identifier (MMModem *self);
|
gchar *mm_modem_dup_equipment_identifier (MMModem *self);
|
||||||
|
|
||||||
|
@@ -3328,6 +3328,21 @@ interface_initialization_step (InitializationContext *ctx)
|
|||||||
mm_gdbus_modem_set_plugin (ctx->skeleton, plugin);
|
mm_gdbus_modem_set_plugin (ctx->skeleton, plugin);
|
||||||
g_free (plugin);
|
g_free (plugin);
|
||||||
}
|
}
|
||||||
|
/* Load primary port if not done before */
|
||||||
|
if (!mm_gdbus_modem_get_primary_port (ctx->skeleton)) {
|
||||||
|
MMPort *primary;
|
||||||
|
|
||||||
|
#if defined WITH_QMI
|
||||||
|
primary = MM_PORT (mm_base_modem_peek_port_qmi (MM_BASE_MODEM (ctx->self)));
|
||||||
|
if (!primary)
|
||||||
|
primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (ctx->self)));
|
||||||
|
#else
|
||||||
|
primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (ctx->self)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
g_assert (primary != NULL);
|
||||||
|
mm_gdbus_modem_set_primary_port (ctx->skeleton, mm_port_get_device (primary));
|
||||||
|
}
|
||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user