summary refs log tree commit diff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@debian.org>2008-11-30 14:07:06 +0000
committerSjoerd Simons <sjoerd@debian.org>2008-11-30 14:07:06 +0000
commit68214fcc44dd2c5e8272c06e538271e9d6ab39e0 (patch)
tree155ec0b025d0719a4d947a4378e862fde3013d3f
parenta447c8079ad25f03424908182932fc3e42e738e5 (diff)
* debian/patches/03-F3507g.patch
  - Added. Fix gsm support for Ericsson F3507g Mobile Broadband cards

git-svn-id: svn+ssh://svn.debian.org/svn/pkg-utopia/packages/experimental/networkmanager@2513 ceb527fc-18e6-0310-9fe2-813c157c29e7
-rw-r--r--debian/changelog4
-rw-r--r--debian/patches/03-F3507g.patch129
-rw-r--r--debian/patches/series1
3 files changed, 133 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index bf5bb629..6160b39c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,10 @@ network-manager (0.7.0-1) UNRELEASED; urgency=low
   * New upstream release
   * debian/libnm-util0.symbols: Updated
   * debian/libnm-glib0.symbols: Updated
+  * debian/patches/03-F3507g.patch
+    - Added. Fix gsm support for Ericsson F3507g Mobile Broadband cards
 
- -- Sjoerd Simons <sjoerd@debian.org>  Sat, 29 Nov 2008 23:15:47 +0100
+ -- Sjoerd Simons <sjoerd@debian.org>  Sun, 30 Nov 2008 15:06:27 +0100
 
 network-manager (0.7.0~svn4191-1) experimental; urgency=low
 
diff --git a/debian/patches/03-F3507g.patch b/debian/patches/03-F3507g.patch
new file mode 100644
index 00000000..296eab81
--- /dev/null
+++ b/debian/patches/03-F3507g.patch
@@ -0,0 +1,129 @@
+Index: src/nm-gsm-device.c
+===================================================================
+--- src/nm-gsm-device.c	(revision 4357)
++++ src/nm-gsm-device.c	(working copy)
+@@ -51,6 +51,15 @@
+ 	guint init_tries;
+ } NMGsmDevicePrivate;
+ 
++/* Various possible init sequences */
++const gchar *modem_init_sequences[] = {
++	"ATZ E0 V1 X4 &C1 +FCLASS=0",
++	"ATZ E0 V1 &C1",
++	"AT&F E0 V1",
++	NULL
++};
++
++
+ enum {
+ 	PROP_0,
+ 	PROP_MONITOR_IFACE,
+@@ -69,7 +78,7 @@
+ static void enter_pin (NMGsmDevice *device, NMGsmSecret secret_type, gboolean retry);
+ static void manual_registration (NMGsmDevice *device);
+ static void automatic_registration (NMGsmDevice *device);
+-static void init_modem (NMSerialDevice *device, gpointer user_data);
++static void init_modem (NMSerialDevice *device);
+ 
+ NMGsmDevice *
+ nm_gsm_device_new (const char *udi,
+@@ -431,7 +440,7 @@
+ 	const char *responses[] = { "+CREG: 0,0", "+CREG: 0,1", "+CREG: 0,2", "+CREG: 0,3", "+CREG: 0,5", NULL };
+ 	const char *terminators[] = { "OK", "ERROR", "ERR", NULL };
+ 
+-	modem_wait_for_reply (device, "AT+CREG?", 15, responses, terminators, automatic_registration_response, NULL);
++	modem_wait_for_reply (device, "AT+CREG?", 25, responses, terminators, automatic_registration_response, NULL);
+ }
+ 
+ static void
+@@ -496,13 +505,14 @@
+ static void
+ init_modem_full (NMGsmDevice *device)
+ {
++	NMGsmDevicePrivate *priv = NM_GSM_DEVICE_GET_PRIVATE (device);
+ 	const char *responses[] = { "OK", "ERROR", "ERR", NULL };
+ 
+ 	/* Send E0 too because some devices turn echo back on after CPIN which
+ 	 * just breaks stuff since echo-ed commands are interpreted as replies.
+ 	 * rh #456770
+ 	 */
+-	modem_wait_for_reply (device, "ATZ E0 V1 X4 &C1 +FCLASS=0", 10, responses, responses, init_full_done, NULL);
++	modem_wait_for_reply (device, modem_init_sequences[priv->init_tries], 10, responses, responses, init_full_done, NULL);
+ }
+ 
+ static void
+@@ -647,7 +657,6 @@
+ 
+ 	switch (reply_index) {
+ 	case 0:
+-		priv->init_tries = 0;
+ 		check_pin (NM_GSM_DEVICE (device));
+ 		break;
+ 	case -1:
+@@ -657,36 +666,27 @@
+ 		                         NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED);
+ 		break;
+ 	default:
+-		switch (priv->init_tries) {
+-		case 0:
+-			nm_warning ("Trying alternate modem initialization");
+-			init_modem (device, "ATZ E0 V1 &C1");
+-			break;
+-		case 1:
+-			nm_warning ("Trying second alternate modem initialization");
+-			init_modem (device, "AT&F E0 V1");
+-			break;
+-		default:
++		priv->init_tries++;
++		if (modem_init_sequences[priv->init_tries] != NULL) {
++			nm_warning ("Trying alternate modem initialization (%d)",
++				priv->init_tries);
++			init_modem (device);
++		} else {
+ 			nm_warning ("Modem initialization failed");
+ 			nm_device_state_changed (NM_DEVICE (device),
+ 			                         NM_DEVICE_STATE_FAILED,
+ 			                         NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED);
+-			break;
+ 		}
+-		priv->init_tries++;
+-		return;
+ 	}
+ }
+ 
+ static void
+-init_modem (NMSerialDevice *device, gpointer user_data)
++init_modem (NMSerialDevice *device)
+ {
++	NMGsmDevicePrivate *priv = NM_GSM_DEVICE_GET_PRIVATE (device);
+ 	const char *responses[] = { "OK", "ERROR", "ERR", NULL };
+-	const char *init_string = user_data;
++	const char *init_string = modem_init_sequences[priv->init_tries];
+ 
+-	if (!init_string)
+-		init_string = "ATZ E0 V1 X4 &C1 +FCLASS=0";
+-
+ 	modem_wait_for_reply (NM_GSM_DEVICE (device), init_string, 10, responses, responses, init_done, NULL);
+ }
+ 
+@@ -706,7 +706,7 @@
+ 
+ 	NM_GSM_DEVICE_GET_PRIVATE (device)->init_tries = 0;
+ 
+-	id = nm_serial_device_flash (serial_device, 100, init_modem, NULL);
++	id = nm_serial_device_flash (serial_device, 100, (NMSerialFlashFn) init_modem, NULL);
+ 	if (!id)
+ 		*reason = NM_DEVICE_STATE_REASON_UNKNOWN;
+ 
+Index: src/nm-serial-device.c
+===================================================================
+--- src/nm-serial-device.c	(revision 4357)
++++ src/nm-serial-device.c	(working copy)
+@@ -415,6 +415,7 @@
+ 	}
+ 
+ 	priv->channel = g_io_channel_unix_new (priv->fd);
++	g_io_channel_set_encoding (priv->channel, NULL, NULL);
+ 
+ 	return TRUE;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 5bb8c3f1..4e4e8051 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 02-dbus_access_network_manager.patch
+03--F3507g.patch -p0