Skip to content

Conversation

@JianyuWang0623
Copy link
Contributor

Summary

Add support for setting paths bind to LUN at runtime.

Help

nsh> msconn -h
Usage: msconn [-o OPTION]... [-l LUNs]...
Configures the USB mass storage device and exports the LUN(s).

Supported arguments
  -o
      nc: No const LUN
      ro: Readonly
      rw: Read/Write(default)
  -l
      Device path to export

Examples
  1. Export const LUN(s) only
      msconn
  2. Export /dev/ramx and const LUN(s)
      msconn -l /dev/ramx
  3. Export /dev/ramx without const LUN
      msconn -o nc -l /dev/ramx

Export without const LUN

nsh> msconn -o nc -l /dev/esp32s3flash
mcsonn_main: Creating block drivers
mcsonn_main: Configuring with NLUNS=1
mcsonn_main: handle=0x3fc8ec80
mcsonn_main: Bind LUN=0 to /dev/esp32s3flash
mcsonn_main: Connected
nsh> msdis
msdis: Disconnected

Export with const LUN

nsh> mkrd -m 10 -s 512 640
nsh> msconn
mcsonn_main: Creating block drivers
mcsonn_main: Configuring with NLUNS=2
mcsonn_main: handle=0x3fcdecc8
mcsonn_main: Bind LUN=1 to /dev/esp32s3flash
mcsonn_main: Bind LUN=0 to /dev/ram10
mcsonn_main: Connected
nsh> msdis
msdis: Disconnected

Export without const LUN

nsh> msconn -o nc -l /dev/ram10
mcsonn_main: Creating block drivers
mcsonn_main: Configuring with NLUNS=1
mcsonn_main: handle=0x3fcdecc8
mcsonn_main: Bind LUN=0 to /dev/ram10
mcsonn_main: Connected
nsh>

Impact

  • system/usbmsc: Compatible with current usage.

Testing

  1. Selftest as above
  2. NuttX CI

@JianyuWang0623
Copy link
Contributor Author

@Donny9 Could you review this PR please?

@JianyuWang0623 JianyuWang0623 force-pushed the br_wjy_usbmsc_msconn_runtime_lun_path_241202 branch from cb7efdb to f8b23df Compare December 2, 2024 09:52
@JianyuWang0623

This comment was marked as resolved.

@xiaoxiang781216
Copy link
Contributor

The CI maybe broken

common/riscv_exit.c: In function 'up_exit':
Error: common/riscv_exit.c:65:33: error: 'tcb' undeclared (first use in this function); did you mean 'tcb_s'?
   65 |   g_running_tasks[this_cpu()] = tcb;
      |                                 ^~~
      |                                 tcb_s

Fix here: apache/nuttx#15014

@JianyuWang0623 JianyuWang0623 force-pushed the br_wjy_usbmsc_msconn_runtime_lun_path_241202 branch from f8b23df to 5239e39 Compare December 2, 2024 12:52
@JianyuWang0623 JianyuWang0623 force-pushed the br_wjy_usbmsc_msconn_runtime_lun_path_241202 branch 5 times, most recently from d556fe7 to c280cb2 Compare December 5, 2024 01:10
@JianyuWang0623 JianyuWang0623 force-pushed the br_wjy_usbmsc_msconn_runtime_lun_path_241202 branch from c280cb2 to 90d0ff5 Compare December 5, 2024 09:26
@JianyuWang0623

This comment was marked as resolved.

Help

  nsh> msconn -h
  Usage: msconn [-o OPTION]... [-l LUNs]...
  Configures the USB mass storage device and exports the LUN(s).

  Supported arguments
    -o
        nc: No const LUN
        ro: Readonly
        rw: Read/Write(default)
    -l
        Device path to export

  Examples
    1. Export const LUN(s) only
        msconn
    2. Export /dev/ramx and const LUN(s)
        msconn -l /dev/ramx

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
@JianyuWang0623 JianyuWang0623 force-pushed the br_wjy_usbmsc_msconn_runtime_lun_path_241202 branch from 90d0ff5 to fbb50df Compare December 5, 2024 13:00
@JianyuWang0623
Copy link
Contributor Author

Unrelated CI error

Configuration/Tool: esp32-devkitc/nxdiag
2024-12-05 10:19:53
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Building NuttX...
fatal: could not read Username for 'https://github.com/': No such device or address
make[3]: *** [Makefile:83: espressif_prepare] Error 128
make[3]: Target 'context' not remade because of errors.
make[2]: *** [Makefile:55: /github/workspace/sources/apps/system/nxdiag_context] Error 2
make[2]: Target 'context_all' not remade because of errors.
make[1]: *** [Makefile:185: context] Error 2
make: *** [tools/Unix.mk:457: /github/workspace/sources/apps/.context] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory

@xiaoxiang781216
Copy link
Contributor

let's ignore it.

@xiaoxiang781216 xiaoxiang781216 merged commit b08c296 into apache:master Dec 6, 2024
22 of 25 checks passed
JianyuWang0623 added a commit to JianyuWang0623/nuttx that referenced this pull request Dec 6, 2024
The Kconfig of system/usbmsc has updated to support setting paths that bind to LUN at runtime.
More details: apache/nuttx-apps#2876

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
JianyuWang0623 added a commit to JianyuWang0623/nuttx that referenced this pull request Dec 6, 2024
The Kconfig of system/usbmsc has updated to support setting paths that bind to LUN at runtime.
More details: apache/nuttx-apps#2876

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
xiaoxiang781216 pushed a commit to apache/nuttx that referenced this pull request Dec 6, 2024
The Kconfig of system/usbmsc has updated to support setting paths that bind to LUN at runtime.
More details: apache/nuttx-apps#2876

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
linguini1 pushed a commit to CarletonURocketry/nuttx that referenced this pull request Jan 15, 2025
The Kconfig of system/usbmsc has updated to support setting paths that bind to LUN at runtime.
More details: apache/nuttx-apps#2876

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants