[PATCH] Add 'signal_poll' command interface
Dmitry Shmidt
dimitrysh
Fri Apr 8 10:35:12 PDT 2011
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
wpa_supplicant/ctrl_iface.c | 20 ++++++++++++++++++++
wpa_supplicant/wpa_cli.c | 10 ++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index d5a74eb..4f3f7e0 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -2859,6 +2859,23 @@ static int wpa_supplicant_ctrl_iface_sta_autoconnect(
}
+static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
+ size_t buflen)
+{
+ struct wpa_signal_info si;
+ int ret;
+
+ ret = wpa_drv_signal_poll(wpa_s, &si);
+ if (!ret)
+ ret = os_snprintf(buf, buflen, "RSSI=%d\nLINKSPEED=%d\n"
+ "NOISE=%d\nFREQUENCY=%u\nTHRESHOLD=%d\n",
+ si.current_signal, si.current_txrate / 1000,
+ si.current_noise, si.frequency,
+ si.above_threshold);
+ return ret;
+}
+
+
static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s, char *cmd,
char *buf, size_t buflen)
{
@@ -3251,6 +3268,9 @@ char * wpa_supplicant_ctrl_iface_process(struct
wpa_supplicant *wpa_s,
if (wpa_supplicant_ctrl_iface_tdls_teardown(wpa_s, buf + 14))
reply_len = -1;
#endif /* CONFIG_TDLS */
+ } else if (os_strncmp(buf, "SIGNAL_POLL", 11) == 0) {
+ reply_len = wpa_supplicant_signal_poll(wpa_s, reply,
+ reply_size);
} else if (os_strncmp(buf, "DRIVER ", 7) == 0) {
reply_len = wpa_supplicant_driver_cmd(wpa_s, buf + 7, reply,
reply_size);
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index e422402..9c72042 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -2273,6 +2273,13 @@ static int wpa_cli_cmd_tdls_teardown(struct
wpa_ctrl *ctrl, int argc,
}
+static int wpa_cli_cmd_signal_poll(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_ctrl_command(ctrl, "SIGNAL_POLL");
+}
+
+
enum wpa_cli_cmd_flags {
cli_cmd_flag_none = 0x00,
cli_cmd_flag_sensitive = 0x01
@@ -2585,6 +2592,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "tdls_teardown", wpa_cli_cmd_tdls_teardown,
cli_cmd_flag_none,
"<addr> = tear down TDLS with <addr>" },
+ { "signal_poll", wpa_cli_cmd_signal_poll,
+ cli_cmd_flag_none,
+ "= get signal parameters" },
{ NULL, NULL, cli_cmd_flag_none, NULL }
};
--
1.7.3.1
More information about the Hostap
mailing list