File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -398,7 +398,7 @@ static void connect(uint8_t *data, uint16_t len)
398
398
ble_addr_t * addr = (void * ) data ;
399
399
uint16_t mtu = htole16 (cmd -> mtu );
400
400
int rc ;
401
- int i ;
401
+ int i , j ;
402
402
403
403
SYS_LOG_DBG ("connect: type: %d addr: %s" , addr -> type , bt_hex (addr -> val , 6 ));
404
404
@@ -420,6 +420,8 @@ static void connect(uint8_t *data, uint16_t len)
420
420
SYS_LOG_ERR ("No free channels" );
421
421
goto fail ;
422
422
}
423
+ /* temporarily mark channel as used to select next one */
424
+ chan -> state = 1 ;
423
425
424
426
rp -> chan_ids [i ] = chan -> chan_id ;
425
427
@@ -430,6 +432,15 @@ static void connect(uint8_t *data, uint16_t len)
430
432
}
431
433
}
432
434
435
+ /* mark selected channels as unused again */
436
+ for (i = 0 ; i < cmd -> num ; i ++ ) {
437
+ for (j = 0 ; j < CHANNELS ; j ++ ) {
438
+ if (rp -> chan_ids [i ] == channels [j ].chan_id ) {
439
+ channels [j ].state = 0 ;
440
+ }
441
+ }
442
+ }
443
+
433
444
if (cmd -> num == 1 ) {
434
445
rc = ble_l2cap_connect (desc .conn_handle , htole16 (cmd -> psm ),
435
446
mtu , sdu_rx [0 ],
You can’t perform that action at this time.
0 commit comments