From owner-freebsd-embedded@FreeBSD.ORG Thu Apr 3 18:13:01 2008 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1EC9106567F for ; Thu, 3 Apr 2008 18:13:01 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from heff.fud.org.nz (203-109-251-39.static.bliink.ihug.co.nz [203.109.251.39]) by mx1.freebsd.org (Postfix) with ESMTP id 918DF8FC0A for ; Thu, 3 Apr 2008 18:13:01 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: by heff.fud.org.nz (Postfix, from userid 1001) id 07ADE80E9; Fri, 4 Apr 2008 06:59:06 +1300 (NZDT) Date: Fri, 4 Apr 2008 06:59:06 +1300 From: Andrew Thompson To: Jordan Coleman Message-ID: <20080403175906.GB29676@heff.fud.org.nz> References: <8C45E249-2E03-4F70-B3C2-E28A92EEFB05@JordanColeman.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8C45E249-2E03-4F70-B3C2-E28A92EEFB05@JordanColeman.com> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-embedded@freebsd.org Subject: Re: Programmatic access to 802.11 info X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Apr 2008 18:13:02 -0000 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 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 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