Set USB Device Name

Hello folks,

I'm working on a device that needs a USB storage connection capability. I have put the "mass" sample into my application, and it works as expected except for one thing -- I can't seem to change the displayed name of the mounted drive.

I'm working in SDK v2.5.0 / nRF52840 / Windows 11 Host.

The nRF USB port connection connects as "USB Drive (E:)" and I can use my computer to format the drive to whatever name I want (e.g. USB_CfgTool (E:)). I want to be able to set this name programmatically.

What I have tried so far:

KConfig - CONFIG_USB_DEVICE_PRODUCT="MyName"

Code: Change the name of the mount_point (fs_mount_t *mnt ;; mnt->mnt_point="MyName" ;; usb_dc_reset();) (In the hope that changing mount point, then disconnecting / reconnecting would update the name)

Based on this post:  Set USB Device Product name on runtime

It seems like I might be fighting against Windows Driver Caching based on VID/PID -- but I'd like to set up new devices (my own) to show up with a correct USB name on their first run. In that case, the caching won't be an issue because the right information will get cached.

Could someone please point me in the right direction to name USB Devices?

Thank you,

    - Finn

Parents Reply Children
  • Hello Edvin,

    Helpful pointer! I can set those values without getting an error, but I have some config options expanding memory that's available, which may be helpful.

    In particular, `CONFIG_MAIN_STACK_SIZE` may need an increase.

    Unfortunately, the additions from the linked post don't change the behavior of the USB connections. It's an interesting direction though, and I'll let you know if I find something while poking around the ffconf.h file or similar.

    Best,

        - Finn

  • Hi, 

    Sorry to hijack the post, I have the exact same issue. The provided link is not valid because : 

    1) There is no such _USE_LABEL in ffconf.h, but it is FF_USE_LABEL (ncs v2.7.0)

    2) I think it is a bad practice to modify the SDK files directly for an industrial sized project. One have to maintain it (with a fork or something) 

    On my side, when I click on the bottom right of my screen to see my USB devices and I click on my device, the name is the right one, But "USB Drive" is displayed everywhere else.

    On a PC that never seen any nordic device, it shows as SDCH. 

    Help is appreciated

    Best regards

    [EDIT] I tried to use f_setlabel anyway (just to see), and it didn't worked for me. Still "USB Drive" displayed.

Related