Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
On Wed, 2012-10-31 at 10:14 +0100, Marius Kotsbak wrote: Den 31. okt. 2012 09:05, skrev Aleksander Morgado: On 30/10/12 22:44, Dan Williams wrote: So I'd love to do this, and I actually pushed it along with a fix to Sierra. But then when testing it out with my 8775 and 8781, they both crash when going from CFUN=4 - CFUN=1. I've always had reliability/crashing issues with the 8775, and I've even bought 4 separate devices to figure out if the hardware was the problem. I even tried them in 3 different carriers, including one with external power, to ensure that they were getting enough current when powering on the radios. No luck. We can always limit the power-up/power-down to all sierra devices except for that one :-/ Japp, that I also was about to propose. But is it impossible to power down that modem then, or does +cfun=0 works better? I don't have that problem with my internal Sierra modem card, but your device is has legacy status. Do you have the latest firmware? Yeah, I've got 3 different firmware versions of the 8775, including 1.8.something, 1.9.something, and the 2.x update that added HSDPA 7.2 support. None of them work reliably. Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
On 30/10/12 22:44, Dan Williams wrote: So I'd love to do this, and I actually pushed it along with a fix to Sierra. But then when testing it out with my 8775 and 8781, they both crash when going from CFUN=4 - CFUN=1. I've always had reliability/crashing issues with the 8775, and I've even bought 4 separate devices to figure out if the hardware was the problem. I even tried them in 3 different carriers, including one with external power, to ensure that they were getting enough current when powering on the radios. No luck. We can always limit the power-up/power-down to all sierra devices except for that one :-/ -- Aleksander ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
Den 31. okt. 2012 09:05, skrev Aleksander Morgado: On 30/10/12 22:44, Dan Williams wrote: So I'd love to do this, and I actually pushed it along with a fix to Sierra. But then when testing it out with my 8775 and 8781, they both crash when going from CFUN=4 - CFUN=1. I've always had reliability/crashing issues with the 8775, and I've even bought 4 separate devices to figure out if the hardware was the problem. I even tried them in 3 different carriers, including one with external power, to ensure that they were getting enough current when powering on the radios. No luck. We can always limit the power-up/power-down to all sierra devices except for that one :-/ Japp, that I also was about to propose. But is it impossible to power down that modem then, or does +cfun=0 works better? I don't have that problem with my internal Sierra modem card, but your device is has legacy status. Do you have the latest firmware? -- Marius ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
Den 09. sep. 2012 21:56, skrev Marius Kotsbak: Den 09. sep. 2012 17:39, skrev Marius Kotsbak: See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) See attached patch to avoid that this change causes reset when changing to cfun=1 (as we avoid running +cfun=1 if it is already in mode 1 and with this change it will be in mode 4). -- Marius From ed89bf5874d248d9841da0457eb7075e1417895b Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Tue, 30 Oct 2012 18:01:23 +0100 Subject: [PATCH] sierra: avoid reset when setting cfun=1 Some Sierra modems trigger a reset of the modem when sending +cfun=1. All sierra modems supports a second parameter to indicate that no reset is to be done: +cfun=1,0. --- plugins/sierra/mm-common-sierra.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sierra/mm-common-sierra.c b/plugins/sierra/mm-common-sierra.c index 1af64af..e76c366 100644 --- a/plugins/sierra/mm-common-sierra.c +++ b/plugins/sierra/mm-common-sierra.c @@ -115,7 +115,7 @@ get_current_functionality_status_ready (MMBaseModem *self, * Works well if we previously switched off the power with CFUN=4 */ mm_base_modem_at_command (MM_BASE_MODEM (self), - +CFUN=1, + +CFUN=1,0, /* ,0 ensures no reset */ 3, FALSE, (GAsyncReadyCallback)full_functionality_status_ready, -- 1.7.10.4 ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
On Tue, 2012-10-30 at 18:07 +0100, Marius Kotsbak wrote: Den 09. sep. 2012 21:56, skrev Marius Kotsbak: Den 09. sep. 2012 17:39, skrev Marius Kotsbak: See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) See attached patch to avoid that this change causes reset when changing to cfun=1 (as we avoid running +cfun=1 if it is already in mode 1 and with this change it will be in mode 4). Pushed, thanks! Bonus points for a patch for MM_06? You'll have to override MM_GENERIC_GSM_PROP_POWER_UP_CMD like plugins/mm-modem-nokia.c does by implementing get_property/set_property in the sierra plugin but that's about it. Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
Den 30. okt. 2012 18:54, skrev Dan Williams: On Tue, 2012-10-30 at 18:07 +0100, Marius Kotsbak wrote: Den 09. sep. 2012 21:56, skrev Marius Kotsbak: Den 09. sep. 2012 17:39, skrev Marius Kotsbak: See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) See attached patch to avoid that this change causes reset when changing to cfun=1 (as we avoid running +cfun=1 if it is already in mode 1 and with this change it will be in mode 4). Pushed, thanks! Bonus points for a patch for MM_06? You'll have to override MM_GENERIC_GSM_PROP_POWER_UP_CMD like plugins/mm-modem-nokia.c does by implementing get_property/set_property in the sierra plugin but that's about it. Of course, already done, attached! :) -- Marius Dan From 2ec4e4efcde67403f6bbaa1fc218f5416a12dc77 Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Tue, 30 Oct 2012 18:31:52 +0100 Subject: [PATCH 2/2] sierra: avoid reset when setting cfun=1 Some Sierra modems trigger a reset of the modem when sending +cfun=1, which is more likely when +cfun=4 is used for powering down since +cfun=1 is skipped if mode is already 1. All sierra modems supports a second parameter to indicate that no reset is to be done: +cfun=1,0. --- plugins/mm-modem-sierra-gsm.c |8 1 file changed, 8 insertions(+) diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c index b4f5b15..3737bf5 100644 --- a/plugins/mm-modem-sierra-gsm.c +++ b/plugins/mm-modem-sierra-gsm.c @@ -1090,6 +1090,10 @@ get_property (GObject *object, /* Use AT+CFUN=4 for power down (low power mode) */ g_value_set_string (value, +CFUN=4); break; +case MM_GENERIC_GSM_PROP_POWER_UP_CMD: +/* Use AT+CFUN=1,0 for power up, to avoid reset that +cfun=1 can trigger in some modems */ +g_value_set_string (value, +CFUN=1,0); +break; default: break; } @@ -1112,6 +1116,10 @@ mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass) MM_GENERIC_GSM_PROP_POWER_DOWN_CMD, MM_GENERIC_GSM_POWER_DOWN_CMD); +g_object_class_override_property (object_class, + MM_GENERIC_GSM_PROP_POWER_UP_CMD, + MM_GENERIC_GSM_POWER_UP_CMD); + gsm_class-port_grabbed = port_grabbed; gsm_class-do_enable_power_up_check_needed = do_enable_power_up_check_needed; gsm_class-do_enable_power_up_done = real_do_enable_power_up_done; -- 1.7.10.4 From d4b07afb7ef8a576ae7b54255d201a90fd52c438 Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Sun, 9 Sep 2012 16:17:46 +0200 Subject: [PATCH 1/2] sierra: use +CFUN=4 for powering down --- plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c index 7a241b3..b4f5b15 100644 --- a/plugins/mm-modem-sierra-gsm.c +++ b/plugins/mm-modem-sierra-gsm.c @@ -1071,6 +1071,31 @@ dispose (GObject *object) } static void +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ +/* Do nothing... see set_property() in parent, which also does nothing */ +} + +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ +switch (prop_id) { +case MM_GENERIC_GSM_PROP_POWER_DOWN_CMD: +/* Use AT+CFUN=4 for power down (low power mode) */ +g_value_set_string (value, +CFUN=4); +break; +default: +break; +} +} + +static void mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -1080,6 +1105,13 @@ mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass) g_type_class_add_private (object_class, sizeof (MMModemSierraGsmPrivate)); object_class-dispose = dispose; +object_class-get_property = get_property; +object_class-set_property = set_property; + +g_object_class_override_property (object_class, + MM_GENERIC_GSM_PROP_POWER_DOWN_CMD, + MM_GENERIC_GSM_POWER_DOWN_CMD); + gsm_class-port_grabbed = port_grabbed; gsm_class-do_enable_power_up_check_needed = do_enable_power_up_check_needed; gsm_class-do_enable_power_up_done = real_do_enable_power_up_done; -- 1.7.10.4 ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
On Tue, 2012-10-30 at 18:53 +0100, Marius Kotsbak wrote: Den 30. okt. 2012 18:54, skrev Dan Williams: On Tue, 2012-10-30 at 18:07 +0100, Marius Kotsbak wrote: Den 09. sep. 2012 21:56, skrev Marius Kotsbak: Den 09. sep. 2012 17:39, skrev Marius Kotsbak: See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) See attached patch to avoid that this change causes reset when changing to cfun=1 (as we avoid running +cfun=1 if it is already in mode 1 and with this change it will be in mode 4). Pushed, thanks! Bonus points for a patch for MM_06? You'll have to override MM_GENERIC_GSM_PROP_POWER_UP_CMD like plugins/mm-modem-nokia.c does by implementing get_property/set_property in the sierra plugin but that's about it. Of course, already done, attached! :) So I'd love to do this, and I actually pushed it along with a fix to Sierra. But then when testing it out with my 8775 and 8781, they both crash when going from CFUN=4 - CFUN=1. I've always had reliability/crashing issues with the 8775, and I've even bought 4 separate devices to figure out if the hardware was the problem. I even tried them in 3 different carriers, including one with external power, to ensure that they were getting enough current when powering on the radios. No luck. The USB sticks and CardBus devices I have seem to do just fine though. Thoughts? If anyone has an internal Sierra card, maybe they could test and see if they have the same problems I do. Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
[MM] Power down during init (was: Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down)
Hey Dan and Marius, Power Up = enabled Power Down = disabled So we already have those states in ModemManager via the Enable() method and the modem states. It's just that not all devices actually implement the low-power mode when disabling, partially because we're not always sure of the side-effects. The problem here isn't that we don't have a safe power-down command; the problem is that even if we have it, we don't use it just after plugging in the modem: initialized - locked - disabled But for that 'disabled' state we didn't run the power-down command even if we have it, so the radio interface may be powered on there. That's the thing to fix by running the disabling sequence just after initialization. If there is no default power down command, then we would run the disabling sequence but without any power down command, so no big deal. The attached patch runs just a new power-down step during the modem initialization, to ensure it starts in low power mode. Adding a new step to run power-down instead of running the whole disabling sequence seemed a better option, as the disabling sequence really assumes we were previously enabled. Note that this patch just re-uses the power-down implementation given in each plugin, which we previously used only during the disabling sequence. Given that it's quite a big change, can you guys try it with some of the modems that we know have given issues before with these things? Thinking on Sierra modems specifically here. I've got a Wavecom modem which also had issues with CFUN (e.g. rebooting on CFUN=1 if it was already in CFUN=1), but won't be able to test it until Friday. Cheers! -- Aleksander From 99e070b97aeacd47c119e5b9a5eeeb9033eba9f5 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado aleksan...@lanedo.com Date: Tue, 18 Sep 2012 16:09:54 +0200 Subject: [PATCH] iface-modem: ensure we're in low power mode when initializing --- src/mm-iface-modem.c | 34 ++ 1 file changed, 34 insertions(+) diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 5a2b2bd..2b76914 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -2934,6 +2934,7 @@ static void interface_initialization_step (InitializationContext *ctx); typedef enum { INITIALIZATION_STEP_FIRST, +INITIALIZATION_STEP_POWER_DOWN, INITIALIZATION_STEP_CURRENT_CAPABILITIES, INITIALIZATION_STEP_MODEM_CAPABILITIES, INITIALIZATION_STEP_BEARERS, @@ -3009,6 +3010,25 @@ initialization_context_complete_and_free_if_cancelled (InitializationContext *ct return TRUE; } +static void +initialization_modem_power_down_ready (MMIfaceModem *self, + GAsyncResult *res, + InitializationContext *ctx) +{ +GError *error = NULL; + +MM_IFACE_MODEM_GET_INTERFACE (self)-modem_power_down_finish (self, res, error); +if (error) { +mm_dbg (Couldn't power down the modem during initialization: '%s', error-message); +g_error_free (error); +} else +mm_dbg (Modem initially powered down...); + +/* Go on to next step */ +ctx-step++; +interface_initialization_step (ctx); +} + #undef STR_REPLY_READY_FN #define STR_REPLY_READY_FN(NAME,DISPLAY)\ static void \ @@ -3280,6 +3300,20 @@ interface_initialization_step (InitializationContext *ctx) /* Fall down to next step */ ctx-step++; +case INITIALIZATION_STEP_POWER_DOWN: +/* We run the power down command during initialization, to ensure we + * start with radio off, when possible */ +if (MM_IFACE_MODEM_GET_INTERFACE (ctx-self)-modem_power_down +MM_IFACE_MODEM_GET_INTERFACE (ctx-self)-modem_power_down_finish) { +MM_IFACE_MODEM_GET_INTERFACE (ctx-self)-modem_power_down ( +ctx-self, +(GAsyncReadyCallback)initialization_modem_power_down_ready, +ctx); +return; +} +/* Fall down to next step */ +ctx-step++; + case INITIALIZATION_STEP_CURRENT_CAPABILITIES: /* Current capabilities may change during runtime, i.e. if new firmware reloaded; but we'll * try to handle that by making sure the capabilities are cleared when the new firmware is -- 1.7.11.4 ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM] Power down during init (was: Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down)
On Tue, 2012-09-18 at 19:45 +0200, Marius Kotsbak wrote: 2012/9/18 Aleksander Morgado aleksan...@lanedo.com Hey Dan and Marius, Power Up = enabled Power Down = disabled So we already have those states in ModemManager via the Enable() method and the modem states. It's just that not all devices actually implement the low-power mode when disabling, partially because we're not always sure of the side-effects. The problem here isn't that we don't have a safe power-down command; the problem is that even if we have it, we don't use it just after plugging in the modem: initialized - locked - disabled But for that 'disabled' state we didn't run the power-down command even if we have it, so the radio interface may be powered on there. That's the thing to fix by running the disabling sequence just after initialization. If there is no default power down command, then we would run the disabling sequence but without any power down command, so no big deal. The attached patch runs just a new power-down step during the modem initialization, to ensure it starts in low power mode. Adding a new step to run power-down instead of running the whole disabling sequence seemed a better option, as the disabling sequence really assumes we were previously enabled. Note that this patch just re-uses the power-down implementation given in each plugin, which we previously used only during the disabling sequence. Given that it's quite a big change, can you guys try it with some of the modems that we know have given issues before with these things? Thinking on Sierra modems specifically here. I've got a Wavecom modem which also had issues with CFUN (e.g. rebooting on CFUN=1 if it was already in CFUN=1), but won't be able to test it until Friday. Tested my ZTE MF820D and seems to work nice. Would this be possible to backport to MM_06? It could be, patches accepted unless we get to it first :) Btw, is this expected?: model: '+CGMM: MF820D' A bug, the handler code here probably needs to strip out the CGMM if found. Most devices don't actually prefix the CGMM response with +CGMM so the code wasn't built to handle that, either in 05/06 or git master I guess. Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM] Power down during init (was: Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down)
2012/9/18 Marius Kotsbak marius.kots...@gmail.com 2012/9/18 Aleksander Morgado aleksan...@lanedo.com Hey Dan and Marius, Power Up = enabled Power Down = disabled So we already have those states in ModemManager via the Enable() method and the modem states. It's just that not all devices actually implement the low-power mode when disabling, partially because we're not always sure of the side-effects. The problem here isn't that we don't have a safe power-down command; the problem is that even if we have it, we don't use it just after plugging in the modem: initialized - locked - disabled But for that 'disabled' state we didn't run the power-down command even if we have it, so the radio interface may be powered on there. That's the thing to fix by running the disabling sequence just after initialization. If there is no default power down command, then we would run the disabling sequence but without any power down command, so no big deal. The attached patch runs just a new power-down step during the modem initialization, to ensure it starts in low power mode. Adding a new step to run power-down instead of running the whole disabling sequence seemed a better option, as the disabling sequence really assumes we were previously enabled. Note that this patch just re-uses the power-down implementation given in each plugin, which we previously used only during the disabling sequence. Given that it's quite a big change, can you guys try it with some of the modems that we know have given issues before with these things? Thinking on Sierra modems specifically here. I've got a Wavecom modem which also had issues with CFUN (e.g. rebooting on CFUN=1 if it was already in CFUN=1), but won't be able to test it until Friday. Tested my ZTE MF820D and seems to work nice. But it seems not to work with my Sierra modem in AT mode: ModemManager[3734]: debug [1347998708.810662] [mm-serial-port.c:929] mm_serial_port_open(): (ttyUSB3) device open count is 4 (open) ModemManager[3734]: debug [1347998708.810953] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- 'ATE0CR' ModemManager[3734]: debug [1347998708.815802] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- 'ATE' ModemManager[3734]: debug [1347998708.822968] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- '0CR' ModemManager[3734]: debug [1347998708.824151] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- 'CRLFOKCRLF' ModemManager[3734]: debug [1347998708.824446] [mm-serial-port.c:969] mm_serial_port_close(): (ttyUSB3) device open count is 3 (close) ModemManager[3734]: debug [1347998708.824688] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- 'AT+CMEE=1CR' ModemManager[3734]: debug [1347998708.840464] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- 'CRLFOKCRLF' ModemManager[3734]: debug [1347998708.840817] [mm-serial-port.c:969] mm_serial_port_close(): (ttyUSB3) device open count is 2 (close) ModemManager[3734]: debug [1347998708.841066] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- 'AT!pcstate=0CR' ModemManager[3734]: debug [1347998708.865357] [mm-at-serial-port.c:392] debug_log(): (ttyUSB3): -- 'CRLFERRORCRLF' ModemManager[3734]: debug [1347998708.865590] [mm-serial-parsers.c:316] mm_serial_parser_v1_parse(): Got failure code 100: Unknown error ModemManager[3734]: debug [1347998708.865743] [mm-iface-modem.c:3025] initialization_modem_power_down_ready(): Modem initially powered down... This might be caused by the check if it is CDMA or GSM modem is run before it knows the answer (see my patch I send in a moment). -- Marius ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
2012/9/10 Aleksander Morgado aleksan...@lanedo.com See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) This also needs to be intregrated in the master branch version. Attached is my attempt to do it, but it seems not to work. I see no effect of disabling the modem with mmcli -m X -d. See review below. 0001-sierra-use-CFUN-4-for-powering-down.patch From ac69eb9a08f821efb674f54292ee90707ca81e29 Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Sun, 9 Sep 2012 18:06:30 +0200 Subject: [PATCH] sierra: use +CFUN=4 for powering down --- plugins/sierra/mm-broadband-modem-sierra.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c index 49c2e22..c8e8f3e 100644 --- a/plugins/sierra/mm-broadband-modem-sierra.c +++ b/plugins/sierra/mm-broadband-modem-sierra.c @@ -527,11 +527,14 @@ modem_power_down (MMIfaceModem *self, return; } -/* For 3GPP modems we should call parent's power down, but there is no - * such power down command in MMBroadbandModem, so just finish here. */ -g_simple_async_result_set_op_res_gboolean (result, TRUE); -g_simple_async_result_complete_in_idle (result); g_object_unref (result); + +mm_base_modem_at_command (MM_BASE_MODEM (self), + +CFUN=4, + 3, + FALSE, + callback, + user_data); } There are 2 main ways to handle the async command execution when an AT command is issued: 1) If only the AT command can be issued, just run base_modem_at_command() passing callback and user_data. In that case you don't need the _ready() method and you can just run base_modem_at_command_finish() in the async method finish(). 2) If the logic of the async command may end up not issuing an AT command, you need to create a GSimpleAsyncResult, and use a specific ready() method passed as GAsyncReadyCallback in base_modem_at_command(). In this case, your new ready() method is responsible for calling base_modem_at_command_finish() and setting the simple async result in the GSimpleAsyncResult. Your async method finish would then just get the result or the error from the GSimpleAsyncResult. Now, before your patch, this async method was using approach 2, as the async would end up issuing an AT command if it was a CDMA modem, but just returning in idle if it was a 3GPP modem. After the patch, you're merging both approaches, which is wrong. Given that now the async command will always issue an AT command, you can use the approach to pass the callback/user_data directly in *both* the at_command() methods instead of providing new custom ready() methods, modifying the async method finish() as well so that it calls _at_command_finish() itself. Thanks for the explanation. It is quite complicated, but I think I understand it now. Updated patch attached. This time it works with the mmcli -m X -d (but not with the init power down patch). -- Marius 0001-sierra-use-CFUN-4-for-powering-down-GSM-modems.patch Description: Binary data ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
On Tue, 2012-09-18 at 22:15 +0200, Marius Kotsbak wrote: 2012/9/10 Aleksander Morgado aleksan...@lanedo.com See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) This also needs to be intregrated in the master branch version. Attached is my attempt to do it, but it seems not to work. I see no effect of disabling the modem with mmcli -m X -d. See review below. 0001-sierra-use-CFUN-4-for-powering-down.patch From ac69eb9a08f821efb674f54292ee90707ca81e29 Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Sun, 9 Sep 2012 18:06:30 +0200 Subject: [PATCH] sierra: use +CFUN=4 for powering down --- plugins/sierra/mm-broadband-modem-sierra.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c index 49c2e22..c8e8f3e 100644 --- a/plugins/sierra/mm-broadband-modem-sierra.c +++ b/plugins/sierra/mm-broadband-modem-sierra.c @@ -527,11 +527,14 @@ modem_power_down (MMIfaceModem *self, return; } -/* For 3GPP modems we should call parent's power down, but there is no - * such power down command in MMBroadbandModem, so just finish here. */ -g_simple_async_result_set_op_res_gboolean (result, TRUE); -g_simple_async_result_complete_in_idle (result); g_object_unref (result); + +mm_base_modem_at_command (MM_BASE_MODEM (self), + +CFUN=4, + 3, + FALSE, + callback, + user_data); } There are 2 main ways to handle the async command execution when an AT command is issued: 1) If only the AT command can be issued, just run base_modem_at_command() passing callback and user_data. In that case you don't need the _ready() method and you can just run base_modem_at_command_finish() in the async method finish(). 2) If the logic of the async command may end up not issuing an AT command, you need to create a GSimpleAsyncResult, and use a specific ready() method passed as GAsyncReadyCallback in base_modem_at_command(). In this case, your new ready() method is responsible for calling base_modem_at_command_finish() and setting the simple async result in the GSimpleAsyncResult. Your async method finish would then just get the result or the error from the GSimpleAsyncResult. Now, before your patch, this async method was using approach 2, as the async would end up issuing an AT command if it was a CDMA modem, but just returning in idle if it was a 3GPP modem. After the patch, you're merging both approaches, which is wrong. Given that now the async command will always issue an AT command, you can use the approach to pass the callback/user_data directly in *both* the at_command() methods instead of providing new custom ready() methods, modifying the async method finish() as well so that it calls _at_command_finish() itself. Thanks for the explanation. It is quite complicated, but I think I understand it now. Updated patch attached. This time it works with the mmcli -m X -d (but not with the init power down patch). Yeah, !pcstate is a CDMA-only command; CFUN=4 is the right one for GSM/UMTS/LTE devices. Pushed, thanks! Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM] Power down during init (was: Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down)
I briefly tested the patch on Samsung/Icera Y3300/Y3400 modems. Planning to do some more stress tests later this week. It may not be a bad idea to allow a plugin to override the power-down-on-initialization behavior. Thanks, Ben On Tue, Sep 18, 2012 at 7:24 AM, Aleksander Morgado aleksan...@lanedo.com wrote: Hey Dan and Marius, Power Up = enabled Power Down = disabled So we already have those states in ModemManager via the Enable() method and the modem states. It's just that not all devices actually implement the low-power mode when disabling, partially because we're not always sure of the side-effects. The problem here isn't that we don't have a safe power-down command; the problem is that even if we have it, we don't use it just after plugging in the modem: initialized - locked - disabled But for that 'disabled' state we didn't run the power-down command even if we have it, so the radio interface may be powered on there. That's the thing to fix by running the disabling sequence just after initialization. If there is no default power down command, then we would run the disabling sequence but without any power down command, so no big deal. The attached patch runs just a new power-down step during the modem initialization, to ensure it starts in low power mode. Adding a new step to run power-down instead of running the whole disabling sequence seemed a better option, as the disabling sequence really assumes we were previously enabled. Note that this patch just re-uses the power-down implementation given in each plugin, which we previously used only during the disabling sequence. Given that it's quite a big change, can you guys try it with some of the modems that we know have given issues before with these things? Thinking on Sierra modems specifically here. I've got a Wavecom modem which also had issues with CFUN (e.g. rebooting on CFUN=1 if it was already in CFUN=1), but won't be able to test it until Friday. Cheers! -- Aleksander ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) This also needs to be intregrated in the master branch version. Attached is my attempt to do it, but it seems not to work. I see no effect of disabling the modem with mmcli -m X -d. See review below. Also, it seems like the power down is not done before the modem enters disabled state at startup of MM or after modem is inserted, so I filed a bug about that: https://bugzilla.gnome.org/show_bug.cgi?id=683681 Yes, that's a known issue, see TODO in the source tree. Dan, what do you think of this, should we run the whole disabling sequence, including the power-down command, just after the modem gets initialized? I would do it, but now sure if that would have any unexpected complication. The only problem I could think of is when you want to connect your modem as soon as it appears in DBus, running the Simple.Connect() command. In this case you don't really want to go to the low-power mode as you're going to connect it right away. -- Marius 0001-sierra-use-CFUN-4-for-powering-down.patch From ac69eb9a08f821efb674f54292ee90707ca81e29 Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Sun, 9 Sep 2012 18:06:30 +0200 Subject: [PATCH] sierra: use +CFUN=4 for powering down --- plugins/sierra/mm-broadband-modem-sierra.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c index 49c2e22..c8e8f3e 100644 --- a/plugins/sierra/mm-broadband-modem-sierra.c +++ b/plugins/sierra/mm-broadband-modem-sierra.c @@ -527,11 +527,14 @@ modem_power_down (MMIfaceModem *self, return; } -/* For 3GPP modems we should call parent's power down, but there is no - * such power down command in MMBroadbandModem, so just finish here. */ -g_simple_async_result_set_op_res_gboolean (result, TRUE); -g_simple_async_result_complete_in_idle (result); g_object_unref (result); + +mm_base_modem_at_command (MM_BASE_MODEM (self), + +CFUN=4, + 3, + FALSE, + callback, + user_data); } There are 2 main ways to handle the async command execution when an AT command is issued: 1) If only the AT command can be issued, just run base_modem_at_command() passing callback and user_data. In that case you don't need the _ready() method and you can just run base_modem_at_command_finish() in the async method finish(). 2) If the logic of the async command may end up not issuing an AT command, you need to create a GSimpleAsyncResult, and use a specific ready() method passed as GAsyncReadyCallback in base_modem_at_command(). In this case, your new ready() method is responsible for calling base_modem_at_command_finish() and setting the simple async result in the GSimpleAsyncResult. Your async method finish would then just get the result or the error from the GSimpleAsyncResult. Now, before your patch, this async method was using approach 2, as the async would end up issuing an AT command if it was a CDMA modem, but just returning in idle if it was a 3GPP modem. After the patch, you're merging both approaches, which is wrong. Given that now the async command will always issue an AT command, you can use the approach to pass the callback/user_data directly in *both* the at_command() methods instead of providing new custom ready() methods, modifying the async method finish() as well so that it calls _at_command_finish() itself. -- Aleksander ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) This also needs to be intregrated in the master branch version. Attached is my attempt to do it, but it seems not to work. I see no effect of disabling the modem with mmcli -m X -d. See review below. Also, it seems like the power down is not done before the modem enters disabled state at startup of MM or after modem is inserted, so I filed a bug about that: https://bugzilla.gnome.org/show_bug.cgi?id=683681 Yes, that's a known issue, see TODO in the source tree. The text there is slightly incorrect. It does not help if the modem is in low power mode when started (some might also be configured to be), because at least in the Sierra plugin, it is waked up to CFUN=1 in the init anyway. This could be avoided by accepting CFUN mode 4 and 7 as well. But then it must be changed to mode 1 when connecting. I am not sure if all the init steps are possible in low power mode. CFUN=1 is sent when *enabling* the modem, not during init. All the init steps should really be possible while in CFUN=4 low power mode as that should only kill the radio power. Also, for Sierra modems there's the problem that CFUN=1 may actually reboot the modem, so the problem with powering down the radio with CFUN=4 in Sierra is that this may require a reboot/reprobing of the modem afterwards :-/ IIRC Wavecom (which also suffers from the same issue) had a CFUN=1,0 to try to go into full functionality mode without rebooting, not sure if Sierra has something similar. Dan, what do you think of this, should we run the whole disabling sequence, including the power-down command, just after the modem gets initialized? I would do it, but now sure if that would have any unexpected complication. The only problem I could think of is when you want to connect your modem as soon as it appears in DBus, running the Simple.Connect() command. In this case you don't really want to go to the low-power mode as you're going to connect it right away. When would this happen? This power down/disabling should only happen if the mobile broadband is disabled (the default now, although it could be discussed if it should be if there are any auto connections available). If mobile broadband is enabled and a new modem appears, it should move directly from init to start connection. MM doesn't know anything about broadband disabled; that's a NM setting and NM is the one required to honour it. Just assume MM doesn't work only with NM. Ah, so then MM api could be extended to either expose the power up/down functions or the init gets a parameter saying if the modem should be enabled after init. MM interface already has Enable() and Disable() methods. We could expose a more fine-grained interface to control radio power up/down, but not sure if it would help much here. Wouldn't make much sense to have a modem disabled with radio on (which btw is what we currently have...). But I do agree that we need to handle this properly. We do need to run the whole disabling sequence at the end of the initialization sequence, either if we're in LOCKED or DISABLED state. The problem doesn't only come with power consumption (e.g. the modem has radio powered on, even if we say it's disabled); also, the modem will be registered in the network and may receive SMS, which we wouldn't process as all the feature-specific interfaces are not enabled yet. I'll look at how to do this and suggest a fix for this. Japp, beside that the computer might be positioned and it should be turned off to use it in an airplane. That's a very good reason to make sure we have radio off (when possible). -- Aleksander ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) This also needs to be intregrated in the master branch version. Attached is my attempt to do it, but it seems not to work. I see no effect of disabling the modem with mmcli -m X -d. See review below. Also, it seems like the power down is not done before the modem enters disabled state at startup of MM or after modem is inserted, so I filed a bug about that: https://bugzilla.gnome.org/show_bug.cgi?id=683681 Yes, that's a known issue, see TODO in the source tree. The text there is slightly incorrect. It does not help if the modem is in low power mode when started (some might also be configured to be), because at least in the Sierra plugin, it is waked up to CFUN=1 in the init anyway. This could be avoided by accepting CFUN mode 4 and 7 as well. But then it must be changed to mode 1 when connecting. I am not sure if all the init steps are possible in low power mode. CFUN=1 is sent when *enabling* the modem, not during init. All the init steps should really be possible while in CFUN=4 low power mode as that should only kill the radio power. Sorry, I did not test it or dig deep enough in the code. If I sent the modem to CFUN=4, it actually keeps this state after the init, and enabling works fine. Also, for Sierra modems there's the problem that CFUN=1 may actually reboot the modem, so the problem with powering down the radio with CFUN=4 in Sierra is that this may require a reboot/reprobing of the modem afterwards :-/ IIRC Wavecom (which also suffers from the same issue) had a CFUN=1,0 to try to go into full functionality mode without rebooting, not sure if Sierra has something similar. Seems my Sierra modem has the same: +CFUN: (0-1,4-7),(0-1) but the default is ,0 on my modem, as CFUN=1,1 behaves just like CFUN=1, but CFUN=1,1 causes a restart. We could do a detection of the right version by using some regex of the CFUN=? output. Or, just try first with AT+CFUN=1,0 and if we get any error, retry with the original AT+CFUN=1. This can easily be done with an AT sequence. Note that anyway the power-up command needs to be sent *only* if not already in the full-functionality mode (that's why the Sierra and Wavecom plugins have already the AT+CFUN? check). -- Aleksander ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
On Mon, 2012-09-10 at 14:21 +0200, Aleksander Morgado wrote: See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) This also needs to be intregrated in the master branch version. Attached is my attempt to do it, but it seems not to work. I see no effect of disabling the modem with mmcli -m X -d. See review below. Also, it seems like the power down is not done before the modem enters disabled state at startup of MM or after modem is inserted, so I filed a bug about that: https://bugzilla.gnome.org/show_bug.cgi?id=683681 Yes, that's a known issue, see TODO in the source tree. The text there is slightly incorrect. It does not help if the modem is in low power mode when started (some might also be configured to be), because at least in the Sierra plugin, it is waked up to CFUN=1 in the init anyway. This could be avoided by accepting CFUN mode 4 and 7 as well. But then it must be changed to mode 1 when connecting. I am not sure if all the init steps are possible in low power mode. CFUN=1 is sent when *enabling* the modem, not during init. All the init steps should really be possible while in CFUN=4 low power mode as that should only kill the radio power. Sorry, I did not test it or dig deep enough in the code. If I sent the modem to CFUN=4, it actually keeps this state after the init, and enabling works fine. Also, for Sierra modems there's the problem that CFUN=1 may actually reboot the modem, so the problem with powering down the radio with CFUN=4 in Sierra is that this may require a reboot/reprobing of the modem afterwards :-/ IIRC Wavecom (which also suffers from the same issue) had a CFUN=1,0 to try to go into full functionality mode without rebooting, not sure if Sierra has something similar. Seems my Sierra modem has the same: +CFUN: (0-1,4-7),(0-1) but the default is ,0 on my modem, as CFUN=1,1 behaves just like CFUN=1, but CFUN=1,1 causes a restart. We could do a detection of the right version by using some regex of the CFUN=? output. Or, just try first with AT+CFUN=1,0 and if we get any error, retry with the original AT+CFUN=1. This can easily be done with an AT sequence. Note that anyway the power-up command needs to be sent *only* if not already in the full-functionality mode (that's why the Sierra and Wavecom plugins have already the AT+CFUN? check). Sierra 2.8 AT docs (which aren't very up-to-date) suggest that AT +CFUN=x,x is supported by most modems, but only lists states 0 and 1. So we'd probably need to parse AT+CFUN=? and then figure out if we *can* do state 4 or not. But we could also just retry like you suggest. Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
Power Up = enabled Power Down = disabled So we already have those states in ModemManager via the Enable() method and the modem states. It's just that not all devices actually implement the low-power mode when disabling, partially because we're not always sure of the side-effects. The problem here isn't that we don't have a safe power-down command; the problem is that even if we have it, we don't use it just after plugging in the modem: initialized - locked - disabled But for that 'disabled' state we didn't run the power-down command even if we have it, so the radio interface may be powered on there. That's the thing to fix by running the disabling sequence just after initialization. If there is no default power down command, then we would run the disabling sequence but without any power down command, so no big deal. -- Aleksander ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
[MM06] [PATCH] sierra: use +CFUN=4 for powering down
See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) From f256d6cc79e0c640968105ea4dd7affd231b2f01 Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Sun, 9 Sep 2012 16:17:46 +0200 Subject: [PATCH] sierra: use +CFUN=4 for powering down --- plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c index 23ed029..759ab87 100644 --- a/plugins/mm-modem-sierra-gsm.c +++ b/plugins/mm-modem-sierra-gsm.c @@ -1062,6 +1062,31 @@ dispose (GObject *object) } static void +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ +/* Do nothing... see set_property() in parent, which also does nothing */ +} + +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ +switch (prop_id) { +case MM_GENERIC_GSM_PROP_POWER_DOWN_CMD: +/* Use AT+CFUN=4 for power down (low power mode) */ +g_value_set_string (value, +CFUN=4); +break; +default: +break; +} +} + +static void mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -1071,6 +1096,13 @@ mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass) g_type_class_add_private (object_class, sizeof (MMModemSierraGsmPrivate)); object_class-dispose = dispose; +object_class-get_property = get_property; +object_class-set_property = set_property; + +g_object_class_override_property (object_class, + MM_GENERIC_GSM_PROP_POWER_DOWN_CMD, + MM_GENERIC_GSM_POWER_DOWN_CMD); + gsm_class-port_grabbed = port_grabbed; gsm_class-do_enable_power_up_check_needed = do_enable_power_up_check_needed; gsm_class-do_enable_power_up_done = real_do_enable_power_up_done; -- 1.7.10.4 ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
[MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down
Den 09. sep. 2012 17:39, skrev Marius Kotsbak: See patch attached. sierra: use +CFUN=4 for powering down plugins/mm-modem-sierra-gsm.c | 32 1 file changed, 32 insertions(+) This also needs to be intregrated in the master branch version. Attached is my attempt to do it, but it seems not to work. I see no effect of disabling the modem with mmcli -m X -d. Also, it seems like the power down is not done before the modem enters disabled state at startup of MM or after modem is inserted, so I filed a bug about that: https://bugzilla.gnome.org/show_bug.cgi?id=683681 -- Marius From ac69eb9a08f821efb674f54292ee90707ca81e29 Mon Sep 17 00:00:00 2001 From: Marius B. Kotsbak mar...@kotsbak.com Date: Sun, 9 Sep 2012 18:06:30 +0200 Subject: [PATCH] sierra: use +CFUN=4 for powering down --- plugins/sierra/mm-broadband-modem-sierra.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c index 49c2e22..c8e8f3e 100644 --- a/plugins/sierra/mm-broadband-modem-sierra.c +++ b/plugins/sierra/mm-broadband-modem-sierra.c @@ -527,11 +527,14 @@ modem_power_down (MMIfaceModem *self, return; } -/* For 3GPP modems we should call parent's power down, but there is no - * such power down command in MMBroadbandModem, so just finish here. */ -g_simple_async_result_set_op_res_gboolean (result, TRUE); -g_simple_async_result_complete_in_idle (result); g_object_unref (result); + +mm_base_modem_at_command (MM_BASE_MODEM (self), + +CFUN=4, + 3, + FALSE, + callback, + user_data); } /*/ -- 1.7.10.4 ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list