Locking the Colibri USB Mass Storage Device example code in C#

When I connect the USB host port to PC on Colibri iMX6, the Flashdisk becomes visible on my PC as a Removable drive. I need some C# code example to lock and unlock this feature programmatically without restarting Colibri module. We need that option to be only available to product technicians with proper authorization.

You can prevent it from being mounted by setting the Automount registry entry to 0 under


but this will also prevent any application you put in the autorun folder from being executed.
As an alternative you may consider setting the MountAsHidden flag under the same key, in this way the eMMC will be mounted, but not visible.


Autorun applications will be executed and passwords stored, but to access the contents of flashdisk you’ll need to type it’s full path in explorer (\flashdisk), you’ll also need to hit F5 or select refresh every time you create a folder or copy a file because explorer does not refresh automatically hidden directories.