[PATCH] mbm: don't try to load generic supported modes
Dan Williams
dcbw at redhat.com
Wed Dec 16 08:55:58 PST 2015
On Wed, 2015-12-16 at 10:27 +0100, Aleksander Morgado wrote:
> We were trying to load the generic modes supported reported by either
> *CNTI=2 or
> AT+WS46=?, so that then we could filter out the MBM-specific modes
> unsupported.
>
> But, this may not be ideal, as both these two commands may fail:
Sounds fine, and both fail on my MD300 with and without a SIM. Perhaps
instead we could use +CFUN=? and parse the result:
at+cfun=?
+CFUN: (0,1,4-6)
If we get '6' we know it supports 3G. Even my 2007 era SonyEricsson TM
-506 which uses mostly the same command set and supports UMTS says:
at+cfun=?
+CFUN: (0,1,4-6),(0,1)
But it also supports AT+WS46=?, so meh.
Dan
> [mm-broadband-modem.c:1612] modem_load_supported_modes(): loading
> supported modes...
> [mm-port-serial.c:1237] mm_port_serial_open(): (ttyACM1) device
> open count is 3 (open)
> [mm-port-serial.c:1294] _close_internal(): (ttyACM1) device open
> count is 2 (close)
> [mm-port-serial-at.c:440] debug_log(): (ttyACM1): -->
> 'AT*CNTI=2<CR>'
> [mm-port-serial-at.c:440] debug_log(): (ttyACM1): <--
> '<CR><LF>ERROR<CR><LF>'
> [mm-serial-parsers.c:364] mm_serial_parser_v1_parse(): Got
> failure code 100: Unknown error
> [mm-broadband-modem.c:1546] supported_modes_cnti_ready(): Generic
> query of supported 3GPP networks with *CNTI failed: 'Unknown error'
> [mm-port-serial.c:1237] mm_port_serial_open(): (ttyACM1) device
> open count is 3 (open)
> [mm-port-serial.c:1294] _close_internal(): (ttyACM1) device open
> count is 2 (close)
> [mm-port-serial-at.c:440] debug_log(): (ttyACM1): -->
> 'AT+WS46=?<CR>'
> [mm-port-serial-at.c:440] debug_log(): (ttyACM1): <--
> '<CR><LF>ERROR<CR><LF>'
> [mm-serial-parsers.c:364] mm_serial_parser_v1_parse(): Got
> failure code 100: Unknown error
> [mm-broadband-modem.c:1494] supported_modes_ws46_test_ready():
> Generic query of supported 3GPP networks with WS46=? failed: 'Unknown
> error'
> [mm-iface-modem.c:3974] load_supported_modes_ready(): couldn't
> load Supported Modes: 'Couldn't retrieve supported modes'
>
> Instead, we'll just assume that all 2G and 3G mode combinations are
> supported,
> which is likely also true for all MBM modems.
> ---
> plugins/mbm/mm-broadband-modem-mbm.c | 46 ++++++++------------------
> ----------
> 1 file changed, 10 insertions(+), 36 deletions(-)
>
> diff --git a/plugins/mbm/mm-broadband-modem-mbm.c b/plugins/mbm/mm
> -broadband-modem-mbm.c
> index 5627dee..995cf1d 100644
> --- a/plugins/mbm/mm-broadband-modem-mbm.c
> +++ b/plugins/mbm/mm-broadband-modem-mbm.c
> @@ -215,24 +215,14 @@ load_supported_modes_finish (MMIfaceModem
> *self,
> }
>
> static void
> -parent_load_supported_modes_ready (MMIfaceModem *self,
> - GAsyncResult *res,
> - GSimpleAsyncResult *simple)
> +load_supported_modes (MMIfaceModem *self,
> + GAsyncReadyCallback callback,
> + gpointer user_data)
> {
> - GError *error = NULL;
> - GArray *all;
> + GSimpleAsyncResult *simple;
> GArray *combinations;
> - GArray *filtered;
> MMModemModeCombination mode;
>
> - all = iface_modem_parent->load_supported_modes_finish (self,
> res, &error);
> - if (!all) {
> - g_simple_async_result_take_error (simple, error);
> - g_simple_async_result_complete (simple);
> - g_object_unref (simple);
> - return;
> - }
> -
> /* Build list of combinations */
> combinations = g_array_sized_new (FALSE, FALSE, sizeof
> (MMModemModeCombination), 3);
>
> @@ -249,31 +239,15 @@ parent_load_supported_modes_ready (MMIfaceModem
> *self,
> mode.preferred = MM_MODEM_MODE_NONE;
> g_array_append_val (combinations, mode);
>
> - /* Filter out those unsupported modes */
> - filtered = mm_filter_supported_modes (all, combinations);
> - g_array_unref (all);
> - g_array_unref (combinations);
> -
> - g_simple_async_result_set_op_res_gpointer (simple, filtered,
> (GDestroyNotify) g_array_unref);
> - g_simple_async_result_complete (simple);
> + simple = g_simple_async_result_new (G_OBJECT (self),
> + callback,
> + user_data,
> + load_supported_modes);
> + g_simple_async_result_set_op_res_gpointer (simple, combinations,
> (GDestroyNotify) g_array_unref);
> + g_simple_async_result_complete_in_idle (simple);
> g_object_unref (simple);
> }
>
> -static void
> -load_supported_modes (MMIfaceModem *self,
> - GAsyncReadyCallback callback,
> - gpointer user_data)
> -{
> - /* Run parent's loading */
> - iface_modem_parent->load_supported_modes (
> - MM_IFACE_MODEM (self),
> - (GAsyncReadyCallback)parent_load_supported_modes_ready,
> - g_simple_async_result_new (G_OBJECT (self),
> - callback,
> - user_data,
> - load_supported_modes));
> -}
> -
> /*******************************************************************
> **********/
> /* Load initial allowed/preferred modes (Modem interface) */
>
More information about the ModemManager-devel
mailing list