From d3311a35d99eca1ffe4c845e78baca4570cf8eb1 Mon Sep 17 00:00:00 2001 From: awalol Date: Wed, 13 May 2026 16:45:48 +0800 Subject: [PATCH] adjust l2cap mtu --- src/bt.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bt.cpp b/src/bt.cpp index cc4c4f1..f0b19c4 100644 --- a/src/bt.cpp +++ b/src/bt.cpp @@ -17,8 +17,8 @@ #include "config.h" #include "pico/util/queue.h" -#define MTU_CONTROL 256 -#define MTU_INTERRUPT 1691 +#define MTU_CONTROL 672 +#define MTU_INTERRUPT 672 using std::unordered_map; using std::vector; @@ -395,6 +395,9 @@ static void l2cap_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t if (psm == PSM_HID_CONTROL) { printf("[L2CAP] HID Control opened cid=0x%04X\n", local_cid); hid_control_cid = local_cid; + + const auto mtu = l2cap_get_remote_mtu_for_local_cid(hid_control_cid); + printf("[L2CAP] Remote Control MTU: %d\n",mtu); } else if (psm == PSM_HID_INTERRUPT) { printf("[L2CAP] HID Interrupt opened cid=0x%04X\n", local_cid); hid_interrupt_cid = local_cid; @@ -429,6 +432,9 @@ static void l2cap_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t memcpy(report32 + 2, packet_0x10, sizeof(packet_0x10)); bt_write(report32, sizeof(report32)); + const auto mtu = l2cap_get_remote_mtu_for_local_cid(hid_interrupt_cid); + printf("[L2CAP] Remote Interrupt MTU: %d\n",mtu); + // tud_connect(); } else { printf("[L2CAP] Unknown Channel psm: 0x%02X", psm);