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:
Aleksander Morgado
2012-10-19 00:58:36 +02:00
parent e123c7d5b4
commit 79fdddccbf
6 changed files with 75 additions and 2 deletions

View File

@@ -3328,6 +3328,21 @@ interface_initialization_step (InitializationContext *ctx)
mm_gdbus_modem_set_plugin (ctx->skeleton, 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 */
ctx->step++;