summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorJerzy Kasenberg <[email protected]>2022-08-09 09:53:08 +0200
committerJerzy Kasenberg <[email protected]>2022-08-09 10:42:30 +0200
commitc7469ce986b495ccd3777e542df31bd90f4134f2 (patch)
tree87bc3e7ae22831906d46cd6ddedf6869aedcf98f /src/class
parent251ce9899039fbdf8e749342bc6504e7438d2e88 (diff)
dfu: Allow DFU coexistence with other interfaces
dfu_moded_open() only works correct when its called on DFU interface descriptor. It means that DFU is the only one interface in configuration or driver is called after all others interface drivers were tried and gave up. If other interface is supported and but driver for DFU is called first (this is the case for BTH and RNDIS). Code after while loop (that was not entered) has an TU_ASSERT that will make set_configuration to fail. Now TU_VERIFY is called first to make sure open code is called for DFU only and not other interface descriptors like in other drivers.
Diffstat (limited to 'src/class')
-rw-r--r--src/class/dfu/dfu_device.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/class/dfu/dfu_device.c b/src/class/dfu/dfu_device.c
index 8d859d2ee..aa5891ca9 100644
--- a/src/class/dfu/dfu_device.c
+++ b/src/class/dfu/dfu_device.c
@@ -167,6 +167,8 @@ uint16_t dfu_moded_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc,
uint8_t alt_count = 0;
uint16_t drv_len = 0;
+ TU_VERIFY(itf_desc->bInterfaceSubClass == TUD_DFU_APP_SUBCLASS && itf_desc->bInterfaceProtocol == DFU_PROTOCOL_DFU, 0);
+
while(itf_desc->bInterfaceSubClass == TUD_DFU_APP_SUBCLASS && itf_desc->bInterfaceProtocol == DFU_PROTOCOL_DFU)
{
TU_ASSERT(max_len > drv_len, 0);