Mount USB mass storage disk in PC at application run-time

Hi, 

I am working on ncs, I am using USB cdc acm and external flash in my project. My project requirement is when I will send command over USB cdc acm through PC then USB mass storage device must mount in windows.

I merged the sample code of cdc acm(path: zephyr/samples/subsys/usb/cdc_acm)  and mass storage device(path: zephyr/samples/subsys/usb/mass), Usb mass storage device and Usb serial device is showing in PC at same time.

When  I commented out the below line from project configuration, then USB mass storage device is not showing in computer.

#CONFIG_USB_MASS_STORAGE=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
#CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y

So my question is how to enable USB mass storage device during the application runtime. I could not found any api for this.

 

Thanks.

Parents
  • Changing the USB (class) descriptors at runtime would require an USB reset, you don't want that with an active CDC connection.

    What you can do instead is use the removable media feature of USB mass storage. By default you just tell the host that "there is no media present" until you get the signal to enable it.

    But there is a big catch: The simple MSC layer in Zephyr does not seem to support removable media out-of-the-box, and the changes are not completely trivial.

Reply
  • Changing the USB (class) descriptors at runtime would require an USB reset, you don't want that with an active CDC connection.

    What you can do instead is use the removable media feature of USB mass storage. By default you just tell the host that "there is no media present" until you get the signal to enable it.

    But there is a big catch: The simple MSC layer in Zephyr does not seem to support removable media out-of-the-box, and the changes are not completely trivial.

Children
Related