Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4604ad0f authored by Loic Poulain's avatar Loic Poulain Committed by Yong Yao
Browse files

Bluedroid: Fix HCI buffer size issue



The maximum HCI frame coming from the kernel is
the maximum ACL HCI data packet (1024) + ACL HCI
header (4) + H4 header (1) = 1029.
Previous maximum read value was 1016 which is
incorrect and leads to data sync problem for
frames > 1016.

Change-Id: I37f74ad4c612d802e6758b3fe0eb156bcf265b4f
Signed-off-by: default avatarLoic Poulain <loic.poulain@intel.com>
parent 9bdb42e2
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -62,9 +62,8 @@
#endif
#endif  // (BTHC_LINUX_BASE_POLICY != SCHED_NORMAL)

#ifndef BTHC_USERIAL_READ_MEM_SIZE
#define BTHC_USERIAL_READ_MEM_SIZE (1024)
#endif
#define HCI_ACL_MAX_SIZE 1024
#define HCI_MAX_FRAME_SIZE (HCI_ACL_MAX_SIZE + 4)

#ifndef BTSNOOPDISP_INCLUDED
#define BTSNOOPDISP_INCLUDED TRUE
+3 −4
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@
#endif

#define MAX_SERIAL_PORT (USERIAL_PORT_3 + 1)
#define READ_LIMIT (BTHC_USERIAL_READ_MEM_SIZE - BT_HC_HDR_SIZE)

enum {
    USERIAL_RX_EXIT,
@@ -254,8 +253,8 @@ static void *userial_read_thread(void *arg)
    {
        if (bt_hc_cbacks)
        {
            p_buf = (HC_BT_HDR *) bt_hc_cbacks->alloc( \
                                                BTHC_USERIAL_READ_MEM_SIZE);
            p_buf = (HC_BT_HDR *) bt_hc_cbacks->alloc(
                        BT_HC_HDR_SIZE + HCI_MAX_FRAME_SIZE + 1); /* H4 HDR = 1 */
        }
        else
            p_buf = NULL;
@@ -266,7 +265,7 @@ static void *userial_read_thread(void *arg)
            p_buf->layer_specific = 0;

            p = (uint8_t *) (p_buf + 1);
            rx_length = select_read(userial_cb.fd, p, READ_LIMIT);
            rx_length = select_read(userial_cb.fd, p, HCI_MAX_FRAME_SIZE + 1);
        }
        else
        {