I'm a newbie to linux/openwrt. I'm using TL-841n v7(CPU:Atheros AR7241,Wireless NIC:Atheros AR9287 (onboard),driver:ath9k) ,
I want to get signal strength of every client linking with it. it seems the driver doesn't support iwlist wlan0 scanning.
root@OpenWrt:~# iwlist wlan0 scanning
wlan0 Interface doesn't support scanning : Operation not supported
and i have write some code using iotcl like here http://www.linuxquestions.org/questions … si-611337/
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/wireless.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
/* The name of the interface */
#ifndef IW_NAME
#define IW_NAME "wlan0"
#endif
int main()
{
int sockfd;
struct iw_statistics stats;
struct iwreq req;
memset(&stats, 0, sizeof(stats));
memset(&req, 0, sizeof(req));
sprintf(req.ifr_name, IW_NAME);
req.u.data.pointer = &stats;
req.u.data.length = sizeof(stats);
#ifdef CLEAR_UPDATED
req.u.data.flags = 1;
#endif
/* Any old socket will do, and a datagram socket is pretty cheap */
if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
perror("Could not create simple datagram socket");
exit(EXIT_FAILURE);
}
/* Perform the ioctl */
if(ioctl(sockfd, SIOCGIWSTATS, &req) == -1) {
perror("Error performing SIOCGIWSTATS");
close(sockfd);
exit(EXIT_FAILURE);
}
close(sockfd);
printf("Signal level%s is %d%s.\n",(stats.qual.updated & IW_QUAL_DBM ? " (in dBm)" :""),
stats.qual.level,(stats.qual.updated & IW_QUAL_LEVEL_UPDATED ? " (updated)" :""));
return 0;
}
it works good on my computer(driver rt73usb),but not working on my router(of course i have build it with openwrt sdk).
root@OpenWrt:~# ./openwrtrssi
Error performing SIOCGIWSTATS: Operation not supported
but when i loggin the rounter with web(luci), luci report ervey client's signal strength on page wifi like
SSID MAC Address Signal Noise
OpenWrt 00:23:54:48:A7:D9 192.168.1.202 -31 dBm -119 dBm
……
so does anyone kown how to get it like luci did? please help! Sorry about my poor English...
ps: i notice that there is a nerwork called mon.wan0
root@OpenWrt:~# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
eth1 no wireless extensions.
br-lan no wireless extensions.
wlan0 IEEE 802.11bgn Mode:Master Frequency:2.462 GHz Tx-Power=0 dBm
RTS thr:off Fragment thr:off
Power Management:on
mon.wlan0 IEEE 802.11bgn Mode:Monitor Tx-Power=0 dBm
RTS thr:off Fragment thr:off
Power Management:off
what is this?(mon.wlan0)