From 60845f10c9dae6c7e53022050aa8d09e1e1354ea Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 19 Apr 2013 16:24:17 -0500 Subject: broadband-modem-qmi: work around old Gobi 1K firmware SetDataFormat issue It seems that really old Gobi 1K firmware (from ~2008) doesn't implement the SetDataFormat command, and will simply ignore the request without replying to it. But the device works just fine if we retry the QMI port open operation without the SetDataFormat request. The downside of this is is that on older kernels, the qmi_wwan driver won't automatically fix up any raw-ip packets it receives, but the old Gobi devices don't ever send raw-ip packets anyway, so it's not a problem. --- src/mm-broadband-modem-qmi.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 50fa85a7..32a43473 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -7806,6 +7806,23 @@ allocate_next_client (InitializationStartedContext *ctx) ctx); } + +static void +qmi_port_open_ready_no_data_format (MMQmiPort *qmi, + GAsyncResult *res, + InitializationStartedContext *ctx) +{ + GError *error = NULL; + + if (!mm_qmi_port_open_finish (qmi, res, &error)) { + g_simple_async_result_take_error (ctx->result, error); + initialization_started_context_complete_and_free (ctx); + return; + } + + allocate_next_client (ctx); +} + static void qmi_port_open_ready (MMQmiPort *qmi, GAsyncResult *res, @@ -7814,8 +7831,16 @@ qmi_port_open_ready (MMQmiPort *qmi, GError *error = NULL; if (!mm_qmi_port_open_finish (qmi, res, &error)) { - g_simple_async_result_take_error (ctx->result, error); - initialization_started_context_complete_and_free (ctx); + /* Really, really old devices (Gobi 1K, 2008-era firmware) may not + * support SetDataFormat, so if we get an error opening the port + * try without it. The qmi_wwan driver will fix up any issues that + * the device might have between raw-ip and 802.3 mode anyway. + */ + mm_qmi_port_open (ctx->qmi, + FALSE, + NULL, + (GAsyncReadyCallback)qmi_port_open_ready_no_data_format, + ctx); return; } -- cgit v1.2.3-70-g09d2