diff --git a/src/ubus.c b/src/ubus.c index 0b3d056414e80a1c83653016c57a528fd6c4b46a..c01ee2368d552d28f2c1599625a81979f3b41cd7 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -523,9 +523,9 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, } else if (!strcmp(event, "cac-start")) { static const struct blobmsg_policy data_attr[] = { - [0] = { .name = "channel", .type = BLOBMSG_TYPE_STRING }, - [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_STRING }, - [2] = { .name = "cac_time", .type = BLOBMSG_TYPE_STRING }, + [0] = { .name = "channel", .type = BLOBMSG_TYPE_INT32 }, + [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_INT32 }, + [2] = { .name = "cac_time", .type = BLOBMSG_TYPE_INT32 }, }; struct blob_attr *data[ARRAY_SIZE(data_attr)]; uint32_t channel = 0; @@ -540,18 +540,18 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, return; } - channel = atoi(blobmsg_data(data[0])); - bandwidth = atoi(blobmsg_data(data[1])); - cac_time = atoi(blobmsg_data(data[2])); + channel = blobmsg_get_u32(data[0]); + bandwidth = blobmsg_get_u32(data[1]); + cac_time = blobmsg_get_u32(data[2]); csmngr_process_event_radio_cac_start(priv, r, channel, bandwidth, cac_time); } else if (!strcmp(event, "cac-end")) { static const struct blobmsg_policy data_attr[] = { - [0] = { .name = "channel", .type = BLOBMSG_TYPE_STRING }, - [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_STRING }, - [2] = { .name = "success", .type = BLOBMSG_TYPE_STRING }, + [0] = { .name = "channel", .type = BLOBMSG_TYPE_INT32 }, + [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_INT32 }, + [2] = { .name = "success", .type = BLOBMSG_TYPE_INT32 }, }; struct blob_attr *data[ARRAY_SIZE(data_attr)]; uint32_t channel = 0; @@ -566,9 +566,9 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, return; } - channel = atoi(blobmsg_data(data[0])); - bandwidth = atoi(blobmsg_data(data[1])); - status = atoi(blobmsg_data(data[2])); + channel = blobmsg_get_u32(data[0]); + bandwidth = blobmsg_get_u32(data[1]); + status = blobmsg_get_u32(data[2]); csmngr_process_event_radio_cac_end(priv, r, channel, bandwidth, status); @@ -577,9 +577,9 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, !strcmp(event, "nop-end") || !strcmp(event, "pre-cac-end")) { static const struct blobmsg_policy data_attr[] = { - [0] = { .name = "freq", .type = BLOBMSG_TYPE_STRING }, - [1] = { .name = "channel", .type = BLOBMSG_TYPE_STRING }, - [2] = { .name = "bandwidth", .type = BLOBMSG_TYPE_STRING }, + [0] = { .name = "freq", .type = BLOBMSG_TYPE_INT32 }, + [1] = { .name = "channel", .type = BLOBMSG_TYPE_INT32 }, + [2] = { .name = "bandwidth", .type = BLOBMSG_TYPE_INT32 }, }; struct blob_attr *data[ARRAY_SIZE(data_attr)]; //uint32_t freq = 0; @@ -595,8 +595,8 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, } //freq = atoi(blobmsg_data(data[0])); - channel = atoi(blobmsg_data(data[1])); - bandwidth = atoi(blobmsg_data(data[2])); + channel = blobmsg_get_u32(data[1]); + bandwidth = blobmsg_get_u32(data[2]); csmngr_process_event_radio_radar(priv, r, channel, bandwidth);