summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-06-18 13:41:46 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-08-19 07:36:15 +0200
commit55a86cd1450c5dd6c37f91b1c3044fff7e3a2a5d (patch)
tree34970b4f2c0fedd1c5c3c0eb16a8faa064ff40aa /common
parentfea78c974579883a6cadea546fb8742f6fdb8a83 (diff)
downloadbarebox-55a86cd1450c5dd6c37f91b1c3044fff7e3a2a5d.tar.gz
barebox-55a86cd1450c5dd6c37f91b1c3044fff7e3a2a5d.tar.xz
fastboot: Add fastboot_abort()
Add fastboot_abort() to allow aborting the current session. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/fastboot.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/fastboot.c b/common/fastboot.c
index 7eb10ac177..2a42fa5b6d 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);