Hi NM,

I've done some little work this we in order to be able to use a Sierra A850 
connected to "Bougues Telecom Entreprises" (french broadband provider provider, 
*98*1, a2bouygues.com).

Here are the resulting patches...

Since...
- all of them can be implemented in better ways,
- the "98 service code" which is also a standard has a few (but major) side 
effects on NM related packages (nn-applet, serviceprovider, libmbca, ... please 
forward this email to these lists if needed)
- I'm not familiar with your dev/upgrade processes (and I've seen too many 
branches in the lauchpad and svn repositories)

...I've simply done the diffs against "ubuntu/intrepid/secutity/updates/no 
proposed/no backport " sources packages. Let me know what I can do to finalize 
the paches or if I you need my help.

Best regards from the "Pyrénées" (great mountains, south of France/north of 
Spain),

Jerome

(Abonnement "Bouygues Télécom Entreprises", Linux, Sierra Wireless, INCOMS 
<http://www.incoms.fr/>).

//
//A. Patch summary :
//

/*
1. do_not_power_up_if_cfun_=_1.patch
(network-manager-0.7~~svn20081018t105859/src/nm-gsm-device.c)
*/

Sending AT+CFUN=1 to a Sierra AC850 card when it is already powered up causes a 
"Modem hangup" in ppp session (I don't know why... but I've confimed this 
behavor with wvdial, maybe some kind of differed reset?). This patch gets the 
CFUN value (AT+CFUN?) in "power_up" and direcly calls "do_register" when its 
value is 1 (power_up has been changed, the AT+CFUN=1 is done in the new 
"do_power_up").

/*
2. gprs_ip_service_d_98_cid.patch
(network-manager-0.7~~svn20081018t105859/src/nm-gsm-device.c)
*/

99 is just the GPRS service code of GPRS service 'D'. 3GPP TS 07.07 V7.8.0 
(2003-03) 
(<http://www.3gpp.org/ftp/Specs/archive/07_series/07.07/0707-780.zip>) defines 
an other type of "MT originated PDP context activation": GPRS IP service 'D'. 
The service code for this service is 88 and the number format is *98*<cid>#. My 
french provider (Bougues Telecom Entreprises, APN: a2bouygues.com) uses this 
type of number (I guess they are is not the only ones in this world...).

This pach modifies "real_do_dial" to allow this type of dialing (And it doesn't 
change numbers when they aren't *99#/*98# shortcuts in order to simplify the 
use of "future" service codes/dialstring). IMHO, users knows better than NM the 
correct number to their provider, please read the comments included in the 
pach).

/*
3. The following paches are all related to the non "99" service codes ("99" is 
not the only one "de-facto" standard). Side effecets on nn-applet, 
serviceprovider, libmbca ... I've check the kde/xfce/... impact.
*/

/*
3.1 bouygues_telecom_enterprises_dtd_number.patch
(mobile-broadband-provider-info-20081015.1/
- serviceproviders.dtd,
- serviceproviders.xml)
*/

Modify the "serviceproviders.dtd" by adding a "number" ELEMENT to the dtd 
(needed for "*98#" service providers). Add "Bougues Telecom Entreprises" in 
serviceproviders.xml. 3GPP standards are not frozen. New service 
codes/dialstring format may be approuved.

/*
3.2 dtd_number.patch
(libmbca-0.0.3~bzr42/src/
- mbca_serviceprovider.h
- mbca_serviceprovider.c
- serviceprovider_parser.c
- test_mbca.c)
*/

Process the new "number" ELEMENT (Add the "number" field to the "provider" and 
get it).

/*
3.2 no_de-facto_standard_if_number_exits.patch
(network-manager-applet-0.7~~svn20081020t000444./src/connection-editor/nm-connection-list.c)
*/

Don't use the "de-facto" standard (*99#) when the number is defined. Use the 
number defined in "serviceproviders.xml"

//
// B. Pach details:
//

/*
1. do_not_power_up_if_cfun_=_1.patch
*/

--- network-manager-0.7~~svn20081018t105859/src/nm-gsm-device.c 2009-02-22 
12:20:05.000000000 +0100
+++ network-manager-0.7~~svn20081018t105859.new/src/nm-gsm-device.c     
2009-02-22 12:24:07.000000000 +0100
@@ -464,8 +464,9 @@
        do_register (NM_GSM_DEVICE (device));
 }
 
