Re: Fix for wrong handling of cid variable in mm-generic-gsm.c connect()
- From: Dan Williams <dcbw redhat com>
- To: Maciej Grela <maciej grela gmail com>
- Cc: networkmanager-list gnome org
- Subject: Re: Fix for wrong handling of cid variable in mm-generic-gsm.c connect()
- Date: Mon, 01 Nov 2010 20:53:12 -0500
On Sun, 2010-10-31 at 12:08 +0200, Maciej Grela wrote:
> Hi,
>
> I have recently noticed, that my Nokia E51 stopped working in
> NetworkManager. In mm debug I saw the following message:
Hmm, did you give an APN in the config before connecting? If not, then
I think there's a few things we should do to handle that case better.
The patch is still clearly correct; though it would cause the code to
dial ATD*99***0#, which is invalid. If the phone accepts that, it's
wrong. I think what we should end up doing when there's no APN is just
dialing ATD*99# and let the modem decide, possibly screwing the user in
the process when the modem's stored APN is wrong.
(APNs are stored in the *modem*, not the SIM, so if you ever change
providers and put in a different SIM, ATD*99# is guaranteed not to work)
Dan
> ** (modem-manager:2449): DEBUG: <1288513309.559793> (ttyACM0): network_mode => 0
> ** (modem-manager:2449): DEBUG: <1288513309.559793> (ttyACM0): allowed_mode => 0
> ** (modem-manager:2449): DEBUG: <1288513309.559793> (ttyACM0): number => "*99#"
> ** (modem-manager:2449): DEBUG: <1288513309.559793> (ttyACM0): home_only => TRUE
> ** (modem-manager:2449): DEBUG: <1288513309.559994> (ttyACM0): simple
> connect state 0
> ** (modem-manager:2449): DEBUG: <1288513309.560127> (ttyACM0): simple
> connect state 2
> ** (modem-manager:2449): DEBUG: <1288513309.560232> (ttyACM0): -->
> 'AT+CREG?<CR>'
> ** (modem-manager:2449): DEBUG: <1288513309.571103> (ttyACM0): <--
> '<CR><LF>+CREG: 2,1,"2B32","5476"<CR><LF><CR><LF>OK<CR><LF>'
> ** (modem-manager:2449): DEBUG: <1288513309.571308> (ttyACM0): simple
> connect state 4
> ** (modem-manager:2449): DEBUG: <1288513309.571417> Modem
> /org/freedesktop/ModemManager/Modems/0: state changed (registered ->
> connecting)
> ** (modem-manager:2449): DEBUG: <1288513309.571520> (ttyACM0): -->
> 'ATD*99***-1#<CR>'
> ** (modem-manager:2449): DEBUG: <1288513309.588073> (ttyACM0): <--
> '<CR><LF>ERROR<CR><LF>'
> ** (modem-manager:2449): DEBUG: Got failure code 100: Unknown error
> ** (modem-manager:2449): DEBUG: <1288513309.588168> (ttyACM0): --> 'AT+CEER<CR>'
>
> The number being dialled is obviously wrong. I've traced this problem
> to the connect() function in mm-generic-gsm and noticed, that it
> incorrectly uses a guint32 for the cid, where in many places in the
> code it's set to -1. This causes the 'if (cid > 0)' condition to
> always succeed producing the invalid phone number. The fix is simple:
>
> diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
> index c534904..417aa3c 100644
> --- a/src/mm-generic-gsm.c
> +++ b/src/mm-generic-gsm.c
> @@ -747,7 +747,7 @@ connect (MMModem *modem,
> {
> MMCallbackInfo *info;
> char *command;
> - guint32 cid = mm_generic_gsm_get_cid (MM_GENERIC_GSM (modem));
> + gint cid = mm_generic_gsm_get_cid (MM_GENERIC_GSM (modem));
>
> info = mm_callback_info_new (modem, callback, user_data);
>
>
> Applying this patch fixed the problem immidiately. Please consider
> including it in the repo.
>
>
> Best regards,
> Maciej Grela
>
> PS. Please include me in CC, I'm not subscribed.
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]