mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 10:20:57 +00:00
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.
This commit is contained in:
parent
251ce98990
commit
c7469ce986
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user