umbim: add registration set support
authorIngo Feinerer <feinerer@logic.at>
Thu, 10 Jan 2019 14:58:00 +0000 (15:58 +0100)
committerPetr Štetiar <ynezz@true.cz>
Wed, 10 Apr 2019 14:05:20 +0000 (16:05 +0200)
This implements the MBIM automatic registration mode to let the function
select the best provider network.

Signed-off-by: Ingo Feinerer <feinerer@logic.at>
Reviewed-by: Bjørn Mork <bjorn@mork.no>
cli.c

diff --git a/cli.c b/cli.c
index 1dd6330b8113fc9e43c193a3c4c7a651de85fb91..e00b6d4911c6c84a5ff4930ae0840dfa1af0bd81 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -297,7 +297,16 @@ mbim_pin_state_request(void)
 static int
 mbim_registration_request(void)
 {
-       mbim_setup_command_msg(basic_connect, MBIM_MESSAGE_COMMAND_TYPE_QUERY, MBIM_CMD_BASIC_CONNECT_REGISTER_STATE, 0);
+       if (_argc > 0) {
+               struct mbim_basic_connect_register_state_s *rs =
+                       (struct mbim_basic_connect_register_state_s *) mbim_setup_command_msg(basic_connect,
+                                       MBIM_MESSAGE_COMMAND_TYPE_SET, MBIM_CMD_BASIC_CONNECT_REGISTER_STATE,
+                                       sizeof(struct mbim_basic_connect_register_state_s));
+
+               rs->registeraction = htole32(MBIM_REGISTER_ACTION_AUTOMATIC);
+       } else {
+               mbim_setup_command_msg(basic_connect, MBIM_MESSAGE_COMMAND_TYPE_QUERY, MBIM_CMD_BASIC_CONNECT_REGISTER_STATE, 0);
+       }
 
        return mbim_send_command_msg();
 }