quack/main/SDK/quack.diff
2021-09-19 23:32:58 +02:00

76 lines
3.3 KiB
Diff

diff --git a/components/bt/host/bluedroid/bta/hh/bta_hh_le.c b/components/bt/host/bluedroid/bta/hh/bta_hh_le.c
index 6c86cb9be7..8fdf1a1dc3 100644
--- a/components/bt/host/bluedroid/bta/hh/bta_hh_le.c
+++ b/components/bt/host/bluedroid/bta/hh/bta_hh_le.c
@@ -498,7 +498,7 @@ tBTA_HH_LE_RPT *bta_hh_le_find_rpt_by_idtype(tBTA_HH_LE_RPT *p_head, UINT8 mode,
UINT8 i;
#if BTA_HH_DEBUG == TRUE
- APPL_TRACE_DEBUG("bta_hh_le_find_rpt_by_idtype: r_type: %d rpt_id: %d", r_type, rpt_id);
+ :required:("bta_hh_le_find_rpt_by_idtype: r_type: %d rpt_id: %d", r_type, rpt_id);
#endif
for (i = 0 ; i < BTA_HH_LE_RPT_MAX; i ++, p_rpt++) {
diff --git a/components/esp_hid/include/esp_hidh.h b/components/esp_hid/include/esp_hidh.h
index b1a8264307..bedcb42b65 100644
--- a/components/esp_hid/include/esp_hidh.h
+++ b/components/esp_hid/include/esp_hidh.h
@@ -100,6 +100,7 @@ typedef union {
typedef struct {
esp_event_handler_t callback;
+ uint16_t event_stack_size;
} esp_hidh_config_t;
/**
diff --git a/components/esp_hid/src/ble_hidh.c b/components/esp_hid/src/ble_hidh.c
index 5fe54f2fa7..28cc35e295 100644
--- a/components/esp_hid/src/ble_hidh.c
+++ b/components/esp_hid/src/ble_hidh.c
@@ -617,7 +617,7 @@ esp_err_t esp_ble_hidh_init(const esp_hidh_config_t *config)
.queue_size = 5,
.task_name = "esp_ble_hidh_events",
.task_priority = uxTaskPriorityGet(NULL),
- .task_stack_size = 2048,
+ .task_stack_size = config->event_stack_size > 0 ? config->event_stack_size : 2048,
.task_core_id = tskNO_AFFINITY
};
ret = esp_event_loop_create(&event_task_args, &event_loop_handle);
diff --git a/components/esp_hid/src/bt_hidh.c b/components/esp_hid/src/bt_hidh.c
index 1a17e6aa35..6ae12958ff 100644
--- a/components/esp_hid/src/bt_hidh.c
+++ b/components/esp_hid/src/bt_hidh.c
@@ -320,7 +320,7 @@ esp_err_t esp_bt_hidh_init(const esp_hidh_config_t *config)
.queue_size = 5,
.task_name = "esp_bt_hidh_events",
.task_priority = uxTaskPriorityGet(NULL),
- .task_stack_size = 2048,
+ .task_stack_size = config->event_stack_size > 0 ? config->event_stack_size : 2048,
.task_core_id = tskNO_AFFINITY
};
esp_err_t ret = esp_event_loop_create(&event_task_args, &event_loop_handle);
@@ -386,6 +386,23 @@ void bta_hh_co_data(uint8_t handle, uint8_t *p_rpt, uint16_t len, tBTA_HH_PROTO_
ESP_LOGE(TAG, "Device Not Found: handle %u", handle);
return;
}
+
+ /*
+ * quack patch: mode is always ESP_HID_PROTOCOL_MODE_BOOT even if the device is in BOOT mode
+ * BTA_HH_PROTO_RPT_MODE from Bluedroid is 0
+ * BOOT report id is also questionable, assume than an REPORT mode with a lengh of 3 or 4 is a BOOT packet
+ */
+ if (len >= 2 + 1 && p_rpt[0] == 2 && mode == 0) {
+ esp_hidh_event_data_t p = {0};
+ p.input.dev = dev;
+ p.feature.report_id = 2;
+ p.feature.usage = ESP_HID_USAGE_MOUSE;
+ p.feature.data = p_rpt + 1;
+ p.input.length = len - 1;
+ esp_event_post_to(event_loop_handle, ESP_HIDH_EVENTS, ESP_HIDH_INPUT_EVENT, &p, sizeof(esp_hidh_event_data_t), portMAX_DELAY);
+ return ;
+ }
+
report = esp_hidh_dev_get_input_report_by_id_and_proto(dev, p_rpt[0], mode ? ESP_HID_PROTOCOL_MODE_BOOT : ESP_HID_PROTOCOL_MODE_REPORT);
if (report == NULL) {
ESP_LOGE(TAG, "Report Not Found: %d mode: %s", p_rpt[0], mode ? "BOOT" : "REPORT");