Skip to content

Commit

Permalink
Upgraded SDK to v4.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
demik committed Apr 3, 2022
1 parent b402468 commit eeb5772
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 36 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
@@ -1,3 +1,8 @@
## v1.4.4
- update to ESP-IDF v4.2.3:
- https://github.com/espressif/esp-idf/releases/tag/v4.2.2
- mostly bluetooth related security and bug fixes

## v1.4.3
- provides some slight acceleration and desceleration on bluetooth mouses

Expand Down
2 changes: 1 addition & 1 deletion main/README.md
Expand Up @@ -2,7 +2,7 @@

### Supported SDK versions:

The code is designed to be build with ESP-IDF SDK version 4.2.2. To workaround some patchs or limitations of this specific release, you need to apply the patch located in the SDK subfolder
The code is designed to be build with ESP-IDF SDK version 4.2.3. To workaround some patchs or limitations of this specific release, you need to apply the patch located in the SDK subfolder

### Unsupported mouse conversions:

Expand Down
56 changes: 22 additions & 34 deletions main/SDK/quack.diff
@@ -1,74 +1,62 @@
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
index b1a8264307..d3d1002103 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;
+ 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
index 5fe54f2fa7..a56eb04c44 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_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
index 1a17e6aa35..16fae9e65a 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_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_
@@ -386,6 +386,24 @@ 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 ;
+ }
+ * 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) {
Expand Down
3 changes: 2 additions & 1 deletion sdkconfig
Expand Up @@ -877,6 +877,7 @@ CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
CONFIG_LWIP_GARP_TMR_INTERVAL=60
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set

#
Expand Down Expand Up @@ -1257,7 +1258,7 @@ CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
# CONFIG_WPA_MBEDTLS_CRYPTO is not set
# CONFIG_WPA_DEBUG_PRINT is not set
# CONFIG_WPA_TESTING_OPTIONS is not set
# CONFIG_WPA_WPS_WARS is not set
# CONFIG_WPA_WPS_STRICT is not set
# end of Supplicant
# end of Component config

Expand Down

0 comments on commit eeb5772

Please sign in to comment.