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

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

commit cd5c5447bfdae03a33b3dfa39822e08f3278cae5
Author: zhaozhenghang <[email protected]>
AuthorDate: Thu Nov 12 09:45:21 2026 +0800

    system/nxlooper: support 32-bit chmap
    
    Widen the chmap parameter of nxlooper_loopback() to uint32_t and parse
    it with strtoul in the loopback command so hex values are accepted.
    
    Signed-off-by: zhaozhenghang <[email protected]>
---
 include/system/nxlooper.h       |  2 +-
 system/nxlooper/nxlooper.c      |  2 +-
 system/nxlooper/nxlooper_main.c | 10 ++++++----
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/system/nxlooper.h b/include/system/nxlooper.h
index 154e12ca7..27de9af33 100644
--- a/include/system/nxlooper.h
+++ b/include/system/nxlooper.h
@@ -184,7 +184,7 @@ int nxlooper_setdevice(FAR struct nxlooper_s *plooper,
 
 int nxlooper_loopback(FAR struct nxlooper_s *plooper, int format,
                       uint8_t nchannels, uint8_t bpsamp,
-                      uint32_t samprate, uint8_t chmap);
+                      uint32_t samprate, uint32_t chmap);
 
 /****************************************************************************
  * Name: nxlooper_stop
diff --git a/system/nxlooper/nxlooper.c b/system/nxlooper/nxlooper.c
index 6c142ee26..c1b84c18f 100644
--- a/system/nxlooper/nxlooper.c
+++ b/system/nxlooper/nxlooper.c
@@ -988,7 +988,7 @@ int nxlooper_stop(FAR struct nxlooper_s *plooper)
 
 int nxlooper_loopback(FAR struct nxlooper_s *plooper, int format,
                       uint8_t nchannels, uint8_t bpsamp,
-                      uint32_t samprate, uint8_t chmap)
+                      uint32_t samprate, uint32_t chmap)
 {
   struct mq_attr           attr;
   struct sched_param       sparam;
diff --git a/system/nxlooper/nxlooper_main.c b/system/nxlooper/nxlooper_main.c
index 5c23eabf3..dc93ef5e1 100644
--- a/system/nxlooper/nxlooper_main.c
+++ b/system/nxlooper/nxlooper_main.c
@@ -203,10 +203,12 @@ static int nxlooper_cmd_loopback(FAR struct nxlooper_s 
*plooper, char *parg)
   int channels = 0;
   int bpsamp = 0;
   int samprate = 0;
-  int chmap = 0;
+  char chmap[16] = "";
 
-  sscanf(parg, "%d %d %d %d %d", &channels, &bpsamp,
-                                &samprate, &chmap, &format);
+  /* chmap is read as text so that hex masks and bit 31 both fit */
+
+  sscanf(parg, "%d %d %d %15s %d", &channels, &bpsamp,
+                                  &samprate, chmap, &format);
 
   if (format == AUDIO_FMT_UNDEF)
     {
@@ -216,7 +218,7 @@ static int nxlooper_cmd_loopback(FAR struct nxlooper_s 
*plooper, char *parg)
   /* Try to loopback raw data with settings specified */
 
   ret = nxlooper_loopback(plooper, format, channels, bpsamp,
-                          samprate, chmap);
+                          samprate, strtoul(chmap, NULL, 0));
 
   /* nxlooper_loopraw returned values:
    *

Reply via email to