nas: add --set-network-preference
authorFelix Fietkau <nbd@openwrt.org>
Sat, 8 Jun 2013 17:18:09 +0000 (19:18 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 8 Jun 2013 17:18:19 +0000 (19:18 +0200)
commands-nas.c
commands-nas.h

index c3298e2473bfddca7077877add610396567127c9..b30da1fa65c73429c0ed949425dcbdeb40eabb6c 100644 (file)
@@ -45,6 +45,22 @@ cmd_nas_set_network_modes_prepare(struct qmi_dev *qmi, struct qmi_request *req,
        return QMI_CMD_REQUEST;
 }
 
+#define cmd_nas_set_network_preference_cb no_cb
+static enum qmi_cmd_result
+cmd_nas_set_network_preference_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       QmiNasGsmWcdmaAcquisitionOrderPreference pref = QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_AUTOMATIC;
+
+       if (!strcmp(arg, "gsm"))
+               pref = QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_GSM;
+       else if (!strcmp(arg, "wcdma"))
+               pref = QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_WCDMA;
+
+       qmi_set(&sel_req, gsm_wcdma_acquisition_order_preference, pref);
+       qmi_set_nas_set_system_selection_preference_request(msg, &sel_req);
+       return QMI_CMD_REQUEST;
+}
+
 #define cmd_nas_initiate_network_register_cb no_cb
 static enum qmi_cmd_result
 cmd_nas_initiate_network_register_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
index 2478bcfffac8d3cef303ae8b3f16e3d9cf7c5f1f..3ed4e28699dfd1655e0e46c7c3cdb43d0843fd64 100644 (file)
@@ -2,11 +2,14 @@
        __uqmi_command(nas_set_network_modes, set-network-modes, required, QMI_SERVICE_NAS), \
        __uqmi_command(nas_initiate_network_register, network-register, no, QMI_SERVICE_NAS), \
        __uqmi_command(nas_get_signal_info, get-signal-info, no, QMI_SERVICE_NAS), \
-       __uqmi_command(nas_get_serving_system, get-serving-system, no, QMI_SERVICE_NAS) \
+       __uqmi_command(nas_get_serving_system, get-serving-system, no, QMI_SERVICE_NAS), \
+       __uqmi_command(nas_set_network_preference, set-network-preference, required, QMI_SERVICE_NAS) \
 
 #define nas_helptext \
-               "  --set-network-modes <modes>:      Set preferred network mode (Syntax: <mode1>[,<mode2>,...])\n" \
+               "  --set-network-modes <modes>:      Set usable network modes (Syntax: <mode1>[,<mode2>,...])\n" \
                "                                    Available modes: all, lte, umts, gsm, cdma, td-scdma\n" \
+               "  --set-network-preference <mode>   Set preferred network mode to <mode>\n" \
+               "                                    Available modes: auto, gsm, wcdma\n" \
                "  --network-register:               Initiate network register\n" \
                "  --get-signal-info:                Get signal strength info\n" \
                "  --get-serving-system:             Get serving system info\n" \