diff USBLib/Communication/LibUsbDotNet.cs @ 60:3424fa5a12c9

Updated Windows USB enumeration classes and VBoxUSB backend
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 12 Oct 2013 16:35:24 +0200
parents a9c4fed19e99
children 2b24666cd759
line wrap: on
line diff
--- a/USBLib/Communication/LibUsbDotNet.cs	Wed Oct 09 20:56:28 2013 +0200
+++ b/USBLib/Communication/LibUsbDotNet.cs	Sat Oct 12 16:35:24 2013 +0200
@@ -20,6 +20,7 @@
 	public class UsbDevice : IUsbDevice {
 		public nIUsbInterface Device { get; private set; }
 		public UsbDevice(nIUsbInterface dev) {
+			if (dev == null) throw new ArgumentNullException("dev");
 			Device = dev;
 		}
 		public bool GetDescriptor(byte descriptorType, byte index, short langId, Byte[] buffer, int bufferLength, out int transferLength) {
@@ -87,6 +88,7 @@
 			nIUsbDevice dev = Device as nIUsbDevice;
 			if (dev == null) return false;
 			try {
+				if (dev.Configuration == 0) dev.Configuration = 1;
 				dev.ClaimInterface(interfaceID);
 				return true;
 			} catch {