Merge branch 'bugfix/fix_wrong_params_in_hidd' into 'master'

Fix wrong parameter of get_report_by_id_and_type in bt_hidd.c

See merge request espressif/esp-idf!18892
This commit is contained in:
Jiang Jiang Jian
2022-07-08 01:10:20 +08:00
2 changed files with 11 additions and 20 deletions

View File

@@ -1,16 +1,8 @@
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "bt_hidd.h" #include "bt_hidd.h"
#if CONFIG_BT_HID_DEVICE_ENABLED #if CONFIG_BT_HID_DEVICE_ENABLED
@@ -643,8 +635,8 @@ void bt_hidd_cb(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param)
break; break;
case ESP_HIDD_GET_REPORT_EVT: { case ESP_HIDD_GET_REPORT_EVT: {
uint8_t *data_ptr = NULL; uint8_t *data_ptr = NULL;
p_rpt = get_report_by_id_and_type((esp_bt_hidd_dev_t *)s_hidd_param.dev->dev, param->get_report.report_id, p_rpt = get_report_by_id_and_type(s_hidd_param.dev, param->get_report.report_id, param->get_report.report_type,
param->get_report.report_type, &map_index); &map_index);
if (p_rpt == NULL) { if (p_rpt == NULL) {
ESP_LOGE(TAG, "Can not find report!"); ESP_LOGE(TAG, "Can not find report!");
esp_bt_hid_device_report_error(ESP_HID_PAR_HANDSHAKE_RSP_ERR_INVALID_REP_ID); esp_bt_hid_device_report_error(ESP_HID_PAR_HANDSHAKE_RSP_ERR_INVALID_REP_ID);
@@ -684,8 +676,8 @@ void bt_hidd_cb(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param)
break; break;
} }
case ESP_HIDD_SET_REPORT_EVT: { case ESP_HIDD_SET_REPORT_EVT: {
p_rpt = get_report_by_id_and_type((esp_bt_hidd_dev_t *)s_hidd_param.dev->dev, param->set_report.report_id, p_rpt = get_report_by_id_and_type(s_hidd_param.dev, param->set_report.report_id, param->set_report.report_type,
param->set_report.report_type, &map_index); &map_index);
if (p_rpt == NULL) { if (p_rpt == NULL) {
ESP_LOGE(TAG, "Can not find report!"); ESP_LOGE(TAG, "Can not find report!");
esp_bt_hid_device_report_error(ESP_HID_PAR_HANDSHAKE_RSP_ERR_INVALID_REP_ID); esp_bt_hid_device_report_error(ESP_HID_PAR_HANDSHAKE_RSP_ERR_INVALID_REP_ID);
@@ -743,8 +735,8 @@ void bt_hidd_cb(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param)
break; break;
} }
case ESP_HIDD_INTR_DATA_EVT: { case ESP_HIDD_INTR_DATA_EVT: {
p_rpt = get_report_by_id_and_type((esp_bt_hidd_dev_t *)s_hidd_param.dev->dev, param->intr_data.report_id, p_rpt = get_report_by_id_and_type(s_hidd_param.dev, param->intr_data.report_id, ESP_HID_REPORT_TYPE_OUTPUT,
ESP_HID_REPORT_TYPE_OUTPUT, &map_index); &map_index);
if (p_rpt == NULL) { if (p_rpt == NULL) {
ESP_LOGE(TAG, "Can not find report!"); ESP_LOGE(TAG, "Can not find report!");
break; break;

View File

@@ -446,7 +446,6 @@ components/esp_hid/private/ble_hidh.h
components/esp_hid/private/bt_hidd.h components/esp_hid/private/bt_hidd.h
components/esp_hid/private/bt_hidh.h components/esp_hid/private/bt_hidh.h
components/esp_hid/private/esp_hidd_private.h components/esp_hid/private/esp_hidd_private.h
components/esp_hid/src/bt_hidd.c
components/esp_hid/src/bt_hidh.c components/esp_hid/src/bt_hidh.c
components/esp_hid/src/esp_hid_common.c components/esp_hid/src/esp_hid_common.c
components/esp_hid/src/esp_hidd.c components/esp_hid/src/esp_hidd.c