X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/f0647cc9dd7b3b9c340210ab21cc50cf8e71978c..b8d5619ca8ac95b4a0365a7adcce4b0d9c7305ce:/package/iwinfo/src/iwinfo_wl.c?ds=sidebyside diff --git a/package/iwinfo/src/iwinfo_wl.c b/package/iwinfo/src/iwinfo_wl.c index 3acfff4aa..3d15fc9ca 100644 --- a/package/iwinfo/src/iwinfo_wl.c +++ b/package/iwinfo/src/iwinfo_wl.c @@ -82,7 +82,7 @@ void wl_close(void) /* Nop */ } -int wl_get_mode(const char *ifname, char *buf) +int wl_get_mode(const char *ifname, int *buf) { int ret = -1; int ap, infra, passive; @@ -97,13 +97,13 @@ int wl_get_mode(const char *ifname, char *buf) return ret; if (passive) - sprintf(buf, "Monitor"); + *buf = IWINFO_OPMODE_MONITOR; else if (!infra) - sprintf(buf, "Ad-Hoc"); + *buf = IWINFO_OPMODE_ADHOC; else if (ap) - sprintf(buf, "Master"); + *buf = IWINFO_OPMODE_MASTER; else - sprintf(buf, "Client"); + *buf = IWINFO_OPMODE_CLIENT; return 0; } @@ -401,8 +401,8 @@ static void wl_get_assoclist_cb(const char *ifname, e->tx_rate.rate = sta.tx_rate; /* ToDo: 11n */ - e.rx_rate.mcs = -1; - e.tx_rate.mcs = -1; + e->rx_rate.mcs = -1; + e->tx_rate.mcs = -1; } } @@ -489,18 +489,18 @@ int wl_get_assoclist(const char *ifname, char *buf, int *len) int wl_get_txpwrlist(const char *ifname, char *buf, int *len) { struct iwinfo_txpwrlist_entry entry; - uint8_t dbm[8] = { 0, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 }; - uint8_t mw[8] = { 1, 3, 6, 10, 15, 25, 39, 63, 100, 158, 251 }; + uint8_t dbm[11] = { 0, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 }; + uint8_t mw[11] = { 1, 3, 6, 10, 15, 25, 39, 63, 100, 158, 251 }; int i; - for (i = 0; i < 8; i++) + for (i = 0; i < 11; i++) { entry.dbm = dbm[i]; entry.mw = mw[i]; memcpy(&buf[i*sizeof(entry)], &entry, sizeof(entry)); } - *len = 8 * sizeof(entry); + *len = 11 * sizeof(entry); return 0; }