Skip to main content

MassStorage Class

NuGet: GHIElectronics.TinyCLR.Devices.UsbClient
Assembly: GHIElectronics.TinyCLR.Devices.UsbClient
Namespace: GHIElectronics.TinyCLR.Devices.UsbClient

This device emulates a mass storage. Your Micro Framework device will appear as a virtual mass storage device similar to a USB Drive. This works by exposing the storage connected to this device, such as SD card or USB sticks, to the host.

public class MassStorage : RawDevice

Constructors

MassStorage(UsbClientController usbClientController)

public MassStorage(UsbClientController usbClientController) : this(usbClientController, new UsbClientSetting()

Creates a new mass storage with default parameters.

MassStorage(UsbClientController usbClientController, UsbClientSetting usbClientSetting)

public MassStorage(UsbClientController usbClientController, UsbClientSetting usbClientSetting) : base(usbClientController, usbClientSetting)

Creates a new mass storage.

ParameterTypeDescription
usbClientControllerUsbClientControllerUSBClient controller.
usbClientSettingUsbClientSettingUSBClient setting.

Properties

MaximumSupportedLogicalUnits

public static int MaximumSupportedLogicalUnits { get; }

The maximum number of logical units that any mass storage can support.

LogicalUnitCount

public int LogicalUnitCount { get; }

The number of logical units assocaited with this mass storage.

Methods

AttachLogicalUnit(IntPtr storage)

public void AttachLogicalUnit(IntPtr storage)

Attaches a removable storage device.

ParameterTypeDescription
storageIntPtrThe storage device (hdc )to attach.

AttachLogicalUnit(IntPtr storage, string vendor, string product)

public void AttachLogicalUnit(IntPtr storage, string vendor, string product)

Attaches a removable storage device, giving it SCSI identification strings.

ParameterTypeDescription
storageIntPtrThe storage device (hdc )to attach.
vendorstringSCSI vendor identification, up to 8 characters. Reported by INQUIRY and shown by Windows as the Ven_ part of the device id. Pass null to keep the default. Longer strings are truncated by the device; shorter ones are space padded.
productstringSCSI product identification, up to 16 characters, shown as the Prod_ part. Pass null to use UsbClientSetting.ProductName, which is what earlier releases always did.

AttachLogicalUnit(IntPtr storage, string vendor, string product, string revision)

public void AttachLogicalUnit(IntPtr storage, string vendor, string product, string revision)

Attaches a removable storage device, giving it SCSI identification strings.

ParameterTypeDescription
storageIntPtrThe storage device (hdc )to attach.
vendorstringSCSI vendor identification, up to 8 characters. null keeps the default.
productstringSCSI product identification, up to 16 characters. null uses UsbClientSetting.ProductName.
revisionstringSCSI product revision level, up to 4 characters. null keeps "1.00".

RemoveLogicalUnit(IntPtr storage)

public void RemoveLogicalUnit(IntPtr storage)

Remove a removable storage device.

ParameterTypeDescription
storageIntPtrThe storage device (hdc )to attach.

Enable()

public override void Enable()

Enable a removable storage device.

Disable()

public override void Disable()

Disable a removable storage device.