summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-05-28 10:53:06 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-05-28 10:53:06 +0200
commit8795b554432853ca6f2fa223df83609298e7a901 (patch)
tree7f8a8a31f4b25ffe4cbad6f0613517dc2a176ed0
parent0304daa6fb7411916f42b31ec5e1a9cfdae9f84d (diff)
downloadModemManager-aleksander/supported-capabilities.tar.gz
iface-modem: default to current capabilities when supported loading not availablealeksander/supported-capabilities
-rw-r--r--src/mm-iface-modem.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index c89d4e60a..b084420ed 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -3524,8 +3524,8 @@ static void interface_initialization_step (InitializationContext *ctx);
typedef enum {
INITIALIZATION_STEP_FIRST,
- INITIALIZATION_STEP_SUPPORTED_CAPABILITIES,
INITIALIZATION_STEP_CURRENT_CAPABILITIES,
+ INITIALIZATION_STEP_SUPPORTED_CAPABILITIES,
INITIALIZATION_STEP_BEARERS,
INITIALIZATION_STEP_MANUFACTURER,
INITIALIZATION_STEP_MODEL,
@@ -3715,7 +3715,7 @@ load_supported_capabilities_ready (MMIfaceModem *self,
supported_capabilities = MM_IFACE_MODEM_GET_INTERFACE (self)->load_supported_capabilities_finish (self, res, &error);
if (error) {
g_propagate_error (&ctx->fatal_error, error);
- g_prefix_error (&ctx->fatal_error, "couldn't load current capabilities: ");
+ g_prefix_error (&ctx->fatal_error, "couldn't load supported capabilities: ");
/* Jump to the last step */
ctx->step = INITIALIZATION_STEP_LAST;
interface_initialization_step (ctx);
@@ -3944,6 +3944,23 @@ interface_initialization_step (InitializationContext *ctx)
/* Fall down to next step */
ctx->step++;
+ case INITIALIZATION_STEP_CURRENT_CAPABILITIES:
+ /* Current capabilities may change during runtime, i.e. if new firmware reloaded; but we'll
+ * try to handle that by making sure the capabilities are cleared when the new firmware is
+ * reloaded. So if we're asked to re-initialize, if we already have current capabilities loaded,
+ * don't try to load them again. */
+ if (mm_gdbus_modem_get_current_capabilities (ctx->skeleton) == MM_MODEM_CAPABILITY_NONE &&
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_capabilities &&
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_capabilities_finish) {
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_capabilities (
+ ctx->self,
+ (GAsyncReadyCallback)load_current_capabilities_ready,
+ ctx);
+ return;
+ }
+ /* Fall down to next step */
+ ctx->step++;
+
case INITIALIZATION_STEP_SUPPORTED_CAPABILITIES: {
GArray *supported_capabilities;
@@ -3955,6 +3972,8 @@ interface_initialization_step (InitializationContext *ctx)
* don't try to load them again. */
if (supported_capabilities->len == 0 ||
g_array_index (supported_capabilities, MMModemCapability, 0) == MM_MODEM_CAPABILITY_NONE) {
+ MMModemCapability current;
+
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_capabilities &&
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_capabilities_finish) {
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_capabilities (
@@ -3964,10 +3983,14 @@ interface_initialization_step (InitializationContext *ctx)
return;
}
- /* If no specific way of getting modem capabilities, default to ANY */
+ /* If no specific way of getting modem capabilities, default to the current ones */
+ g_array_unref (supported_capabilities);
+ supported_capabilities = g_array_sized_new (FALSE, FALSE, sizeof (MMModemCapability), 1);
+ current = mm_gdbus_modem_get_current_capabilities (ctx->skeleton);
+ g_array_append_val (supported_capabilities, current);
mm_gdbus_modem_set_supported_capabilities (
ctx->skeleton,
- mm_common_build_capabilities_any ());
+ mm_common_capabilities_garray_to_variant (supported_capabilities));
}
g_array_unref (supported_capabilities);
@@ -3975,23 +3998,6 @@ interface_initialization_step (InitializationContext *ctx)
ctx->step++;
}
- case INITIALIZATION_STEP_CURRENT_CAPABILITIES:
- /* Current capabilities may change during runtime, i.e. if new firmware reloaded; but we'll
- * try to handle that by making sure the capabilities are cleared when the new firmware is
- * reloaded. So if we're asked to re-initialize, if we already have current capabilities loaded,
- * don't try to load them again. */
- if (mm_gdbus_modem_get_current_capabilities (ctx->skeleton) == MM_MODEM_CAPABILITY_NONE &&
- MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_capabilities &&
- MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_capabilities_finish) {
- MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_capabilities (
- ctx->self,
- (GAsyncReadyCallback)load_current_capabilities_ready,
- ctx);
- return;
- }
- /* Fall down to next step */
- ctx->step++;
-
case INITIALIZATION_STEP_BEARERS: {
MMBearerList *list = NULL;