public InitializeResult Initialize() { Log.Comment("UsbDefaultConfig test Initialize"); try { defaultConfig = new DefaultUSB(); } catch (System.NotSupportedException) { if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) //The Emulator on Windows Host { Log.Comment("UsbClient not supported UnSupported Exception expected"); return InitializeResult.Skip; } } catch (Exception E) { Log.Exception("UsbClient Unexpected usbDevices enumeration failed" + E.Message); return InitializeResult.Skip; } // // usbDevices enumerated with something, now check known issue // if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { Log.Comment("UsbClient does not return expected NotSupprotedException on Windows - bug 20936\n"); return InitializeResult.Skip; } return InitializeResult.ReadyToGo; }
public InitializeResult Initialize() { Log.Comment("UsbDefaultConfig test Initialize"); try { defaultConfig = new DefaultUSB(); } catch (System.NotSupportedException) { if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) //The Emulator on Windows Host { Log.Comment("UsbClient not supported UnSupported Exception expected"); return(InitializeResult.Skip); } } catch (Exception E) { Log.Exception("UsbClient Unexpected usbDevices enumeration failed" + E.Message); return(InitializeResult.Skip); } // // usbDevices enumerated with something, now check known issue // if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { Log.Comment("UsbClient does not return expected NotSupprotedException on Windows - bug 20936\n"); return(InitializeResult.Skip); } return(InitializeResult.ReadyToGo); }
public MFTestResults TestDefaultConfiguration() { if (defaultConfig.controllers.Length == 0) { // // Note: For platforms without USB controllers // Log.Comment("Device Platform has 0 USB Controllers"); return(MFTestResults.Skip); } if (defaultConfig.controllers.Length > 1) { Log.Comment("The target actually has " + defaultConfig.controllers.Length.ToString() + " controllers. This test only applies to controller 0"); } if (defaultConfig.controllers[0].Status == UsbController.PortState.Stopped) // If configuration may not already be set { try { defaultConfig.controllers[0].Configuration = null; // Set USB configuration to default } catch (Exception e) { Log.Exception("Setting the default configuration caused an exception (" + e.ToString() + "). The configuration failed with error " + defaultConfig.controllers[0].ConfigurationError.ToString()); return(MFTestResults.Fail); } } DefaultUSB.config = defaultConfig.controllers[0].Configuration; MFTestResults result; DefaultUSB defaultTests = new DefaultUSB(); result = defaultTests.CheckDescriptors(); if (result == MFTestResults.Pass) // If all tests pass { Log.Comment("USB Default Configuration passed all tests"); } return(result); }
public MFTestResults TestDefaultConfiguration() { if (defaultConfig.controllers.Length == 0) { // // Note: For platforms without USB controllers // Log.Comment("Device Platform has 0 USB Controllers"); return MFTestResults.Skip; } if (defaultConfig.controllers.Length > 1) { Log.Comment("The target actually has " + defaultConfig.controllers.Length.ToString() + " controllers. This test only applies to controller 0"); } if (defaultConfig.controllers[0].Status == UsbController.PortState.Stopped) // If configuration may not already be set { try { defaultConfig.controllers[0].Configuration = null; // Set USB configuration to default } catch (Exception e) { Log.Exception("Setting the default configuration caused an exception (" + e.ToString() + "). The configuration failed with error " + defaultConfig.controllers[0].ConfigurationError.ToString()); return MFTestResults.Fail; } } DefaultUSB.config = defaultConfig.controllers[0].Configuration; MFTestResults result; DefaultUSB defaultTests = new DefaultUSB(); result = defaultTests.CheckDescriptors(); if (result == MFTestResults.Pass) // If all tests pass { Log.Comment("USB Default Configuration passed all tests"); } return result; }