@@ -1168,7 +1168,6 @@ uint16_t videod_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
1168
1168
tusb_desc_vc_itf_t const * vc = _get_desc_vc (self );
1169
1169
uint_fast8_t bInCollection = vc -> ctl .bInCollection ;
1170
1170
1171
- videod_streaming_interface_t * default_stm = NULL ;
1172
1171
/* Find the end of the video interface descriptor */
1173
1172
void const * cur = _next_desc_itf (itf_desc , end );
1174
1173
for (uint8_t stm_idx = 0 ; stm_idx < bInCollection ; ++ stm_idx ) {
@@ -1186,9 +1185,16 @@ uint16_t videod_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
1186
1185
stm -> desc .beg = (uint16_t ) ((uintptr_t )cur - (uintptr_t )itf_desc );
1187
1186
cur = _next_desc_itf (cur , end );
1188
1187
stm -> desc .end = (uint16_t ) ((uintptr_t )cur - (uintptr_t )itf_desc );
1189
- if (!default_stm ) default_stm = stm ;
1188
+ if (0 == stm_idx && 1 == bInCollection ) {
1189
+ /* If there is only one streaming interface and no alternate settings,
1190
+ * host may not issue set_interface so open the streaming interface here. */
1191
+ uint8_t const * sbeg = (uint8_t const * )itf_desc + stm -> desc .beg ;
1192
+ uint8_t const * send = (uint8_t const * )itf_desc + stm -> desc .end ;
1193
+ if (end == _find_desc_itf (sbeg , send , _desc_itfnum (sbeg ), 1 )) {
1194
+ TU_VERIFY (_open_vs_itf (rhport , stm , 0 ), 0 );
1195
+ }
1196
+ }
1190
1197
}
1191
- TU_VERIFY (_open_vs_itf (rhport , default_stm , 0 ), 0 );
1192
1198
self -> len = (uint16_t ) ((uintptr_t )cur - (uintptr_t )itf_desc );
1193
1199
return (uint16_t ) ((uintptr_t )cur - (uintptr_t )itf_desc );
1194
1200
}
@@ -1201,7 +1207,6 @@ bool videod_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_
1201
1207
int err ;
1202
1208
TU_VERIFY (request -> bmRequestType_bit .recipient == TUSB_REQ_RCPT_INTERFACE );
1203
1209
uint_fast8_t itfnum = tu_u16_low (request -> wIndex );
1204
-
1205
1210
/* Identify which control interface to use */
1206
1211
uint_fast8_t itf ;
1207
1212
for (itf = 0 ; itf < CFG_TUD_VIDEO ; ++ itf ) {
0 commit comments