Mercurial > hg > ucis.core
diff USBLib/Windows/USB/UsbDevice.cs @ 68:e811297f5aa4
Updated USBLib: removed old LibUsbDotNet compatibility code and added new information helper classes
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Wed, 16 Oct 2013 16:58:39 +0200 |
parents | 2d16447eff12 |
children | 9b898d8b2541 |
line wrap: on
line diff
--- a/USBLib/Windows/USB/UsbDevice.cs Wed Oct 16 01:11:49 2013 +0200 +++ b/USBLib/Windows/USB/UsbDevice.cs Wed Oct 16 16:58:39 2013 +0200 @@ -141,8 +141,14 @@ int nBytes = length + szRequest; Byte[] bigbuffer = new Byte[nBytes]; if (!Kernel32.DeviceIoControl(handle, UsbApi.IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ref request, Marshal.SizeOf(typeof(USB_DESCRIPTOR_REQUEST)), bigbuffer, nBytes, out nBytes, IntPtr.Zero)) { + if (descriptorType == (Byte)UsbDescriptorType.Device && index == 0 && langId == 0) { + Byte[] descbytes = DeviceDescriptor.GetBytes(); + length = Math.Min(descbytes.Length, length); + Array.Copy(descbytes, 0, buffer, 0, length); + return length; + } int err = Marshal.GetLastWin32Error(); - if (err != 2 && err != 31 && err != 87) throw new Win32Exception(err); + if (err != 31) throw new Win32Exception(err); return 0; } nBytes -= szRequest;