Loading fastboot/engine.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -88,7 +88,9 @@ void fb_init(fastboot::FastBootDriver& fbi) { } void fb_reinit(Transport* transport) { fb->set_transport(transport); if (Transport* old_transport = fb->set_transport(transport)) { delete old_transport; } } const std::string fb_get_error() { Loading Loading @@ -392,6 +394,6 @@ bool fb_reboot_to_userspace() { } fprintf(stderr, "OKAY\n"); fb->set_transport(nullptr); fb_reinit(nullptr); return true; } fastboot/fastboot.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1847,6 +1847,10 @@ int FastBootTool::Main(int argc, char* argv[]) { int status = fb_execute_queue() ? EXIT_FAILURE : EXIT_SUCCESS; fprintf(stderr, "Finished. Total time: %.3fs\n", (now() - start)); if (Transport* old_transport = fb.set_transport(nullptr)) { delete old_transport; } return status; } Loading fastboot/fastboot_driver.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ FastBootDriver::FastBootDriver(Transport* transport, std::function<void(std::str } FastBootDriver::~FastBootDriver() { set_transport(nullptr); } RetCode FastBootDriver::Boot(std::string* response, std::vector<std::string>* info) { Loading Loading @@ -537,12 +536,9 @@ int FastBootDriver::SparseWriteCallback(std::vector<char>& tpbuf, const char* da return 0; } void FastBootDriver::set_transport(Transport* transport) { if (transport_) { transport_->Close(); delete transport_; } transport_ = transport; Transport* FastBootDriver::set_transport(Transport* transport) { std::swap(transport_, transport); return transport; } } // End namespace fastboot fastboot/fastboot_driver.h +2 −2 Original line number Diff line number Diff line Loading @@ -109,8 +109,8 @@ class FastBootDriver { std::string Error(); RetCode WaitForDisconnect(); // Note: changing the transport will close and delete the existing one. void set_transport(Transport* transport); // Note: set_transport will return the previous transport. Transport* set_transport(Transport* transport); Transport* transport() const { return transport_; } // This is temporarily public for engine.cpp Loading fastboot/fuzzy_fastboot/fixtures.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -133,7 +133,6 @@ void FastBootTest::TearDown() { fb.reset(); if (transport) { transport->Close(); transport.reset(); } Loading Loading @@ -188,7 +187,6 @@ void FastBootTest::SetLockState(bool unlock, bool assert_change) { ASSERT_EQ(fb->RawCommand("flashing " + cmd, &resp), SUCCESS) << "Attempting to change locked state, but 'flashing" + cmd + "' command failed"; fb.reset(); transport->Close(); transport.reset(); printf("PLEASE RESPOND TO PROMPT FOR '%sing' BOOTLOADER ON DEVICE\n", cmd.c_str()); while (UsbStillAvailible()) Loading Loading @@ -249,7 +247,6 @@ void Fuzz::TearDown() { } if (transport) { transport->Close(); transport.reset(); } Loading Loading
fastboot/engine.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -88,7 +88,9 @@ void fb_init(fastboot::FastBootDriver& fbi) { } void fb_reinit(Transport* transport) { fb->set_transport(transport); if (Transport* old_transport = fb->set_transport(transport)) { delete old_transport; } } const std::string fb_get_error() { Loading Loading @@ -392,6 +394,6 @@ bool fb_reboot_to_userspace() { } fprintf(stderr, "OKAY\n"); fb->set_transport(nullptr); fb_reinit(nullptr); return true; }
fastboot/fastboot.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1847,6 +1847,10 @@ int FastBootTool::Main(int argc, char* argv[]) { int status = fb_execute_queue() ? EXIT_FAILURE : EXIT_SUCCESS; fprintf(stderr, "Finished. Total time: %.3fs\n", (now() - start)); if (Transport* old_transport = fb.set_transport(nullptr)) { delete old_transport; } return status; } Loading
fastboot/fastboot_driver.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ FastBootDriver::FastBootDriver(Transport* transport, std::function<void(std::str } FastBootDriver::~FastBootDriver() { set_transport(nullptr); } RetCode FastBootDriver::Boot(std::string* response, std::vector<std::string>* info) { Loading Loading @@ -537,12 +536,9 @@ int FastBootDriver::SparseWriteCallback(std::vector<char>& tpbuf, const char* da return 0; } void FastBootDriver::set_transport(Transport* transport) { if (transport_) { transport_->Close(); delete transport_; } transport_ = transport; Transport* FastBootDriver::set_transport(Transport* transport) { std::swap(transport_, transport); return transport; } } // End namespace fastboot
fastboot/fastboot_driver.h +2 −2 Original line number Diff line number Diff line Loading @@ -109,8 +109,8 @@ class FastBootDriver { std::string Error(); RetCode WaitForDisconnect(); // Note: changing the transport will close and delete the existing one. void set_transport(Transport* transport); // Note: set_transport will return the previous transport. Transport* set_transport(Transport* transport); Transport* transport() const { return transport_; } // This is temporarily public for engine.cpp Loading
fastboot/fuzzy_fastboot/fixtures.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -133,7 +133,6 @@ void FastBootTest::TearDown() { fb.reset(); if (transport) { transport->Close(); transport.reset(); } Loading Loading @@ -188,7 +187,6 @@ void FastBootTest::SetLockState(bool unlock, bool assert_change) { ASSERT_EQ(fb->RawCommand("flashing " + cmd, &resp), SUCCESS) << "Attempting to change locked state, but 'flashing" + cmd + "' command failed"; fb.reset(); transport->Close(); transport.reset(); printf("PLEASE RESPOND TO PROMPT FOR '%sing' BOOTLOADER ON DEVICE\n", cmd.c_str()); while (UsbStillAvailible()) Loading Loading @@ -249,7 +247,6 @@ void Fuzz::TearDown() { } if (transport) { transport->Close(); transport.reset(); } Loading