Implements Classic Bluetooth HID Device profile for keyboard/mouse emulation:
Firmware:
- bt_hid.c/h: HID device driver with combo keyboard/mouse HID descriptor
- cmd_hid_{enable,disable,connect,disconnect}: HID lifecycle management
- cmd_hid_send_keyboard: Send keyboard reports (modifier + up to 6 keys)
- cmd_hid_send_mouse: Send mouse reports (buttons + relative X/Y)
- cmd_hid_status: Query HID state (enabled, registered, connected)
Python MCP tools:
- esp32_hid_enable/disable: Control HID device mode
- esp32_hid_connect/disconnect: Manage HID host connections
- esp32_hid_send_keyboard/send_mouse: Send HID reports
- esp32_hid_status: Get connection state
Config:
- Enable BT_HID_ENABLED + BT_HID_DEVICE_ENABLED in sdkconfig.defaults
- Add bt_hid.c to CMakeLists.txt
Tested E2E: Linux (hci1) connects to ESP32 HID device, keyboard and
mouse reports sent successfully.
36 lines
861 B
Plaintext
36 lines
861 B
Plaintext
# Bluetooth (dual-mode: Classic + BLE via Bluedroid)
|
|
CONFIG_BT_ENABLED=y
|
|
CONFIG_BT_BLUEDROID_ENABLED=y
|
|
CONFIG_BT_CLASSIC_ENABLED=y
|
|
CONFIG_BT_BLE_ENABLED=y
|
|
CONFIG_BT_SPP_ENABLED=y
|
|
|
|
# Classic BT Profiles
|
|
CONFIG_BT_HID_ENABLED=y
|
|
CONFIG_BT_HID_DEVICE_ENABLED=y
|
|
CONFIG_BT_A2DP_ENABLE=n
|
|
|
|
# GAP & GATTS
|
|
CONFIG_BT_GATTS_ENABLE=y
|
|
CONFIG_BT_GATTC_ENABLE=n
|
|
|
|
# Bluetooth controller
|
|
CONFIG_BTDM_CTRL_MODE_BTDM=y
|
|
|
|
# UART — disable ESP-IDF console so our protocol handler owns UART0
|
|
CONFIG_ESP_CONSOLE_NONE=y
|
|
|
|
# Stack sizes (Bluetooth needs generous stacks)
|
|
CONFIG_BT_BTU_TASK_STACK_SIZE=8192
|
|
CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y
|
|
|
|
# Logging — keep it reasonable
|
|
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
|
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
|
|
|
# Partition table — large (1.5MB app) needed for dual-mode BT stack
|
|
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
|
|
|
|
# FreeRTOS
|
|
CONFIG_FREERTOS_HZ=1000
|