OSDN Git Service

DO NOT MERGE Send HCI Read Encryption Key properly
authorJakub Pawlowski <jpawlowski@google.com>
Fri, 24 May 2019 20:01:09 +0000 (22:01 +0200)
committerhamzeh <hamzeh@google.com>
Wed, 29 May 2019 17:58:37 +0000 (10:58 -0700)
This patch fixes bad HCI command being send instead of Read Encryption
Key Size.

Bug: 124301137
Test: pair and connect with Bluetooth headset
Change-Id: If325ef2771ca1546ae58df7c684f66ae537b8573
(cherry picked from commit a3cc7575f9ce644a3dfceee61ab7b4b206a3982e)

stack/hcic/hcicmds.c

index 56196ee..97e83b7 100644 (file)
@@ -1360,9 +1360,12 @@ BOOLEAN btsnd_hcic_read_encryption_key_size(UINT16 handle) {
     BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE);
     UINT8 *pp = (UINT8 *)(p + 1);
 
-    p->len    = HCIC_PREAMBLE_SIZE + 2;
+    p->len    = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE;
     p->offset = 0;
 
+    UINT16_TO_STREAM (pp, HCI_READ_ENCR_KEY_SIZE);
+    UINT8_TO_STREAM  (pp, HCIC_PARAM_SIZE_CMD_HANDLE);
+
     UINT16_TO_STREAM (pp, handle);
 
     btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID,  p);