[PATCH] huawei: always parse operator name in +COPS responses as ASCII
Dan Williams
dcbw at redhat.com
Mon Aug 26 07:59:02 PDT 2013
On Mon, 2013-08-26 at 16:30 +0200, Aleksander Morgado wrote:
> On 23/08/13 09:05, Ben Chan wrote:
> > Despite +CSCS? may claim supporting UCS2, Huawei modems always report
> > the oerator name in ASCII in a +COPS response. This patch addresses that
> > by always assuming the charset is IRA when parsing the operator name in a
> > +COPS response.
Are we sure *all* Huawei modems do this?
Dan
> > ---
> > plugins/huawei/mm-broadband-modem-huawei.c | 43 ++++++++++++++++++++++++++++++
> > 1 file changed, 43 insertions(+)
> >
>
>
> Pushed, thanks.
>
>
> > diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
> > index 453fbbd..84f2985 100644
> > --- a/plugins/huawei/mm-broadband-modem-huawei.c
> > +++ b/plugins/huawei/mm-broadband-modem-huawei.c
> > @@ -1781,6 +1781,47 @@ modem_3gpp_disable_unsolicited_events (MMIfaceModem3gpp *self,
> > }
> >
> > /*****************************************************************************/
> > +/* Operator Name loading (3GPP interface) */
> > +
> > +static gchar *
> > +modem_3gpp_load_operator_name_finish (MMIfaceModem3gpp *self,
> > + GAsyncResult *res,
> > + GError **error)
> > +{
> > + const gchar *result;
> > + gchar *operator_name;
> > +
> > + result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
> > + if (!result)
> > + return NULL;
> > +
> > + /* Despite +CSCS? may claim supporting UCS2, Huawei modems always report the
> > + * operator name in ASCII in a +COPS response. Thus, we ignore the current
> > + * charset claimed by the modem and assume the charset is IRA when parsing
> > + * the operator name.
> > + */
> > + operator_name = mm_3gpp_parse_operator (result, MM_MODEM_CHARSET_IRA);
> > + if (operator_name)
> > + mm_dbg ("loaded Operator Name: %s", operator_name);
> > +
> > + return operator_name;
> > +}
> > +
> > +static void
> > +modem_3gpp_load_operator_name (MMIfaceModem3gpp *self,
> > + GAsyncReadyCallback callback,
> > + gpointer user_data)
> > +{
> > + mm_dbg ("loading Operator Name (huawei)...");
> > + mm_base_modem_at_command (MM_BASE_MODEM (self),
> > + "+COPS=3,0;+COPS?",
> > + 3,
> > + FALSE,
> > + callback,
> > + user_data);
> > +}
> > +
> > +/*****************************************************************************/
> > /* Create Bearer (Modem interface) */
> >
> > typedef struct {
> > @@ -3037,6 +3078,8 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
> > iface->enable_unsolicited_events_finish = modem_3gpp_enable_unsolicited_events_finish;
> > iface->disable_unsolicited_events = modem_3gpp_disable_unsolicited_events;
> > iface->disable_unsolicited_events_finish = modem_3gpp_disable_unsolicited_events_finish;
> > + iface->load_operator_name = modem_3gpp_load_operator_name;
> > + iface->load_operator_name_finish = modem_3gpp_load_operator_name_finish;
> > }
> >
> > static void
> >
>
>
More information about the ModemManager-devel
mailing list