diff options
author | John Crispin <blogic@openwrt.org> | 2013-07-01 18:34:13 +0200 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-07-04 12:42:38 +0200 |
commit | 3283d681f9da65b500ad0cb3d4550cb840ed481a (patch) | |
tree | 781d470d353e8eb3a8efb71c598b93caf2900b4a /system.c | |
parent | 4ec2545ed6a0626715802a1c7919fe0e38436301 (diff) | |
download | unitd-3283d681f9da65b500ad0cb3d4550cb840ed481a.tar unitd-3283d681f9da65b500ad0cb3d4550cb840ed481a.zip |
add trigger support
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'system.c')
-rw-r--r-- | system.c | 30 |
1 files changed, 0 insertions, 30 deletions
@@ -259,41 +259,11 @@ static int watchdog_set(struct ubus_context *ctx, struct ubus_object *obj, return 0; } -enum { - EVENT_TYPE, - EVENT_DATA, - __EVENT_MAX -}; - -static const struct blobmsg_policy event_policy[__WDT_MAX] = { - [EVENT_TYPE] = { .name = "frequency", .type = BLOBMSG_TYPE_INT32 }, - [EVENT_DATA] = { .name = "timeout", .type = BLOBMSG_TYPE_INT32 }, -}; - -static int system_event(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__EVENT_MAX]; - - if (!msg) - return UBUS_STATUS_INVALID_ARGUMENT; - - blobmsg_parse(event_policy, __EVENT_MAX, tb, blob_data(msg), blob_len(msg)); - if (!tb[EVENT_TYPE]) - return UBUS_STATUS_INVALID_ARGUMENT; - - fprintf(stderr, "%s\n", blobmsg_get_string(tb[EVENT_TYPE])); - - return 0; -} - static const struct ubus_method system_methods[] = { UBUS_METHOD_NOARG("board", system_board), UBUS_METHOD_NOARG("info", system_info), UBUS_METHOD_NOARG("upgrade", system_upgrade), UBUS_METHOD("watchdog", watchdog_set, watchdog_policy), - UBUS_METHOD("event", system_event, event_policy), }; static struct ubus_object_type system_object_type = |