From: Jules Maselbas <jmaselbas@kalray.eu>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH v2 4/4] usb: gadget: dfu: Fix DFU mode interface descriptor
Date: Thu, 26 Mar 2020 19:33:04 +0100 [thread overview]
Message-ID: <20200326183304.16531-5-jmaselbas@kalray.eu> (raw)
In-Reply-To: <20200326183304.16531-1-jmaselbas@kalray.eu>
The gadget driver set the bInterfaceProtocol value to 1 in the DFU
interface descriptor. However this value is used to indicate that the
gadget is in run-time mode and not ready for DFU. When ready for DFU
operation the bInterfaceProtocol value must be set to 2 (DFU mode).
From the DFU 1.1 specification, the value of bInterfaceProtocol select:
- 1: Runtime protocol (see Table 4.1)
- 2: DFU mode protocol (see Table 4.4)
This patch change the bInterfaceProtocol value from 1 to 2. As this
DFU gadget driver is always ready for DFU operation (DFU mode) and
doesn't require a USB reset.
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
I was getting errors when trying to update a partition using
dfu-util when there was more than one partition available.
(the error was "More than one DFU capable USB device found!")
This is the output of dfu-util when listing partitions.
The first is before this patch and second one is after.
Notice the difference between the two: in the first you
can read 'Found Runtime' where in the other 'Found DFU'.
The bInterfaceProtocol was set to 1 (before):
$ dfu-util -l
Found Runtime: [1d6b:0104] [...] alt=0, name="/dev/mtd0.p0"
Found Runtime: [1d6b:0104] [...] alt=1, name="/dev/mtd0.p1"
...
When bInterfaceProtocol is set to 2 (after patch):
$ dfu-util -l
Found DFU: [1d6b:0104] [...] alt=0, name="/dev/mtd0.p0"
Found DFU: [1d6b:0104] [...] alt=1, name="/dev/mtd0.p1"
...
---
drivers/usb/gadget/dfu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c
index 225c6e3c6..9117a5b06 100644
--- a/drivers/usb/gadget/dfu.c
+++ b/drivers/usb/gadget/dfu.c
@@ -239,7 +239,7 @@ dfu_bind(struct usb_configuration *c, struct usb_function *f)
desc[i].bNumEndpoints = 0;
desc[i].bInterfaceClass = 0xfe;
desc[i].bInterfaceSubClass = 1;
- desc[i].bInterfaceProtocol = 1;
+ desc[i].bInterfaceProtocol = 2;
desc[i].bAlternateSetting = i;
desc[i].iInterface = us[i + 1].id;
header[i] = (struct usb_descriptor_header *)&desc[i];
--
2.21.0.196.g041f5ea
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-03-26 18:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 18:33 [PATCH v2 0/4] usb: gadget: dfu: Fix timeout on erase when using big partition Jules Maselbas
2020-03-26 18:33 ` [PATCH v2 1/4] usb: gadget: dfu: Reset global variables on unbind Jules Maselbas
2020-03-26 18:33 ` [PATCH v2 2/4] usb: gadget: dfu: Add manifestation phase Jules Maselbas
2020-03-26 18:33 ` [PATCH v2 3/4] usb: gadget: dfu: Progressive erase if file is a mtd Jules Maselbas
2020-03-26 18:33 ` Jules Maselbas [this message]
2020-03-30 5:26 ` [PATCH v2 4/4] usb: gadget: dfu: Fix DFU mode interface descriptor Sascha Hauer
2020-03-30 9:13 ` Jules Maselbas
2020-03-31 5:13 ` [PATCH v2 0/4] usb: gadget: dfu: Fix timeout on erase when using big partition Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200326183304.16531-5-jmaselbas@kalray.eu \
--to=jmaselbas@kalray.eu \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox