#include "commands.h"
static struct blob_buf status;
+bool single_line = false;
static void no_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
{
if (!blob_len(data))
return;
- str = blobmsg_format_json_indent(blob_data(data), false, 0);
+ str = blobmsg_format_json_indent(blob_data(data), false, single_line ? -1 : 0);
if (!str)
return;
#define __uqmi_command(_name, _optname, _arg, _option) { #_optname, _arg##_argument, NULL, CMD_OPT(__UQMI_COMMAND_##_name) }
static const struct option uqmi_getopt[] = {
__uqmi_commands,
+ { "single", no_argument, NULL, 's' },
{ "device", required_argument, NULL, 'd' },
{ "keep-client-id", required_argument, NULL, 'k' },
{ "release-client-id", required_argument, NULL, 'r' },
{
fprintf(stderr, "Usage: %s <options|actions>\n"
"Options:\n"
+ " --single, -s: Print output as a single line (for scripts)\n"
" --device=NAME, -d NAME: Set device name to NAME (required)\n"
" --keep-client-id <name>: Keep Client ID for service <name>\n"
" (implies --keep-client-id)\n"
signal(SIGINT, handle_exit_signal);
signal(SIGTERM, handle_exit_signal);
- while ((ch = getopt_long(argc, argv, "d:k:", uqmi_getopt, NULL)) != -1) {
+ while ((ch = getopt_long(argc, argv, "d:k:s", uqmi_getopt, NULL)) != -1) {
int cmd_opt = CMD_OPT(ch);
if (ch < 0 && cmd_opt >= 0 && cmd_opt < __UQMI_COMMAND_LAST) {
case 'd':
device = optarg;
break;
+ case 's':
+ single_line = true;
+ break;
default:
return usage(argv[0]);
}