comparison USBLib/Windows/USB/UsbBus.cs @ 21:dcfec2be27c9

Added USBLib
author Ivo Smits <Ivo@UCIS.nl>
date Mon, 15 Apr 2013 01:04:59 +0200
parents
children 5b14fed54a89
comparison
equal deleted inserted replaced
20:c873e3dd73fe 21:dcfec2be27c9
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4 using UCIS.HWLib.Windows.Devices;
5 using UCIS.USBLib.Internal.Windows;
6
7 namespace UCIS.HWLib.Windows.USB {
8 public class UsbBus {
9 private List<UsbController> devices = null;
10 public IList<UsbController> Controllers {
11 get {
12 if (devices == null) Refresh();
13 return devices.AsReadOnly();
14 }
15 }
16 public void Refresh() {
17 devices = new List<UsbController>();
18 Guid m_Guid = new Guid(UsbApi.GUID_DEVINTERFACE_HUBCONTROLLER);
19 foreach (DeviceNode dev in DeviceNode.GetDevices(m_Guid)) {
20 String[] interfaces = dev.GetInterfaces(m_Guid);
21 if (interfaces == null || interfaces.Length == 0) continue;
22 devices.Add(new UsbController(this, dev, interfaces[0]));
23 }
24 }
25 }
26 }