Update Kconfig.in

Add BT HID task size config option
Update esp_hid_common.h

add #ifndef BT_HID_DEVICE_TASK_SIZE to set a default
Update ble_hidd.c

add defined BT_HID_DEVICE_TASK_SIZE
Update bt_hidd.c

Add defined BT_HID_DEVICE_TASK_SIZE
Update esp_hid_common.h

Increase default to 4096
Update Kconfig.in

Update default HID task size to 4096 bytes
Implement DID for Bluetooth Classic HID Device

- Add necessary attributes that get passed along from the esp_hidd component

Remove unneeded comment
This commit is contained in:
Mitch Cairns 2023-12-28 13:34:04 -08:00
parent e49823f10c
commit 151ac2efbf
10 changed files with 64 additions and 2 deletions

View File

@ -144,6 +144,13 @@ config BT_HID_DEVICE_ENABLED
help
This enables the BT HID Device
config BT_HID_DEVICE_TASK_SIZE
int "Bluetooth HID event (callback to application) task stack size"
depends on BT_HID_DEVICE_ENABLED
default 4096
help
This selects the esp_hid task size
config BT_BLE_ENABLED
bool "Bluetooth Low Energy"
depends on BT_BLUEDROID_ENABLED

View File

@ -98,6 +98,12 @@ typedef struct {
uint8_t subclass; /*!< HID device subclass */
uint8_t *desc_list; /*!< HID descriptor list */
int desc_list_len; /*!< size in bytes of HID descriptor list */
// DID Profile SDP
uint16_t vendor_id; /*!< HID Vendor ID */
uint16_t product_id; /*!< HID Product ID */
uint16_t version; /*!< HID Product Version */
uint8_t vendor_id_source; /*!< HID Country Code */
} esp_hidd_app_param_t;
/**

View File

@ -175,6 +175,16 @@ void bta_hd_register_act(tBTA_HD_DATA *p_data)
p_app_data->subclass, p_app_data->d_len, p_app_data->d_data);
bta_sys_add_uuid(UUID_SERVCLASS_HUMAN_INTERFACE);
// Set DID Profile SDP Record
tBTA_DI_RECORD bqb_device_info;
bqb_device_info.vendor = p_app_data->vendor_id;
bqb_device_info.vendor_id_source = p_app_data->vendor_id_source;
bqb_device_info.product = p_app_data->product_id;
bqb_device_info.version = p_app_data->version;
bqb_device_info.primary_record = TRUE;
BTA_DmSetLocalDiRecord(&bqb_device_info, &bta_hd_cb.sdp_handle);
HID_DevSetIncomingQos(p_app_data->in_qos.service_type, p_app_data->in_qos.token_rate,
p_app_data->in_qos.token_bucket_size, p_app_data->in_qos.peak_bandwidth,
p_app_data->in_qos.access_latency, p_app_data->in_qos.delay_variation);

View File

@ -114,6 +114,13 @@ extern void BTA_HdRegisterApp(tBTA_HD_APP_INFO *p_app_info, tBTA_HD_QOS_INFO *p_
p_buf->subclass = p_app_info->subclass;
p_buf->d_len = p_app_info->descriptor.dl_len;
memcpy(p_buf->d_data, p_app_info->descriptor.dsc_list, p_app_info->descriptor.dl_len);
// copy DID profile SDP info
p_buf->vendor_id = p_app_info->vendor_id;
p_buf->product_id = p_app_info->product_id;
p_buf->version = p_app_info->version;
p_buf->vendor_id_source = p_app_info->vendor_id_source;
// copy qos data as-is
memcpy(&p_buf->in_qos, p_in_qos, sizeof(tBTA_HD_QOS_INFO));
memcpy(&p_buf->out_qos, p_out_qos, sizeof(tBTA_HD_QOS_INFO));

View File

@ -75,6 +75,13 @@ typedef struct {
uint8_t subclass;
uint16_t d_len;
uint8_t d_data[BTA_HD_APP_DESCRIPTOR_LEN];
// DID SDP Information (Device Information)
uint16_t vendor_id;
uint16_t product_id;
uint16_t version;
uint8_t vendor_id_source;
tBTA_HD_QOS_INFO in_qos;
tBTA_HD_QOS_INFO out_qos;
} tBTA_HD_REGISTER_APP;

View File

@ -69,6 +69,13 @@ typedef struct {
char *p_description;
char *p_provider;
uint8_t subclass;
// SDP Idenification info
uint16_t vendor_id; // 0x0201
uint16_t product_id; // 0x0202
uint16_t version; // 0x0203
uint8_t vendor_id_source; // 0x0205
tBTA_HD_DEV_DESCR descriptor;
} tBTA_HD_APP_INFO;

View File

@ -341,6 +341,13 @@ static void btc_hd_register_app(esp_hidd_app_param_t *p_app_param, esp_hidd_qos_
btc_hd_cb.out_qos.access_latency = p_out_qos->access_latency;
btc_hd_cb.out_qos.delay_variation = p_out_qos->delay_variation;
// Copy SDP record information for DID (Device Identification Profile)
btc_hd_cb.app_info.vendor_id = p_app_param->vendor_id;
btc_hd_cb.app_info.product_id = p_app_param->product_id;
btc_hd_cb.app_info.version = p_app_param->version;
btc_hd_cb.app_info.vendor_id_source = p_app_param->vendor_id_source;
BTA_HdRegisterApp(&btc_hd_cb.app_info, &btc_hd_cb.in_qos, &btc_hd_cb.out_qos);
} while(0);

View File

@ -23,6 +23,11 @@ extern "C" {
#include <stdbool.h>
#include <stdio.h>
/* HID BT Task Size Def */
#ifndef BT_HID_DEVICE_TASK_SIZE
#define BT_HID_DEVICE_TASK_SIZE 4096
#endif
/* HID Report Map Values */
#define HID_RM_INPUT 0x80
#define HID_RM_OUTPUT 0x90

View File

@ -976,7 +976,7 @@ esp_err_t esp_ble_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_conf
.queue_size = 5,
.task_name = "ble_hidd_events",
.task_priority = uxTaskPriorityGet(NULL),
.task_stack_size = 4096,
.task_stack_size = BT_HID_DEVICE_TASK_SIZE,
.task_core_id = tskNO_AFFINITY
};
ret = esp_event_loop_create(&event_task_args, &s_dev->event_loop_handle);

View File

@ -282,6 +282,12 @@ static void bt_hidd_init_app(void)
s_hidd_param.app_param.subclass = get_subclass_by_appearance(s_hidd_param.dev->appearance);
s_hidd_param.app_param.desc_list = (uint8_t *)s_hidd_param.dev->devices[0].reports_map.data;
s_hidd_param.app_param.desc_list_len = s_hidd_param.dev->devices[0].reports_map.len;
// Information SDP
s_hidd_param.app_param.vendor_id = p_config->vendor_id;
s_hidd_param.app_param.product_id = p_config->product_id;
s_hidd_param.app_param.version = p_config->version;
s_hidd_param.app_param.vendor_id_source = s_hidd_param.app_param.vendor_id_source;
}
static void bt_hidd_init_qos(void)
@ -812,7 +818,7 @@ esp_err_t esp_bt_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_confi
.queue_size = 5,
.task_name = "bt_hidd_events",
.task_priority = uxTaskPriorityGet(NULL),
.task_stack_size = 2048,
.task_stack_size = BT_HID_DEVICE_TASK_SIZE,
.task_core_id = tskNO_AFFINITY
};
ret = esp_event_loop_create(&event_task_args, &s_hidd_param.dev->event_loop_handle);