From: Rob Herring <robh@kernel.org>
Date: Mon, 26 Jan 2015 21:14:41 +0000 (-0600)
Subject: fastboot: Add USB cable detect check
X-Git-Tag: v2025.01-rc5-pxa1908~13714^2~4
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/gitweb.css?a=commitdiff_plain;h=7c23bcb93fd44026c737c0f102262f98b5a08ea9;p=u-boot.git

fastboot: Add USB cable detect check

Add a check for USB cable attached and only enter fastboot when a cable
is attached.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Steve Rae <srae@broadcom.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
---

diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index b72f4f310d..346ab80454 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -20,6 +20,12 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	if (ret)
 		return ret;
 
+	if (!g_dnl_board_usb_cable_connected()) {
+		puts("\rUSB cable not detected.\n" \
+		     "Command exit.\n");
+		return CMD_RET_FAILURE;
+	}
+
 	while (1) {
 		if (g_dnl_detach())
 			break;