Mercurial > hg > ucis.core
comparison USBLib/Windows/USB/UsbHub.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 | fd63c453ff65 |
children | edc41c861d96 |
comparison
equal
deleted
inserted
replaced
59:4e1a5dec786a | 60:3424fa5a12c9 |
---|---|
1 using System; | 1 using System; |
2 using System.Collections.Generic; | 2 using System.Collections.Generic; |
3 using System.ComponentModel; | |
3 using System.Runtime.InteropServices; | 4 using System.Runtime.InteropServices; |
4 using Microsoft.Win32.SafeHandles; | 5 using Microsoft.Win32.SafeHandles; |
5 using UCIS.USBLib.Internal.Windows; | 6 using UCIS.USBLib.Internal.Windows; |
6 using System.ComponentModel; | |
7 using UCIS.USBLib.Communication; | |
8 | 7 |
9 namespace UCIS.HWLib.Windows.USB { | 8 namespace UCIS.HWLib.Windows.USB { |
10 public class UsbHub : UsbDevice { | 9 public class UsbHub : UsbDevice { |
11 public bool IsRootHub { get; private set; } | 10 public bool IsRootHub { get; private set; } |
12 internal USB_NODE_INFORMATION NodeInformation { get; private set; } | 11 internal USB_NODE_INFORMATION NodeInformation { get; private set; } |
16 public override string DeviceDescription { get { return IsRootHub ? "RootHub" : "Standard-USB-Hub"; } } | 15 public override string DeviceDescription { get { return IsRootHub ? "RootHub" : "Standard-USB-Hub"; } } |
17 | 16 |
18 public override string DriverKey { | 17 public override string DriverKey { |
19 get { | 18 get { |
20 if (Parent == null) return null; | 19 if (Parent == null) return null; |
21 using (SafeFileHandle handle = OpenHandle(Parent.DevicePath)) return UsbHub.GetNodeConnectionDriverKey(handle, AdapterNumber); | 20 using (SafeFileHandle handle = OpenHandle(Parent.DevicePath)) return GetNodeConnectionDriverKey(handle, AdapterNumber); |
22 } | 21 } |
23 } | 22 } |
24 | 23 |
25 internal UsbHub(UsbDevice parent, USB_NODE_CONNECTION_INFORMATION_EX nci, string devicePath, uint port, Boolean roothub) | 24 internal UsbHub(UsbDevice parent, USB_NODE_CONNECTION_INFORMATION_EX nci, string devicePath, uint port, Boolean roothub) |
26 : base(parent, nci, port, devicePath) { | 25 : base(parent, nci, port, devicePath) { |
32 } | 31 } |
33 } | 32 } |
34 | 33 |
35 public override int GetDescriptor(byte descriptorType, byte index, short langId, byte[] buffer, int offset, int length) { | 34 public override int GetDescriptor(byte descriptorType, byte index, short langId, byte[] buffer, int offset, int length) { |
36 if (Parent == null) return 0; | 35 if (Parent == null) return 0; |
37 using (SafeFileHandle handle = UsbHub.OpenHandle(Parent.DevicePath)) return UsbHub.GetDescriptor(handle, AdapterNumber, descriptorType, index, langId, buffer, offset, length); | 36 using (SafeFileHandle handle = UsbHub.OpenHandle(Parent.DevicePath)) return GetDescriptor(handle, AdapterNumber, descriptorType, index, langId, buffer, offset, length); |
38 } | 37 } |
39 | 38 |
40 | 39 |
41 public IList<UsbDevice> Devices { | 40 public IList<UsbDevice> Devices { |
42 get { | 41 get { |