iwinfo: clean up rpc_iwinfo_call_hw_ht_mode()
There's no need to call hwmodelist() again, just pass on the earlier result. Signed-off-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
parent
c46ad61d49
commit
b3f530bc6b
1 changed files with 11 additions and 12 deletions
23
iwinfo.c
23
iwinfo.c
|
@ -241,30 +241,28 @@ rpc_iwinfo_call_htmodes(const char *name)
|
||||||
false, 0);
|
false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
rpc_iwinfo_call_hwmodes(const char *name)
|
rpc_iwinfo_call_hwmodes(const char *name)
|
||||||
{
|
{
|
||||||
int modes;
|
int modes;
|
||||||
|
|
||||||
if (iw->hwmodelist(ifname, &modes))
|
if (iw->hwmodelist(ifname, &modes))
|
||||||
return;
|
return -1;
|
||||||
|
|
||||||
rpc_iwinfo_add_bit_array(name, modes,
|
rpc_iwinfo_add_bit_array(name, modes,
|
||||||
IWINFO_80211_NAMES, IWINFO_80211_COUNT,
|
IWINFO_80211_NAMES, IWINFO_80211_COUNT,
|
||||||
false, 0);
|
false, 0);
|
||||||
|
|
||||||
|
return modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rpc_iwinfo_call_hw_ht_mode()
|
static void rpc_iwinfo_call_hw_ht_mode(int hwmodelist)
|
||||||
{
|
{
|
||||||
const char *hwmode_str;
|
const char *hwmode_str;
|
||||||
const char *htmode_str;
|
const char *htmode_str;
|
||||||
int32_t htmode = 0;
|
int htmode;
|
||||||
int modes;
|
|
||||||
|
|
||||||
if (iw->hwmodelist(ifname, &modes))
|
if (hwmodelist == IWINFO_80211_AD)
|
||||||
return;
|
|
||||||
|
|
||||||
if (modes == IWINFO_80211_AD)
|
|
||||||
{
|
{
|
||||||
blobmsg_add_string(&buf, "hwmode", "ad");
|
blobmsg_add_string(&buf, "hwmode", "ad");
|
||||||
return;
|
return;
|
||||||
|
@ -305,7 +303,7 @@ rpc_iwinfo_info(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
struct ubus_request_data *req, const char *method,
|
struct ubus_request_data *req, const char *method,
|
||||||
struct blob_attr *msg)
|
struct blob_attr *msg)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv, hwmodes;
|
||||||
void *c;
|
void *c;
|
||||||
|
|
||||||
rv = rpc_iwinfo_open(msg);
|
rv = rpc_iwinfo_open(msg);
|
||||||
|
@ -342,9 +340,10 @@ rpc_iwinfo_info(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
|
|
||||||
rpc_iwinfo_call_encryption("encryption");
|
rpc_iwinfo_call_encryption("encryption");
|
||||||
rpc_iwinfo_call_htmodes("htmodes");
|
rpc_iwinfo_call_htmodes("htmodes");
|
||||||
rpc_iwinfo_call_hwmodes("hwmodes");
|
hwmodes = rpc_iwinfo_call_hwmodes("hwmodes");
|
||||||
|
|
||||||
rpc_iwinfo_call_hw_ht_mode();
|
if (hwmodes > 0)
|
||||||
|
rpc_iwinfo_call_hw_ht_mode(hwmodes);
|
||||||
|
|
||||||
c = blobmsg_open_table(&buf, "hardware");
|
c = blobmsg_open_table(&buf, "hardware");
|
||||||
rpc_iwinfo_call_hardware_id("id");
|
rpc_iwinfo_call_hardware_id("id");
|
||||||
|
|
Loading…
Reference in a new issue