From 75abe029f3d264520f0e4065e3ebe895d941db38 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 8 Jun 2013 19:18:09 +0200 Subject: [PATCH] nas: add --set-network-preference --- commands-nas.c | 16 ++++++++++++++++ commands-nas.h | 7 +++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/commands-nas.c b/commands-nas.c index c3298e2..b30da1f 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -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) diff --git a/commands-nas.h b/commands-nas.h index 2478bcf..3ed4e28 100644 --- a/commands-nas.h +++ b/commands-nas.h @@ -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 : Set preferred network mode (Syntax: [,,...])\n" \ + " --set-network-modes : Set usable network modes (Syntax: [,,...])\n" \ " Available modes: all, lte, umts, gsm, cdma, td-scdma\n" \ + " --set-network-preference Set preferred network mode to \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" \ -- 2.30.2