Question

So, we've got a small embedded linux system acting as a wireless (WiFi) router as part of a larger robotics project at our company. It doesn't really matter, but it has one card configured to be 5.8 GHz wireless A (to keep it from interfering with other things) and another special card which speaks 900MHz to get us a ~3km range.

Our control tablets connect on the 5.8, and the packets are relayed to the robot on the 900MHz. As such, both the tablet and the robots use the router box as an access point, so we are running hostapd. As part of our user interface, we want to collect RSSI (signal strength/noise/etc) information from different components of the system and display it all.

The robot (which also runs linux), does this by reading /proc/net/wireless and then sending the numbers it reads down to the control tablet. However, on the router box, if the cards are configured for AP mode (hostapd running), /proc/net/wireless has lines for both interfaces, but all the values are 0.

If I do an iw station dump it spits out some RSSI numbers, but I don't really want to resort to grepping the output of this. I am (IMHO) a rather competant C programmer (I've written a real time kernel), and I am wondering what the best way to get this information from the kernel is. I know a little bit about using the WEXT ioctl interface, however I recently found out that API is deprecated and new wireless config/management systems are being phased in.

I could get away with writing something that uses WEXT, as we aren't keeping our embedded linux installs updated to the bleeding edge. However if somebody could point me at a tutorial/resources for whatever the new API is going to be, I'd appreciate it. Or, if there's a way to make /proc/net/wireless work nicely with hostapd, I'd take that too :P

Was it helpful?

Solution

SIOCGIWSTATS would give you the stats from /proc/net/wireless

include/linux/wireless.h

#define SIOCGIWSTATS    0x8B0F          /* Get /proc/net/wireless stats */
/* SIOCGIWSTATS is strictly used between user space and the kernel, and
 * is never passed to the driver (i.e. the driver will never see it). */

However, to get the RSSI values directly from the driver, you need to use the ioctl specific to your wifi driver.

Broadcom for example has a macro WLC_GET_RSSI which can be used in SIOCDEVPRIVATE. For more on this, please refer to OpenWRT source code(https://dev.openwrt.org/browser/trunk/package/broadcom-wl/src?rev=15242)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top