Existing code has transport memory leaks. Use smart pointers
for transport to get rid of those cases and manual memory
management
Test: atest fastboot_test
Test: manually checked transport isn't leaking anymore
Bug: 296629925
Change-Id: Ifdf162d5084f61ae5c1d2b56a897464af58100da
Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
It's not possible to programmatically determine which fastboot mode a
device is in, without sending a getvar:is-userspace query. Unfortunately
this is not possible asynchronously, and may interrupt other queries
being processed.
This patch changes fastbootd's USB interface name to "fastbootd". Note
that tools use the protocol number/class and not this string, so it
should be safe to extend. When using "fastboot devices", the interface
name is now listed if set. Note that currently only the Linux version of
the fastboot tool is capable of reading the interface name.
Bug: 156966319
Test: fastboot devices on Linux
Change-Id: I57ccf2bec1dda573fe3ac628a646624b76f45905
We recently changed 'xfer' to a size_t, so update the DBG format
accordingly. We also fix a long standing issue with format for
the unsigned 'read'.
Test: TreeHugger
Change-Id: I3dc5f26a033fea64119016802bc9cdb54bbb7b52
Read function exits before reading all requested bytes. Fix that by
looping until the len requested is completed.
This will fix the issue execting get_staged command for a staged image
bigger than 1MB
Test: fastboot get_staged file.txt
Change-Id: Ic70ab48f3a8c8d78c225db638892501d4dc20b13
Signed-off-by: Fernando Lugo <flugo@google.com>
This change moves Transport ownership back out of FastBootDriver.
Callers of set_transport must ensure that the previous transport is
destroyed. In addition, deleting a transport now ensures that it is
closed.
Bug: 78793464
Test: fastboot, fuzzy_fastboot works
Change-Id: I8f9ed2f7d5b09fd0820b2677d087a027378f26db
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
This reverts commit ceb7cbf5fd.
Reason for revert: Broke mac builds:
system/core/fastboot/usb_osx.cpp:513:35: error: use of undeclared identifier 'USB_TRANSACTION_TIMEOUT'
USB_TRANSACTION_TIMEOUT, USB_TRANSACTION_TIMEOUT);
^
Change-Id: Ibe2f9ff2d5c63f9d33f4bd6d9ba962604cf8caeb
For testing there needs to be a way to simulate unplugging and
replugging a device. This change adds support for a USB reset
method that does this.
Also add timeouts, so USB reads/writes don't block forever
on an unresponsive device.
Test: glinux, fastboot tool still works
Test: Reset confirmed working via wireshark Linux URB captures
Change-Id: I7213a2395d4ef1c0238810e4929ab966e78c8b55
Fix some bit-rotten instances of printf("%d", size_t), add more
logging for device selection.
Test: fastboot.exe devices
Change-Id: I4683fab8f88805e1ac88e193a1e84821be8bfa4c
(Second upload of this CL; original upload had the wrong version of
usb_windows.cpp that caused a compilation error. Fixed error and
re-tested.)
This CL creates a Transport object to provide a generic interface for
various transports. Specifically this is designed to be able to add UDP
support to fastboot in an upcoming CL without changing the main program
logic.
Also includes some minor code style fixes and replaces malloc/free
in the USB implementation files with smart pointers and std::string.
Bug: http://b/22029765
Change-Id: I1175bbce08690fbd15f51e68166be9b3e9973ea0
This CL creates a Transport object to provide a generic interface for
various transports. Specifically this is designed to be able to add UDP
support to fastboot in an upcoming CL without changing the main program
logic.
Also includes some minor code style fixes and replaces malloc/free
in the USB implementation files with smart pointers and std::string.
Bug: http://b/22029765
Change-Id: I68641af0da7d13db4647f5e20a18d04d67f0b327