#include "libubus.h"
static struct blob_buf b;
+static int timeout = 30;
static const char *format_type(void *priv, struct blob_attr *attr)
{
static const char * const attr_types[] = {
+ [BLOBMSG_TYPE_INT8] = "\"Boolean\"",
[BLOBMSG_TYPE_INT32] = "\"Integer\"",
[BLOBMSG_TYPE_STRING] = "\"String\"",
};
if (ret)
return ret;
- return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, NULL);
+ return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, NULL, timeout * 1000);
}
static int ubus_cli_listen(struct ubus_context *ctx, int argc, char **argv)
progname = argv[0];
- while ((ch = getopt(argc, argv, "s:")) != -1) {
+ while ((ch = getopt(argc, argv, "s:t:")) != -1) {
switch (ch) {
case 's':
ubus_socket = optarg;
break;
+ case 't':
+ timeout = atoi(optarg);
+ break;
default:
return usage(progname);
}