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 993cebd33f5a1c9ee2eb14f11b7401f8c0cdff2b
Author: zhaozhenghang <[email protected]>
AuthorDate: Thu Nov 12 09:45:21 2026 +0800

    system/nxrecorder: support 32-bit chmap
    
    Widen the chmap parameter of nxrecorder_recordinternal() to uint32_t
    and parse it with strtoul in the record and recordraw commands so hex
    values are accepted.
    
    Signed-off-by: zhaozhenghang <[email protected]>
---
 include/system/nxrecorder.h         |  2 +-
 system/nxrecorder/nxrecorder.c      |  2 +-
 system/nxrecorder/nxrecorder_main.c | 20 ++++++++++++--------
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/include/system/nxrecorder.h b/include/system/nxrecorder.h
index 161a4d5fc..cb826a9c0 100644
--- a/include/system/nxrecorder.h
+++ b/include/system/nxrecorder.h
@@ -185,7 +185,7 @@ int nxrecorder_setdevice(FAR struct nxrecorder_s *precorder,
 int nxrecorder_recordinternal(FAR struct nxrecorder_s *precorder,
                               FAR const char *filename, int filefmt,
                               uint8_t nchannels, uint8_t bpsamp,
-                              uint32_t samprate, uint8_t chmap);
+                              uint32_t samprate, uint32_t chmap);
 
 /****************************************************************************
  * Name: nxrecorder_stop
diff --git a/system/nxrecorder/nxrecorder.c b/system/nxrecorder/nxrecorder.c
index 4918bb01c..583d3eaae 100644
--- a/system/nxrecorder/nxrecorder.c
+++ b/system/nxrecorder/nxrecorder.c
@@ -1042,7 +1042,7 @@ int nxrecorder_stop(FAR struct nxrecorder_s *precorder)
 int nxrecorder_recordinternal(FAR struct nxrecorder_s *precorder,
                               FAR const char *pfilename, int filefmt,
                               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/nxrecorder/nxrecorder_main.c 
b/system/nxrecorder/nxrecorder_main.c
index ac8682e3c..80e782735 100644
--- a/system/nxrecorder/nxrecorder_main.c
+++ b/system/nxrecorder/nxrecorder_main.c
@@ -190,7 +190,7 @@ static int nxrecorder_cmd_recordraw(FAR struct nxrecorder_s 
*precorder,
   int channels = 0;
   int bpsamp = 0;
   int samprate = 0;
-  int chmap = 0;
+  char chmap[16] = "";
   size_t len;
   char filename[PATH_MAX];
 
@@ -204,8 +204,10 @@ static int nxrecorder_cmd_recordraw(FAR struct 
nxrecorder_s *precorder,
   memcpy(filename, parg, len);
   filename[len] = '\0';
 
-  sscanf(parg + len, "%d %d %d %d", &channels, &bpsamp,
-         &samprate, &chmap);
+  /* chmap is read as text so that hex masks and bit 31 both fit */
+
+  sscanf(parg + len, "%d %d %d %15s", &channels, &bpsamp,
+         &samprate, chmap);
 
   /* Try to record the file specified */
 
@@ -215,7 +217,7 @@ static int nxrecorder_cmd_recordraw(FAR struct nxrecorder_s 
*precorder,
                                   channels,
                                   bpsamp,
                                   samprate,
-                                  chmap);
+                                  strtoul(chmap, NULL, 0));
 
   /* nxrecorder_recordfile returned values:
    *
@@ -270,7 +272,7 @@ static int nxrecorder_cmd_record(FAR struct nxrecorder_s 
*precorder,
   int channels = 0;
   int bpsamp = 0;
   int samprate = 0;
-  int chmap = 0;
+  char chmap[16] = "";
   size_t len;
   char filename[PATH_MAX];
 
@@ -284,8 +286,10 @@ static int nxrecorder_cmd_record(FAR struct nxrecorder_s 
*precorder,
   memcpy(filename, parg, len);
   filename[len] = '\0';
 
-  sscanf(parg + len, "%d %d %d %d", &channels, &bpsamp,
-         &samprate, &chmap);
+  /* chmap is read as text so that hex masks and bit 31 both fit */
+
+  sscanf(parg + len, "%d %d %d %15s", &channels, &bpsamp,
+         &samprate, chmap);
 
   /* Try to record the file specified */
 
@@ -295,7 +299,7 @@ static int nxrecorder_cmd_record(FAR struct nxrecorder_s 
*precorder,
                                   channels,
                                   bpsamp,
                                   samprate,
-                                  chmap);
+                                  strtoul(chmap, NULL, 0));
 
   /* nxrecorder_recordfile returned values:
    *

Reply via email to