dfu: Introduce CONFIG_BOOT_WAIT_FOR_USB_DFU

This Kconfig parameter makes MCUboot wait for a prescribed duration
of time to allow for USB DFU to be invoked.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 236f80c..e276454 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -40,6 +40,10 @@
 };
 #endif
 
+#ifdef CONFIG_BOOT_WAIT_FOR_USB_DFU
+#include <usb/class/usb_dfu.h>
+#endif
+
 MCUBOOT_LOG_MODULE_REGISTER(mcuboot);
 
 void os_heap_init(void);
@@ -197,6 +201,12 @@
     }
 #endif
 
+#ifdef CONFIG_BOOT_WAIT_FOR_USB_DFU
+    BOOT_LOG_INF("Waiting for USB DFU");
+    wait_for_usb_dfu();
+    BOOT_LOG_INF("USB DFU wait time elapsed");
+#endif
+
     rc = boot_go(&rsp);
     if (rc != 0) {
         BOOT_LOG_ERR("Unable to find bootable image");