diff options
author | Sven Schwermer <sven.schwermer@disruptive-technologies.com> | 2022-08-05 15:09:28 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2022-10-17 09:35:30 +0000 |
commit | 855977c4c7c1ead7dedd710671ca0359b277c417 (patch) | |
tree | dd64bf7116c4cb060b5795c248c18370d250a7f4 | |
parent | e5bb33a46369f12ef97b766079fa61b7d4a2f9f8 (diff) |
fibocom: Implement power down/off
Also bump the timeout for the +CFUN operations as they may take up to
10s according to the AT command manual (e.g. MA510).
Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
-rw-r--r-- | plugins/fibocom/mm-broadband-modem-fibocom.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/plugins/fibocom/mm-broadband-modem-fibocom.c b/plugins/fibocom/mm-broadband-modem-fibocom.c index 9a819432..747d0769 100644 --- a/plugins/fibocom/mm-broadband-modem-fibocom.c +++ b/plugins/fibocom/mm-broadband-modem-fibocom.c @@ -164,12 +164,12 @@ modem_create_bearer (MMIfaceModem *_self, } /*****************************************************************************/ -/* Reset (Modem interface) */ +/* Reset / Power (Modem interface) */ static gboolean -modem_reset_finish (MMIfaceModem *self, - GAsyncResult *res, - GError **error) +modem_common_power_finish (MMIfaceModem *self, + GAsyncResult *res, + GError **error) { return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error); } @@ -181,6 +181,32 @@ modem_reset (MMIfaceModem *self, { mm_base_modem_at_command (MM_BASE_MODEM (self), "+CFUN=15", + 15, + FALSE, + callback, + user_data); +} + +static void +modem_power_down (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + mm_base_modem_at_command (MM_BASE_MODEM (self), + "+CFUN=4", + 15, + FALSE, + callback, + user_data); +} + +static void +modem_power_off (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + mm_base_modem_at_command (MM_BASE_MODEM (self), + "+CPWROFF", 3, FALSE, callback, @@ -261,7 +287,11 @@ iface_modem_init (MMIfaceModem *iface) iface->create_bearer = modem_create_bearer; iface->create_bearer_finish = modem_create_bearer_finish; iface->reset = modem_reset; - iface->reset_finish = modem_reset_finish; + iface->reset_finish = modem_common_power_finish; + iface->modem_power_down = modem_power_down; + iface->modem_power_down_finish = modem_common_power_finish; + iface->modem_power_off = modem_power_off; + iface->modem_power_off_finish = modem_common_power_finish; } static void |