diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-28 17:07:10 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-28 17:15:18 +0200 |
commit | 3ff03c946fb244bf336aebd61807b5ffa0b28124 (patch) | |
tree | 1cc263ad0c638dfdc0d9d92c5ec142634e358b9b /src | |
parent | 567a744a49deb81ecdda307444692d8c38d062c6 (diff) |
iface-modem-simple: don't launch band/mode updates unless explicitly required
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-simple.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index bfc30943..399fb2ab 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -522,40 +522,50 @@ connection_step (ConnectionContext *ctx) mm_info ("Simple connect state (%d/%d): Allowed mode", ctx->step, CONNECTION_STEP_LAST); - mm_simple_connect_properties_get_allowed_modes (ctx->properties, - &allowed_modes, - &preferred_mode); - mm_iface_modem_set_allowed_modes (MM_IFACE_MODEM (ctx->self), - allowed_modes, - preferred_mode, - (GAsyncReadyCallback)set_allowed_modes_ready, - ctx); - return; + /* Don't set modes unless explicitly requested to do so */ + if (mm_simple_connect_properties_get_allowed_modes (ctx->properties, + &allowed_modes, + &preferred_mode)) { + mm_iface_modem_set_allowed_modes (MM_IFACE_MODEM (ctx->self), + allowed_modes, + preferred_mode, + (GAsyncReadyCallback)set_allowed_modes_ready, + ctx); + return; + } + + /* Fall down to next step */ + ctx->step++; } case CONNECTION_STEP_BANDS: { - GArray *array; const MMModemBand *bands = NULL; guint n_bands = 0; - guint i; mm_info ("Simple connect state (%d/%d): Bands", ctx->step, CONNECTION_STEP_LAST); - mm_simple_connect_properties_get_bands (ctx->properties, - &bands, - &n_bands); - - array = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), n_bands); - for (i = 0; i < n_bands; i++) - g_array_insert_val (array, i, bands[i]); + /* Don't set bands unless explicitly requested to do so */ + if (mm_simple_connect_properties_get_bands (ctx->properties, + &bands, + &n_bands)) { + GArray *array; + guint i; + + array = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), n_bands); + for (i = 0; i < n_bands; i++) + g_array_insert_val (array, i, bands[i]); + + mm_iface_modem_set_bands (MM_IFACE_MODEM (ctx->self), + array, + (GAsyncReadyCallback)set_bands_ready, + ctx); + g_array_unref (array); + return; + } - mm_iface_modem_set_bands (MM_IFACE_MODEM (ctx->self), - array, - (GAsyncReadyCallback)set_bands_ready, - ctx); - g_array_unref (array); - return; + /* Fall down to next step */ + ctx->step++; } case CONNECTION_STEP_REGISTER: |