comparison USBLib/Windows/USB/UsbHub.cs @ 62:edc41c861d96

Updates and cleanup in Windows USB enumeration code
author Ivo Smits <Ivo@UCIS.nl>
date Sun, 13 Oct 2013 02:47:08 +0200
parents 3424fa5a12c9
children 309c705d7460
comparison
equal deleted inserted replaced
61:2b24666cd759 62:edc41c861d96
56 USB_NODE_CONNECTION_INFORMATION_EX nodeConnection; 56 USB_NODE_CONNECTION_INFORMATION_EX nodeConnection;
57 if (!GetNodeConnectionInformation(handle, portCount, out nodeConnection)) throw new Win32Exception(Marshal.GetLastWin32Error()); 57 if (!GetNodeConnectionInformation(handle, portCount, out nodeConnection)) throw new Win32Exception(Marshal.GetLastWin32Error());
58 UsbDevice device = null; 58 UsbDevice device = null;
59 if (nodeConnection.ConnectionStatus != USB_CONNECTION_STATUS.DeviceConnected) { 59 if (nodeConnection.ConnectionStatus != USB_CONNECTION_STATUS.DeviceConnected) {
60 device = new UsbDevice(parent, nodeConnection, portCount, devicePath); 60 device = new UsbDevice(parent, nodeConnection, portCount, devicePath);
61 } else if (nodeConnection.DeviceDescriptor.bDeviceClass == UsbDeviceClass.HubDevice) { 61 } else if (nodeConnection.DeviceDescriptor.DeviceClass == (Byte)UsbDeviceClass.HubDevice) {
62 String nodeName = GetNodeConnectionName(handle, portCount); 62 String nodeName = GetNodeConnectionName(handle, portCount);
63 device = new UsbHub(parent, nodeConnection, @"\\?\" + nodeName, portCount, false); 63 device = new UsbHub(parent, nodeConnection, @"\\?\" + nodeName, portCount, false);
64 } else { 64 } else {
65 device = new UsbDevice(parent, nodeConnection, portCount, devicePath); 65 device = new UsbDevice(parent, nodeConnection, portCount, devicePath);
66 } 66 }