[PATCH] add device-open-net cmdline option

Tim Harvey tharvey at gateworks.com
Thu Dec 12 10:40:37 PST 2013


The device-open-net cmdline option allows you to specify network-mode
and qos-header mode flags when opening the device.

This has been found to be necessary on some cards/modes such as the MC7750
in LTE mode.

I lack the propper hardware/signal to test this properly - review/testing
needed.

Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 src/qmicli/qmicli.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c
index dc63c41..d2b202e 100644
--- a/src/qmicli/qmicli.c
+++ b/src/qmicli/qmicli.c
@@ -50,6 +50,7 @@ static gboolean get_service_version_info_flag;
 static gchar *device_set_instance_id_str;
 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 gchar *client_cid_str;
 static gboolean client_no_release_cid_flag;
@@ -82,6 +83,10 @@ static GOptionEntry main_entries[] = {
       "Request to use the 'qmi-proxy' proxy",
       NULL
     },
+    { "device-open-net", 0, 0, G_OPTION_ARG_STRING, &device_open_net_str,
+      "Open device with specific net mode and qos flags <net-mode>,<net-flags>",
+      NULL
+    },
     { "client-cid", 0, 0, G_OPTION_ARG_STRING, &client_cid_str,
       "Use the given CID, don't allocate a new one",
       "[CID]"
@@ -467,6 +472,45 @@ device_new_ready (GObject *unused,
     QmiDeviceOpenFlags open_flags = QMI_DEVICE_OPEN_FLAGS_NONE;
     GError *error = NULL;
 
+    if (device_open_net_str) {
+        gchar **split;
+
+        /* Format of the string is:
+         *   "(net-mode),(qos-header-mode)"
+         */
+        split = g_strsplit (device_open_net_str, ",", -1);
+        if (g_str_equal (split[0], "net-802-3")) {
+            open_flags |= QMI_DEVICE_OPEN_FLAGS_NET_802_3;
+        }
+
+        else if (g_str_equal (split[0], "net-raw-ip")) {
+            open_flags |= QMI_DEVICE_OPEN_FLAGS_NET_RAW_IP;
+        }
+
+        else {
+            g_printerr ("error: net-mode: expected 'net-802-3'"
+                        " or 'net-raw-ip'\n");
+        }
+
+        if (g_str_equal (split[1], "net-no-qos-header")) {
+            open_flags |= QMI_DEVICE_OPEN_FLAGS_NET_NO_QOS_HEADER;
+        }
+
+        else if (g_str_equal (split[1], "net-qos-header")) {
+            open_flags |= QMI_DEVICE_OPEN_FLAGS_NET_QOS_HEADER;
+        }
+
+        else {
+            g_printerr ("error: expected 'net-qos-header'"
+                        " or 'net-no-qos-header'\n");
+        }
+        if (!split[0] || split[0][0] == '\0') {
+            g_printerr ("error: expected '', got: none\n");
+        }
+
+        g_strfreev (split);
+    }
+
     device = qmi_device_new_finish (res, &error);
     if (!device) {
         g_printerr ("error: couldn't create QmiDevice: %s\n",
-- 
1.8.4.2



More information about the libqmi-devel mailing list