// checks the system for the devices listed in the list private static void CheckSystem(List <UsbIdentifier> devicesId) { lock (devicesId) { foreach (UsbIdentifier usbId in devicesId) { List <String> devPaths = UsbApi.GetDevices(usbId.Identifier, usbId.Guid); foreach (String devicePath in devPaths) { bool found = false; // check for duplicate devices foreach (IUsbDevice device in devices) { if (device.DevicePath == devicePath) { found = true; break; } } if (found) { continue; } IUsbDevice dev = new WebServiceUsbDevice(devicePath); dev.UsbId = usbId; devices.Add(dev); // call all the registered clients for USB events UsbNotify(dev, true); } } } }
public static List <USBController> GetUSBControllers() { // Get all host controllers active on the machine List <string> devPaths = UsbApi.GetDevices(null, UsbApi.GUID_CLASS_USB_HOST_CONTROLLER); List <USBController> controllers = new List <USBController>(); foreach (string path in devPaths) { controllers.Add(new USBController(path)); } return(controllers); }