+/* Was power_up */
 static void
-power_up (NMGsmDevice *device)
+do_power_up (NMGsmDevice *device)
 {
        const char *responses[] = { "OK", "ERROR", "ERR", NULL };
 
@@ -474,6 +475,36 @@
 }
 
 static void
+get_power_response (NMSerialDevice *device,
+                      int reply_index,
+                      const char *reply,
+                      gpointer user_data)
+{
+       switch (reply_index) {
+       case 0:
+               /* Already powered up! */
+               nm_info ("(%s): already powered up!", nm_device_get_iface 
(NM_DEVICE (device)));                
+               do_register (NM_GSM_DEVICE (device));
+               break;
+       default:
+               /* Power up the device */
+               do_power_up (NM_GSM_DEVICE (device));
+       }
+}
+
+/* New power_up */
+static void
+power_up(NMGsmDevice *device)
+{
+       const char *responses[] = { "+CFUN: 1", NULL };
+       const char *terminators[] = { "OK", "ERROR", "ERR", NULL };
+       /* Sending AT+CFUN=1 to a Sierra AC850 card that is already powered up 
causes a "Modem hangup" in ppp session.
+       Check CFUN value before powering up the device*/
+       nm_info ("(%s): checking CFUN...", nm_device_get_iface (NM_DEVICE 
(device)));
+       modem_wait_for_reply (device, "AT+CFUN?", 10, responses, terminators, 
get_power_response, NULL);
+}
+
+static void
 init_full_done (NMSerialDevice *device,
                 int reply_index,
                 const char *reply,

/*
2. gprs_ip_service_d_98_cid.patch
*/

--- network-manager-0.7~~svn20081018t105859/src/nm-gsm-device.c 2009-02-21 
10:53:42.000000000 +0100
+++ network-manager-0.7~~svn20081018t105859.new/src/nm-gsm-device.c     
2009-02-21 12:31:53.000000000 +0100
@@ -158,24 +158,55 @@
 
        setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE 
(device), NM_TYPE_SETTING_GSM));
 
