summaryrefslogtreecommitdiffstats
path: root/fastboot/usb.h
diff options
context:
space:
mode:
authorAaron Wisner <awisner@google.com>2018-07-26 10:56:09 -0500
committerAaron Wisner <awisner@google.com>2018-07-26 11:19:44 -0500
commitacf78d462f556bef83dfe9a36db8201e552711a8 (patch)
tree79b47ce34c507fd7f6704c6e9480b214c1cc20f5 /fastboot/usb.h
parent28fb130cbbd7c01ef706d5b6a5a9877b290f275c (diff)
downloadsystem_core-acf78d462f556bef83dfe9a36db8201e552711a8.tar.gz
system_core-acf78d462f556bef83dfe9a36db8201e552711a8.tar.bz2
system_core-acf78d462f556bef83dfe9a36db8201e552711a8.zip
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
Diffstat (limited to 'fastboot/usb.h')
-rw-r--r--fastboot/usb.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/fastboot/usb.h b/fastboot/usb.h
index 5b44468bb..7ca44c414 100644
--- a/fastboot/usb.h
+++ b/fastboot/usb.h
@@ -52,6 +52,14 @@ struct usb_ifc_info {
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);