コード例 #1
0
ファイル: Functions.cs プロジェクト: dache/GreanDev
 // private routine for enumerating a hub
 static void ListHub(USBHub Hub, List <USBDevice> DevList)
 {
     foreach (USBPort Port in Hub.GetPorts())
     {
         if (Port.IsHub)
         {
             // recursive
             ListHub(Port.GetHub(), DevList);
         }
         else
         {
             if (Port.IsDeviceConnected)
             {
                 DevList.Add(Port.GetDevice());
             }
         }
     }
 }
コード例 #2
0
ファイル: Functions.cs プロジェクト: dache/GreanDev
 // private routine for enumerating a hub
 static void SearchHubDriverKeyName(USBHub Hub, ref USBDevice FoundDevice, string DriverKeyName)
 {
     foreach (USBPort Port in Hub.GetPorts())
     {
         if (Port.IsHub)
         {
             // recursive
             SearchHubDriverKeyName(Port.GetHub(), ref FoundDevice, DriverKeyName);
         }
         else
         {
             if (Port.IsDeviceConnected)
             {
                 USBDevice Device = Port.GetDevice();
                 if (Device.DeviceDriverKey == DriverKeyName)
                 {
                     FoundDevice = Device;
                     break;
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: Functions.cs プロジェクト: dache/GreanDev
 // private routine for enumerating a hub
 static void SearchHubInstanceID(USBHub Hub, ref USBDevice FoundDevice, string InstanceID)
 {
     foreach (USBPort Port in Hub.GetPorts())
     {
         if (Port.IsHub)
         {
             // recursive
             SearchHubInstanceID(Port.GetHub(), ref FoundDevice, InstanceID);
         }
         else
         {
             if (Port.IsDeviceConnected)
             {
                 USBDevice Device = Port.GetDevice();
                 if (Device.InstanceID == InstanceID)
                 {
                     FoundDevice = Device;
                     break;
                 }
             }
         }
     }
 }