aboutsummaryrefslogtreecommitdiff
path: root/src/mm-broadband-bearer.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-03-24 14:55:36 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-03-24 21:49:23 +0100
commit15d135b9c47a0878e3c62906d33c2a5f08546ac1 (patch)
treefe25e9459117602729446f26df22d06f58f8169d /src/mm-broadband-bearer.c
parentdd1e281e82726bcf3349a776da53c4158b088724 (diff)
base-bearer: stop connection status monitoring if no TTY available
On modems with a single TTY for both control and data, we cannot use the TTY to load connection status once we're in connected mode: Connection through a plain serial AT port (ttyUSB2) (ttyUSB2): --> 'ATD*99***2#<CR>' (ttyUSB2): <-- '<CR><LF>CONNECT 100000000<CR><LF>' (ttyUSB2): port now connected Connected bearer '/org/freedesktop/ModemManager1/Bearer/0' Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected) Simple connect state (8/8): All done checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command ... So, disable connection monitoring right away if that situation is detected: Connection through a plain serial AT port (ttyUSB2) (ttyUSB2): --> 'ATD*99***2#<CR>' (ttyUSB2): <-- '<CR><LF>CONNECT 100000000<CR><LF>' (ttyUSB2): port now connected Connected bearer '/org/freedesktop/ModemManager1/Bearer/0' Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected) Simple connect state (8/8): All done Connection monitoring is unsupported by the device ... https://bugs.freedesktop.org/show_bug.cgi?id=100376
Diffstat (limited to 'src/mm-broadband-bearer.c')
-rw-r--r--src/mm-broadband-bearer.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index 3a82defa..9491f5a8 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -1992,30 +1992,45 @@ load_connection_status (MMBaseBearer *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GTask *task;
- MMBaseModem *modem = NULL;
+ GTask *task;
+ MMBaseModem *modem = NULL;
+ MMPortSerialAt *port;
task = g_task_new (self, NULL, callback, user_data);
+ g_object_get (MM_BASE_BEARER (self),
+ MM_BASE_BEARER_MODEM, &modem,
+ NULL);
+
+ /* If CID not defined, error out */
if (!MM_BROADBAND_BEARER (self)->priv->cid) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Couldn't load connection status: cid not defined");
g_object_unref (task);
- return;
+ goto out;
}
- g_object_get (MM_BASE_BEARER (self),
- MM_BASE_BEARER_MODEM, &modem,
- NULL);
+ /* If no control port available, error out */
+ port = mm_base_modem_peek_best_at_port (modem, NULL);
+ if (!port) {
+ g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Couldn't load connection status: no control port available");
+ g_object_unref (task);
+ goto out;
+ }
- mm_base_modem_at_command (MM_BASE_MODEM (modem),
- "+CGACT?",
- 3,
- FALSE,
- (GAsyncReadyCallback) cgact_periodic_query_ready,
- task);
+ mm_base_modem_at_command_full (MM_BASE_MODEM (modem),
+ port,
+ "+CGACT?",
+ 3,
+ FALSE, /* allow cached */
+ FALSE, /* raw */
+ NULL, /* cancellable */
+ (GAsyncReadyCallback) cgact_periodic_query_ready,
+ task);
- g_object_unref (modem);
+out:
+ g_clear_object (&modem);
}
/*****************************************************************************/