summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-08-02 10:47:25 -0500
committerDan Williams <dcbw@redhat.com>2011-08-02 10:47:25 -0500
commit26debc1a9745ebc54d35569ba416a368f084a3f4 (patch)
tree9a17d83b1477851cd194af848c5a9a68efd6e4cd
parentd3c2228f7b55465f4433bedb36d47744b8d791f1 (diff)
mbm: don't flash serial ports on disconnect (bgo #650740)
The F5521gw resets various port properties like echo when the port is flashed, which was happening on disconnect. Since MM had already turned of echo with ATE0, and the AT parser in-use expected no echo, this confused MM when the port magically started echoing commands back. We don't need flashing on the Ericsson devices because there will always be a free AT port even if PPP is used for a secondary PDP context, so we can just skip flashing entirely for these devices.
-rw-r--r--plugins/mm-modem-mbm.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
index 70faef42..7aa8a019 100644
--- a/plugins/mm-modem-mbm.c
+++ b/plugins/mm-modem-mbm.c
@@ -437,18 +437,28 @@ mbm_emrdy_done (MMAtSerialPort *port,
gpointer user_data)
{
MMCallbackInfo *info = user_data;
+ MMModemMbmPrivate *priv;
/* If the modem has already been removed, return without
* scheduling callback */
if (mm_callback_info_check_modem_removed (info))
return;
- if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
- mm_warn ("timed out waiting for EMRDY response.");
- else {
- MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
-
- priv->have_emrdy = TRUE;
+ /* EMRDY unsolicited response might have happened between the command
+ * submission and the response. This was seen once:
+ *
+ * (ttyACM0): --> 'AT*EMRDY?<CR>'
+ * (ttyACM0): <-- 'T*EMRD<CR><LF>*EMRDY: 1<CR><LF>Y?'
+ *
+ * So suppress the warning if the unsolicited handler handled the response
+ * before we get here.
+ */
+ priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
+ if (!priv->have_emrdy) {
+ if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
+ mm_warn ("timed out waiting for EMRDY response.");
+ else
+ priv->have_emrdy = TRUE;
}
do_init (port, info);
@@ -966,6 +976,13 @@ grab_port (MMModem *modem,
if (port && MM_IS_AT_SERIAL_PORT (port)) {
GRegex *regex;
+ /* The Ericsson modems always have a free AT command port, so we
+ * don't need to flash the ports when disconnecting to get back to
+ * command mode. F5521gw R2A07 resets port properties like echo when
+ * flashed, leading to confusion. bgo #650740
+ */
+ g_object_set (G_OBJECT (port), MM_SERIAL_PORT_FLASH_OK, FALSE, NULL);
+
if (ptype == MM_PORT_TYPE_PRIMARY) {
regex = g_regex_new ("\\r\\n\\*E2NAP: (\\d)\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
mm_at_serial_port_add_unsolicited_msg_handler (MM_AT_SERIAL_PORT (port), regex, mbm_e2nap_received, modem, NULL);