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 2021/01/18 14:20:15 UTC

[incubator-nuttx] branch master updated (eabb2fb -> 34a300b)

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

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


    from eabb2fb  Re-arranged syslog fields.
     new db0b661  arch/sim: Don't potect recvsem in bthcitty_pollnotify
     new 8c8c30b  arch/sim: Rename g_hcitty_ops to g_bthcitty_ops
     new aa37399  arch/sim: Extend hcitty_register to accept device name
     new 34a300b  arch/sim: Fix up_hcitty.c:366:20: warning: ‘eventset’ may be used uninitialized

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/sim/src/sim/up_hcitty.c         | 56 +++++++++++++++---------------------
 arch/sim/src/sim/up_internal.h       |  2 +-
 boards/sim/sim/sim/src/sim_bringup.c |  4 +--
 3 files changed, 26 insertions(+), 36 deletions(-)


[incubator-nuttx] 02/04: arch/sim: Rename g_hcitty_ops to g_bthcitty_ops

Posted by ac...@apache.org.
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.git

commit 8c8c30b9d7a234a13030e57ae6fbd9ee8476c454
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jan 18 04:39:47 2021 +0800

    arch/sim: Rename g_hcitty_ops to g_bthcitty_ops
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/sim/up_hcitty.c | 43 +++++++++++++++++++------------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/arch/sim/src/sim/up_hcitty.c b/arch/sim/src/sim/up_hcitty.c
index de60e1b..5b29656 100644
--- a/arch/sim/src/sim/up_hcitty.c
+++ b/arch/sim/src/sim/up_hcitty.c
@@ -82,32 +82,32 @@ struct bthcitty_s
  * Private Function Prototypes
  ****************************************************************************/
 
