[GitHub] [nuttx] raiden00pl opened a new pull request, #8923: nrf52: initial support for USBDEV

2023-03-29 Thread via GitHub


raiden00pl opened a new pull request, #8923:
URL: https://github.com/apache/nuttx/pull/8923

   ## Summary
   - nrf52: add usb support
   - nrf52840-dk: add usbdev examples
   
   ## Impact
   none
   
   ## Testing
   nrf52840-dk
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8862: syscall/libc: add more syscall/libc symbols into csv file

2023-03-29 Thread via GitHub


pkarashchenko commented on code in PR #8862:
URL: https://github.com/apache/nuttx/pull/8862#discussion_r1151506748


##
include/stdlib.h:
##
@@ -286,6 +286,11 @@ FAR void  *bsearch(FAR const void *key, FAR const void 
*base, size_t nel,
 
 FAR const char *getprogname(void);
 
+/* Registers a destructor function to be called by exit() */
+
+int __cxa_atexit(CODE void (*func)(FAR void *), FAR void *arg,

Review Comment:
   One question:
   Shouldn't `__cxa_atexit` be a part of `icxxabi.h` and available only if C++ 
is used?
   Also I noticed that `__cxa_finalize` definition is missing in code tree. I 
will fill a separate issue for this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] wengzhe commented on pull request #8915: net/tcp: Reply RST when we cannot receive data

2023-03-29 Thread via GitHub


wengzhe commented on PR #8915:
URL: https://github.com/apache/nuttx/pull/8915#issuecomment-1488110762

   > @wengzhe please include this Summary message in the commit log message. 
Including the message initially in the commit log message you don't need to 
duplicate your effort because it appear automatically in the Summary
   
   Done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] masayuki2009 opened a new pull request, #1690: nshlib: Fix the ps command format

2023-03-29 Thread via GitHub


masayuki2009 opened a new pull request, #1690:
URL: https://github.com/apache/nuttx-apps/pull/1690

   ## Summary
   
   - I noticed that the ps command shows the wrong format due to recent changes 
on sigmask length from 32bits to 64bits
   - This commit fixes this issue
   
   ```
   Before:
   nsh> ps
 PID GROUP CPU PRI POLICY   TYPENPX STATEEVENT SIGMASK   STACK  
 USED  FILLED COMMAND
   0 0   0   0 FIFO Kthread N-- Assigned    
001000 000544  54.4%  CPU0 IDLE
   1 1   1   0 FIFO Kthread N-- Running 
001000 000664  66.4%  CPU1 IDLE
   2 2   2   0 FIFO Kthread N-- Running 
001000 000664  66.4%  CPU2 IDLE
   3 3   3   0 FIFO Kthread N-- Running 
001000 000664  66.4%  CPU3 IDLE
   4 4 --- 192 RR   Kthread --- Waiting  Semaphore  
001992 000416  20.8%  hpwork 0x10824b44
   5 5   0 100 RR   Task--- Running 
002000 001272  63.6%  nsh_main
   
   After:
   nsh> ps
 PID GROUP CPU PRI POLICY   TYPENPX STATEEVENT SIGMASK  
 STACK   USED  FILLED COMMAND
   0 0   0   0 FIFO Kthread N-- Assigned    
001000 000544  54.4%  CPU0 IDLE
   1 1   1   0 FIFO Kthread N-- Running 
001000 000664  66.4%  CPU1 IDLE
   2 2   2   0 FIFO Kthread N-- Running 
001000 000664  66.4%  CPU2 IDLE
   3 3   3   0 FIFO Kthread N-- Running 
001000 000664  66.4%  CPU3 IDLE
   4 4 --- 192 RR   Kthread --- Waiting  Semaphore  
001992 000416  20.8%  hpwork 0x10824b44
   5 5   0 100 RR   Task--- Running 
002000 001416  70.8%  nsh_main
   ```
   ## Impact
   
   - None
   
   ## Testing
   
   - Tested with sabre-6quad:smp on qemu-7.1
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1687: system/cu: Move fd_std_tty, g_tio_std and g_tio_dev to cu_globals_s

2023-03-29 Thread via GitHub


pkarashchenko commented on PR #1687:
URL: https://github.com/apache/nuttx-apps/pull/1687#issuecomment-1488212163

   @xiaoxiang781216 will you apply suggestion or should we move to merge?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] xiaoxiang781216 commented on pull request #1687: system/cu: Move fd_std_tty, g_tio_std and g_tio_dev to cu_globals_s

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on PR #1687:
URL: https://github.com/apache/nuttx-apps/pull/1687#issuecomment-1488270641

   > @xiaoxiang781216 will you apply suggestion or should we move to merge?
   
   Yes, I will apply your suggestion. Please wait a moment.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1687: system/cu: Move fd_std_tty, g_tio_std and g_tio_dev to cu_globals_s

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on code in PR #1687:
URL: https://github.com/apache/nuttx-apps/pull/1687#discussion_r1151669606


##
system/cu/cu_main.c:
##
@@ -291,15 +288,15 @@ int main(int argc, FAR char *argv[])
 
   /* Initialize global data */
 
-  memset(&g_cu, 0, sizeof(struct cu_globals_s));
+  memset(cu, 0, sizeof(struct cu_globals_s));

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1683: Minor signal fix found from https://github.com/apache/nuttx/pull/8900

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on code in PR #1683:
URL: https://github.com/apache/nuttx-apps/pull/1683#discussion_r1151438835


##
include/graphics/twm4nx/twm4nx_config.hxx:
##
@@ -448,7 +448,7 @@
  */
 
 #ifndef CONFIG_TWM4NX_INPUT_SIGNO
-#  define CONFIG_TWM4NX_INPUT_SIGNO 6
+#  define CONFIG_TWM4NX_INPUT_SIGNO 33

Review Comment:
   No, this program uses two signal 5/6 at the same time, we need map to 32/33.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] pkarashchenko merged pull request #1687: system/cu: Move fd_std_tty, g_tio_std and g_tio_dev to cu_globals_s

2023-03-29 Thread via GitHub


pkarashchenko merged PR #1687:
URL: https://github.com/apache/nuttx-apps/pull/1687


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx-apps] branch master updated: system/cu: Move fd_std_tty, g_tio_std and g_tio_dev to cu_globals_s

2023-03-29 Thread pkarashchenko
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new fd9c92e2e system/cu: Move fd_std_tty, g_tio_std and g_tio_dev to 
cu_globals_s
fd9c92e2e is described below

commit fd9c92e2e9598582532d4bc14680cfb204fd2105
Author: Xiang Xiao 
AuthorDate: Sun Mar 26 11:44:42 2023 +0800

system/cu: Move fd_std_tty, g_tio_std and g_tio_dev to cu_globals_s

Signed-off-by: Xiang Xiao 
---
 system/cu/cu.h  | 12 ---
 system/cu/cu_main.c | 95 +
 2 files changed, 53 insertions(+), 54 deletions(-)

diff --git a/system/cu/cu.h b/system/cu/cu.h
index 744a61831..fa7d72c7d 100644
--- a/system/cu/cu.h
+++ b/system/cu/cu.h
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /
  * Pre-processor Definitions
@@ -70,10 +71,13 @@
 
 struct cu_globals_s
 {
-  int infd;/* Incoming data from serial port */
-  int outfd;   /* Outgoing data to serial port */
-  pthread_t listener;  /* Terminal listener thread */
-  bool force_exit; /* Force exit */
+  int infd;  /* Incoming data from serial port */
+  int outfd; /* Outgoing data to serial port */
+  int stdfd; /* I/O data to standard console */
+  struct termios devtio; /* Original serial port setting */
+  struct termios stdtio; /* Original standard console setting */
+  pthread_t listener;/* Terminal listener thread */
+  bool force_exit;   /* Force exit */
 };
 
 /
diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c
index c67b379ff..572533a19 100644
--- a/system/cu/cu_main.c
+++ b/system/cu/cu_main.c
@@ -50,7 +50,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "system/readline.h"
@@ -73,9 +72,6 @@ enum parity_mode
  /
 
 static struct cu_globals_s g_cu;
-static int fd_std_tty;
-static struct termios g_tio_std;
-static struct termios g_tio_dev;
 
 /
  * Public Data
