Programmatic access to 802.11 info

Andrew Thompson thompsa at FreeBSD.org
Thu Apr 3 18:13:02 UTC 2008


On Thu, Apr 03, 2008 at 01:09:01PM -0400, Jordan Coleman wrote:
> We are currently working on an embedded application that need to connect to 
> wireless networks.  The UI lets the user configure one or more networks, 
> select whether to use a specific network or roam among a list of SSIDs, 
> view SSID scan information etc.  We are wrapping wpa_supplicant and letting 
> it handle network selection, roaming, WPA (as well as WEP), etc. and that 
> seems to work well enough.  However, at the moment, we're having trouble 
> getting various status information in a reliable and efficient manner.
>
> Our temporary code invokes "ifconfig -v <dev> list scan" and scrapes its 
> output to get scanning info (it appears to provide more and better info 
> than wpa_supplicant's 'scan results' command).  Similarly, we're scraping 
> "wpa_cli status" and "ifconfig <dev> list sta" for association and signal 
> strength information.  At best, this seems like the hard way to get this 
> info and it's darn ugly, too (polling sucks, but having to fork and exec 
> ifconfig on every poll sucks even more).  What's more, some of the 
> information we want, such as signal quality ("n out of 5 bars", etc.), 
> isn't really available.  We can get RSSI from "ifconfig list sta", but it's 
> not the same thing.
>
> So can anyone suggest how to go about getting this information straight 
> from the system?  The application is primarily written in Perl, but Perl is 
> not a hard requirement for this portion of the code.  The device runs 
> FreeBSD 7 and the wireless hardware is Atheros-based.  So far, I've been 
> unsuccessful in finding helpful docs and the FreeBSD wireless code is big 
> enough to make grokking it a challenge.

The best reference is the ifconfig code itself. Have a look at
src/sbin/ifconfig/ifieee80211.c


Andrew


More information about the freebsd-embedded mailing list