aboutsummaryrefslogtreecommitdiff
path: root/cli/mmcli.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-08-20 10:33:01 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:25 +0100
commitfcadc0f841750a108d154cabee159c115b3e557a (patch)
treed2f0f7373bcab5abb3c975fab5d801a7bcea40a0 /cli/mmcli.c
parent9e241b7062883a67a31500a6f095c9839c8666c8 (diff)
cli: add commands to get info from modem
Diffstat (limited to 'cli/mmcli.c')
-rw-r--r--cli/mmcli.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/cli/mmcli.c b/cli/mmcli.c
index 85e4c4af..f403d31f 100644
--- a/cli/mmcli.c
+++ b/cli/mmcli.c
@@ -116,6 +116,8 @@ main (gint argc, gchar **argv)
context = g_option_context_new ("- Control and monitor the ModemManager");
g_option_context_add_group (context,
mmcli_manager_get_option_group ());
+ g_option_context_add_group (context,
+ mmcli_modem_get_option_group ());
g_option_context_add_main_entries (context, main_entries, NULL);
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
@@ -145,6 +147,13 @@ main (gint argc, gchar **argv)
/* Manager options? */
if (mmcli_manager_options_enabled ()) {
+ /* Ensure options from different groups are not enabled */
+ if (mmcli_modem_options_enabled ()) {
+ g_printerr ("error: cannot use manager and modem options "
+ "at the same time\n");
+ exit (EXIT_FAILURE);
+ }
+
if (async_flag)
mmcli_manager_run_asynchronous (connection, cancellable);
else
@@ -153,6 +162,18 @@ main (gint argc, gchar **argv)
g_printerr ("error: no actions specified\n");
exit (EXIT_FAILURE);
}
+ /* Modem options? */
+ else if (mmcli_modem_options_enabled ()) {
+ if (async_flag)
+ keep_loop = mmcli_modem_run_asynchronous (connection, cancellable);
+ else
+ mmcli_modem_run_synchronous (connection);
+ }
+ /* No options? */
+ else {
+ g_printerr ("error: no actions specified\n");
+ exit (EXIT_FAILURE);
+ }
/* Run loop only in async operations */
if (async_flag) {
@@ -164,6 +185,8 @@ main (gint argc, gchar **argv)
if (mmcli_manager_options_enabled ()) {
mmcli_manager_shutdown ();
+ } else if (mmcli_modem_options_enabled ()) {
+ mmcli_modem_shutdown ();
}
g_object_unref (connection);