I am running the USB client cdc sample and I am getting the following exception at Controller.ActiveDevice = vsp.
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### GHI.Usb.Client.RawDevice::NativeInitialize [IP: 0000] ####
#### GHI.Usb.Client.RawDevice::Activate [IP: 00f3] ####
#### GHI.Usb.Client.Controller::set_ActiveDevice [IP: 0015] ####
#### SerialPortTesting.Program::Main [IP: 0010] ####
Code :
Cdc vsp = new Cdc();
//activedevice is null
Controller.ActiveDevice = vsp;
// Send "Hello world!" to PC every second. (Append a new line too)
byte[] bytes = System.Text.Encoding.UTF8.GetBytes("Hello world!\r\n");
while (true)
{
// Check if connected to PC
if (Controller.State !=
UsbController.PortState.Running)
{
Debug.Print("Waiting to connect to PC...");
}
else
{
vsp.Stream.Write(bytes, 0, bytes.Length);
}
Thread.Sleep(1000);
}
using EMX module, GHI Electronics NETMF SDK 2015 R1 Pre-Release 4, win 8.1 , netmf 4.3 , vs 2010
I have no idea what is wrong please help.