From 8241964b5877c00555e925c1c7495f5fe9f45a0f Mon Sep 17 00:00:00 2001 From: demik Date: Tue, 17 Aug 2021 23:27:41 +0200 Subject: [PATCH] commited SDK 4.2 patch --- SDK/quack.diff | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 SDK/quack.diff diff --git a/SDK/quack.diff b/SDK/quack.diff new file mode 100644 index 0000000..fac7b7f --- /dev/null +++ b/SDK/quack.diff @@ -0,0 +1,75 @@ +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 6c86cb9be..8fdf1a1dc 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 b1a826430..bedcb42b6 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 5fe54f2fa..28cc35e29 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 1a17e6aa3..6ae12958f 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");