diff --git a/example/libusb/ble_server.c b/example/libusb/ble_server.c index aa16798f2..e83ca1750 100644 --- a/example/libusb/ble_server.c +++ b/example/libusb/ble_server.c @@ -117,7 +117,6 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * // reset connection MTU att_connection.mtu = 23; att_advertisements_enabled = 0; - att_ir_lookup_active = 1; break; default: @@ -149,6 +148,9 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * break; } break; + case SM_IDENTITY_RESOLVING_STARTED: + att_ir_lookup_active = 1; + break; case SM_IDENTITY_RESOLVING_SUCCEEDED: att_ir_lookup_active = 0; att_ir_central_device_db_index = ((sm_event_identity_resolving_t*) packet)->central_device_db_index; @@ -203,7 +205,6 @@ static void att_run(void){ return; } if (att_ir_lookup_active){ - // search ongoing, return; } if (att_ir_central_device_db_index < 0){ diff --git a/example/libusb/sm.c b/example/libusb/sm.c index d4f2609e9..41bfd3de7 100644 --- a/example/libusb/sm.c +++ b/example/libusb/sm.c @@ -1277,14 +1277,15 @@ static void sm_event_packet_handler (void * connection, uint8_t packet_type, uin printf("Incoming connection, own address "); print_bd_addr(sm_s_address); - // try to lookup device - sm_central_device_test = 0; - sm_central_device_matched = -1; - // request security if (sm_s_request_security){ sm_state_responding = SM_STATE_SEND_SECURITY_REQUEST; } + + // try to lookup device + sm_central_device_test = 0; + sm_central_device_matched = -1; + sm_notify_client_identity_resolving(SM_IDENTITY_RESOLVING_STARTED, 0); break; case HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST: diff --git a/include/btstack/hci_cmds.h b/include/btstack/hci_cmds.h index 3443a8259..76fbbde26 100644 --- a/include/btstack/hci_cmds.h +++ b/include/btstack/hci_cmds.h @@ -229,8 +229,9 @@ extern "C" { #define SM_PASSKEY_DISPLAY_CANCEL 0xb3 #define SM_PASSKEY_INPUT_NUMBER 0xb4 #define SM_PASSKEY_INPUT_CANCEL 0xb5 -#define SM_IDENTITY_RESOLVING_FAILED 0xb6 -#define SM_IDENTITY_RESOLVING_SUCCEEDED 0xb7 +#define SM_IDENTITY_RESOLVING_STARTED 0xb6 +#define SM_IDENTITY_RESOLVING_FAILED 0xb7 +#define SM_IDENTITY_RESOLVING_SUCCEEDED 0xb8 // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors