qmi_set_nas_get_signal_info_request(msg);
return QMI_CMD_REQUEST;
}
+
+static void
+cmd_nas_get_serving_system_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ struct qmi_nas_get_serving_system_response res;
+ static const char *reg_states[] = {
+ [QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED] = "not_registered",
+ [QMI_NAS_REGISTRATION_STATE_REGISTERED] = "registered",
+ [QMI_NAS_REGISTRATION_STATE_NOT_REGISTERED_SEARCHING] = "searching",
+ [QMI_NAS_REGISTRATION_STATE_REGISTRATION_DENIED] = "registering_denied",
+ [QMI_NAS_REGISTRATION_STATE_UNKNOWN] = "unknown",
+ };
+
+ qmi_parse_nas_get_serving_system_response(msg, &res);
+
+ if (res.set.serving_system) {
+ int state = res.data.serving_system.registration_state;
+
+ if (state > QMI_NAS_REGISTRATION_STATE_UNKNOWN)
+ state = QMI_NAS_REGISTRATION_STATE_UNKNOWN;
+
+ blobmsg_add_string(&status, "registration", reg_states[state]);
+ }
+ if (res.set.current_plmn) {
+ blobmsg_add_u32(&status, "plmn_mcc", res.data.current_plmn.mcc);
+ blobmsg_add_u32(&status, "plmn_mnc", res.data.current_plmn.mnc);
+ if (res.data.current_plmn.description)
+ blobmsg_add_string(&status, "plmn_description", res.data.current_plmn.description);
+ }
+
+ if (res.set.roaming_indicator)
+ blobmsg_add_u8(&status, "roaming", !res.data.roaming_indicator);
+}
+
+static enum qmi_cmd_result
+cmd_nas_get_serving_system_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ qmi_set_nas_get_serving_system_request(msg);
+ return QMI_CMD_REQUEST;
+}
#define __uqmi_nas_commands \
__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_signal_info, get-signal-info, no, QMI_SERVICE_NAS), \
+ __uqmi_command(nas_get_serving_system, get-serving-system, no, QMI_SERVICE_NAS) \
#define nas_helptext \
" --set-network-modes <modes>: Set preferred network mode (Syntax: <mode1>[,<mode2>,...])\n" \
" Available modes: all, lte, umts, gsm, cdma, td-scdma\n" \
" --network-register: Initiate network register\n" \
- " --get-signal-info: Get signal strength info\n"
+ " --get-signal-info: Get signal strength info\n" \
+ " --get-serving-system: Get serving system info\n" \