Skip to content

Instantly share code, notes, and snippets.

@x29a
Created February 27, 2021 20:54
Show Gist options
  • Save x29a/ebdea9acccca450119e1cc5b04dc36ac to your computer and use it in GitHub Desktop.
Save x29a/ebdea9acccca450119e1cc5b04dc36ac to your computer and use it in GitHub Desktop.
SMA Q2 disable secure pairing
diff --git a/ble/ble_watch_service.c b/ble/ble_watch_service.c
index 78af531..494819c 100644
--- a/ble/ble_watch_service.c
+++ b/ble/ble_watch_service.c
@@ -188,8 +188,17 @@ static uint32_t tx_char_add(ble_watchs_t * p_watchs)
memset(&attr_md, 0, sizeof(attr_md));
- BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&attr_md.read_perm);
- BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&attr_md.write_perm);
+ // manually disable secure pairing for now
+ if (1)
+ {
+ BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
+ BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm);
+ }
+ else
+ {
+ BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&attr_md.read_perm);
+ BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&attr_md.write_perm);
+ }
attr_md.vloc = BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment