Hi.
USBH_Device class does not appear in the namespace GHIElectronics.NETMF.USBHost version 4.1.5.0, was changed by another class? ???
It is in different dll as shows in documentation
Hi Gus.
Will not let me clear your response, update the firmware of my FEZ Domino
MFDeploy reported by the tool.
ClrInfo.targetFrameworkVersion: 4.1.2821.0
SolutionReleaseInfo.solutionVersion: 4.1.5.1
SolutionReleaseInfo.solutionVendorInfo: GHI Electronics, LLC
SoftwareVersion.BuildDate: April 11 2011
Install SDK FEZ references but does not appear USBH_Device class to run the following example of USB Mass Storage:
class Program
{
/ / Hold a static reference in case the GC kicks in and disposing it
/ / Automatically, NOTE THAT we support only one in this example!
ps PersistentStorage static;
public static void Main ()
{
/ / Subscribe to events RemovableMedia
RemovableMedia.Insert + = RemovableMedia_Insert;
RemovableMedia.Eject + = RemovableMedia_Eject;
/ / Subscribe to USB events
USBHostController.DeviceConnectedEvent + = DeviceConnectedEvent;
/ / Sleep forever
Thread.Sleep (Timeout.Infinite)
}
static void DeviceConnectedEvent (USBH_Device device)
{
if (device.TYPE == USBH_DeviceType.MassStorage)
{
Debug.Print ("USB Mass Storage detected ...");
ps = new PersistentStorage (device);
ps.MountFileSystem ();
}
}
static void RemovableMedia_Insert (object sender, MediaEventArgs e)
{
Debug.Print ("Storage \" "+ + e.Volume.RootDirectory
"\" Is inserted. ")
Debug.Print ("Getting files and folders:");
if (e.Volume.IsFormatted)
{
string [] files = Directory.GetFiles (e.Volume.RootDirectory)
string [] folders =
Directory.GetDirectories (e.Volume.RootDirectory)
Debug.Print ("Files available on" +
e.Volume.RootDirectory + ":");
for (int i = 0; i <files.Length; i + +)
Debug.Print (files [i]);
Debug.Print ("Folders available on" +
e.Volume.RootDirectory + ":");
for (int i = 0; i <folders.Length; i + +)
Debug.Print (folders [i]);
}
else
{
Debug.Print ("Storage is Not formatted. Format on PC with
FAT32/FAT16 first. ")
}
}
static void RemovableMedia_Eject (object sender, MediaEventArgs e)
{
Debug.Print ("Storage \" "+ + e.Volume.RootDirectory
"\" Is ejected. ")
}
}
}
Open up your GHI NetMF library documentation, navigate to GHIElectronics.NETMF.USBHost -> USBH_Device and you will see it depends on GHIElectronics.NETMF.System.
Thank EriSan500
When i tried this i get the following error.
ClrInfo.targetFrameworkVersion: 4.1.2821.0
SolutionReleaseInfo.solutionVersion: 4.1.6.0
SoftwareVersion.BuildDate: Jun 30 2011
Any ideas why ?
Look this up in NETMF documentation. Directory should be in System.IO or maybe Microsoft.SPOT.IO
I am getting the error as well. Cannot easily located the namespace to add/reference to get this cleared up.
The name ‘Directory’ does not exist in the current context?"
Did you include System.IO ?
Are you using 4.1 ?