• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

external/wpa_supplicant_6


Commit MetaInfo

Revision9d919bf3263717f5b2049a32fdc2551fa365b096 (tree)
Zeit2012-02-19 22:05:23
AutorStefan Seidel <android@stef...>
CommiterStefan Seidel

Log Message

backport SIGNAL_POLL from wpa_supplicant 0.8.x to awext driver

Ändern Zusammenfassung

Diff

--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -1640,6 +1640,25 @@ static int wpa_supplicant_ctrl_iface_ap_scan(
16401640 }
16411641
16421642 #ifdef ANDROID
1643+static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
1644+ size_t buflen)
1645+{
1646+ struct wpa_signal_info si;
1647+ int ret;
1648+
1649+ ret = wpa_drv_signal_poll(wpa_s, &si);
1650+ if (ret)
1651+ return -1;
1652+
1653+ ret = os_snprintf(buf, buflen, "RSSI=%d\nLINKSPEED=%d\n"
1654+ "NOISE=%d\nFREQUENCY=%u\n",
1655+ si.current_signal, si.current_txrate / 1000,
1656+ si.current_noise, si.frequency);
1657+ if (ret < 0 || (unsigned int) ret > buflen)
1658+ return -1;
1659+ return ret;
1660+}
1661+
16431662 static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s,
16441663 char *cmd, char *buf, size_t buflen)
16451664 {
@@ -1839,6 +1858,8 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
18391858 reply_len = wpa_supplicant_ctrl_iface_bss(
18401859 wpa_s, buf + 4, reply, reply_size);
18411860 #ifdef ANDROID
1861+ } else if (os_strncmp(buf, "SIGNAL_POLL", 11) == 0) {
1862+ reply_len = wpa_supplicant_signal_poll(wpa_s, reply, reply_size);
18421863 } else if (os_strncmp(buf, "DRIVER ", 7) == 0) {
18431864 reply_len = wpa_supplicant_driver_cmd(wpa_s, buf + 7, reply, reply_size);
18441865 #endif
--- a/wpa_supplicant/src/drivers/driver.h
+++ b/wpa_supplicant/src/drivers/driver.h
@@ -372,6 +372,17 @@ struct ieee80211_rx_status {
372372 struct wpa_ssid;
373373
374374 /**
375+ * struct wpa_signal_info - Information about channel signal quality
376+ */
377+struct wpa_signal_info {
378+ u32 frequency;
379+ int above_threshold;
380+ int current_signal;
381+ int current_noise;
382+ int current_txrate;
383+};
384+
385+/**
375386 * struct wpa_driver_ops - Driver interface API definition
376387 *
377388 * This structure defines the API that each driver interface needs to implement
@@ -1037,6 +1048,13 @@ struct wpa_driver_ops {
10371048 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
10381049
10391050 #ifdef ANDROID
1051+ /**
1052+ * signal_poll - Get current connection information
1053+ * @priv: Private driver interface data
1054+ * @signal_info: Connection info structure
1055+ */
1056+ int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
1057+
10401058 /**
10411059 * driver_cmd - execute driver-specific command
10421060 * @priv: private driver interface data from init()
--- a/wpa_supplicant/src/drivers/driver_awext.c
+++ b/wpa_supplicant/src/drivers/driver_awext.c
@@ -663,6 +663,9 @@ int wpa_driver_awext_set_wpa(void *priv, int enabled)
663663 }
664664
665665 #ifdef ANDROID
666+#define RSSI_CMD "RSSI"
667+#define LINKSPEED_CMD "LINKSPEED"
668+
666669 static int wpa_driver_priv_driver_cmd(void *priv, char *cmd, char *buf, size_t buf_len)
667670 {
668671
@@ -872,6 +875,32 @@ static int wpa_driver_priv_driver_cmd(void *priv, char *cmd, char *buf, size_t b
872875 }
873876 return (ret);
874877 }
878+
879+static int wpa_driver_awext_signal_poll(void *priv, struct wpa_signal_info *si)
880+{
881+ char buf[MAX_DRV_CMD_SIZE];
882+ struct wpa_driver_awext_data *drv = priv;
883+ char *prssi;
884+ int res;
885+
886+ os_memset(si, 0, sizeof(*si));
887+ res = wpa_driver_priv_driver_cmd(priv, RSSI_CMD, buf, sizeof(buf));
888+ /* Answer: SSID rssi -Val */
889+ if (res < 0)
890+ return res;
891+ prssi = strcasestr(buf, RSSI_CMD);
892+ if (!prssi)
893+ return -1;
894+ si->current_signal = atoi(prssi + strlen(RSSI_CMD) + 1);
895+
896+ res = wpa_driver_priv_driver_cmd(priv, LINKSPEED_CMD, buf, sizeof(buf));
897+ /* Answer: LinkSpeed Val */
898+ if (res < 0)
899+ return res;
900+ si->current_txrate = atoi(buf + strlen(LINKSPEED_CMD) + 1) * 1000;
901+
902+ return 0;
903+}
875904 #endif
876905
877906 const struct wpa_driver_ops wpa_driver_awext_ops = {
@@ -908,6 +937,7 @@ const struct wpa_driver_ops wpa_driver_awext_ops = {
908937 .mlme_remove_sta = wpa_driver_awext_mlme_remove_sta,
909938 #endif /* CONFIG_CLIENT_MLME */
910939 #ifdef ANDROID
940+ .signal_poll = wpa_driver_awext_signal_poll,
911941 .driver_cmd = wpa_driver_priv_driver_cmd,
912942 #endif
913943 };
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -769,6 +769,14 @@ static inline int wpa_drv_set_probe_req_ie(struct wpa_supplicant *wpa_s,
769769 }
770770
771771 #ifdef ANDROID
772+static inline int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s,
773+ struct wpa_signal_info *si)
774+{
775+ if (wpa_s->driver->signal_poll)
776+ return wpa_s->driver->signal_poll(wpa_s->drv_priv, si);
777+ return -1;
778+}
779+
772780 static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s,
773781 char *cmd, char *buf, size_t buf_len)
774782 {