Commit fd955d00 authored by Jerry Zhang's avatar Jerry Zhang Committed by Chromium LUCI CQ

[usb] Update the FunctionInfo if the original path in the map is empty

On Windows, Chromium may fail to read the function path in
GetFunctionInfo() after the USB device is plugged in. But the empty
function path is still added to the functions vector which is passed
to the constructor of UsbDeviceWin. We need to update the FunctionInfo
in the calling of UsbDeviceWin::UpdateFunction later on. Otherwise,
Chromium will report errors while the USB APIs are called from upper
apps due to the empty path check.

Bug: 1166403
Change-Id: I539890dd66cb2f313f2dd413cce1a8ece56a4e0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628704
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844295}
parent 2373806e
......@@ -466,6 +466,7 @@ Jeremy Noring <jnoring@hirevue.com>
Jeremy Spiegel <jeremysspiegel@gmail.com>
Jeroen Van den Berghe <vandenberghe.jeroen@gmail.com>
Jerry Lin <wahahab11@gmail.com>
Jerry Zhang <zhj8407@gmail.com>
Jesper Storm Bache <jsbache@gmail.com>
Jesse Miller <jesse@jmiller.biz>
Jesus Sanchez-Palencia <jesus.sanchez-palencia.fernandez.fil@intel.com>
......
......@@ -73,7 +73,7 @@ void UsbDeviceWin::ReadDescriptors(base::OnceCallback<void(bool)> callback) {
void UsbDeviceWin::UpdateFunction(int interface_number,
const FunctionInfo& function_info) {
functions_.insert({interface_number, function_info});
functions_[interface_number] = function_info;
for (UsbDeviceHandle* handle : handles()) {
// This is safe because only this class only adds instance of
......
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