Add support for fastboot transport timeouts and USB Reset() on linux
USB Reset() allows simulating unplugging and replugging device.
Test: build and run fastboot on mac 10.13.3
Test: glinux build and run fastboot
Change-Id: Id924d063e549a4cca9dda03afd8f8fe266f6d2ab
diff --git a/fastboot/usb.h b/fastboot/usb.h
index 5b44468..7ca44c4 100644
--- a/fastboot/usb.h
+++ b/fastboot/usb.h
@@ -52,6 +52,14 @@
char device_path[256];
};
+class UsbTransport : public Transport {
+ // Resets the underlying transport. Returns 0 on success.
+ // This effectively simulates unplugging and replugging
+ public:
+ virtual int Reset() = 0;
+};
+
typedef int (*ifc_match_func)(usb_ifc_info *ifc);
-Transport* usb_open(ifc_match_func callback);
+// 0 is non blocking
+UsbTransport* usb_open(ifc_match_func callback, uint32_t timeout_ms = 0);