diff options
| author | hathach <[email protected]> | 2023-11-29 17:21:21 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-11-29 17:21:21 +0700 |
| commit | 1c1c2dc3b95b36136373f74380b90646d4847718 (patch) | |
| tree | 2f5b26393cfbe648cb6eb15ea0a03b5003091496 /src/class/bth | |
| parent | 00484d18a5b89eb3a0e7cc138f34142f3464016d (diff) | |
| parent | 9c9ebb342d2d3cb0396ff4ad8c7b09acd2aee75e (diff) | |
Merge branch 'master' into codeql
Diffstat (limited to 'src/class/bth')
| -rwxr-xr-x | src/class/bth/bth_device.c | 6 | ||||
| -rwxr-xr-x | src/class/bth/bth_device.h | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/class/bth/bth_device.c b/src/class/bth/bth_device.c index f96bb3552..f145e2ead 100755 --- a/src/class/bth/bth_device.c +++ b/src/class/bth/bth_device.c @@ -55,7 +55,7 @@ typedef struct //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -CFG_TUSB_MEM_SECTION btd_interface_t _btd_itf; +CFG_TUD_MEM_SECTION btd_interface_t _btd_itf; static bool bt_tx_data(uint8_t ep, void *data, uint16_t len) { @@ -204,7 +204,9 @@ bool btd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t c request->bmRequestType_bit.recipient == TUSB_REQ_RCPT_DEVICE) { // HCI command packet addressing for single function Primary Controllers - TU_VERIFY(request->bRequest == 0 && request->wValue == 0 && request->wIndex == 0); + // also compatible with historical mode if enabled + TU_VERIFY((request->bRequest == 0 && request->wValue == 0 && request->wIndex == 0) || + (CFG_TUD_BTH_HISTORICAL_COMPATIBLE && request->bRequest == 0xe0)); } else if (request->bmRequestType_bit.recipient == TUSB_REQ_RCPT_INTERFACE) { diff --git a/src/class/bth/bth_device.h b/src/class/bth/bth_device.h index 921bd7a1a..e782c532b 100755 --- a/src/class/bth/bth_device.h +++ b/src/class/bth/bth_device.h @@ -36,10 +36,17 @@ #ifndef CFG_TUD_BTH_EVENT_EPSIZE #define CFG_TUD_BTH_EVENT_EPSIZE 16 #endif + #ifndef CFG_TUD_BTH_DATA_EPSIZE #define CFG_TUD_BTH_DATA_EPSIZE 64 #endif +// Allow BTH class to work in historically compatibility mode where the bRequest is always 0xe0. +// See Bluetooth Core v5.3, Vol. 4, Part B, Section 2.2 +#ifndef CFG_TUD_BTH_HISTORICAL_COMPATIBLE +#define CFG_TUD_BTH_HISTORICAL_COMPATIBLE 0 +#endif + typedef struct TU_ATTR_PACKED { uint16_t op_code; |
