devices: usb: temporarily disable resets

This is a workaround for a bug encountered with newer Android phones -
when connected to the Linux VM, resetting the USB device via
USBDEVFS_RESET causes the device to disconnect from the host, preventing
its use in the VM.

This works around the issue by removing both paths that can cause a
USB device reset (initial reset at device insertion plus reset when
requested by the guest kernel).  Both of these must be removed to
restore functionality; if either is still in place, the failure is still
observed.

The workaround specifically exempts Edge TPU devices, which need a reset
for firmware update; these devices will still issue a reset on connect
and when requested by the guest.

BUG=chromium:1058059
TEST=Connect Pixel 3 to eve, adb logcat

Change-Id: I7a689da1120e1fb772d95e41a0d4debe64f7d6a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105814
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2020-03-16 12:07:54 -07:00 committed by Commit Bot
parent d74bb77a3e
commit bbb82287c1

View file

@ -182,6 +182,15 @@ impl Device {
/// Perform a USB port reset to reinitialize a device.
pub fn reset(&self) -> Result<()> {
// TODO(dverkamp): re-enable reset once crbug.com/1058059 is resolved.
// Skip reset for all non-Edge TPU devices.
let vid = self.device_descriptor_tree.idVendor;
let pid = self.device_descriptor_tree.idProduct;
match (vid, pid) {
(0x1a6e, 0x089a) => (),
_ => return Ok(()),
}
// Safe because self.fd is a valid usbdevfs file descriptor.
let result = unsafe { self.ioctl(usb_sys::USBDEVFS_RESET()) };