summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2020-03-16 12:07:54 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-27 03:58:37 +0000
commitbbb82287c1139340bfa77029eee25d6076e51e3c (patch)
treef8c8c03fa5db080ec5a64341ba3ea6a56a63ead3
parentd74bb77a3eb17acc8878f2459ba70d9cf58a731b (diff)
downloadcrosvm-bbb82287c1139340bfa77029eee25d6076e51e3c.tar
crosvm-bbb82287c1139340bfa77029eee25d6076e51e3c.tar.gz
crosvm-bbb82287c1139340bfa77029eee25d6076e51e3c.tar.bz2
crosvm-bbb82287c1139340bfa77029eee25d6076e51e3c.tar.lz
crosvm-bbb82287c1139340bfa77029eee25d6076e51e3c.tar.xz
crosvm-bbb82287c1139340bfa77029eee25d6076e51e3c.tar.zst
crosvm-bbb82287c1139340bfa77029eee25d6076e51e3c.zip
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>
-rw-r--r--usb_util/src/device.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/usb_util/src/device.rs b/usb_util/src/device.rs
index 3ac1403..8d55682 100644
--- a/usb_util/src/device.rs
+++ b/usb_util/src/device.rs
@@ -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()) };