You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/02/05 21:46:56 UTC

[incubator-nuttx-apps] branch master updated: gs2200m: Retry indefinately on GS2200M_IOC_ASSOC failure

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

acassis 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 2f4b309  gs2200m: Retry indefinately on GS2200M_IOC_ASSOC failure
2f4b309 is described below

commit 2f4b309b1b9faad87788d0668617b07bcfbca305
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Feb 5 18:45:43 2020 -0300

    gs2200m: Retry indefinately on GS2200M_IOC_ASSOC failure
    
    Author: Alan Carvalho de Assis <en...@siam.ind.br>
    
        Run nxstyle again gs2200m_main.c file and fix issues
    
    Author: YAMAMOTO Takashi <ya...@midokura.com>
    
        gs2200m: Retry indefinately on GS2200M_IOC_ASSOC failure
    
        The ioctl doesn't return why it failed.
        It might or might not be a transient failure.
    
        In my environment, gs2200m often returns the following for AT+WA.
        It usually works after a few retries.
    
        [   12.110000] _parse_pkt_in_s1: +++++ 0:(msize=19, msg=WLAN CONNECT ERROR|)
        [   12.110000] _parse_pkt_in_s1: +++++ 1:(msize=6, msg=ERROR|)
---
 wireless/gs2200m/gs2200m_main.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/wireless/gs2200m/gs2200m_main.c b/wireless/gs2200m/gs2200m_main.c
index 9f7d559..604c89f 100644
--- a/wireless/gs2200m/gs2200m_main.c
+++ b/wireless/gs2200m/gs2200m_main.c
@@ -376,6 +376,7 @@ read_req(int fd, FAR const struct usrsock_request_common_s *com_hdr,
     {
       return -errno;
     }
+
   if (rlen + sizeof(*com_hdr) != reqsize)
     {
       return -EMSGSIZE;
@@ -1350,12 +1351,16 @@ static int gs2200m_loop(FAR struct gs2200m_s *priv)
   amsg.key  = priv->key;
   amsg.mode = priv->mode;
   amsg.ch   = priv->ch;
-  ret = ioctl(priv->gsfd, GS2200M_IOC_ASSOC, (unsigned long)&amsg);
-
-  if (0 != ret)
+  while (true)
     {
-      fprintf(stderr, "association failed : invalid ssid or key \n");
-      goto errout;
+      ret = ioctl(priv->gsfd, GS2200M_IOC_ASSOC, (unsigned long)&amsg);
+
+      if (0 == ret)
+        {
+          break;
+        }
+
+      fprintf(stderr, "association failed : retrying\n");
     }
 
   while (true)