-static int      bthcitty_open  (FAR struct file *filep);
-static int      bthcitty_close (FAR struct file *filep);
-static ssize_t  bthcitty_read  (FAR struct file *filep,
+static int      bthcitty_open (FAR struct file *filep);
+static int      bthcitty_close(FAR struct file *filep);
+static ssize_t  bthcitty_read (FAR struct file *filep,
                                FAR char *buffer, size_t buflen);
-static ssize_t  bthcitty_write (FAR struct file *filep,
+static ssize_t  bthcitty_write(FAR struct file *filep,
                                FAR const char *buffer, size_t buflen);
-static int      bthcitty_ioctl (FAR struct file *filep,
+static int      bthcitty_ioctl(FAR struct file *filep,
                                int cmd, unsigned long arg);
-static int      bthcitty_poll  (FAR struct file *filep,
+static int      bthcitty_poll (FAR struct file *filep,
                                FAR struct pollfd *fds, bool setup);
 
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
-static const struct file_operations g_hcitty_ops =
+static const struct file_operations g_bthcitty_ops =
 {
-  .open   = bthcitty_open,
-  .close  = bthcitty_close,
-  .read   = bthcitty_read,
-  .write  = bthcitty_write,
-  .ioctl  = bthcitty_ioctl,
-  .poll   = bthcitty_poll
+  .open  = bthcitty_open,
+  .close = bthcitty_close,
+  .read  = bthcitty_read,
+  .write = bthcitty_write,
+  .ioctl = bthcitty_ioctl,
+  .poll  = bthcitty_poll
 };
 
-static sq_queue_t g_hcitty_list;
+static sq_queue_t g_bthcitty_list;
 
 /****************************************************************************
  * Private Functions
@@ -159,7 +159,6 @@ static int bthcitty_open(FAR struct file *filep)
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct bthcitty_s *dev = inode->i_private;
-  int ret;
   int fd;
 
   fd = bthcisock_host_open(dev->id);
@@ -186,8 +185,7 @@ static int bthcitty_close(FAR struct file *filep)
   dev->fd = -1;
 
   bthcitty_pollnotify(dev, POLLIN | POLLOUT);
-
-  return 0;
+  return OK;
 }
 
 static ssize_t bthcitty_read(FAR struct file *filep,
@@ -232,7 +230,6 @@ static ssize_t bthcitty_read(FAR struct file *filep,
   dev->recvpos += buflen;
 
   nxsem_post(&dev->recvlock);
-
   return buflen;
 }
 
@@ -392,7 +389,6 @@ static int bthcitty_poll(FAR struct file *filep,
     }
 
   nxsem_post(&dev->fdslock);
-
   return ret;
 }
 
@@ -405,7 +401,7 @@ void bthcitty_loop(void)
   FAR struct bthcitty_s *dev;
   FAR sq_entry_t *entry;
 
-  for (entry = sq_peek(&g_hcitty_list); entry; entry = sq_next(entry))
+  for (entry = sq_peek(&g_bthcitty_list); entry; entry = sq_next(entry))
     {
       dev = container_of(entry, struct bthcitty_s, link);
       if (bthcisock_host_avail(dev->fd))
@@ -439,7 +435,7 @@ int bthcitty_register(int dev_id)
 
   nxsem_set_protocol(&dev->recvsem, SEM_PRIO_NONE);
 
-  ret = register_driver(name, &g_hcitty_ops, 0666, dev);
+  ret = register_driver(name, &g_bthcitty_ops, 0666, dev);
   if (ret < 0)
     {
       nxsem_destroy(&dev->recvlock);
@@ -450,7 +446,6 @@ int bthcitty_register(int dev_id)
       return ret;
     }
 
-  sq_addlast(&dev->link, &g_hcitty_list);
-
-  return 0;
+  sq_addlast(&dev->link, &g_bthcitty_list);
+  return OK;
 }


[incubator-nuttx] 01/04: arch/sim: Don't potect recvsem in bthcitty_pollnotify

Posted by ac...@apache.org.
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.git

commit db0b661f37f24d80c21b35d5b830a37b72ac3e45
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jan 18 04:33:57 2021 +0800

    arch/sim: Don't potect recvsem in bthcitty_pollnotify
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/sim/up_hcitty.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/sim/src/sim/up_hcitty.c b/arch/sim/src/sim/up_hcitty.c
index ee79300..de60e1b 100644
--- a/arch/sim/src/sim/up_hcitty.c
+++ b/arch/sim/src/sim/up_hcitty.c
@@ -151,9 +151,8 @@ static void bthcitty_pollnotify(FAR struct bthcitty_s *dev,
         }
     }
 
-  bthcitty_post(&dev->recvsem);
-
   nxsem_post(&dev->fdslock);
+  bthcitty_post(&dev->recvsem);
 }
 
 static int bthcitty_open(FAR struct file *filep)


[incubator-nuttx] 04/04: arch/sim: Fix up_hcitty.c:366:20: warning: ‘eventset’ may be used uninitialized

Posted by ac...@apache.org.
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.git

commit 34a300b647661a7033db0e3f8fc523a17fa96660
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jan 18 03:20:26 2021 +0800

    arch/sim: Fix up_hcitty.c:366:20: warning: ‘eventset’ may be used uninitialized
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/sim/up_hcitty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sim/src/sim/up_hcitty.c b/arch/sim/src/sim/up_hcitty.c
index 6bf99ab..b592ace4 100644
--- a/arch/sim/src/sim/up_hcitty.c
+++ b/arch/sim/src/sim/up_hcitty.c
@@ -330,7 +330,7 @@ static int bthcitty_poll(FAR struct file *filep,
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct bthcitty_s *dev = inode->i_private;
-  pollevent_t eventset;
+  pollevent_t eventset = 0;
   int ret;
   int i;
 


[incubator-nuttx] 03/04: arch/sim: Extend hcitty_register to accept device name

Posted by ac...@apache.org.
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.git

commit aa37399c8936a86aa18fa23c47b1a1cbc215737a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jan 18 02:31:16 2021 +0800

    arch/sim: Extend hcitty_register to accept device name
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/sim/up_hcitty.c         | 8 ++------
 arch/sim/src/sim/up_internal.h       | 2 +-
 boards/sim/sim/sim/src/sim_bringup.c | 4 ++--
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/sim/src/sim/up_hcitty.c b/arch/sim/src/sim/up_hcitty.c
index 5b29656..6bf99ab 100644
--- a/arch/sim/src/sim/up_hcitty.c
+++ b/arch/sim/src/sim/up_hcitty.c
@@ -28,7 +28,6 @@
 #include <nuttx/nuttx.h>
 
 #include <string.h>
-#include <stdio.h>
 #include <poll.h>
 #include <queue.h>
 
@@ -411,14 +410,11 @@ void bthcitty_loop(void)
     }
 }
 
-int bthcitty_register(int dev_id)
+int bthcitty_register(const char *name, int id)
 {
   FAR struct bthcitty_s *dev;
-  unsigned char name[16];
   int ret;
 
-  snprintf(name, sizeof(name), "/dev/ttyHCI%d", dev_id);
-
   dev = (FAR struct bthcitty_s *)kmm_zalloc(sizeof(struct bthcitty_s));
   if (dev == NULL)
     {
@@ -426,7 +422,7 @@ int bthcitty_register(int dev_id)
     }
 
   dev->fd = -1;
-  dev->id = dev_id;
+  dev->id = id;
 
   nxsem_init(&dev->recvlock, 0, 1);
   nxsem_init(&dev->sendlock, 0, 1);
diff --git a/arch/sim/src/sim/up_internal.h b/arch/sim/src/sim/up_internal.h
index ddca786..55863c6 100644
--- a/arch/sim/src/sim/up_internal.h
+++ b/arch/sim/src/sim/up_internal.h
@@ -400,7 +400,7 @@ int bthcisock_loop(void);
 /* up_hcitty.c **************************************************************/
 
 #ifdef CONFIG_SIM_HCITTY
-int bthcitty_register(int dev_id);
+int  bthcitty_register(const char *name, int id);
 void bthcitty_loop(void);
 #endif
 
diff --git a/boards/sim/sim/sim/src/sim_bringup.c b/boards/sim/sim/sim/src/sim_bringup.c
index b50d148..ea5bd4f 100644
--- a/boards/sim/sim/sim/src/sim_bringup.c
+++ b/boards/sim/sim/sim/src/sim_bringup.c
@@ -349,9 +349,9 @@ int sim_bringup(void)
 #endif
 
 #ifdef CONFIG_SIM_HCITTY
-  /* Register the Host Bluetooth network device via HCI socket */
+  /* Register the HCI TTY device via HCI socket */
 
-  ret = bthcitty_register(0);  /* Use HCI0 */
+  ret = bthcitty_register("/dev/ttyHCI", 0);  /* Use HCI0 */
   if (ret < 0)
     {
       syslog(LOG_ERR, "ERROR: bthcitty_register() failed: %d\n", ret);