From 45bd1e24975d9d4f1e17047634cf2af3b4ba2914 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Thu, 28 Nov 2013 21:23:01 +0000 Subject: [PATCH] handle unknown io capabilities --- example/libusb/ble_server.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/example/libusb/ble_server.c b/example/libusb/ble_server.c index 69483f3b2..bc4c2b943 100644 --- a/example/libusb/ble_server.c +++ b/example/libusb/ble_server.c @@ -421,6 +421,10 @@ void sm_reset_tk(){ // - OOB data availability static void sm_tk_setup(){ + // default: just works + sm_stk_generation_method = JUST_WORKS; + sm_reset_tk(); + // If both devices have out of band authentication data, then the Authentication // Requirements Flags shall be ignored when selecting the pairing method and the // Out of Band pairing method shall be used. @@ -433,8 +437,12 @@ static void sm_tk_setup(){ // Flags, then the IO capabilities shall be ignored and the Just Works association // model shall be used. if ((sm_s_auth_req & sm_m_auth_req & 0x04) == 0){ - sm_stk_generation_method = JUST_WORKS; - sm_reset_tk(); + return; + } + + // Also use just works if unknown io capabilites + if ((sm_m_io_capabilities > 4) || (sm_m_io_capabilities > 4)){ + return; } // Otherwise the IO capabilities of the devices shall be used to determine the