Commit d3459074 authored by Anjan Chanda's avatar Anjan Chanda

method 'scanresults' can accept 'bssid' arg

parent 6bd06929
Pipeline #459 passed with stage
in 33 seconds
......@@ -16,4 +16,8 @@ char *btostr(unsigned char *bytes, int len, char *str);
int set_sighandler(int sig, void (*handler)(int));
int unset_sighandler(int sig);
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(_a) sizeof(_a)/sizeof(_a[0])
#endif
#endif /* UTILS_H */
......@@ -35,14 +35,7 @@
#include "wifimngr.h"
#include "version.h"
#define MAX_RADIO 2 // FIXME: get from config
#define WL_STA_ANT_MAX 4
#define EXIT_SUCCESS_MANDATORY 1
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(_a) sizeof(_a)/sizeof(_a[0])
#endif
#define WIFI_DEV_MAX_ANTENNA_NUM 4
/* if IF_OPER_* not defined */
#ifndef IF_OPER_UNKNOWN
......@@ -445,15 +438,6 @@ static void wl_dump_capabilities(struct blob_buf *bb, struct wifi_caps *caps, ui
blobmsg_close_table(bb, f);
}
enum {
VIF_NAME,
__WL_MAX,
};
static const struct blobmsg_policy wl_vif_policy[__WL_MAX] = {
[VIF_NAME] = { .name = "vif", .type = BLOBMSG_TYPE_STRING },
};
static void wifi_print_radio_stats(struct blob_buf *bb,
struct wifi_radio_stats *s)
{
......@@ -484,14 +468,13 @@ static int wl_radio_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__WL_MAX];
char std_buf2[32] = "802.11";
char std_buf[32] = {0};
const char *wldev;
ifstatus_t ifs = 0;
uint32_t channel;
enum wifi_bw bw;
int band = 0;
enum wifi_band band = BAND_2;
unsigned long maxrate;
int noise;
struct wifi_radio radio;
......@@ -500,14 +483,13 @@ static int wl_radio_status(struct ubus_context *ctx, struct ubus_object *obj,
int i;
memset(&bb, 0, sizeof(bb));
blobmsg_parse(wl_vif_policy, __WL_MAX, tb, blob_data(msg), blob_len(msg));
wldev = ubus_radio_to_ifname(obj);
wifi_get_ifstatus(wldev, &ifs);
wifi_get_channel(wldev, &channel, &bw); // FIXME: bw
if (channel && channel > 14)
band = 1; // 5GHz
band = BAND_5;
wifi_get_bandwidth(wldev, &bw);
if (bw < BW20 || bw > BW160) { // FIXME: in libwifi
......@@ -522,7 +504,7 @@ 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 == 1) ? 5 : 2);
blobmsg_add_u32(&bb, "band", !!(band & BAND_5) ? 5 : 2);
sprintf(std_buf2 + strlen(std_buf2), "%s",
etostr(radio.oper_std, std_buf, WIFI_NUM_STD, standard_str));
......@@ -913,7 +895,7 @@ static int wl_dump_stations(struct blob_buf *bb, const char *ifname,
blobmsg_close_table(bb, s);
r = blobmsg_open_array(bb, "rssi_per_antenna");
for (j = 0; j < WL_STA_ANT_MAX; j++)
for (j = 0; j < WIFI_DEV_MAX_ANTENNA_NUM; j++)
blobmsg_add_u32(bb, "", sx.rssi[j]);
blobmsg_close_array(bb, r);
blobmsg_close_table(bb, t);
......@@ -2149,7 +2131,7 @@ static int add_radio_methods(struct ubus_object *radio_obj,
UBUS_METHOD("scan", wl_scan, wl_scan_policy));
UBUS_METHOD_ADD(radio_methods, n_methods,
UBUS_METHOD_NOARG("scanresults", wl_scanresults));
UBUS_METHOD("scanresults", wl_scanresults, wl_scanres_policy));
}
UBUS_METHOD_ADD(radio_methods, n_methods,
......
......@@ -89,17 +89,6 @@ extern int wifimngr_exit(struct wifimngr *w);
extern void wifimngr_version(void);
#if 0
extern int ubus_add_wifi_object(struct wifimngr *w,
struct ubus_context *ctx, char *name);
extern int ubus_add_radio_object(struct wifimngr *w,
struct ubus_context *ctx, char *name);
extern int ubus_add_interface_object(struct wifimngr *w,
struct ubus_context *ctx, char *name);
#endif
extern int wifimngr_nl_msgs_handler(struct ubus_context *ctx);
extern int wifimngr_setup_event(const char *ifname, const char *family,
......
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