From 46d757faa768db7d7bb23d51cc2af3196f7a7e30 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 6 Jul 2011 13:13:41 -0500 Subject: [PATCH] gsm: send init command twice to make the N900 happy (rh #583691) (lp:765516) The N900 has some odd serial characteristics in that it appears to send pieces of the commands back for whatever reason, until you've sent a few commands down to it. Almost like it's training on whatever you send and needs a bit of input to figure out the characteristics. Whatever. Just send the init command twice instead of failing when the N900 barfs the first time. --- src/mm-generic-gsm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index c8cf7db4..c5c5969a 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -1614,7 +1614,13 @@ enable_flash_done (MMSerialPort *port, GError *error, gpointer user_data) return; } + /* Send the init command twice; some devices (Nokia N900) appear to take a + * few commands before responding correctly. Instead of penalizing them for + * being stupid the first time by failing to enable the device, just + * try again. + */ g_object_get (G_OBJECT (info->modem), MM_GENERIC_GSM_INIT_CMD, &cmd, NULL); + mm_at_serial_port_queue_command (MM_AT_SERIAL_PORT (port), cmd, 3, NULL, NULL); mm_at_serial_port_queue_command (MM_AT_SERIAL_PORT (port), cmd, 3, init_done, user_data); g_free (cmd); }