Search code examples
clinuxwireless

obtaining received signal strength of neighboring devices


I use AR9271 chipset usb WiFi device on Debian 7 on kernel 3.12.rc5. I use ath9k_htc and nl80211 drivers.

I create an ad-hoc WLAN via wpa_supplicant 2.0 and I would like to obtain received signal strength of the neighboring device in a C program.

What function or API can I use to obtain that information?


Solution

  • Edit: Did not notice the ad-hoc part the first time.. For ad-hoc, I don't really know.

    For what it's worth and for infrastructure connections:

    If you have wpa_supplicant, you should also have wpa_cli.

    The command:

    wpa_cli signal_poll
    

    should give you screen scrapeable output.

    You can (also) interface with wpa_supplicant via C, using wpa_ctrl_open() and wpa_ctrl_request():

    Something in the line of:

    #include "wpa_ctrl.h"
    <needed declarations and definitions>
    ctrl = wpa_ctrl_open(path);
    wpa_ctrl_request(ctrl, "SIGNAL_POLL", 11, buf, &len, NULL);