-       if (cid) {
+       /* GPRS service commands are defined in:
+       3GPP TS 07.07 V7.8.0 (2003-03)
+       http://www.3gpp.org/ftp/Specs/archive/07_series/07.07/0707-780.zip 
+       0707-780.doc
+       10.2.1 MT originated PDP context activation (pp 104-106) */
+
+       if (cid && (strlen (setting->number) < 5)) {
+               /* If the number is a shortcut to *99***<cid># (GPRS service 
'D')
+               or *98*<cid># (GPRS IP service 'D') */
                GString *str;
 
-               str = g_string_new ("ATD");
+               nm_info ("GPRS service shortcut: %s", setting->number);
+               str = g_string_new ("");
                if (g_str_has_suffix (setting->number, "#"))
                        str = g_string_append_len (str, setting->number, strlen 
(setting->number) - 1);
                else
                        str = g_string_append (str, setting->number);
-
-               g_string_append_printf (str, "***%d#", cid);
+               if (strcmp (str->str,"*99") == 0) {
+                       /* 10.2.1.1     GPRS service 'D' (pp104-105)
+                       D*<GPRS_SC>[*[<called_address>] [*[<L2P>][*[<cid>]]]]# 
*/
+                       g_string_append_printf (str, "***%d#", cid);
+                       nm_info ("GPRS service 'D': %s", str->str);
+               } else {
+                       if (strcmp (str->str,"*98") == 0) {
+                               /* 10.2.1.2 Request GPRS IP service 'D' 
(pp105-106)
+                               D*<GPRS_SC_IP>[*<cid>]#
+                               Defined Values
+                               <GPRS_SC_IP>: (GPRS Service Code for IP) a 
digit string (value 98) which identifies a request to use the GPRS with IP (PDP 
types IP and PPP) 
+                               <cid>: a digit string which specifies a 
particular PDP context definition (see +CGDCONT command).
+                               ex. Bouyges Telecom Enterprise (french 
provider, APN: a2bouygtel.com) requires *98*1# */
+                               g_string_append_printf (str, "*%d#", cid);
+                               nm_info ("GPRS IP service 'D': %s", str->str);
+                       } else {
+                               g_string_append_printf (str, "***%d#", cid);
+                               nm_warning ("Unknown \"Service Code\", using 
default format: %s", str->str);
+                       }
+               }
+               g_string_prepend (str, "ATD"); 
                command = g_string_free (str, FALSE);
-       } else
+       } else {
+               /* Don't change numbers when they aren't shortcuts. Consider 
that the user knows the right dialstring,
+               or that some other type of Service Code/dialstring could (one 
day?) be specified */
+               nm_warning ("You know your GPRS service number better than us, 
make sure it is correct if something fails later: %s", setting->number);
                command = g_strconcat ("ATDT", setting->number, NULL);
+       }
 
        modem_wait_for_reply (device, command, 60, responses, responses, 
dial_done, NULL);
        g_free (command);
 }
-
 static void
 set_apn_done (NMSerialDevice *device,
               int reply_index,

/*
3.1 bouygues_telecom_enterprises_dtd_number.patch
*/
diff -Nur mobile-broadband-provider-info-20081015.1/serviceproviders.dtd 
mobile-broadband-provider-info-20081015.1.new/serviceproviders.dtd
--- mobile-broadband-provider-info-20081015.1/serviceproviders.dtd      
2008-10-21 15:05:05.000000000 +0200
+++ mobile-broadband-provider-info-20081015.1.new/serviceproviders.dtd  
2009-02-22 15:57:10.000000000 +0100
@@ -8,6 +8,7 @@
                      (gsm|cdma),
                      username?,
                      password?,
+                    number?,
                      dns*,
                      gateway?)>
                      
@@ -21,5 +22,6 @@
 
 <!ELEMENT username (#PCDATA)> 
 <!ELEMENT password (#PCDATA)>
+<!ELEMENT number (#PCDATA)> 
 <!ELEMENT dns (#PCDATA)>
-<!ELEMENT gateway (#PCDATA)>
\ No newline at end of file
+<!ELEMENT gateway (#PCDATA)>
diff -Nur mobile-broadband-provider-info-20081015.1/serviceproviders.xml 
mobile-broadband-provider-info-20081015.1.new/serviceproviders.xml
--- mobile-broadband-provider-info-20081015.1/serviceproviders.xml      
2008-10-21 15:05:05.000000000 +0200
+++ mobile-broadband-provider-info-20081015.1.new/serviceproviders.xml  
2009-02-22 15:59:51.000000000 +0100
@@ -34,7 +34,7 @@
 conceived.
 -->
 
-<serviceproviders format="1.0">
+<serviceproviders format="1.0.1">
 
 <!-- United Arab Emirates -->
 <country code="ae">
@@ -1127,6 +1127,13 @@
 <!-- France -->
 <country code="fr">
        <provider>
+               <name>Bouygues Telecom Entreprises</name>
+               <gsm>
+                       <apn>a2bouygtel.com</apn>
+               </gsm>
+               <number>*98#</number>
+       </provider>
+       <provider>
                <name>Bouygues Telecom (B2Bouygtel)</name>
                <gsm>
                        <apn>b2bouygtel.com</apn>

/*
3.2 dtd_number.patch
*/

diff -Nur libmbca-0.0.3~bzr42/src/mbca_serviceprovider.c 
libmbca-0.0.3~bzr42.new/src/mbca_serviceprovider.c
--- libmbca-0.0.3~bzr42/src/mbca_serviceprovider.c      2008-09-01 
17:04:05.000000000 +0200
+++ libmbca-0.0.3~bzr42.new/src/mbca_serviceprovider.c  2009-02-22 
11:44:23.000000000 +0100
@@ -65,6 +65,9 @@
        
        _dupstr(newprovider->username, provider->username);
        _dupstr(newprovider->password, provider->password);
+
+       _dupstr(newprovider->number, provider->number);
+
        _dupstr(newprovider->dns1, provider->dns1);
        _dupstr(newprovider->dns2, provider->dns2);
        _dupstr(newprovider->gateway, provider->gateway);
@@ -108,6 +111,9 @@
        
        free (provider->username);
        free (provider->password);
+       
+       free (provider->number);
+
        free (provider->dns1);
        free (provider->dns2);
        free (provider->gateway);
diff -Nur libmbca-0.0.3~bzr42/src/mbca_serviceprovider.h 
libmbca-0.0.3~bzr42.new/src/mbca_serviceprovider.h
--- libmbca-0.0.3~bzr42/src/mbca_serviceprovider.h      2008-09-01 
17:04:05.000000000 +0200
+++ libmbca-0.0.3~bzr42.new/src/mbca_serviceprovider.h  2009-02-22 
19:57:49.000000000 +0100
@@ -100,10 +100,11 @@
        };                                 /**< union containing network 
specific settings.
                                            *   _MBCAServiceProvider::type 
indicates valid
                                            *   member */
-
        gchar* username;           /**< if NULL, no authentication required     
    */
        gchar* password;           /**< if NULL, no password required.          
          */
 
+       gchar* number;
+
        gchar* dns1;               /**< primary DNS, NULL if automatically 
acquired */
        gchar* dns2;               /**< secondary DNS, NULL if none.            
          */
        gchar* gateway;    /**< gateway to use, NULL if none                    
  */
diff -Nur libmbca-0.0.3~bzr42/src/serviceprovider_parser.c 
libmbca-0.0.3~bzr42.new/src/serviceprovider_parser.c
--- libmbca-0.0.3~bzr42/src/serviceprovider_parser.c    2008-09-01 
17:04:05.000000000 +0200
+++ libmbca-0.0.3~bzr42.new/src/serviceprovider_parser.c        2009-02-22 
12:03:09.000000000 +0100
@@ -221,6 +221,14 @@
                        provider->password = (gchar*)xmlStrdup (value);
                        continue;
                }
+               else if (xmlStrcmp (name, BAD_CAST "number") == 0)
+               {
+                       xmlTextReaderRead (reader); /* get to text */
+                       value = xmlTextReaderConstValue (reader);
+                       provider->number = (gchar*)xmlStrdup (value);
+                       g_debug("number = %s", provider->number);
+                       continue;
+               }
                else if (xmlStrcmp (name, BAD_CAST "dns") == 0)
                {
                        xmlTextReaderRead (reader); /* get to text */
diff -Nur libmbca-0.0.3~bzr42/src/test_mbca.c 
libmbca-0.0.3~bzr42.new/src/test_mbca.c
--- libmbca-0.0.3~bzr42/src/test_mbca.c 2008-09-01 17:04:05.000000000 +0200
+++ libmbca-0.0.3~bzr42.new/src/test_mbca.c     2009-02-22 19:57:33.000000000 
+0100
@@ -100,6 +100,10 @@
        {
                g_print ("password:  %s\n", conf->provider->password);
        }
+       if (conf->provider->number)
+       {
+               g_print ("number:  %s\n", conf->provider->number);
+       }
        if (conf->provider->dns1)
        {
                g_print ("dns1:      %s\n", conf->provider->dns1);

/*
3.3 no_de-facto_standard_if_number_exits.patch
*/
--- 
network-manager-applet-0.7~~svn20081020t000444/src/connection-editor/nm-connection-list.c
   2009-02-22 13:10:48.000000000 +0100
+++ 
network-manager-applet-0.7~~svn20081020t000444.new/src/connection-editor/nm-connection-list.c
       2009-02-22 15:46:45.000000000 +0100
@@ -868,7 +868,15 @@
 
                        type_setting = nm_setting_gsm_new ();
                        s_gsm = NM_SETTING_GSM (type_setting);
-                       s_gsm->number = g_strdup ("*99#");  /* De-facto 
standard for GSM */
+
+                       if (strlen(conf->provider->number) == 0)
+                               s_gsm->number = g_strdup ("*99#");  /* De-facto 
standard for GSM */
+                       else {
+                               /* De-facto standard does not seem to work for 
Bouygues Telecom Entreprises... and other GPRS IP Service 'D' providers? 98 
service code.
+                               Use the number "as is" when it is provided */
+                               s_gsm->number = g_strdup 
(conf->provider->number);
+                               g_warning ("GPRS service number = %s", 
conf->provider->number);
+                       }
 
                        s_gsm->apn = g_strdup (conf->provider->gsm.apn);

Attachment: do_not_power_up_if_cfun_=_1.patch
Description: Binary data

Attachment: gprs_ip_service_d_98_cid.patch
Description: Binary data

Attachment: bouygues_telecom_enterprises_dtd_number.patch
Description: Binary data

Attachment: dtd_number.patch
Description: Binary data

Attachment: no_de-facto_standard_if_number_exits.patch
Description: Binary data

_______________________________________________
NetworkManager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to