Пример #1
0
        } //TestUSB

        private MFTestResults TestDescriptors(USB USB1)
        {
            Log.Comment("Found " + USB1.controllers.Length.ToString() + " controller(s)");

            foreach (UsbController UsbController in USB1.controllers)
            {
                Configuration UsbConfig = UsbController.Configuration;
                Log.Comment("Number of descriptor elements = " + UsbConfig.descriptors.Length.ToString());
                foreach (Configuration.Descriptor descriptor in UsbConfig.descriptors)
                {
                    USB1.ParseDescriptor(descriptor);
                }

                try
                {
                    // As a test, set the same configuration back to see if its data matches
                    ;//USB1.controllers[0].Configuration = UsbConfig;
                }
                catch (ArgumentException)
                {
                    Log.Exception("USB configuration not set - error " +
                                  UsbController.ConfigurationError.ToString());
                    return(MFTestResults.Fail);
                }
            } //UsbController
            return(MFTestResults.Pass);
        }     //TestDescriptors
Пример #2
0
 public InitializeResult Initialize()
 {
     Log.Comment("UsbClient Initialize");
     try
     {
         usbDevices = new USB();
     }
     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);
 }
Пример #3
0
        public MFTestResults TestUSB()
        {
            USB usbDevices = null;

            try
            {
                usbDevices = new USB();
            }
            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(MFTestResults.KnownFailure);
                }
            }
            catch (Exception E)
            {
                Log.Exception("UsbClient Unexpected usbDevices enumeration failed" + E.Message);
                return(MFTestResults.Fail);
            }
            //
            // 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(MFTestResults.KnownFailure);
            }

            if (usbDevices.controllers.Length == 0)
            {
                //
                // Note: For platforms without USB controllers
                //
                Log.Comment("Device Platform has 0 USB Controllers");
                return(MFTestResults.Skip);
            }

            try
            {
                return(TestDescriptors(usbDevices));
            }
            catch (Exception e)
            {
                Log.Exception("UsbClient unknown failure - TestDescriptors" + e.Message + e.StackTrace);
                return(MFTestResults.Fail);
            }
        } //TestUSB
Пример #4
0
 public InitializeResult Initialize()
 {
     Log.Comment("UsbClient Initialize");
     try
     {
         usbDevices = new USB();
     }
     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;
 }
Пример #5
0
        } //TestUSB


        private MFTestResults TestDescriptors(USB USB1)
        {
            Log.Comment("Found " + USB1.controllers.Length.ToString() + " controller(s)");

            foreach (UsbController UsbController in USB1.controllers)
            {
                Configuration UsbConfig = UsbController.Configuration;
                Log.Comment("Number of descriptor elements = " + UsbConfig.descriptors.Length.ToString());
                foreach (Configuration.Descriptor descriptor in UsbConfig.descriptors)
                {
                    USB1.ParseDescriptor(descriptor);
                }

                try
                {
                    // As a test, set the same configuration back to see if its data matches
                    ;//USB1.controllers[0].Configuration = UsbConfig;
                }
                catch (ArgumentException)
                {
                    Log.Exception("USB configuration not set - error " +
                        UsbController.ConfigurationError.ToString());
                    return MFTestResults.Fail;
                }
            } //UsbController
            return MFTestResults.Pass;
        } //TestDescriptors
Пример #6
0
 public MFTestResults TestUSB()
 {
     USB usbDevices=null;
     try
     {
         usbDevices = new USB();
     }
     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 MFTestResults.KnownFailure;
         }
     }
     catch (Exception E)
     {
         Log.Exception("UsbClient Unexpected usbDevices enumeration failed" + E.Message);
         return MFTestResults.Fail;
     }
     //
     // 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 MFTestResults.KnownFailure;
     }
    
     if (usbDevices.controllers.Length == 0)
     {
         //
         // Note: For platforms without USB controllers
         //
         Log.Comment("Device Platform has 0 USB Controllers");
         return MFTestResults.Skip;
     }
     
     try
     {
         return TestDescriptors(usbDevices);
     }
     catch (Exception e)
     {
         Log.Exception("UsbClient unknown failure - TestDescriptors" + e.Message + e.StackTrace);
         return MFTestResults.Fail;                
     }
 } //TestUSB