summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-05-03 13:48:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-05-12 08:00:00 +0200
commit01a55aa0cbd34ca3740b066ddd22ac7da08a66a7 (patch)
tree572fe347fd9367df5c30103f74e91134a4ea2759
parent25e04a10438440cb9ca71da5b3c1edcdfc704757 (diff)
downloadbarebox-01a55aa0cbd34ca3740b066ddd22ac7da08a66a7.tar.gz
barebox-01a55aa0cbd34ca3740b066ddd22ac7da08a66a7.tar.xz
usbgadget: allow DFU and Fastboot functions to coexist
According to the commit, one upon a time the fastboot client tool did not support a device that exports DFU as well. It does nowadays, and while dfu-util 0.9 doesn't, it might some day. Because these host tools are outside of barebox' control, allow both to coexist and just throw a warning that dfu-util might not work. With the new system partitions support, enabled fastboot and DFU mean that autostart would start both as part of the same multi-gadget. This would've failed, but would now just emit a warning. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-11-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/usbgadget.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/common/usbgadget.c b/common/usbgadget.c
index 0b2d9a2120..009debd93e 100644
--- a/common/usbgadget.c
+++ b/common/usbgadget.c
@@ -52,14 +52,13 @@ int usbgadget_register(bool dfu, const char *dfu_opts,
return COMMAND_ERROR_USAGE;
/*
- * Creating a gadget with both DFU and Fastboot doesn't work.
- * Both client tools seem to assume that the device only has
- * a single configuration
+ * Creating a gadget with both DFU and Fastboot may not work.
+ * fastboot 1:8.1.0+r23-5 can deal with it, but dfu-util 0.9
+ * seems to assume that the device only has a single configuration
+ * That's not our fault though. Emit a warning and continue
*/
- if (fastboot_opts && dfu_opts) {
- pr_err("Only one of Fastboot and DFU allowed\n");
- return -EINVAL;
- }
+ if (fastboot_opts && dfu_opts)
+ pr_warn("Both DFU and Fastboot enabled. dfu-util may not like this!\n");
opts = xzalloc(sizeof(*opts));
opts->release = usb_multi_opts_release;