Fix for wrong handling of cid variable in mm-generic-gsm.c connect()



Hi,

I have recently noticed, that my Nokia E51 stopped working in
NetworkManager. In mm debug I saw the following message:

** (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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]