Commit 5f7671a5 authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

[usb] Collect all composite devices paths during enumeration on Windows

On Windows separate device nodes are created for each function of a
composite USB device. This change implements the additional steps
necessary to collect all of the device paths for these child nodes when
the parent USB device node is enumerated.

As implemented this works for devices that are already connected when
enumeration is performed but not for devices that are detected after
startup because the DBT_DEVICEARRIVAL window message is delivered
before these nodes are created. This will be addressed in a follow-up.

Bug: 637404
Change-Id: I080e40104c422e446f07e3d5dee47291802a7728
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132532
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755993}
parent 95f61619
......@@ -24,14 +24,17 @@ namespace {
const uint16_t kUsbVersion2_1 = 0x0210;
} // namespace
UsbDeviceWin::UsbDeviceWin(const base::string16& device_path,
const base::string16& hub_path,
uint32_t bus_number,
uint32_t port_number,
const base::string16& driver_name)
UsbDeviceWin::UsbDeviceWin(
const base::string16& device_path,
const base::string16& hub_path,
const std::vector<base::string16>& child_device_paths,
uint32_t bus_number,
uint32_t port_number,
const base::string16& driver_name)
: UsbDevice(bus_number, port_number),
device_path_(device_path),
hub_path_(hub_path),
child_device_paths_(child_device_paths),
driver_name_(driver_name) {}
UsbDeviceWin::~UsbDeviceWin() {}
......
......@@ -21,6 +21,13 @@ struct WebUsbPlatformCapabilityDescriptor;
class UsbDeviceWin : public UsbDevice {
public:
UsbDeviceWin(const base::string16& device_path,
const base::string16& hub_path,
const std::vector<base::string16>& child_device_paths,
uint32_t bus_number,
uint32_t port_number,
const base::string16& driver_name);
// UsbDevice implementation:
void Open(OpenCallback callback) override;
......@@ -28,16 +35,12 @@ class UsbDeviceWin : public UsbDevice {
friend class UsbServiceWin;
friend class UsbDeviceHandleWin;
// Called by UsbServiceWin only.
UsbDeviceWin(const base::string16& device_path,
const base::string16& hub_path,
uint32_t bus_number,
uint32_t port_number,
const base::string16& driver_name);
~UsbDeviceWin() override;
const base::string16& device_path() const { return device_path_; }
const std::vector<base::string16>& child_device_paths() const {
return child_device_paths_;
}
const base::string16& driver_name() const { return driver_name_; }
// Opens the device's parent hub in order to read the device, configuration
......@@ -73,6 +76,7 @@ class UsbDeviceWin : public UsbDevice {
const base::string16 device_path_;
const base::string16 hub_path_;
const std::vector<base::string16> child_device_paths_;
const base::string16 driver_name_;
DISALLOW_COPY_AND_ASSIGN(UsbDeviceWin);
......
This diff is collapsed.
......@@ -42,6 +42,7 @@ class UsbServiceWin final : public DeviceMonitorWin::Observer,
void HelperStarted();
void CreateDeviceObject(const base::string16& device_path,
const base::string16& hub_path,
const std::vector<base::string16>& child_device_paths,
uint32_t bus_number,
uint32_t port_number,
const base::string16& driver_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment