[PATCH 15/21] fastboot: Add fastboot_abort()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add fastboot_abort() to allow aborting the current session.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 common/fastboot.c  | 12 ++++++++++++
 include/fastboot.h |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/common/fastboot.c b/common/fastboot.c
index 7f5b8b6f03..10ebb8b2a9 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -347,6 +347,18 @@ void fastboot_download_finished(struct fastboot *fb)
 	fastboot_tx_print(fb, FASTBOOT_MSG_OKAY, "");
 }
 
+void fastboot_abort(struct fastboot *fb)
+{
+	if (fb->download_fd > 0) {
+		close(fb->download_fd);
+		fb->download_fd = 0;
+	}
+
+	fb->active = false;
+
+	unlink(fb->tempname);
+}
+
 static void cb_download(struct fastboot *fb, const char *cmd)
 {
 	fb->download_size = simple_strtoul(cmd, NULL, 16);
diff --git a/include/fastboot.h b/include/fastboot.h
index 8619dcd34e..7718390ae5 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -66,4 +66,6 @@ int fastboot_tx_print(struct fastboot *fb, enum fastboot_msg_type type,
 void fastboot_start_download_generic(struct fastboot *fb);
 void fastboot_download_finished(struct fastboot *fb);
 void fastboot_exec_cmd(struct fastboot *fb, const char *cmdbuf);
+void fastboot_abort(struct fastboot *fb);
+
 #endif
-- 
2.27.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux