diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-23 21:33:05 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-02-08 18:49:21 +0100 |
commit | 3b56f04e3befadd40f62568e028b1cd09a735296 (patch) | |
tree | 63744020485cfed1411b1d2e1d82166aaf77c2ff | |
parent | 830b6326404e59fb2d4b5733f57c7f1d9fb6e930 (diff) | |
download | external_libqmi-3b56f04e3befadd40f62568e028b1cd09a735296.zip external_libqmi-3b56f04e3befadd40f62568e028b1cd09a735296.tar.gz external_libqmi-3b56f04e3befadd40f62568e028b1cd09a735296.tar.bz2 |
qmicli: support automatic mode (QMI/MBIM) detection by default
The default, if nothing specified, is the 'auto mode', which can also be
explicitly selected with --device-open-auto.
The user may also select an explicit mode with --device-open-mbim or
--device-open-qmi.
-rw-r--r-- | src/qmicli/qmicli.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c index a2a5560..e119a96 100644 --- a/src/qmicli/qmicli.c +++ b/src/qmicli/qmicli.c @@ -61,7 +61,9 @@ static gboolean device_open_version_info_flag; static gboolean device_open_sync_flag; static gchar *device_open_net_str; static gboolean device_open_proxy_flag; +static gboolean device_open_qmi_flag; static gboolean device_open_mbim_flag; +static gboolean device_open_auto_flag; static gchar *client_cid_str; static gboolean client_no_release_cid_flag; static gboolean verbose_flag; @@ -105,8 +107,16 @@ static GOptionEntry main_entries[] = { "Request to use the 'qmi-proxy' proxy", NULL }, + { "device-open-qmi", 0, 0, G_OPTION_ARG_NONE, &device_open_qmi_flag, + "Open a cdc-wdm device explicitly in QMI mode", + NULL + }, { "device-open-mbim", 0, 0, G_OPTION_ARG_NONE, &device_open_mbim_flag, - "Open an MBIM device with EXT_QMUX support", + "Open a cdc-wdm device explicitly in MBIM mode", + NULL + }, + { "device-open-auto", 0, 0, G_OPTION_ARG_NONE, &device_open_auto_flag, + "Open a cdc-wdm device in either QMI or MBIM mode (default)", NULL }, { "device-open-net", 0, 0, G_OPTION_ARG_STRING, &device_open_net_str, @@ -610,6 +620,11 @@ device_new_ready (GObject *unused, exit (EXIT_FAILURE); } + if (device_open_mbim_flag + device_open_qmi_flag + device_open_auto_flag > 1) { + g_printerr ("error: cannot specify multiple mode flags to open device\n"); + exit (EXIT_FAILURE); + } + /* Setup device open flags */ if (device_open_version_info_flag) open_flags |= QMI_DEVICE_OPEN_FLAGS_VERSION_INFO; @@ -619,6 +634,8 @@ device_new_ready (GObject *unused, open_flags |= QMI_DEVICE_OPEN_FLAGS_PROXY; if (device_open_mbim_flag) open_flags |= QMI_DEVICE_OPEN_FLAGS_MBIM; + if (device_open_auto_flag || (!device_open_qmi_flag && !device_open_mbim_flag)) + open_flags |= QMI_DEVICE_OPEN_FLAGS_AUTO; if (device_open_net_str) if (!qmicli_read_net_open_flags_from_string (device_open_net_str, &open_flags)) exit (EXIT_FAILURE); |