How pink0d/btd_vhci works
This is an ESP-IDF Bluetooth Classic HID library for connecting PS4, PS5, Xbox One S, and generic keyboard/mouse devices to an ESP32 through VHCI. The documented workflow is for an application to initialize the VHCI layer, start auto-connect/pairing for a device instance, then read device state while coordinating access with the background update task. Controller reports are handled by device-specific parsers; the generic HID path also supports boot-protocol keyboard and mouse parsing. The graph follows README and source-index evidence; some lower-level report-dispatch links are left out because their implementation was not shown.
Main entry points: BTHID.cpp Bluetooth HID service · PS4BT.h PS4 device · PS5BT.h PS5 device · XBOXONESBT.h Xbox One S device
Components 21
Bluetooth transport
- VHCI runtime
src/btd_vhci.cpp - Bluetooth driver
src/BTD.cpp - Bluetooth driver API
src/BTD.h
HID services
- Bluetooth HID service
src/BTHID.cpp - HID service API
src/BTHID.h - Boot HID parsing
src/hidboot.cpp - Boot HID definitions
src/hidboot.h
Controller support
- PS4 device
src/PS4BT.h - PS4 report parsing
src/PS4Parser.cpp - PS4 parser API
src/PS4Parser.h - PS5 device
src/PS5BT.h - PS5 report parsing
src/PS5Parser.cpp - PS5 parser API
src/PS5Parser.h - PS5 trigger effects
src/PS5Trigger.cpp - PS5 trigger API
src/PS5Trigger.h - Xbox One S device
src/XBOXONESBT.h - Xbox report parsing
src/XBOXONESParser.cpp - Xbox parser API
src/XBOXONESParser.h
Shared definitions
- Controller enums
src/controllerEnums.h - Shared utilities
src/extras.h
Other components
- ESP-IDF application
Connections 29
- ESP-IDF application → VHCI runtime: initializes
README.md - ESP-IDF application → VHCI runtime: starts pairing
README.md - ESP-IDF application → PS4 device: instantiates
README.md - ESP-IDF application → PS5 device: instantiates
- ESP-IDF application → Xbox One S device: instantiates
- VHCI runtime → Bluetooth driver: updates
src/btd_vhci.cpp - Bluetooth driver → Bluetooth driver API: implements
src/BTD.cpp - Bluetooth driver → VHCI runtime: sends packets
src/BTD.cpp - Bluetooth HID service → HID service API: implements
src/BTHID.cpp - Bluetooth HID service → Bluetooth driver API: uses driver
- Bluetooth HID service → Boot HID parsing: dispatches reports
- Boot HID parsing → Boot HID definitions: implements
src/hidboot.cpp - PS4 device → Bluetooth HID service: extends HID
src/PS4BT.h - PS4 device → PS4 report parsing: parses reports
- PS4 report parsing → PS4 parser API: implements
src/PS4Parser.cpp - PS5 device → Bluetooth HID service: extends HID
src/PS5BT.h - PS5 device → PS5 report parsing: parses reports
- PS5 report parsing → PS5 parser API: implements
src/PS5Parser.cpp - PS5 parser API → PS5 trigger API: uses effects
src/PS5Parser.h - PS5 trigger effects → PS5 trigger API: implements
src/PS5Trigger.cpp - Xbox One S device → Bluetooth HID service: extends HID
src/XBOXONESBT.h - Xbox One S device → Xbox report parsing: parses reports
- Xbox report parsing → Xbox parser API: implements
src/XBOXONESParser.cpp - PS4 parser API → Controller enums: uses enums
src/PS4Parser.h - PS5 parser API → Controller enums: uses enums
src/PS5Parser.h - Xbox parser API → Controller enums: uses enums
src/XBOXONESParser.h - PS4 device → Shared utilities: uses utilities
src/PS4BT.h - PS5 device → Shared utilities: uses utilities
src/PS5BT.h - Xbox One S device → Shared utilities: uses utilities
src/XBOXONESBT.h