@@ -95,12 +91,14 @@ static struct termios g_tio_dev;
 
 static FAR void *cu_listener(FAR void *parameter)
 {
+  FAR struct cu_globals_s *cu = (FAR struct cu_globals_s *)parameter;
+
   for (; ; )
 {
   int rc;
   char ch;
 
-  rc = read(g_cu.infd, &ch, 1);
+  rc = read(cu->infd, &ch, 1);
   if (rc <= 0)
 {
   break;
@@ -121,17 +119,17 @@ static void sigint(int sig)
 }
 
 #ifdef CONFIG_SERIAL_TERMIOS
-static int set_termios(int fd, int rate, enum parity_mode parity,
-   int rtscts, int nocrlf)
+static int set_termios(FAR struct cu_globals_s *cu, int rate,
+   enum parity_mode parity, int rtscts, int nocrlf)
 #else
-static int set_termios(int fd, int nocrlf)
+static int set_termios(FAR struct cu_globals_s *cu, int nocrlf)
 #endif
 {
   int rc = 0;
   int ret;
   struct termios tio;
 
-  tio = g_tio_dev;
+  tio = cu->devtio;
 
 #ifdef CONFIG_SERIAL_TERMIOS
   tio.c_cflag &= ~(PARENB | PARODD | CRTSCTS);
@@ -172,7 +170,7 @@ static int set_termios(int fd, int nocrlf)
   tio.c_oflag |= ONLCR;
 }
 
-  ret = tcsetattr(fd, TCSANOW, &tio);
+  ret = tcsetattr(cu->outfd, TCSANOW, &tio);
   if (ret)
 {
   fprintf(stderr, "set_termios: ERROR during tcsetattr(): %d\n", errno);
@@ -182,15 +180,15 @@ static int set_termios(int fd, int nocrlf)
 
   /* Let the remote machine to handle all crlf/echo except Ctrl-C */
 
-  if (fd_std_tty >= 0)
+  if (cu->stdfd >= 0)
   {
-tio = g_tio_std;
+tio = cu->stdtio;
 
 tio.c_iflag = 0;
 tio.c_oflag = 0;
 tio.c_lflag &= ~ECHO;
 
-ret = tcsetattr(fd_std_tty, TCSANOW, &tio);
+ret = tcsetattr(cu->stdfd, TCSANOW, &tio);
 if (ret)
   {
 fprintf(stderr, "set_termios: ERROR during tcsetattr(): %d\n",
@@ -203,15 +201,13 @@ errout:
   return rc;
 }
 
-static int retrieve_termios(int fd)
+static void retrieve_termios(FAR struct cu_globals_s *cu)
 {
-  tcsetattr(fd, TCSANOW, &g_tio_dev);
-  if (fd_std_tty >= 0)
+  tcsetattr(cu->outfd, TCSANOW, &cu->devtio);
+  if (cu->stdfd >= 0)
 {
-  tcsetattr(fd_std_tty, TCSANOW, &g_tio_std);
+  tcsetattr(cu->stdfd, TCSANOW, &cu->stdtio);
 }
-
-  return 0;
 }
 
 static void print_help(void)
@@ -274,7 +270,8 @@ int main(int argc, FAR char *argv[])
 {
   pthread_attr_t attr;
   struct sigaction sa;
-  FAR char *devname = CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE;
+  FAR const char *devname = CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE;
+  FAR struct cu_globals_s *cu = &g_cu;
 #ifdef CONFIG_SERIAL_TERMIOS
   int baudrate = CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD;
   enum parity

[GitHub] [nuttx-apps] pkarashchenko merged pull request #1690: nshlib: Fix the ps command format

2023-03-29 Thread via GitHub


pkarashchenko merged PR #1690:
URL: https://github.com/apache/nuttx-apps/pull/1690


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx-apps] branch master updated: nshlib: Fix the ps command format

2023-03-29 Thread pkarashchenko
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 125cf7abe nshlib: Fix the ps command format
125cf7abe is described below

commit 125cf7abe2d7f345c3bc58c0bdea2360fdefa170
Author: Masayuki Ishikawa 
AuthorDate: Wed Mar 29 17:15:48 2023 +0900

nshlib: Fix the ps command format

Summary:
- I noticed that the ps command shows the wrong format due to
  recent changes on sigmask length from 32bits to 64bits
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with sabre-6quad:smp on qemu-7.1

Signed-off-by: Masayuki Ishikawa 
---
 nshlib/nsh_proccmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c
index 76b08f8da..ab8560314 100644
--- a/nshlib/nsh_proccmds.c
+++ b/nshlib/nsh_proccmds.c
@@ -627,7 +627,7 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char 
**argv)
"%3s "
 #endif
"%3s %-8s %-7s %3s %-8s %-9s "
-   "%-8s "
+   "%-16s "
 #if CONFIG_MM_BACKTRACE >= 0 && !defined(CONFIG_NSH_DISABLE_PSHEAPUSAGE)
"%8s "
 #endif



[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1689: examples/ftpd: Add support for choosing address family

2023-03-29 Thread via GitHub


pkarashchenko commented on code in PR #1689:
URL: https://github.com/apache/nuttx-apps/pull/1689#discussion_r1151818003


##
examples/ftpd/ftpd_main.c:
##
@@ -154,35 +154,75 @@ static void ftpd_accounts(FTPD_SESSION handle)
 }
 }
 
+static void hint(void)
+{
+  fprintf(stderr,
+  "Usage: ftpd [-46] \n\
+  \t-4Use IPv4\n\
+  \t-6Use IPv6\n\
+  ");
+}
+
 /
  * Name: ftpd_daemon
  /
 
 int ftpd_daemon(int s_argc, char **s_argv)
 {
   FTPD_SESSION handle;
-  int ret;
+  int ret = EXIT_FAILURE;
+  int option;
+  int family;
+  bool badarg = false;
 
   /* The FTPD daemon has been started */
 
   g_ftpdglob.running = true;
   printf("FTP daemon [%d] started\n", g_ftpdglob.pid);
 
-  /* Open FTPD */
-
 #if ADDR_FAMILY == AF_INET6
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET6);
+  family = AF_INET6;
 #else
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET);
+  family = AF_INET;
 #endif

Review Comment:
   Let's remove this and change variable declaration to `int family = 
ADDR_FAMILY;`



##
examples/ftpd/ftpd_main.c:
##
@@ -154,35 +154,75 @@ static void ftpd_accounts(FTPD_SESSION handle)
 }
 }
 
+static void hint(void)
+{
+  fprintf(stderr,
+  "Usage: ftpd [-46] \n\
+  \t-4Use IPv4\n\
+  \t-6Use IPv6\n\
+  ");
+}
+
 /
  * Name: ftpd_daemon
  /
 
 int ftpd_daemon(int s_argc, char **s_argv)
 {
   FTPD_SESSION handle;
-  int ret;
+  int ret = EXIT_FAILURE;
+  int option;
+  int family;
+  bool badarg = false;
 
   /* The FTPD daemon has been started */
 
   g_ftpdglob.running = true;
   printf("FTP daemon [%d] started\n", g_ftpdglob.pid);
 
-  /* Open FTPD */
-
 #if ADDR_FAMILY == AF_INET6
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET6);
+  family = AF_INET6;
 #else
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET);
+  family = AF_INET;
 #endif
 
+  while ((option = getopt(s_argc, &s_argv[1], "46")) != ERROR)
+{
+  switch (option)
+  {
+case '4':
+  family = AF_INET;
+  break;
+case '6':
+  family = AF_INET6;
+  break;
+default:
+  badarg = true;
+  break;
+  }
+}
+
+  if (badarg)
+{
+  hint();

Review Comment:
   Why an't we `hint();` and `goto out;` from `default` case above? I mean, why 
do we need `badarg` variable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1689: examples/ftpd: Add support for choosing address family

2023-03-29 Thread via GitHub


pkarashchenko commented on code in PR #1689:
URL: https://github.com/apache/nuttx-apps/pull/1689#discussion_r1151825372


##
examples/ftpd/ftpd_main.c:
##
@@ -154,35 +154,75 @@ static void ftpd_accounts(FTPD_SESSION handle)
 }
 }
 
+static void hint(void)
+{
+  fprintf(stderr,
+  "Usage: ftpd [-46] \n\
+  \t-4Use IPv4\n\
+  \t-6Use IPv6\n\
+  ");
+}
+
 /
  * Name: ftpd_daemon
  /
 
 int ftpd_daemon(int s_argc, char **s_argv)
 {
   FTPD_SESSION handle;
-  int ret;
+  int ret = EXIT_FAILURE;
+  int option;
+  int family;
+  bool badarg = false;
 
   /* The FTPD daemon has been started */
 
   g_ftpdglob.running = true;
   printf("FTP daemon [%d] started\n", g_ftpdglob.pid);
 
-  /* Open FTPD */
-
 #if ADDR_FAMILY == AF_INET6
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET6);
+  family = AF_INET6;
 #else
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET);
+  family = AF_INET;
 #endif

Review Comment:
   Or to `int family = AF_UNSPEC;` like in `apps/examples/ftpc/ftpc_main.c`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] acassis commented on pull request #8907: video/fb: add vsync offset support

2023-03-29 Thread via GitHub


acassis commented on PR #8907:
URL: https://github.com/apache/nuttx/pull/8907#issuecomment-1488495671

   @FASTSHIFT please include the summary in the commit log message. Do you have 
plans for this driver? Please consider submitting some usage application and 
also include a Documentation/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] acassis merged pull request #8910: usrsock_server: Do not poll SOCK_CTRL

2023-03-29 Thread via GitHub


acassis merged PR #8910:
URL: https://github.com/apache/nuttx/pull/8910


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (bed53538e8 -> 9fd4d6b767)

2023-03-29 Thread acassis
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/nuttx.git


from bed53538e8 rndis: EP0 belongs to composite class if composite enabled
 add 0550082966 usrsock_server: add debug info for poll_setup
 add 61ff04b9e2 net/inet: Only setup poll for UDP when s_type == SOCK_DGRAM
 add 9fd4d6b767 usrsock_server: Do not poll SOCK_CTRL.

No new revisions were added by this update.

Summary of changes:
 drivers/usrsock/usrsock_rpmsg_server.c | 24 
 net/inet/inet_sockif.c |  2 +-
 2 files changed, 21 insertions(+), 5 deletions(-)



[GitHub] [nuttx] acassis merged pull request #8915: net/tcp: Reply RST when we cannot receive data

2023-03-29 Thread via GitHub


acassis merged PR #8915:
URL: https://github.com/apache/nuttx/pull/8915


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: net/tcp: Reply RST when we cannot receive data

2023-03-29 Thread acassis
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/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new b058f37353 net/tcp: Reply RST when we cannot receive data
b058f37353 is described below

commit b058f373539e601203ac4dd64008a6bf92da3b1e
Author: Zhe Weng 
AuthorDate: Mon Mar 27 17:52:19 2023 +0800

net/tcp: Reply RST when we cannot receive data

According to RFC 2525, Section 2.17:
"When an application closes a connection in such a way that it can no 
longer read any received data, the TCP SHOULD, per section 4.2.2.13 of RFC 
1122, send a RST if there is any unread received data, or if any new data is 
received."

When our TCP socket is closed (even when the thread has exited), the peer 
can keep sending data and NuttX keeps replying ACK (we've tried for ~12h). This 
is not a good behavior (also different from Linux), so send RST instead of ACK 
for data receiving in FIN_WAIT.

Signed-off-by: Zhe Weng 
---
 net/tcp/tcp_input.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c
index 07dbede40e..1cd5c0df9e 100644
--- a/net/tcp/tcp_input.c
+++ b/net/tcp/tcp_input.c
@@ -1545,7 +1545,15 @@ found:
 
 if (dev->d_len > 0)
   {
-tcp_send(dev, conn, TCP_ACK, tcpiplen);
+/* Due to RFC 2525, Section 2.17, we SHOULD send RST if we can no
+ * longer read any received data. Also set state into TCP_CLOSED
+ * because the peer will not send FIN after RST received.
+ *
+ * TODO: Modify shutdown behavior to allow read in FIN_WAIT.
+ */
+
+conn->tcpstateflags = TCP_CLOSED;
+tcp_reset(dev, conn);
 return;
   }
 
@@ -1572,7 +1580,13 @@ found:
 
 if (dev->d_len > 0)
   {
-tcp_send(dev, conn, TCP_ACK, tcpiplen);
+/* Due to RFC 2525, Section 2.17, we SHOULD send RST if we can no
+ * longer read any received data. Also set state into TCP_CLOSED
+ * because the peer will not send FIN after RST received.
+ */
+
+conn->tcpstateflags = TCP_CLOSED;
+tcp_reset(dev, conn);
 return;
   }
 



[GitHub] [nuttx] acassis merged pull request #8921: usbhost_hidkbd: Add the option to use interrupt transfers.

2023-03-29 Thread via GitHub


acassis merged PR #8921:
URL: https://github.com/apache/nuttx/pull/8921


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: usbhost_hidkbd: Add the option to use interrupt transfers.

2023-03-29 Thread acassis
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/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 18d196e968 usbhost_hidkbd: Add the option to use interrupt transfers.
18d196e968 is described below

commit 18d196e968d87664cd03176dd4f2dbdbb18df3e0
Author: Lwazi Dube 
AuthorDate: Tue Mar 28 11:02:43 2023 -0400

usbhost_hidkbd: Add the option to use interrupt transfers.

Using the interrupt pipe is recommended in the Get_Report
request section of the HID standard. This option has been
added to support some keyboards that refuse to return valid
keys when polled using the Get_Report request. Support for
the Caps Lock key, including LED, has also been added.
---
 drivers/usbhost/Kconfig  |   6 +
 drivers/usbhost/usbhost_hidkbd.c | 763 +++
 2 files changed, 610 insertions(+), 159 deletions(-)

diff --git a/drivers/usbhost/Kconfig b/drivers/usbhost/Kconfig
index a8e575d505..08fb8e93e7 100644
--- a/drivers/usbhost/Kconfig
+++ b/drivers/usbhost/Kconfig
@@ -361,6 +361,12 @@ config HIDKBD_NODEBOUNCE
If set to y normal debouncing is disabled.  Default:
Debounce enabled (No repeat keys).
 
+config HIDKBD_NOGETREPORT
+   bool "Use Interrupt pipe to get keys"
+   default n
+   ---help---
+   Use the INTERRUPT IN pipe to get keyboard input reports.
+
 endif
 
 config USBHOST_HIDMOUSE
diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c
index 73d062c8b5..bf622d2b1c 100644
--- a/drivers/usbhost/usbhost_hidkbd.c
+++ b/drivers/usbhost/usbhost_hidkbd.c
@@ -179,7 +179,7 @@ struct usbhost_state_s
 
   struct usbhost_class_s  usbclass;
 
-  /* The remainder of the fields are provide o the keyboard class driver */
+  /* The remainder of the fields are provided to the keyboard class driver */
 
   chardevchar;  /* Character identifying the 
/dev/kbd[n] device */
   volatile bool   disconnected; /* TRUE: Device has been disconnected 
*/
@@ -222,6 +222,21 @@ struct usbhost_state_s
   volatile uint16_t   headndx;  /* Buffer head index */
   volatile uint16_t   tailndx;  /* Buffer tail index */
   uint8_t kbdbuffer[CONFIG_HIDKBD_BUFSIZE];
+
+  FAR uint8_t*ctrlreq;  /* Allocated ctrl request structure */
+  size_t  ctrllen;  /* Size of the allocated control 
buffer */
+  boolcaps_lock;/* Private caps lock status */
+  boolsync_led; /* For LED update */
+  boolempty;/* Keep track of data availability */
+  sem_t   syncsem;  /* Semaphore to wait for a poll thread 
*/
+
+#ifdef CONFIG_HIDKBD_NOGETREPORT
+  struct work_s   rwork;/* For interrupt transfer work */
+  int16_t nbytes;   /* # of bytes actually transferred */
+#endif
+#ifndef CONFIG_HIDKBD_NODEBOUNCE
+  uint8_t lastkey[6];   /* For debouncing */
+#endif
 };
 
 /* This type is used for encoding special characters */
@@ -266,6 +281,20 @@ static inline void usbhost_encodescancode(FAR struct 
usbhost_state_s *priv,
 #endif
 static int  usbhost_kbdpoll(int argc, char *argv[]);
 
+#ifdef CONFIG_HIDKBD_NOGETREPORT
+static void usbhost_kbd_work(FAR void *arg);
+static void usbhost_kbd_callback(FAR void *arg, ssize_t nbytes);
+#endif
+
+static int usbhost_extract_keys(FAR struct usbhost_state_s *priv);
+
+static int usbhost_send_request(FAR struct usbhost_state_s *priv,
+uint8_t dir, uint8_t req, uint16_t value,
+uint16_t index, uint16_t len, uint8_t *data);
+
+static inline bool usbhost_get_capslock(void);
+static inline void usbhost_toggle_capslock(void);
+
 /* Helpers for usbhost_connect() */
 
 static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
@@ -282,6 +311,11 @@ static inline void usbhost_putle16(uint8_t *dest, uint16_t 
val);
 static inline int usbhost_tdalloc(FAR struct usbhost_state_s *priv);
 static inline int usbhost_tdfree(FAR struct usbhost_state_s *priv);
 
+/* Control request memory management */
+
+static int usbhost_cralloc(FAR struct usbhost_state_s *priv);
+static int usbhost_crfree(FAR struct usbhost_state_s *priv);
+
 /* struct usbhost_registry_s methods */
 
 static FAR struct usbhost_class_s *usbhost_create(
@@ -353,10 +387,13 @@ static uint32_t g_devinuse;
 /* The following are used to managed the class creation operation */
 
 static mutex_t g_lock = NXMUTEX_INITIALIZER;
-static sem_t g_syncsem = SEM_INITIALIZER(0);
 static FAR struct usbhost_state_s *g_priv;
 
-/* The following tables map keyboard scan codes to printable ASIC
+/* Global caps lock status */
+
+static bool g_caps_lock = false;
+
+/* The following tables map keyboard scan c

[nuttx] branch master updated (18d196e968 -> 536739d2da)

2023-03-29 Thread acassis
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/nuttx.git


from 18d196e968 usbhost_hidkbd: Add the option to use interrupt transfers.
 add 536739d2da tools: Export LLVM style arch info for non-c language

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/armv6-m/Toolchain.defs  |  4 +-
 arch/arm/src/armv7-a/Toolchain.defs  | 16 +--
 arch/arm/src/armv7-m/Toolchain.defs  | 14 +--
 arch/arm/src/armv7-r/Toolchain.defs  | 14 +--
 arch/arm/src/armv8-m/Toolchain.defs  | 14 ---
 arch/arm/src/common/Toolchain.defs   |  8 ++--
 arch/risc-v/src/common/Toolchain.defs| 14 ---
 boards/sim/sim/sim/scripts/Make.defs |  5 +--
 libs/libc/stdlib/Make.defs => tools/Zig.defs | 62 +---
 9 files changed, 106 insertions(+), 45 deletions(-)
 copy libs/libc/stdlib/Make.defs => tools/Zig.defs (50%)



[GitHub] [nuttx] acassis merged pull request #8916: tools: Export LLVM style arch info for non-c language

2023-03-29 Thread via GitHub


acassis merged PR #8916:
URL: https://github.com/apache/nuttx/pull/8916


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] anchao commented on a diff in pull request #8862: syscall/libc: add more syscall/libc symbols into csv file

2023-03-29 Thread via GitHub


anchao commented on code in PR #8862:
URL: https://github.com/apache/nuttx/pull/8862#discussion_r1151888586


##
include/stdlib.h:
##
@@ -286,6 +286,11 @@ FAR void  *bsearch(FAR const void *key, FAR const void 
*base, size_t nel,
 
 FAR const char *getprogname(void);
 
+/* Registers a destructor function to be called by exit() */
+
+int __cxa_atexit(CODE void (*func)(FAR void *), FAR void *arg,

Review Comment:
   But currently __cxa_atexit is implemented in libs/libc/stdlib/lib_atexit.c, 
__cxa_atexit is related to the NuttX system, In terms of the current directory 
structure stdlib.h is a more suitable location.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8862: syscall/libc: add more syscall/libc symbols into csv file

2023-03-29 Thread via GitHub


pkarashchenko commented on code in PR #8862:
URL: https://github.com/apache/nuttx/pull/8862#discussion_r1151891967


##
include/stdlib.h:
##
@@ -286,6 +286,11 @@ FAR void  *bsearch(FAR const void *key, FAR const void 
*base, size_t nel,
 
 FAR const char *getprogname(void);
 
+/* Registers a destructor function to be called by exit() */
+
+int __cxa_atexit(CODE void (*func)(FAR void *), FAR void *arg,

Review Comment:
   Ok. Let's keep it for now in stdlib.h and refine in the future



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on pull request #8862: syscall/libc: add more syscall/libc symbols into csv file

2023-03-29 Thread via GitHub


pkarashchenko commented on PR #8862:
URL: https://github.com/apache/nuttx/pull/8862#issuecomment-1488542314

   @acassis please review and merge if no more comments


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (536739d2da -> 01b0305ab5)

2023-03-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 536739d2da tools: Export LLVM style arch info for non-c language
 add 01b0305ab5 risc-v: SV32 MMU support for qemu-rv.

No new revisions were added by this update.

Summary of changes:
 arch/risc-v/Kconfig|  5 ++
 arch/risc-v/include/arch.h |  2 +
 arch/risc-v/src/common/riscv_mmu.c |  5 ++
 arch/risc-v/src/common/riscv_mmu.h | 86 
 arch/risc-v/src/qemu-rv/qemu_rv_mm_init.c  | 92 --
 boards/risc-v/qemu-rv/rv-virt/README.txt   |  7 +-
 .../rv-virt/configs/{knsh64 => knsh32}/defconfig   | 22 ++
 boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs|  6 +-
 .../{ld-kernel.script => ld-kernel32.script}   | 20 ++---
 .../{ld-kernel.script => ld-kernel64.script}   |  0
 libs/libc/machine/risc-v/arch_elf.c| 14 
 11 files changed, 177 insertions(+), 82 deletions(-)
 copy boards/risc-v/qemu-rv/rv-virt/configs/{knsh64 => knsh32}/defconfig (84%)
 copy boards/risc-v/qemu-rv/rv-virt/scripts/{ld-kernel.script => 
ld-kernel32.script} (94%)
 rename boards/risc-v/qemu-rv/rv-virt/scripts/{ld-kernel.script => 
ld-kernel64.script} (100%)



[GitHub] [nuttx] masayuki2009 merged pull request #8643: risc-v: SV32 MMU support for qemu-rv

2023-03-29 Thread via GitHub


masayuki2009 merged PR #8643:
URL: https://github.com/apache/nuttx/pull/8643


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] acassis merged pull request #8918: sched/sem_waitirq: Fix semaphore wait interruption when MMU is in use

2023-03-29 Thread via GitHub


acassis merged PR #8918:
URL: https://github.com/apache/nuttx/pull/8918


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] 01/02: arch/risc-v: Set Supervisor User Memory (access) for idle process too

2023-03-29 Thread acassis
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/nuttx.git

commit fc44cbdbdbdf76fb75e7ad39d20e8b86e1f3c691
Author: Ville Juven 
AuthorDate: Tue Mar 28 13:57:08 2023 +0300

arch/risc-v: Set Supervisor User Memory (access) for idle process too

This has been a long issue for me as it results in random crashes when
asynchronous events occur when the idle process is active.

The problem is that the kernel cannot access user memory, because the CPU
status prevents it.
---
 arch/risc-v/src/common/riscv_getnewintctx.c | 9 +
 arch/risc-v/src/common/riscv_initialstate.c | 4 
 arch/risc-v/src/common/riscv_internal.h | 1 +
 3 files changed, 14 insertions(+)

diff --git a/arch/risc-v/src/common/riscv_getnewintctx.c 
b/arch/risc-v/src/common/riscv_getnewintctx.c
index f1fa4cf3de..2588ff2841 100644
--- a/arch/risc-v/src/common/riscv_getnewintctx.c
+++ b/arch/risc-v/src/common/riscv_getnewintctx.c
@@ -70,3 +70,12 @@ uintptr_t riscv_get_newintctx(void)
 #endif
   );
 }
+
+void riscv_set_idleintctx(void)
+{
+  /* Set SUM for idle process if needed */
+
+#ifdef CONFIG_ARCH_USE_MMU
+  SET_CSR(CSR_STATUS, STATUS_SUM);
+#endif
+}
diff --git a/arch/risc-v/src/common/riscv_initialstate.c 
b/arch/risc-v/src/common/riscv_initialstate.c
index 3c2b5f00e7..802c2103d7 100644
--- a/arch/risc-v/src/common/riscv_initialstate.c
+++ b/arch/risc-v/src/common/riscv_initialstate.c
@@ -78,6 +78,10 @@ void up_initial_state(struct tcb_s *tcb)
 
   riscv_stack_color(tcb->stack_alloc_ptr, 0);
 #endif /* CONFIG_STACK_COLORATION */
+
+  /* Set idle process' initial interrupt context */
+
+  riscv_set_idleintctx();
   return;
 }
 
diff --git a/arch/risc-v/src/common/riscv_internal.h 
b/arch/risc-v/src/common/riscv_internal.h
index fbfa3f12fa..a6602b06aa 100644
--- a/arch/risc-v/src/common/riscv_internal.h
+++ b/arch/risc-v/src/common/riscv_internal.h
@@ -200,6 +200,7 @@ void riscv_copystate(uintptr_t *dest, uintptr_t *src);
 void riscv_sigdeliver(void);
 int riscv_swint(int irq, void *context, void *arg);
 uintptr_t riscv_get_newintctx(void);
+void riscv_set_idleintctx(void);
 void riscv_exception_attach(void);
 
 #ifdef CONFIG_ARCH_FPU



[nuttx] branch master updated (01b0305ab5 -> f468371332)

2023-03-29 Thread acassis
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/nuttx.git


from 01b0305ab5 risc-v: SV32 MMU support for qemu-rv.
 new fc44cbdbdb arch/risc-v: Set Supervisor User Memory (access) for idle 
process too
 new f468371332 sched/sem_waitirq: Swap user mappings to MMU when releasing 
semaphore

The 2 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/risc-v/src/common/riscv_getnewintctx.c |  9 +
 arch/risc-v/src/common/riscv_initialstate.c |  4 
 arch/risc-v/src/common/riscv_internal.h |  1 +
 sched/semaphore/sem_waitirq.c   | 15 +++
 4 files changed, 29 insertions(+)



[nuttx] 02/02: sched/sem_waitirq: Swap user mappings to MMU when releasing semaphore

2023-03-29 Thread acassis
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/nuttx.git

commit f4683713327aaeab0656e3ea83814b44267bdc4a
Author: Ville Juven 
AuthorDate: Tue Mar 28 13:58:31 2023 +0300

sched/sem_waitirq: Swap user mappings to MMU when releasing semaphore

sem_t is user memory and the correct mappings are needed to perform
the semaphore wait interruption.

Otherwise either a page fault, or access to the WRONG address environment
happens.
---
 sched/semaphore/sem_waitirq.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/sched/semaphore/sem_waitirq.c b/sched/semaphore/sem_waitirq.c
index 2f0a0d8f54..7d69029010 100644
--- a/sched/semaphore/sem_waitirq.c
+++ b/sched/semaphore/sem_waitirq.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -71,6 +72,13 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
   FAR struct tcb_s *rtcb = this_task();
   FAR sem_t *sem = wtcb->waitobj;
 
+#ifdef CONFIG_ARCH_ADDRENV
+  if (wtcb->addrenv_own)
+{
+  addrenv_select(wtcb->addrenv_own);
+}
+#endif
+
   /* It is possible that an interrupt/context switch beat us to the punch
* and already changed the task's state.
*/
@@ -95,6 +103,13 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
 
   dq_rem((FAR dq_entry_t *)wtcb, SEM_WAITLIST(sem));
 
+#ifdef CONFIG_ARCH_ADDRENV
+  if (wtcb->addrenv_own)
+{
+  addrenv_restore();
+}
+#endif
+
   /* Indicate that the wait is over. */
 
   wtcb->waitobj = NULL;



[GitHub] [nuttx] fxysunshine opened a new pull request, #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


fxysunshine opened a new pull request, #8924:
URL: https://github.com/apache/nuttx/pull/8924

   
   ## Summary
   builtin apps so as to isolate or share something for each other, for example 
permisson or user data.
   
   ## Impact
   none if no any setting for builtin apps
   
   ## Testing
   sim:nsh with CONFIG_SCHED_USER_IDENTITY=y
   So getuid syscall will return the confiured uid. It is usefull for a lib 
loaded by different app, but need isolate user data for each other. We also 
need a pull later to configure uid.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152018690


##
include/nuttx/binfmt/binfmt.h:
##
@@ -97,6 +97,7 @@ struct binary_s
 
   uint8_t priority;/* Task execution priority */
   size_t stacksize;/* Size of the stack in bytes 
(unallocated) */
+  uid_t proguid;   /* User identity */

Review Comment:
   How does this proguid get set?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152032179


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   Shouldn't the UID be inherited from the parent when the the builtin app is 
started?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152033729


##
binfmt/builtin.c:
##
@@ -106,6 +106,8 @@ static int builtin_loadbinary(FAR struct binary_s *binp,
   binp->entrypt   = builtin->main;
   binp->stacksize = builtin->stacksize;
   binp->priority  = builtin->priority;
+  binp->proguid   = builtin->proguid;
+

Review Comment:
   Same question:  Shouldn't the UID come from the UID of the parent?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152035309


##
sched/Kconfig:
##
@@ -622,6 +622,12 @@ config SCHED_THREAD_LOCAL
This option enables architecture-specific TLS support 
(__thread/thread_local keyword)
Note: Toolchain must be compiled with '--enable-tls' enabled
 
+config UID_DEFAULT

Review Comment:
   Where is CONFIG_UID_DEFAULT used?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] fxysunshine opened a new pull request, #1691: apps: add default uid for builtin app

2023-03-29 Thread via GitHub


fxysunshine opened a new pull request, #1691:
URL: https://github.com/apache/nuttx-apps/pull/1691

   
   ## Summary
   builtin apps so as to isolate or share something for each other, for example 
permisson or user data.
   
   ## Impact
   
   That pull is followed by https://github.com/apache/nuttx/pull/8924
   And depend on 8924 is merged.
   ## Testing
   sim:nsh with CONFIG_SCHED_USER_IDENTITY=y
   So getuid syscall will return the confiured uid. It is usefull for a lib 
loaded by different app, but need isolate user data for each other.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on issue #8917: nxsem_wait_irq with MMU

2023-03-29 Thread via GitHub


patacongo commented on issue #8917:
URL: https://github.com/apache/nuttx/issues/8917#issuecomment-1488747711

   Another option would be logic that finds the kernel space virtual address 
associated with the user space virtual address.  That would assume that the 
entire address space is addressable in kernel mode.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] fxysunshine commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


fxysunshine commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152051414


##
include/nuttx/binfmt/binfmt.h:
##
@@ -97,6 +97,7 @@ struct binary_s
 
   uint8_t priority;/* Task execution priority */
   size_t stacksize;/* Size of the stack in bytes 
(unallocated) */
+  uid_t proguid;   /* User identity */

Review Comment:
   The apps side commit need follow.
   https://github.com/apache/nuttx-apps/pull/1691/



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] fxysunshine commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


fxysunshine commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152063032


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   I think that is depended on the fork and setuid policy from app. But we can 
set a default UID when task is creating.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] fxysunshine commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


fxysunshine commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152068437


##
sched/Kconfig:
##
@@ -622,6 +622,12 @@ config SCHED_THREAD_LOCAL
This option enables architecture-specific TLS support 
(__thread/thread_local keyword)
Note: Toolchain must be compiled with '--enable-tls' enabled
 
+config UID_DEFAULT

Review Comment:
   
   used by builtin apps side if not configured.
   https://github.com/apache/nuttx-apps/pull/1691



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on issue #8917: nxsem_wait_irq with MMU

2023-03-29 Thread via GitHub


pussuw commented on issue #8917:
URL: https://github.com/apache/nuttx/issues/8917#issuecomment-1488805778

   Thanks for the response!
   
   Those APIs are known to me but as far as I can tell they either rely on the 
correct mappings already being active or on mm_struct and vm_area_struct (which 
we don't quite have, yet), which contain the necessary info to find the 
physical page.
   
   The solution I posted is already merged and does of course work, there is 
just a tiny performance penalty via losing the entire TLB instead of just 
losing 1 page. 
   
   I was trying to think of alternate solutions to the problem, like releasing 
the semaphore from the user process instead (in sem_wait() after the context 
switch when the correct mappings are present) but the problem is that updating 
the task status LUT becomes impossible, as `dq_rem((FAR dq_entry_t *)wtcb, 
SEM_WAITLIST(sem));` needs access to sem->waitlist to move the task into the 
ready-to-run list.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on issue #8917: nxsem_wait_irq with MMU

2023-03-29 Thread via GitHub


pussuw commented on issue #8917:
URL: https://github.com/apache/nuttx/issues/8917#issuecomment-1488812379

   The inner workings of those copy_from/to_user are basically handling the 
access rights from/to user space. Normally the kernel cannot access the user's 
memory and those functions are used to wrap the operation:
   
   - open access to user
   - read/write to user
   - close access to user
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152168433


##
sched/Kconfig:
##
@@ -622,6 +622,12 @@ config SCHED_THREAD_LOCAL
This option enables architecture-specific TLS support 
(__thread/thread_local keyword)
Note: Toolchain must be compiled with '--enable-tls' enabled
 
+config UID_DEFAULT

Review Comment:
   > used by builtin apps side if not configured.
   
   If it effects apps/ (which are optional), then it should not be in an OS 
Kconfig file.  It should be an an apps/ Kconfig file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   Everything I have read states that the UID should be the UID of the parent.  
setuid() should be able to change the UID.
   
   In Unix systems there is an effective UID (euid) and a real UID (ruid).  
Both are inherited from the parent.  The child can change is effective UID but 
not its real UID.
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152032179


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   Shouldn't the UID be inherited from the parent when the the executable 
module is started?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   Everything I have read states that the UID should be the UID of the parent.  
setuid() should be able to change the UID.
   
   NuttX currently sets the user and group IDs of normally created tasks to the 
IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think a different policy for executable modules would be a bad idea.
   
   In Unix systems there is an effective UID (euid) and a real UID (ruid).  
Both are inherited from the parent.  The unprivileged child can change is 
effective UID but not its real UID.
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152195979


##
binfmt/builtin.c:
##
@@ -106,6 +106,8 @@ static int builtin_loadbinary(FAR struct binary_s *binp,
   binp->entrypt   = builtin->main;
   binp->stacksize = builtin->stacksize;
   binp->priority  = builtin->priority;
+  binp->proguid   = builtin->proguid;
+

Review Comment:
   It seems to me that proguid is not really used by the OS.  It just a holder. 
 It is part of application logic and, hence, does not belong deep inside the 
OS.  We do not, in general, support internal OS changes to support 
application-specific things.
   
   I would suggest that you use TLS to support and thread-specific information 
that you might want to retain.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8916: tools: Export LLVM style arch info for non-c language

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on code in PR #8916:
URL: https://github.com/apache/nuttx/pull/8916#discussion_r1152233441


##
tools/Zig.defs:
##
@@ -0,0 +1,69 @@
+
+# tools/Zig.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+
+
+ZIG := zig
+
+ifeq ($(CONFIG_ARCH_RISCV),y)

Review Comment:
   why still check arch here?



##
arch/arm/src/armv7-m/Toolchain.defs:
##
@@ -24,40 +24,48 @@ ifeq ($(CONFIG_ARCH_CORTEXM4),y)
   TOOLCHAIN_ARM7EM   := y
   TOOLCHAIN_MTUNE:= -mtune=cortex-m4
   TOOLCHAIN_MARCH:= -march=armv7e-m
+  LLVM_CPUTYPE   := cortex-m4
   ifeq ($(CONFIG_ARCH_FPU),y)
 TOOLCHAIN_MFLOAT := -mfpu=fpv4-sp-d16
   endif
-  ZARCHCPUFLAGS := -mcpu=cortex_m4
 else ifeq ($(CONFIG_ARCH_CORTEXM7),y)
   TOOLCHAIN_ARM7EM   := y
   TOOLCHAIN_MTUNE:= -mtune=cortex-m7
   TOOLCHAIN_MARCH:= -march=armv7e-m
+  LLVM_CPUTYPE   := cortex-m7
   ifeq ($(CONFIG_ARCH_FPU),y)
 ifeq ($(CONFIG_ARCH_DPFPU),y)
   TOOLCHAIN_MFLOAT := -mfpu=fpv5-d16
 else
   TOOLCHAIN_MFLOAT := -mfpu=fpv5-sp-d16
 endif
   endif
-  ZARCHCPUFLAGS := -mcpu=cortex_m7
 else # ifeq ($(CONFIG_ARCH_CORTEXM3),y)
   TOOLCHAIN_ARM7EM   := n
   TOOLCHAIN_MTUNE:= -mtune=cortex-m3
   TOOLCHAIN_MARCH:= -march=armv7-m
   TOOLCHAIN_MFLOAT   := -mfloat-abi=soft
-  ZARCHCPUFLAGS  := -mcpu=cortex_m3
+  LLVM_CPUTYPE   := cortex-m3
 endif
 
 ifeq ($(CONFIG_ARCH_FPU),y)
+  LLVM_ABITYPE := eabihf
   ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)
 TOOLCHAIN_MFLOAT += -mfloat-abi=softfp
   else
 TOOLCHAIN_MFLOAT += -mfloat-abi=hard
   endif
 else
+  LLVM_ABITYPE  := eabi

Review Comment:
   LLVM_ABITYPE := eabi



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8921: usbhost_hidkbd: Add the option to use interrupt transfers.

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on code in PR #8921:
URL: https://github.com/apache/nuttx/pull/8921#discussion_r1152244784


##
drivers/usbhost/usbhost_hidkbd.c:
##
@@ -353,10 +387,13 @@ static uint32_t g_devinuse;
 /* The following are used to managed the class creation operation */
 
 static mutex_t g_lock = NXMUTEX_INITIALIZER;
-static sem_t g_syncsem = SEM_INITIALIZER(0);
 static FAR struct usbhost_state_s *g_priv;
 
-/* The following tables map keyboard scan codes to printable ASIC
+/* Global caps lock status */
+
+static bool g_caps_lock = false;

Review Comment:
   why not save g_caps_lock to usbhost_state_s?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   Everything I have read states that the UID should be the UID of the parent.  
setuid() should be able to change the UID.
   
   NuttX currently sets the user and group IDs of normally created tasks to the 
IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   In Unix systems there is an effective UID (euid) and a real UID (ruid).  
Both are inherited from the parent.  The unprivileged child can change is 
effective UID but not its real UID.
   
   When running executable files on a file system, the behavior is different 
depending on the state of ST_NOSUID permission bit on the file.
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8922: eMMC driver support

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on code in PR #8922:
URL: https://github.com/apache/nuttx/pull/8922#discussion_r1152243523


##
drivers/mmcsd/mmcsd_sdio.h:
##
@@ -41,11 +68,11 @@
 
 #define MMCSD_CMD8VOLTAGE_SHIFT (8)/* Bits 8-11: 
Supply voltage */
 #define MMCSD_CMD8VOLTAGE_MASK  ((uint32_t)0x0f << MMCSD_CMD8VOLTAGE_SHIFT)
-#  define MMCSD_CMD8VOLTAGE_27  ((uint32_t)0x01 << 
MMCSD_CMD8VOLTAGE_SHIFT) /* 2.7-3.6V */
+#define MMCSD_CMD8VOLTAGE_27((uint32_t)0x01 << 
MMCSD_CMD8VOLTAGE_SHIFT) /* 2.7-3.6V */
 
 #define MMCSD_CMD8ECHO_SHIFT(0)/* Bits 0-7: Check 
pattern */
 #define MMCSD_CMD8ECHO_MASK ((uint32_t)0xff << MMCSD_CMD8ECHO_SHIFT)
-#  define MMCSD_CMD8CHECKPATTERN((uint32_t)0xaa << MMCSD_CMD8ECHO_SHIFT)

Review Comment:
   why remove the Indentation?



##
drivers/mmcsd/mmcsd_sdio.h:
##
@@ -32,6 +32,33 @@
  * Pre-processor Definitions
  /
 
+/* CMD6 (MMC_SWITCH) argument
+ * MMC_SWITCH argument format:
+ *
+ *  [31:26] Always 0
+ *  [25:24] Access Mode
+ *  [23:16] Location of target Byte in EXT_CSD
+ *  [15:08] Value Byte
+ *  [07:03] Always 0
+ *  [02:00] Command Set
+ */
+#define MMCSD_CMD6_BUSWIDTH_RWSHIFT (16) 
+#define MMCSD_CMD6_BUSWIDTH_RW  ((uint32_t)0xb7 << 
MMCSD_CMD6_BUSWIDTH_RWSHIFT)  /* R/W */
+
+#define MMCSD_CMD6_WRITE_BYTE_SHIFT (24)
+
+#define MMCSD_CMD6_MODE_CMD_SET ((uint32_t)0x00 << 
MMCSD_CMD6_WRITE_BYTE_SHIFT)  /* Change the command set */

Review Comment:
   add intent



##
drivers/mmcsd/mmcsd_sdio.h:
##
@@ -32,6 +32,33 @@
  * Pre-processor Definitions
  /
 
+/* CMD6 (MMC_SWITCH) argument
+ * MMC_SWITCH argument format:
+ *
+ *  [31:26] Always 0
+ *  [25:24] Access Mode
+ *  [23:16] Location of target Byte in EXT_CSD
+ *  [15:08] Value Byte
+ *  [07:03] Always 0
+ *  [02:00] Command Set
+ */
+#define MMCSD_CMD6_BUSWIDTH_RWSHIFT (16) 
+#define MMCSD_CMD6_BUSWIDTH_RW  ((uint32_t)0xb7 << 
MMCSD_CMD6_BUSWIDTH_RWSHIFT)  /* R/W */

Review Comment:
   add intent



##
drivers/mmcsd/mmcsd_sdio.h:
##
@@ -32,6 +32,33 @@
  * Pre-processor Definitions
  /
 
+/* CMD6 (MMC_SWITCH) argument
+ * MMC_SWITCH argument format:
+ *
+ *  [31:26] Always 0
+ *  [25:24] Access Mode
+ *  [23:16] Location of target Byte in EXT_CSD
+ *  [15:08] Value Byte
+ *  [07:03] Always 0
+ *  [02:00] Command Set
+ */
+#define MMCSD_CMD6_BUSWIDTH_RWSHIFT (16) 
+#define MMCSD_CMD6_BUSWIDTH_RW  ((uint32_t)0xb7 << 
MMCSD_CMD6_BUSWIDTH_RWSHIFT)  /* R/W */
+
+#define MMCSD_CMD6_WRITE_BYTE_SHIFT (24)
+
+#define MMCSD_CMD6_MODE_CMD_SET ((uint32_t)0x00 << 
MMCSD_CMD6_WRITE_BYTE_SHIFT)  /* Change the command set */
+#define MMCSD_CMD6_MODE_SET_BITS((uint32_t)0x01 << 
MMCSD_CMD6_WRITE_BYTE_SHIFT)  /* Set bits which are 1 in value */
+#define MMCSD_CMD6_MODE_CLEAR_BITS  ((uint32_t)0x02 << 
MMCSD_CMD6_WRITE_BYTE_SHIFT)  /* Clear bits which are 1 in value */
+#define MMCSD_CMD6_MODE_WRITE_BYTE  ((uint32_t)0x03 << 
MMCSD_CMD6_WRITE_BYTE_SHIFT)  /* Set target to value */
+
+#define MMCSD_CMD6_BUS_WIDTH_SHIFT  (8)
+#define MMCSD_CMD6_BUS_WIDTH_1  ((uint32_t)0x00 << 
MMCSD_CMD6_BUS_WIDTH_SHIFT)  /* Card is in 1 bit mode */

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   Everything I have read states that the UID should be the UID of the parent.  
setuid() should be able to change the UID.
   
   NuttX currently sets the user and group IDs of normally created tasks to the 
IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   In Unix systems there is an effective UID (euid) and a real UID (ruid).  
Both are inherited from the parent.  The unprivileged child can change is 
effective UID but not its real UID.
   
   When running executable files on a file system, the behavior differs 
depending on the state of ST_NOSUID permission bit on the file.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   NuttX currently sets the user and group IDs of  "normally" created tasks to 
the IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   When running executable files on a file system, the POSIX behavior differs 
depending on the state of ST_NOSUID permission bit on the file.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] xiaoxiang781216 commented on pull request #8922: eMMC driver support

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on PR #8922:
URL: https://github.com/apache/nuttx/pull/8922#issuecomment-1488999387

   @radek-pesina please squash your change into one patch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152195979


##
binfmt/builtin.c:
##
@@ -106,6 +106,8 @@ static int builtin_loadbinary(FAR struct binary_s *binp,
   binp->entrypt   = builtin->main;
   binp->stacksize = builtin->stacksize;
   binp->priority  = builtin->priority;
+  binp->proguid   = builtin->proguid;
+

Review Comment:
   It seems to me that proguid is not really used by the OS.  It just a holder. 
 It is part of application logic and, hence, does not belong deep inside the 
OS.  We do not, in general, support internal OS changes to support 
application-specific things.
   
   I would suggest that you use TLS to support and thread-specific information 
that you might want to retain.
   
   If you are trying to emulate ST_NOSUID behaviors, then should the group ID 
also be set to match the emulated file identification?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152195979


##
binfmt/builtin.c:
##
@@ -106,6 +106,8 @@ static int builtin_loadbinary(FAR struct binary_s *binp,
   binp->entrypt   = builtin->main;
   binp->stacksize = builtin->stacksize;
   binp->priority  = builtin->priority;
+  binp->proguid   = builtin->proguid;
+

Review Comment:
   It looks like proguid is not really used by the OS.  It just a holder.  It 
is part of application logic and, hence, does not belong deep inside the OS.  
We do not, in general, support internal OS changes to support 
application-specific things.
   
   If you just need thread-specific storage, I would suggest that you use TLS 
to support and thread-specific information that you might want to retain.
   
   If you are trying to emulate ST_NOSUID behaviors, then should the group ID 
also be set to match the emulated file identification?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152195979


##
binfmt/builtin.c:
##
@@ -106,6 +106,8 @@ static int builtin_loadbinary(FAR struct binary_s *binp,
   binp->entrypt   = builtin->main;
   binp->stacksize = builtin->stacksize;
   binp->priority  = builtin->priority;
+  binp->proguid   = builtin->proguid;
+

Review Comment:
   It looks like proguid is not really used by the OS.  It just a holder.  It 
is part of application logic and, hence, does not belong deep inside the OS.  
We do not, in general, support internal OS changes to support 
application-specific things.
   
   If you just need thread-specific storage, I would suggest that you use TLS 
to support and thread-specific information that you might want to retain.
   
   If you are trying to emulate ST_NOSUID behaviors, then should the group ID 
also be set to match the emulated file identification?  @xiaoxiang781216 We 
should have a discussion and determine the best way to this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] xiaoxiang781216 commented on pull request #8247: tools/ci: Update docker to ubuntu 22.04

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on PR #8247:
URL: https://github.com/apache/nuttx/pull/8247#issuecomment-1489030302

   > > but not good to simulator.
   > 
   > @xiaoxiang781216 what do you mean?
   
   I mean it isn't good to limit Ubuntu to 20.04(can't upgrade to 22.04) just 
because Renesas gcc toolchain can't pass the build in 22.04. 
   
   > Do we used simulation of Renesas? 
   
   No.
   
   > Or you are talking that Renesas boards will be restricted to use C++ 
because of GCC version?
   
   Yes, since Renesas just provide gcc with 8.3.0, it's reasonable that some 
new c++ feature can't pass the build for Renesas boards.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] xiaoxiang781216 commented on pull request #8247: tools/ci: Update docker to ubuntu 22.04

2023-03-29 Thread via GitHub


xiaoxiang781216 commented on PR #8247:
URL: https://github.com/apache/nuttx/pull/8247#issuecomment-1489031748

   Anyway, I try to upgrade the final image to Ubuntu 22.04, but build all 
toolchain with 20.04. Let's see what's happen.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   NuttX currently sets the user and group IDs of  "normally" created tasks to 
the IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   When running executable files on a file system, the POSIX behavior differs 
depending on the state of ST_NOSUID mount flags on the volume.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   NuttX currently sets the user and group IDs of  "normally" created tasks to 
the IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   When running executable files on a file system, the POSIX behavior differs 
depending on the state of ST_NOSUID mount flags on the volume.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   If  ST_NOSUID is set on the mounted file system AND the set-user-ID bit is 
set in the file permissions, then the user and group IDs of the file are used.  
Otherwise, the user and group IDs are are inherited from the parent.  That is 
my understanding of the POSIX requirement.
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   
   The POSIX requirement is given in 
https://pubs.opengroup.org/onlinepubs/007904875/functions/exec.html (among 
other places at OpenGroup.org):
   
   > If the ST_NOSUID bit is set for the file system containing the new process 
image file, then the effective user ID, effective group ID, saved set-user-ID, 
and saved set-group-ID are unchanged in the new process image.
   
   If the file system was mounted with the ST_NOSUID f_flag, then the file 
inherits the user and group IDs from the parent:  That is, the fork duplicates 
the those IDs and loading the file system image does not change them.
   
   > Otherwise, if the set-user-ID mode bit of the new process image file is 
set, the effective user ID of the new process image shall be set to the user ID 
of the new process image file.
   
   If the file system foes not include ST_NOSUID in f_flags, then be behavior 
is determined by the set-user-ID bits in the file permissions:  If the 
set-user-ID bit is set, the the user and group ID is set to the user and group 
ID of the file.
   
   The group ID works basically the same:
   
   > Similarly, if the set-group-ID mode bit of the new process image file is 
set, the effective group ID of the new process image shall be set to the group 
ID of the new process image file. The real user ID, real group ID, and 
supplementary group IDs of the new process image shall remain the same as those 
of the calling process image. The effective user ID and effective group ID of 
the new process image shall be saved (as the saved set-user-ID and the saved 
set-group-ID) for use by setuid().
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152195979


##
binfmt/builtin.c:
##
@@ -106,6 +106,8 @@ static int builtin_loadbinary(FAR struct binary_s *binp,
   binp->entrypt   = builtin->main;
   binp->stacksize = builtin->stacksize;
   binp->priority  = builtin->priority;
+  binp->proguid   = builtin->proguid;
+

Review Comment:
   It looks like proguid is not really used by the OS.  It just a holder.  It 
is part of application logic and, hence, does not belong deep inside the OS.  
We do not, in general, support internal OS changes to support 
application-specific things.
   
   If you just need thread-specific storage, I would suggest that you use TLS 
to support and thread-specific information that you might want to retain.
   
   If you are trying to emulate ST_NOSUID behaviors, then should the group ID 
also be set to match the emulated file identification?  @xiaoxiang781216 We 
should have a discussion and determine the best way to this.  I feel pretty 
strongly that we need to follow POSIX requirements and not do anything _ad hoc_ 
here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   NuttX currently sets the user and group IDs of  "normally" created tasks to 
the IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   When running executable files on a file system, the POSIX behavior differs 
depending on the state of ST_NOSUID mount flags on the volume.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   If  ST_NOSUID is set on the mounted file system AND the set-user-ID bit is 
set in the file permissions, then the user and group IDs of the file are used.  
Otherwise, the user and group IDs are are inherited from the parent.  That is 
my understanding of the POSIX requirement.
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   
   The POSIX requirement is given in 
https://pubs.opengroup.org/onlinepubs/007904875/functions/exec.html (among 
other places at OpenGroup.org):
   
   > If the ST_NOSUID bit is set for the file system containing the new process 
image file, then the effective user ID, effective group ID, saved set-user-ID, 
and saved set-group-ID are unchanged in the new process image.
   
   If the file system was mounted with the ST_NOSUID f_flag, then the file 
inherits the user and group IDs from the parent:  That is, the fork duplicates 
the those IDs and loading the file system image does not change them.
   
   > Otherwise, if the set-user-ID mode bit of the new process image file is 
set, the effective user ID of the new process image shall be set to the user ID 
of the new process image file.
   
   If the file system foes not include ST_NOSUID in f_flags, then be behavior 
is determined by the set-user-ID bits in the file permissions:  If the 
set-user-ID bit is set, the the user and group ID is set to the user and group 
ID of the file.
   
   _[I am not aware of any file system supported by NuttX that supports the 
set-user-ID or set-group-ID permission bits.  Linux does not support these 
permission bits either. ]_
   
   The group ID works basically the same:
   
   > Similarly, if the set-group-ID mode bit of the new process image file is 
set, the effective group ID of the new process image shall be set to the group 
ID of the new process image file. The real user ID, real group ID, and 
supplementary group IDs of the new process image shall remain the same as those 
of the calling process image. The effective user ID and effective group ID of 
the new process image shall be saved (as the saved set-user-ID and the saved 
set-group-ID) for use by setuid().
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   NuttX currently sets the user and group IDs of  "normally" created tasks to 
the IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   When running executable files on a file system, the POSIX behavior differs 
depending on the state of ST_NOSUID mount flags on the volume.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   If  ST_NOSUID is set on the mounted file system AND the set-user-ID bit is 
set in the file permissions, then the user and group IDs of the file are used.  
Otherwise, the user and group IDs are are inherited from the parent.  That is 
my understanding of the POSIX requirement.
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   
   The POSIX requirement is given in 
https://pubs.opengroup.org/onlinepubs/007904875/functions/exec.html (among 
other places at OpenGroup.org):
   
   > If the ST_NOSUID bit is set for the file system containing the new process 
image file, then the effective user ID, effective group ID, saved set-user-ID, 
and saved set-group-ID are unchanged in the new process image.
   
   If the file system was mounted with the ST_NOSUID f_flag, then the file 
inherits the user and group IDs from the parent:  That is, the fork duplicates 
the those IDs and loading the file system image does not change them.
   
   > Otherwise, if the set-user-ID mode bit of the new process image file is 
set, the effective user ID of the new process image shall be set to the user ID 
of the new process image file.
   
   If the file system foes not include ST_NOSUID in f_flags, then be behavior 
is determined by the set-user-ID bits in the file permissions:  If the 
set-user-ID bit is set, the the user and group ID is set to the user and group 
ID of the file.
   
   _[I am not aware of any file system supported by NuttX that supports the 
set-user-ID or set-group-ID permission bits.  Linux does not support these 
permission bits either, probably because it is a gaping security hole. ]_
   
   The group ID works basically the same:
   
   > Similarly, if the set-group-ID mode bit of the new process image file is 
set, the effective group ID of the new process image shall be set to the group 
ID of the new process image file. The real user ID, real group ID, and 
supplementary group IDs of the new process image shall remain the same as those 
of the calling process image. The effective user ID and effective group ID of 
the new process image shall be saved (as the saved set-user-ID and the saved 
set-group-ID) for use by setuid().
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] ldube commented on a diff in pull request #8921: usbhost_hidkbd: Add the option to use interrupt transfers.

2023-03-29 Thread via GitHub


ldube commented on code in PR #8921:
URL: https://github.com/apache/nuttx/pull/8921#discussion_r1152377489


##
drivers/usbhost/usbhost_hidkbd.c:
##
@@ -353,10 +387,13 @@ static uint32_t g_devinuse;
 /* The following are used to managed the class creation operation */
 
 static mutex_t g_lock = NXMUTEX_INITIALIZER;
-static sem_t g_syncsem = SEM_INITIALIZER(0);
 static FAR struct usbhost_state_s *g_priv;
 
-/* The following tables map keyboard scan codes to printable ASIC
+/* Global caps lock status */
+
+static bool g_caps_lock = false;

Review Comment:
   Because more than one keyboard can be active at the same time.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] acassis opened a new pull request, #8925: esp32s3: Add esp32s3-meadow board

2023-03-29 Thread via GitHub


acassis opened a new pull request, #8925:
URL: https://github.com/apache/nuttx/pull/8925

   ## Summary
   Add esp32s3-meadow board
   ## Impact
   Users will be able to NuttX on this board
   ## Testing
   ESP32S3-Meadow
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152177168


##
binfmt/binfmt_execmodule.c:
##
@@ -266,6 +266,10 @@ int exec_module(FAR struct binary_s *binp,
 
   pid = tcb->cmn.pid;
 
+#ifdef CONFIG_SCHED_USER_IDENTITY
+  tcb->cmn.group->tg_uid = binp->proguid;

Review Comment:
   > I think that is depended on the fork and setuid policy from app. But we 
can set a default UID when task is creating.
   
   NuttX currently sets the user and group IDs of  "normally" created tasks to 
the IDs of the parent:  
https://github.com/apache/nuttx/blob/master/sched/group/group_create.c#L91  I 
think an inconsistent policy for executable modules would be a bad idea.
   
   When running executable files on a file system, the POSIX behavior differs 
depending on the state of ST_NOSUID mount flags on the volume.  Are you trying 
to emulate setting the UID from the UID in the executable file permissions?
   
   If  ST_NOSUID is set on the mounted file system AND the set-user-ID bit is 
set in the file permissions, then the user and group IDs of the file are used.  
Otherwise, the user and group IDs are are inherited from the parent.  That is 
my understanding of the POSIX requirement.
   
   I certainly think we as a project need to agree on this policy before we 
commit to it.  This has long term implications for behavior and compatibility 
with POSIX and other *nix systems.
   
   The POSIX requirement is given in 
https://pubs.opengroup.org/onlinepubs/007904875/functions/exec.html (among 
other places at OpenGroup.org):
   
   > If the ST_NOSUID bit is set for the file system containing the new process 
image file, then the effective user ID, effective group ID, saved set-user-ID, 
and saved set-group-ID are unchanged in the new process image.
   
   If the file system was mounted with the ST_NOSUID f_flag, then the file 
inherits the user and group IDs from the parent:  That is, the fork duplicates 
the those IDs and loading the file system image does not change them.
   
   > Otherwise, if the set-user-ID mode bit of the new process image file is 
set, the effective user ID of the new process image shall be set to the user ID 
of the new process image file.
   
   If the file system foes not include ST_NOSUID in f_flags, then be behavior 
is determined by the set-user-ID and set-group-ID bits in the file permissions: 
 I_SUID and I_SGID.  If the set-user-ID bit is set, the the user and group ID 
is set to the user and group ID of the file.
   
   _[I think that the only file system supported by NuttX that supports the 
set-user-ID or set-group-ID permission bits is romfs.]_
   
   The group ID works basically the same:
   
   > Similarly, if the set-group-ID mode bit of the new process image file is 
set, the effective group ID of the new process image shall be set to the group 
ID of the new process image file. The real user ID, real group ID, and 
supplementary group IDs of the new process image shall remain the same as those 
of the calling process image. The effective user ID and effective group ID of 
the new process image shall be saved (as the saved set-user-ID and the saved 
set-group-ID) for use by setuid().
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152168433


##
sched/Kconfig:
##
@@ -622,6 +622,12 @@ config SCHED_THREAD_LOCAL
This option enables architecture-specific TLS support 
(__thread/thread_local keyword)
Note: Toolchain must be compiled with '--enable-tls' enabled
 
+config UID_DEFAULT

Review Comment:
   > used by builtin apps side if not configured.
   
   If it effects apps/ (which are optional), then it should not be in an OS 
Kconfig file.  It should be an an apps/ Kconfig file.
   
   This is a very strong coupling between those particular apps/ and the OS.  
We much maintain modular interfaces;  The apps/ directory is optional.  The OS 
must stand alone.  There can be no dependency of the OS on anything in apps/



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] cederom commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


cederom commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152413114


##
sched/Kconfig:
##
@@ -622,6 +622,12 @@ config SCHED_THREAD_LOCAL
This option enables architecture-specific TLS support 
(__thread/thread_local keyword)
Note: Toolchain must be compiled with '--enable-tls' enabled
 
+config UID_DEFAULT

Review Comment:
   I think this idea comes from Android where each application runs on its own 
UID? Do I get the idea right?
   
   What if we set `UID_DEFAULT` to `0` (`root`)?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] cederom commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


cederom commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152413114


##
sched/Kconfig:
##
@@ -622,6 +622,12 @@ config SCHED_THREAD_LOCAL
This option enables architecture-specific TLS support 
(__thread/thread_local keyword)
Note: Toolchain must be compiled with '--enable-tls' enabled
 
+config UID_DEFAULT

Review Comment:
   I think this idea comes from Android where each application runs on its own 
UID? Do I get the idea right?
   
   What if we set `UID_DEFAULT` to `0` (`root`)? Would be possible to alter 
this value somehow in order to launch next process as root?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#issuecomment-1489218982

   It would help to understand exactly what you are trying to accomplish to 
forcing some UID defined in a configuration.
   
   NuttX supports standard /etc/passwd and /etc/group files for assigning UIDs 
and GIDs to users.  These are currently only used in NSH logins and do not for 
set UID and GID, but they should!  See configuration sim:nsh, 
boards/sim/sim/sim/include/nsh_romfsimg.h, and boards/sim/sim/sim/src/etc.
   
   The behavior that I would expect is that the UID and GID defaut to zero 
(root) but are set at login to the values in /etc.  Tasks run (in memory or in 
the file system) would (usually) take the UID and GID of the parent. But could 
be changed with ST_NOSUID logic or setuid() and setgid().
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] tmedicci opened a new pull request, #8926: xtensa/sigdeliver: fix signal deliver when task is running on ther CPU

2023-03-29 Thread via GitHub


tmedicci opened a new pull request, #8926:
URL: https://github.com/apache/nuttx/pull/8926

   ## Summary
   
   While delivering a signal to a task that is currently running on the other 
core (SMP-enabled), the xtensa_sig_deliver needs to leave the critical section 
first. This should use the interrupt state (PS register) of the previously 
duplicated registers set explicitly for the signal handler.
   
   The saved state (saved registers prior to the task's interruption to treat 
the signal) should only be used when restoring the task's registers after 
signal handling.
   
   ## Impact
   
   This allows running tasks to receive a signal while they are running on the 
other core in an SMP-enabled environment.
   
   ## Testing
   
   This behavior can be verified by selecting `EXAMPLES_ALARM` app. In order to 
force the task to be running, one could omit `usleep` on `alarm_main.c`. Prior 
to this commit, the application crashed while delivering the signal to the app.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] tmedicci opened a new issue, #8927: Potential problem regarding `sigdeliver` when SMP is enabled

2023-03-29 Thread via GitHub


tmedicci opened a new issue, #8927:
URL: https://github.com/apache/nuttx/issues/8927

   ## Summary
   
   While delivering a signal to a task that is currently running on the other 
core (SMP-enabled), the `_sig_deliver` needs to leave the critical 
section first (previously forced). This should use the interrupt state (PS 
register on Xtensa, for instance) of the previously set registers explicitly 
for the signal handler. In most cases, however, `leave_critical_section` is 
called with the saved interrupt state as the input argument.
   
   The saved state (saved registers prior to the task's interruption to treat 
the signal) should only be used when restoring the task's registers after 
signal handling.
   
   ## How to Reproduce
   
   This problem was first identified on ESP32: it crashes while trying to 
deliver a signal to a task running on the other CPU. This behavior can be 
verified by selecting `EXAMPLES_ALARM` app and - in order to force the task to 
be running - omitting the `usleep` on `alarm_main.c`. Prior to this 
[PR](https://github.com/apache/nuttx/pull/8926), the application crashed while 
delivering the signal to the app.
   
   ## Is it a "System Bug"?
   
   Potentially! `xtensa_sig_deliver` seems to have been inspired by other 
multi-core architectures. They are all very similar:  
`nuttx/arch/arm/src/armv7-m/arm_sigdeliver.c` is an example.
   
   ## What Have I Done?
   
   I fixed it to Xtensa devices. Please refer to 
https://github.com/apache/nuttx/pull/8926
   
   I can't test on other architectures, so I hope the community can help with 
it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] tmedicci commented on pull request #8926: xtensa/sigdeliver: fix signal deliver when task is running on ther CPU

2023-03-29 Thread via GitHub


tmedicci commented on PR #8926:
URL: https://github.com/apache/nuttx/pull/8926#issuecomment-1489249038

   Please check the related issue: https://github.com/apache/nuttx/issues/8927
   
   It probably requires fixing for other architectures.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] cederom commented on a diff in pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


cederom commented on code in PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#discussion_r1152413114


##
sched/Kconfig:
##
@@ -622,6 +622,12 @@ config SCHED_THREAD_LOCAL
This option enables architecture-specific TLS support 
(__thread/thread_local keyword)
Note: Toolchain must be compiled with '--enable-tls' enabled
 
+config UID_DEFAULT

Review Comment:
   I think this idea comes from Android where each application runs on its own 
UID? Do I get the idea right?
   
   What if we set `UID_DEFAULT` to `0` (`root`)? Would be possible to alter 
this value somehow in order to launch next process as root? That would imply 
security issue..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] tmedicci commented on issue #8927: Potential problem regarding `sigdeliver` when SMP is enabled

2023-03-29 Thread via GitHub


tmedicci commented on issue #8927:
URL: https://github.com/apache/nuttx/issues/8927#issuecomment-1489259655

   Some more thoughts about it:
   
   The `EXAMPLES_ALARM` app requires RTC driver to create a daemon and set an 
alarm that will deliver a signal to the application. This issue, however, has 
nothing to do with the RTC: I just used this app to test it. A simpler 
application could be implemented: the important thing is: SMP and forcing the 
app to be running on the other core (usually an infinite loop would force this).
   
   I think @acassis was able to test `Spresense` (`armv7-m`). In fact, it 
failed to deliver a signal while the `alarm_daemon` is running indefinitely 
(without the `usleep`). It didn't crash, but the signal was not delivered 
(which worked with the unmodified version of the alarm app). However, this 
happened even without SMP being enabled. It does not seem to be related to this 
issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] cederom commented on pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


cederom commented on PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#issuecomment-1489312285

   Good question @patacongo I don't get it too :-) 
   
   Could you please elaborate more on your goal @fxysunshine ?
   
   In Unix if you want to provide different applications with a separate access 
levels (i.e. to filesystem), for instance when you run a service, you would 
want to create a dedicated user and group for that application (or group of 
applications), then launch that application by that user/group. Services may be 
launched by system init scripts and/or local user crontab. Not sure if all this 
functionality is already here in NuttX?
   
   The problem you are facing right now is that UID/GID is not set even if you 
run the application by a given user?
   
   Maybe you want something like `su` to run one application as another user?
   
   Maybe you want `setuid`/`setgid` functionality in order to spawn process 
with `uid`/`gid` or a file owner?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] patacongo commented on pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


patacongo commented on PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#issuecomment-1489480226

   > The problem you are facing right now is that UID/GID is not set even if 
you run the application by a given user?
   
   Currently, each task group does inherit the IDs of its parent.  But 
everything is zero (root) so it doesn't do much,  A lot of machinery is in 
place to do good Unix-style access control (at least in a KERNEL build).  But 
it is not being developed.  We really need a  published roadmap if where we are 
and where we want to go.  I worry about _ad hoc_ solutions that are not based 
on a long term, POSIX compliant roadmap.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] cederom commented on pull request #8924: binfmt: set default uid for builtin app

2023-03-29 Thread via GitHub


cederom commented on PR #8924:
URL: https://github.com/apache/nuttx/pull/8924#issuecomment-1489508949

   > @patacongo: We really need a published roadmap if where we are and where 
we want to go. I worry about _ad hoc_ solutions that are not based on a long 
term, POSIX compliant roadmap.
   
   I usually do a simple TODO list with points and subpoints and subpoints for 
eatch project in a simple wiki style MarkDown (example below). Then I know what 
needs to be done, who is working on it, how much time it cost, what are the 
reference pr, etc. This is a really simple file easy to edit. Things may pop up 
there as discovered by new (sub)tasks. And it is a good reference point / 
worklog in future. It makes vision, planning, implementation, and accounting 
easier :-)
   
   Maybe this could be implemented for NuttX (either as part of the source code 
text document, or GitGub wiki, or project wiki)?
   
   I know there are tools like Jira.. but the general roadmap should be easy to 
read and containted in one place easy to edit / update.
   
   If there is a consensus on how to implement such roadmap I could help in 
creating / updating one just let me know :-)
   
   # TODO / Roadmap
   * Kernel.
 *  [ ] implement pid + gid assignment to process inherited by uid/git of 
the launching user.
 * [ ] commit.
 * [ ] testing.
 * [ ] implementation.
 *  [X] design discussion.
   * Application.
 * [ ] implement `su`.
   * Bootloader.
 * [X] fix some bootloader stuff.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx-website] branch asf-site updated: Publishing web: b50f5ca4ed22743959c1160aab5dcc9ae18b3eff docs: f4683713327aaeab0656e3ea83814b44267bdc4a

2023-03-29 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new c50efb7d Publishing web: b50f5ca4ed22743959c1160aab5dcc9ae18b3eff 
docs: f4683713327aaeab0656e3ea83814b44267bdc4a
c50efb7d is described below

commit c50efb7d6cd67840c9d46787b2bc0fb9cc8df317
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
AuthorDate: Thu Mar 30 00:12:25 2023 +

Publishing web: b50f5ca4ed22743959c1160aab5dcc9ae18b3eff docs: 
f4683713327aaeab0656e3ea83814b44267bdc4a
---
 content/docs/10.0.0/index.html | 2 +-
 content/docs/10.0.0/searchindex.js | 2 +-
 content/docs/10.0.1/index.html | 2 +-
 content/docs/10.0.1/searchindex.js | 2 +-
 content/docs/10.1.0/index.html | 2 +-
 content/docs/10.1.0/searchindex.js | 2 +-
 content/docs/10.2.0/index.html | 2 +-
 content/docs/10.2.0/searchindex.js | 2 +-
 content/docs/10.3.0/index.html | 2 +-
 content/docs/10.3.0/searchindex.js | 2 +-
 content/docs/11.0.0/index.html | 2 +-
 content/docs/11.0.0/searchindex.js | 2 +-
 content/docs/12.0.0/index.html | 2 +-
 content/docs/12.0.0/searchindex.js | 2 +-
 content/docs/latest/index.html | 2 +-
 content/docs/latest/searchindex.js | 2 +-
 content/feed.xml   | 4 ++--
 17 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/content/docs/10.0.0/index.html b/content/docs/10.0.0/index.html
index 6958b8ac..ebf3642e 100644
--- a/content/docs/10.0.0/index.html
+++ b/content/docs/10.0.0/index.html
@@ -133,7 +133,7 @@ by following these 
 NuttX Documentation
 NuttX is a real-time operating system (RTOS) with an emphasis on standards 
compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller 
environments, the primary governing standards in NuttX are Posix and ANSI 
standards. Additional standard APIs from Unix and other common RTOS’s (such as 
VxWorks) are adopted for functionality not available under these standards, or 
for functionality that is not appropriate for deeply-embedded environments 
(such as fork()).
-Last Updated: 29 March 23 at 00:11
+Last Updated: 30 March 23 at 00:09
 
 Table of 
Contents
 
diff --git a/content/docs/10.0.0/searchindex.js 
b/content/docs/10.0.0/searchindex.js
index 2ae9c60c..7fc6e868 100644
--- a/content/docs/10.0.0/searchindex.js
+++ b/content/docs/10.0.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen
 [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen
 [...]
\ No newline at end of file
diff --git a/content/docs/10.0.1/index.html b/content/docs/10.0.1/index.html
index 74dc20f2..3e7ad981 100644
--- a/content/docs/10.0.1/index.html
+++ b/content/docs/10.0.1/index.html
@@ -147,7 +147,7 @@ by following these 
 NuttX Documentation
 NuttX is a real-time operating system (RTOS) with an emphasis on standards 
compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller 
environments, the primary governing standards in NuttX are Posix and ANSI 
standards. Additional standard APIs from Unix and other common RTOS’s (such as 
VxWorks) are adopted for functionality not available under these standards, or 
for functionality that is not appropriate for deeply-embedded environments 
(such as fork()).
-Last Updated: 29 March 23 at 00:11
+Last Updated: 30 March 23 at 00:10
 
 Table of 
Contents
 
diff --git a/content/docs/10.0.1/searchindex.js 
b/content/docs/10.0.1/searchindex.js
index 2ae9c60c..4927ae78 100644
--- a/content/docs/10.0.1/searchindex.js
+++ b/content/docs/10.0.1/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components

[GitHub] [nuttx-apps] wangchen61698 commented on a diff in pull request #1689: examples/ftpd: Add support for choosing address family

2023-03-29 Thread via GitHub


wangchen61698 commented on code in PR #1689:
URL: https://github.com/apache/nuttx-apps/pull/1689#discussion_r1152667073


##
examples/ftpd/ftpd_main.c:
##
@@ -154,35 +154,75 @@ static void ftpd_accounts(FTPD_SESSION handle)
 }
 }
 
+static void hint(void)
+{
+  fprintf(stderr,
+  "Usage: ftpd [-46] \n\
+  \t-4Use IPv4\n\
+  \t-6Use IPv6\n\
+  ");
+}
+
 /
  * Name: ftpd_daemon
  /
 
 int ftpd_daemon(int s_argc, char **s_argv)
 {
   FTPD_SESSION handle;
-  int ret;
+  int ret = EXIT_FAILURE;
+  int option;
+  int family;
+  bool badarg = false;
 
   /* The FTPD daemon has been started */
 
   g_ftpdglob.running = true;
   printf("FTP daemon [%d] started\n", g_ftpdglob.pid);
 
-  /* Open FTPD */
-
 #if ADDR_FAMILY == AF_INET6
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET6);
+  family = AF_INET6;
 #else
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET);
+  family = AF_INET;
 #endif
 
+  while ((option = getopt(s_argc, &s_argv[1], "46")) != ERROR)
+{
+  switch (option)
+  {
+case '4':
+  family = AF_INET;
+  break;
+case '6':
+  family = AF_INET6;
+  break;
+default:
+  badarg = true;
+  break;
+  }
+}
+
+  if (badarg)
+{
+  hint();

Review Comment:
   The variable is to prompt user that the input is unappropriate to the 
connmand.
   
   
![图片](https://user-images.githubusercontent.com/129070278/228712911-688f27ba-8db3-4723-89c5-94a792d02bdc.png)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] wangchen61698 commented on a diff in pull request #1689: examples/ftpd: Add support for choosing address family

2023-03-29 Thread via GitHub


wangchen61698 commented on code in PR #1689:
URL: https://github.com/apache/nuttx-apps/pull/1689#discussion_r1152667073


##
examples/ftpd/ftpd_main.c:
##
@@ -154,35 +154,75 @@ static void ftpd_accounts(FTPD_SESSION handle)
 }
 }
 
+static void hint(void)
+{
+  fprintf(stderr,
+  "Usage: ftpd [-46] \n\
+  \t-4Use IPv4\n\
+  \t-6Use IPv6\n\
+  ");
+}
+
 /
  * Name: ftpd_daemon
  /
 
 int ftpd_daemon(int s_argc, char **s_argv)
 {
   FTPD_SESSION handle;
-  int ret;
+  int ret = EXIT_FAILURE;
+  int option;
+  int family;
+  bool badarg = false;
 
   /* The FTPD daemon has been started */
 
   g_ftpdglob.running = true;
   printf("FTP daemon [%d] started\n", g_ftpdglob.pid);
 
-  /* Open FTPD */
-
 #if ADDR_FAMILY == AF_INET6
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET6);
+  family = AF_INET6;
 #else
-  handle = ftpd_open(CONFIG_EXAMPLES_FTPD_PORT, AF_INET);
+  family = AF_INET;
 #endif
 
+  while ((option = getopt(s_argc, &s_argv[1], "46")) != ERROR)
+{
+  switch (option)
+  {
+case '4':
+  family = AF_INET;
+  break;
+case '6':
+  family = AF_INET6;
+  break;
+default:
+  badarg = true;
+  break;
+  }
+}
+
+  if (badarg)
+{
+  hint();

Review Comment:
   The variable is to prompt user that the input is unappropriate to the 
connmand.
   
   
![图片](https://user-images.githubusercontent.com/129070278/228712911-688f27ba-8db3-4723-89c5-94a792d02bdc.png)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] masayuki2009 commented on pull request #8926: xtensa/sigdeliver: fix signal deliver when task is running on ther CPU

2023-03-29 Thread via GitHub


masayuki2009 commented on PR #8926:
URL: https://github.com/apache/nuttx/pull/8926#issuecomment-1489622816

   >It probably requires fixing for other architectures.
   
   @tmedicci 
   I applied the same changes to arch/arm/src/armv7-a/arm_sigdeliver.c locally 
and tested with sabre-6quad:smp on both qemu-7.1 and the sabre board, but the 
ostest crashed on both environments.
   
   ```
   diff --git a/arch/arm/src/armv7-a/arm_sigdeliver.c 
b/arch/arm/src/armv7-a/arm_sigdeliver.c
   index 856f216c0c..9b32e9b855 100644
   --- a/arch/arm/src/armv7-a/arm_sigdeliver.c
   +++ b/arch/arm/src/armv7-a/arm_sigdeliver.c
   @@ -54,7 +54,6 @@
void arm_sigdeliver(void)
{
  struct tcb_s *rtcb = this_task();
   -  uint32_t *regs = rtcb->xcp.saved_regs;
   
#ifdef CONFIG_SMP
  /* In the SMP case, we must terminate the critical section while the 
signal
   @@ -86,7 +85,7 @@ void arm_sigdeliver(void)
   
  do
{
   -  leave_critical_section(regs[REG_CPSR]);
   +  leave_critical_section(rtcb->xcp.regs[REG_CPSR]);
}
  while (rtcb->irqcount > 0);
#endif /* CONFIG_SMP */
   @@ -144,5 +143,5 @@ void arm_sigdeliver(void)
  /* Then restore the correct state for this thread of execution. */
   
  board_autoled_off(LED_SIGNAL);
   -  arm_fullcontextrestore(regs);
   +  arm_fullcontextrestore(rtcb->xcp.saved_regs);
}
   
   
   user_main: signal handler test 
   sighand_test: Initializing semaphore to 0 
   sighand_test: Starting waiter task 
   sighand_test: Started waiter_main pid=175 
   waiter_main: Waiter started 
   waiter_main: Unmasking signal 17 
   waiter_main: Registering signal handler 
   waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask= 
   waiter_main: Waiting on semaphore 
   sighand_test: Signaling pid=175 with signo=17 sigvalue=42 
   [CPU1] arm_prefetchabort: Prefetch abort. PC: 0010 IFAR: 0010 IFSR: 
000d 
   [CPU1] _assert: Current Version: NuttX 10.3.0 b2c8be28b1-dirty Mar 30 2023 
11:38:58 arm 
   [CPU1] _assert: Assertion failed panic: at file: 
armv7-a/arm_prefetchabort.c:134 task(CPU1): waiter 0x10812c19 
   [CPU1] up_dump_register: R0: 0001 R1:  R2: 10825bb0 R3: 0001 
   [CPU1] up_dump_register: R4:  R5:  R6:  FP: 0001 
   [CPU1] up_dump_register: R8:  SB:  SL:  R11: 
 
   [CPU1] up_dump_register: IP:  SP: 10830eb8 LR: 10801aa9 PC: 0010 
   [CPU1] up_dump_register: CPSR: 20d1 
   [CPU1] dump_stack: IRQ Stack: 
   [CPU1] dump_stack: sp: 0x10830ca0 
   [CPU1] dump_stack: base: 0x108227a8 
   [CPU1] dump_stack: size: 2048 
   [CPU1] dump_stack: ERROR: IRQ Stack pointer is not within the stack 
   [CPU1] stack_dump: 0x10822f20: deadbeef deadbeef deadbeef deadbeef 0001 
10801ea1 108249e0 0001 
   [CPU1] stack_dump: 0x10822f40: 01df 108249e3 108249e1 0002 108249e2 
10801a0b 0001 108241a8 
   [CPU1] stack_dump: 0x10822f60: 0001 10801a69 0001 108241a8 0002 
10800d57 10800d3d 10825bb0 
   [CPU1] stack_dump: 0x10822f80: 10825bb0 10801b5f 10825bb0 1080123f 0002 
  10800a71 
   [CPU1] dump_stack: User Stack: 
   [CPU1] dump_stack: sp: 0x10830eb8 
   [CPU1] dump_stack: base: 0x1082f0d0 
   [CPU1] dump_stack: size: 8152 
   [CPU1] stack_dump: 0x10830ea0:     0010 
20d1 1082a1d0 0001 
   [CPU1] stack_dump: 0x10830ec0: 108241b0 108072a1  108242a8 1082a1d0 
10806fd1   
   [CPU1] stack_dump: 0x10830ee0:      
   
   [CPU1] stack_dump: 0x10830f00:      
   
   [CPU1] stack_dump: 0x10830f20:      
   
   [CPU1] stack_dump: 0x10830f40:      
   
   [CPU1] stack_dump: 0x10830f60:      
   
   [CPU1] stack_dump: 0x10830f80:      
   
   [CPU1] stack_dump: 0x10830fa0:      
   
   [CPU1] stack_dump: 0x10830fc0:      
  10831020 
   [CPU1] stack_dump: 0x10830fe0: 10806fd1 0002 1082a254 10825bb0  
108242a8 1082a1d0 108241b0 
   [CPU1] stack_dump: 0x10831000: 0001     
 10806fdc 20ff 
   [CPU1] stack_dump: 0x10831020: 108256f8 1082a1d0 005f 1080291b  
  1082f0c0 
   [CPU1] stack_dump: 0x10831040:  1080294d  10812cad  
 0002  
   [CPU1] stack_dump: 0x10831060: 10812d35 fffd  0002  
   
   [CPU1] stack_dump: 0x10831080:   10812c

[GitHub] [nuttx] no1wudi opened a new pull request, #8928: tools/riscv: Map extensions to certain cpu model for LLVM based toolc…

2023-03-29 Thread via GitHub


no1wudi opened a new pull request, #8928:
URL: https://github.com/apache/nuttx/pull/8928

   
   
   ## Summary
   
   RISCV has a modular instruction set. It's hard to define cpu-model to 
support all toolchain.
   
   For Zig, cpu model is this formal: generic_rv[32|64][i][m][a][f][d][c]
   
   For Rust, cpu model is this formal: riscv[32|64][i][m][a][f][d][c]
   
   
   So, it's better to map the NuttX config to LLVM builtin cpu model, these 
models supported by all LLVM based toolchain.
   
   Refer to : 
https://github.com/llvm/llvm-project/blob/release/15.x/llvm/lib/Target/RISCV/RISCV.td
   
   These models can't cover all implementation of RISCV, but it's enough for 
most cases (All NuttX supported chips).
   
   ## Impact
   non-c compiler only
   ## Testing
   CI and local machine
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] zhhyu7 commented on pull request #8864: netlink: add RTM_NEWADDR, RTM_DELADDR and RTM_GETADDR

2023-03-29 Thread via GitHub


zhhyu7 commented on PR #8864:
URL: https://github.com/apache/nuttx/pull/8864#issuecomment-1489776950

   > @zhhyu7 could you please include a sample example to use this new 
functionality? Maybe an IP change detection like this: 
https://stackoverflow.com/questions/579783/how-to-detect-ip-address-change-programmatically-in-linux
   
   @acassis 
   I added a example to the summary section, is this OK? Or need to add it to 
another file and submit it together.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] no1wudi opened a new pull request, #1692: wamr: Simplify target handling by LLVM style arch info

2023-03-29 Thread via GitHub


no1wudi opened a new pull request, #1692:
URL: https://github.com/apache/nuttx-apps/pull/1692

   
   ## Summary
   Refactor only
   
   Depends on: https://github.com/apache/nuttx/pull/8928
   
   ## Impact
   WAMR only
   ## Testing
   CI and local machine
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org