You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/01/31 04:19:17 UTC

[incubator-nuttx-apps] branch master updated: wapi: Extend "WAPI_ESSID_DELAY_ON" flag to support customized connection behavior

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 623a668  wapi: Extend "WAPI_ESSID_DELAY_ON" flag to support customized connection behavior
623a668 is described below

commit 623a668baace3d58f016f9bffacef68de13cda50
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Jan 19 16:56:20 2021 +0800

    wapi: Extend "WAPI_ESSID_DELAY_ON" flag to support customized connection behavior
    
    The current essid setting(SIOCSIWESSID) are not satisfactory in case
    of specified bssid connection, if there are multiple essids with same name,
    we need additional bssid information to connect to the specified softap.
    The extended flag "WAPI_ESSID_DELAY_ON" instructs the driver to delay the
    connection behavior of essid, so that which can accept more accurate
    information before generating a connection.
    
    About flow of wapi command, drivers that support WAPI_ESSID_DELAY_ON semantics
    will have the following behavior changes:
    
    1. Station mode without bssid set:
    
    $ ifup wlan0
    $ wapi mode wlan0 2
    $ wapi psk wlan0 12345678 3
    $ wapi essid wlan0 archer 1
    $ renew wlan0
    
    2. Station mode with bssid set:
    
    $ ifup wlan0
    $ wapi mode wlan0 2
    $ wapi psk wlan0 12345678 3
    $ wapi essid wlan0 archer 2       <----- WAPI_ESSID_DELAY_ON will indicate the driver delay
    $                                        the connection event late to bssid set (SIOCSIWAP).
    $ wapi ap wlan0 ec:41:18:e0:76:7e
    $ renew wlan0
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 include/wireless/wapi.h      | 31 ++++++++++++++++++++++++++++++-
 wireless/wapi/src/wireless.c |  2 +-
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/include/wireless/wapi.h b/include/wireless/wapi.h
index 77b4fda..f6dc8d9 100644
--- a/include/wireless/wapi.h
+++ b/include/wireless/wapi.h
@@ -126,7 +126,36 @@ enum wapi_route_target_e
 enum wapi_essid_flag_e
 {
   WAPI_ESSID_OFF,
-  WAPI_ESSID_ON
+  WAPI_ESSID_ON,
+
+/* Extended flag "WAPI_ESSID_DELAY_ON" instructs the driver
+ * to delay the connection behavior of essid, so that which can accept
+ * more accurate information before generating a connection.
+ *
+ * About flow of wapi command, drivers that support WAPI_ESSID_DELAY_ON
+ * semantics will have the following behavior changes:
+ *
+ * 1. Station mode without bssid set:
+ *
+ * $ ifup wlan0
+ * $ wapi mode wlan0 2
+ * $ wapi psk wlan0 12345678 3
+ * $ wapi essid wlan0 archer 1
+ * $ renew wlan0
+ *
+ * 2. Station mode with bssid set:
+ *
+ * $ ifup wlan0
+ * $ wapi mode wlan0 2
+ * $ wapi psk wlan0 12345678 3
+ * $ wapi essid wlan0 archer 2  <-- WAPI_ESSID_DELAY_ON will indicate the
+ * $                                driver delay the connection event late
+ * $                                to bssid set (SIOCSIWAP).
+ * $ wapi ap wlan0 ec:41:18:e0:76:7e
+ * $ renew wlan0
+ */
+
+  WAPI_ESSID_DELAY_ON
 };
 
 /* Supported operation modes. */
diff --git a/wireless/wapi/src/wireless.c b/wireless/wapi/src/wireless.c
index d507012..4a44ac2 100644
--- a/wireless/wapi/src/wireless.c
+++ b/wireless/wapi/src/wireless.c
@@ -740,7 +740,7 @@ int wapi_set_essid(int sock, FAR const char *ifname, FAR const char *essid,
   wrq.u.essid.pointer = buf;
   wrq.u.essid.length =
     snprintf(buf, ((WAPI_ESSID_MAX_SIZE + 1) * sizeof(char)), "%s", essid);
-  wrq.u.essid.flags = (flag == WAPI_ESSID_ON);
+  wrq.u.essid.flags = flag;
 
   strncpy(wrq.ifr_name, ifname, IFNAMSIZ);
   ret = ioctl(sock, SIOCSIWESSID, (unsigned long)((uintptr_t)&wrq));