Commit f8cc609a authored by Anjan Chanda's avatar Anjan Chanda

use helper functions from libwifi

parent 0b448947
Pipeline #685 passed with stage
in 20 seconds
......@@ -29,6 +29,7 @@
#include <libubus.h>
#include <uci.h>
#include <easy/easy.h>
#include <wifi.h>
#include "utils.h"
......@@ -507,7 +508,9 @@ static int wl_radio_status(struct ubus_context *ctx, struct ubus_object *obj,
blob_buf_init(&bb, 0);
blobmsg_add_string(&bb, "radio", wldev);
blobmsg_add_u8(&bb, "isup", (ifs & IFF_UP) ? true : false);
blobmsg_add_u32(&bb, "band", !!(band & BAND_5) ? 5 : 2);
blobmsg_add_string(&bb, "band",
!!(band & BAND_5) ? "5Ghz" :
!!(band & BAND_2) ? "2.4Ghz" : "Unknown");
sprintf(std_buf2 + strlen(std_buf2), "%s",
etostr(radio.oper_std, std_buf, WIFI_NUM_STD, standard_str));
......@@ -847,7 +850,7 @@ static int wl_dump_stations(struct blob_buf *bb, const char *ifname,
unsigned char *sta = &stas[i*6];
char sta_macstr[18] = {0};
if (macaddr && !is_zero_hwaddr(macaddr)
if (macaddr && !hwaddr_is_zero(macaddr)
&& memcmp(macaddr, sta, 6))
continue;
......@@ -1017,8 +1020,8 @@ static void wl_scanresult_print(struct blob_buf *bb, void *buf, bool detail)
wifi_security_str(b->sec, b->enc, b->g_enc, sec_str);
blobmsg_add_string(bb, "encryption", sec_str);
blobmsg_add_string(bb, "band",
b->band == BAND_5 ? "5GHz" :
b->band == BAND_2 ? "2.4GHz" : "unknown");
!!(b->band & BAND_5) ? "5Ghz" :
!!(b->band & BAND_2) ? "2.4Ghz" : "Unknown");
blobmsg_add_u32(bb, "rssi", b->rssi);
//blobmsg_add_u32(bb, "snr", b->snr);
sprintf(std_buf2 + strlen(std_buf2), "%s",
......@@ -1934,8 +1937,12 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_u8(&bb, "isup", (ifstat & IFF_UP) ? true : false);
blobmsg_add_string(&bb, "standard", s_str);
blobmsg_add_string(&bb, "country", country);
blobmsg_add_u32(&bb, "band", (band == 1) ? 5 : 2);
blobmsg_add_string(&bb, "band",
!!(band & BAND_5) ? "5Ghz" :
!!(band & BAND_2) ? "2.4Ghz" : "Unknown");
blobmsg_add_u32(&bb, "channel", channel);
blobmsg_add_u32(&bb, "frequency", wifi_channel_to_freq(channel));
blobmsg_add_u32(&bb, "bandwidth", bw_int[bw]);
blobmsg_add_u32(&bb, "noise", noise);
blobmsg_add_u64(&bb, "rate", rate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment