qmi_parse_nas_get_signal_info_response(msg, &res);
if (res.set.cdma_signal_strength) {
+ blobmsg_add_string(&status, "type", "cdma");
blobmsg_add_u32(&status, "rssi", (int32_t) res.data.cdma_signal_strength.rssi);
blobmsg_add_u32(&status, "ecio", (int32_t) res.data.cdma_signal_strength.ecio);
}
if (res.set.hdr_signal_strength) {
+ blobmsg_add_string(&status, "type", "hdr");
blobmsg_add_u32(&status, "rssi", (int32_t) res.data.hdr_signal_strength.rssi);
blobmsg_add_u32(&status, "ecio", (int32_t) res.data.hdr_signal_strength.ecio);
blobmsg_add_u32(&status, "io", res.data.hdr_signal_strength.io);
}
- if (res.set.gsm_signal_strength)
+ if (res.set.gsm_signal_strength) {
+ blobmsg_add_string(&status, "type", "gsm");
blobmsg_add_u32(&status, "signal", (int32_t) res.data.gsm_signal_strength);
+ }
if (res.set.wcdma_signal_strength) {
+ blobmsg_add_string(&status, "type", "wcdma");
blobmsg_add_u32(&status, "rssi", (int32_t) res.data.wcdma_signal_strength.rssi);
blobmsg_add_u32(&status, "ecio", (int32_t) res.data.wcdma_signal_strength.ecio);
}
if (res.set.lte_signal_strength) {
+ blobmsg_add_string(&status, "type", "lte");
blobmsg_add_u32(&status, "rssi", (int32_t) res.data.lte_signal_strength.rssi);
blobmsg_add_u32(&status, "rsrq", (int32_t) res.data.lte_signal_strength.rsrq);
blobmsg_add_u32(&status, "rsrp", (int32_t) res.data.lte_signal_strength.rsrp);
#include "qmi-errors.h"
#include "qmi-errors.c"
+bool cancel_all_requests = false;
+
#define __qmi_service(_n) [__##_n] = _n
static const uint8_t qmi_services[__QMI_SERVICE_LAST] = {
__qmi_services
req->pending = false;
list_del(&req->list);
- tlv_buf = qmi_msg_get_tlv_buf(msg, &tlv_len);
- req->ret = qmi_check_message_status(tlv_buf, tlv_len);
- if (req->ret)
- msg = NULL;
+ if (msg) {
+ tlv_buf = qmi_msg_get_tlv_buf(msg, &tlv_len);
+ req->ret = qmi_check_message_status(tlv_buf, tlv_len);
+ if (req->ret)
+ msg = NULL;
+ } else {
+ req->ret = QMI_ERROR_CANCELLED;
+ }
if (req->cb && (msg || !req->no_error_cb))
req->cb(qmi, req, msg);
cancelled = uloop_cancelled;
uloop_cancelled = false;
uloop_run();
+
+ if (cancel_all_requests)
+ qmi_request_cancel(qmi, req);
+
uloop_cancelled = cancelled;
}
#include <unistd.h>
#include <errno.h>
#include <getopt.h>
+#include <signal.h>
#include "uqmi.h"
#include "commands.h"
qmi_service_get_client_id(qmi, svc);
}
+static void handle_exit_signal(int signal)
+{
+ cancel_all_requests = true;
+ uloop_end();
+}
+
int main(int argc, char **argv)
{
static struct qmi_dev dev;
int ch;
+ uloop_init();
+ signal(SIGINT, handle_exit_signal);
+ signal(SIGTERM, handle_exit_signal);
+
while ((ch = getopt_long(argc, argv, "d:k:", uqmi_getopt, NULL)) != -1) {
int cmd_opt = CMD_OPT(ch);