mirror of git://git.sysmocom.de/ofono
atmodem: Signal quality on quectel serial modems
As the default way of getting the signal quality with +CIND is also unstable on quectel serial modems (the same as on quectel EC21). In fact the signal quality is only updated on cell changes. Those trigger a manual AT+CSQ in ofono and get an update this way, but the URCs do not work. So we implement a quectelish way here as well. The quectelish way is very similar to the way ifx modems work. We can reuse their csq_notify function.
This commit is contained in:
parent
dbc1fb62ac
commit
a811aca98a
|
@ -780,15 +780,26 @@ static void ifx_xciev_notify(GAtResult *result, gpointer user_data)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ifx_xcsq_notify(GAtResult *result, gpointer user_data)
|
static void ifx_quec_csq_notify(GAtResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_netreg *netreg = user_data;
|
struct ofono_netreg *netreg = user_data;
|
||||||
|
struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
|
||||||
int rssi, ber, strength;
|
int rssi, ber, strength;
|
||||||
GAtResultIter iter;
|
GAtResultIter iter;
|
||||||
|
const char *prefix;
|
||||||
|
|
||||||
g_at_result_iter_init(&iter, result);
|
g_at_result_iter_init(&iter, result);
|
||||||
|
|
||||||
if (!g_at_result_iter_next(&iter, "+XCSQ:"))
|
switch (nd->vendor) {
|
||||||
|
case OFONO_VENDOR_QUECTEL_SERIAL:
|
||||||
|
prefix = "+CSQN:";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
prefix = "+XCSQ:";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_at_result_iter_next(&iter, prefix))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!g_at_result_iter_next_number(&iter, &rssi))
|
if (!g_at_result_iter_next_number(&iter, &rssi))
|
||||||
|
@ -2027,7 +2038,7 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
/* Register for specific signal strength reports */
|
/* Register for specific signal strength reports */
|
||||||
g_at_chat_register(nd->chat, "+XCIEV:", ifx_xciev_notify,
|
g_at_chat_register(nd->chat, "+XCIEV:", ifx_xciev_notify,
|
||||||
FALSE, netreg, NULL);
|
FALSE, netreg, NULL);
|
||||||
g_at_chat_register(nd->chat, "+XCSQ:", ifx_xcsq_notify,
|
g_at_chat_register(nd->chat, "+XCSQ:", ifx_quec_csq_notify,
|
||||||
FALSE, netreg, NULL);
|
FALSE, netreg, NULL);
|
||||||
g_at_chat_send(nd->chat, "AT+XCSQ=1", none_prefix,
|
g_at_chat_send(nd->chat, "AT+XCSQ=1", none_prefix,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
@ -2118,6 +2129,13 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
g_at_chat_send(nd->chat, "AT+QINDCFG=\"act\",1", none_prefix,
|
g_at_chat_send(nd->chat, "AT+QINDCFG=\"act\",1", none_prefix,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
|
case OFONO_VENDOR_QUECTEL_SERIAL:
|
||||||
|
g_at_chat_register(nd->chat, "+CSQN:",
|
||||||
|
ifx_quec_csq_notify, FALSE, netreg, NULL);
|
||||||
|
/* Register for specific signal strength reports */
|
||||||
|
g_at_chat_send(nd->chat, "AT+QEXTUNSOL=\"SQ\",1", none_prefix,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_at_chat_send(nd->chat, "AT+CIND=?", cind_prefix,
|
g_at_chat_send(nd->chat, "AT+CIND=?", cind_prefix,
|
||||||
cind_support_cb, netreg, NULL);
|
cind_support_cb, netreg, NULL);
|
||||||
|
|
Loading…
Reference in New Issue