Of course, although it took me a bit to learn how that works :-). My complete configuration is Fez Spider, RS232 module connected to socket 11, USB Client DP hooked up to Socket 1, USBHost hooked up to socket 3 and T35 LCD hooked up to 10, 12, 13, and 14.
In the IDE, the USB Client module and DIsplay module are the only things “connected” to the Spider. The RS232 and USBHost modules are on the picture, but not hooked up. (see attached picture)
In the project properties, I’ve selected Serial debugging through COM5, and set the Spider switches accordingly.
I added a reference for the GHI.Premium.USBClient.dll.
I start with a good USB Flashdrive plugged into the Spider USBHost module.
Here’s the program.cs code (I’ll change the name later…)
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using GT = Gadgeteer;
using GHI.Premium.USBHost;
using GHI.Premium.IO;
using GHI.Premium.System;
using GHI.Premium.USBClient;
using Gadgeteer.Modules.GHIElectronics;
namespace GadgeteerApp1
{
public partial class Program
{
static PersistentStorage ps = null;
static USBC_MassStorage ms = null;
// This method is run when the mainboard is powered up or reset.
void ProgramStarted()
{
ms = USBClientController.StandardDevices.StartMassStorage();
Debug.Print("USB ms started");
RemovableMedia.Insert += RemovableMedia_Insert;
RemovableMedia.Eject += RemovableMedia_Eject;
// Subscribe to USB events
USBHostController.DeviceConnectedEvent += DeviceConnectedEvent;
Debug.Print("USB Host subscribed to events");
Debug.Print("Program Started");
}
void DeviceConnectedEvent(USBH_Device device)
{
if (device.TYPE == USBH_DeviceType.MassStorage)
{
Debug.Print("USB Mass Storage detected...");
ps = new PersistentStorage(device);
ms.AttachLun(0, ps, " ", " ");
ms.EnableLun(0);
}
}
void RemovableMedia_Insert(object sender, MediaEventArgs e)
{
Debug.Print("Removable Media_Insert Triggered. Storage \"" + e.Volume.RootDirectory + "\" is inserted");
}
void RemovableMedia_Eject(object sender, MediaEventArgs e)
{
Debug.Print("Storage \"" + e.Volume.RootDirectory + "\" is ejected.");
ps = null;
ms.DisableLun(0);
}
}
}
And, here’s the output:
USB ms started
USB Host subscribed to events
Program Started
USB Mass Storage detected…
The thread ‘’ (0x3) has exited with code 0 (0x0).
I can remove the tumbrive, but not see the eject message.
I can plug it back in and go back through the …_insert code
And, I’m unable to see the thumbdrive contents (there are a few files) from the PC.
I’m trying to follow the information int he 4.2 NETMF documents, but I’m confused. Help?