mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/esp_hid_usb_preparation' into 'master'
refactor(esp_hid): Prepare for USB transport layer See merge request espressif/esp-idf!28472
This commit is contained in:
commit
c24dcd02c1
@ -1,16 +1,8 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -20,7 +12,6 @@ extern "C" {
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* HID Report Map Values */
|
||||
@ -185,6 +176,14 @@ typedef struct {
|
||||
uint8_t report_maps_len; /*!< number of raw report maps in the array */
|
||||
} esp_hid_device_config_t;
|
||||
|
||||
/**
|
||||
* @brief HID device address
|
||||
*/
|
||||
typedef union {
|
||||
uint8_t bda[6]; /*!< Bluetooth device address */
|
||||
uint8_t usb_addr; /*!< USB address */
|
||||
} esp_hid_address_t;
|
||||
|
||||
/*
|
||||
* @brief Parse RAW HID report map
|
||||
* It is a responsibility of the user to free the parsed report map,
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -44,6 +36,7 @@ typedef enum {
|
||||
ESP_HIDH_CLOSE_EVENT, /*!< HID device closed */
|
||||
ESP_HIDH_START_EVENT, /*!< HID host stack started, used only for Classic Bluetooth */
|
||||
ESP_HIDH_STOP_EVENT, /*!< HID host stack stopped, used only for Classic Bluetooth */
|
||||
ESP_HIDH_CONN_REQUEST_EVENT, /*!< HID device requested connection, used only for USB */
|
||||
ESP_HIDH_MAX_EVENT, /*!< HID events end marker */
|
||||
} esp_hidh_event_t;
|
||||
|
||||
@ -119,6 +112,15 @@ typedef union {
|
||||
esp_hid_trans_type_t trans_type; /*!< HID host feature transaction type, used only for Classic Bluetooth */
|
||||
} feature; /*!< HID callback param of ESP_HIDH_FEATURE_EVENT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HIDH_CONN_REQUEST_EVENT
|
||||
*/
|
||||
struct {
|
||||
esp_hid_transport_t trans_type; /*!< Transport type, currently only USB */
|
||||
esp_hid_address_t address; /*!< Address of the device */
|
||||
const void *dev_info; /*!< Information about the device that requests connection. usb_intf_desc_t* for USB */
|
||||
} conn_request;
|
||||
|
||||
} esp_hidh_event_data_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -1,20 +1,14 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _ESP_HIDH_PRIVATE_H_
|
||||
#define _ESP_HIDH_PRIVATE_H_
|
||||
#pragma once
|
||||
|
||||
#include "esp_hidh.h"
|
||||
#if CONFIG_BLUEDROID_ENABLED
|
||||
#include "esp_gap_bt_api.h"
|
||||
#endif /* CONFIG_BLUEDROID_ENABLED */
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp_event.h"
|
||||
#include "sys/queue.h"
|
||||
#include "esp_timer.h"
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
@ -46,8 +40,7 @@ typedef struct esp_hidh_dev_report_s {
|
||||
* @brief HIDH device data
|
||||
*/
|
||||
struct esp_hidh_dev_s {
|
||||
struct esp_hidh_dev_s *next;
|
||||
|
||||
esp_hid_address_t addr;
|
||||
esp_hid_device_config_t config;
|
||||
esp_hid_usage_t usage;
|
||||
esp_hid_transport_t transport; //BT, BLE or USB
|
||||
@ -86,21 +79,10 @@ struct esp_hidh_dev_s {
|
||||
esp_err_t (*set_protocol) (esp_hidh_dev_t *dev, uint8_t protocol_mode);
|
||||
void (*dump) (esp_hidh_dev_t *dev, FILE *fp);
|
||||
|
||||
#if CONFIG_BLUEDROID_ENABLED
|
||||
esp_bd_addr_t bda;
|
||||
#endif /* CONFIG_BLUEDROID_ENABLED */
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
uint8_t bda[6];
|
||||
#endif
|
||||
|
||||
union {
|
||||
#if CONFIG_BT_HID_HOST_ENABLED
|
||||
struct {
|
||||
esp_bt_cod_t cod;
|
||||
uint8_t handle;
|
||||
// uint8_t sub_class;
|
||||
// uint8_t app_id;
|
||||
// uint16_t attr_mask;
|
||||
} bt;
|
||||
#endif /* CONFIG_BT_HID_HOST_ENABLED */
|
||||
#if CONFIG_GATTC_ENABLE
|
||||
@ -158,5 +140,3 @@ esp_err_t esp_hidh_dev_free_inner(esp_hidh_dev_t *dev);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ESP_HIDH_PRIVATE_H_ */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -10,7 +10,7 @@
|
||||
#include "ble_hidd.h"
|
||||
#if CONFIG_GATTS_ENABLE
|
||||
|
||||
#include "esp_hidd_private.h"
|
||||
#include "esp_private/esp_hidd_private.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -7,7 +7,7 @@
|
||||
#include <string.h>
|
||||
#include "ble_hidh.h"
|
||||
#if CONFIG_GATTC_ENABLE
|
||||
#include "esp_hidh_private.h"
|
||||
#include "esp_private/esp_hidh_private.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
@ -302,7 +302,7 @@ static void attach_report_listeners(esp_gatt_if_t gattc_if, esp_hidh_dev_t *dev)
|
||||
|
||||
//subscribe to battery notifications
|
||||
if (dev->ble.battery_handle) {
|
||||
register_for_notify(gattc_if, dev->bda, dev->ble.battery_handle);
|
||||
register_for_notify(gattc_if, dev->addr.bda, dev->ble.battery_handle);
|
||||
if (dev->ble.battery_ccc_handle) {
|
||||
//Write CCC descr to enable notifications
|
||||
write_char_descr(gattc_if, dev->ble.conn_id, dev->ble.battery_ccc_handle, 2, (uint8_t *)&ccc_data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NO_MITM);
|
||||
@ -312,7 +312,7 @@ static void attach_report_listeners(esp_gatt_if_t gattc_if, esp_hidh_dev_t *dev)
|
||||
while (report) {
|
||||
//subscribe to notifications
|
||||
if ((report->permissions & ESP_GATT_CHAR_PROP_BIT_NOTIFY) != 0 && report->protocol_mode == ESP_HID_PROTOCOL_MODE_REPORT) {
|
||||
register_for_notify(gattc_if, dev->bda, report->handle);
|
||||
register_for_notify(gattc_if, dev->addr.bda, report->handle);
|
||||
if (report->ccc_handle) {
|
||||
//Write CCC descr to enable notifications
|
||||
write_char_descr(gattc_if, dev->ble.conn_id, report->ccc_handle, 2, (uint8_t *)&ccc_data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NO_MITM);
|
||||
@ -596,7 +596,7 @@ static esp_err_t esp_ble_hidh_dev_report_read(esp_hidh_dev_t *dev, size_t map_in
|
||||
|
||||
static void esp_ble_hidh_dev_dump(esp_hidh_dev_t *dev, FILE *fp)
|
||||
{
|
||||
fprintf(fp, "BDA:" ESP_BD_ADDR_STR ", Appearance: 0x%04x, Connection ID: %d\n", ESP_BD_ADDR_HEX(dev->bda), dev->ble.appearance, dev->ble.conn_id);
|
||||
fprintf(fp, "BDA:" ESP_BD_ADDR_STR ", Appearance: 0x%04x, Connection ID: %d\n", ESP_BD_ADDR_HEX(dev->addr.bda), dev->ble.appearance, dev->ble.conn_id);
|
||||
fprintf(fp, "Name: %s, Manufacturer: %s, Serial Number: %s\n", dev->config.device_name ? dev->config.device_name : "", dev->config.manufacturer_name ? dev->config.manufacturer_name : "", dev->config.serial_number ? dev->config.serial_number : "");
|
||||
fprintf(fp, "PID: 0x%04x, VID: 0x%04x, VERSION: 0x%04x\n", dev->config.product_id, dev->config.vendor_id, dev->config.version);
|
||||
fprintf(fp, "Battery: Handle: %u, CCC Handle: %u\n", dev->ble.battery_handle, dev->ble.battery_ccc_handle);
|
||||
@ -719,11 +719,11 @@ esp_hidh_dev_t *esp_ble_hidh_dev_open(esp_bd_addr_t bda, esp_ble_addr_type_t add
|
||||
|
||||
dev->in_use = true;
|
||||
dev->transport = ESP_HID_TRANSPORT_BLE;
|
||||
memcpy(dev->bda, bda, sizeof(esp_bd_addr_t));
|
||||
memcpy(dev->addr.bda, bda, sizeof(esp_bd_addr_t));
|
||||
dev->ble.address_type = address_type;
|
||||
dev->ble.appearance = ESP_HID_APPEARANCE_GENERIC;
|
||||
|
||||
ret = esp_ble_gattc_open(hid_gattc_if, dev->bda, dev->ble.address_type, true);
|
||||
ret = esp_ble_gattc_open(hid_gattc_if, dev->addr.bda, dev->ble.address_type, true);
|
||||
if (ret) {
|
||||
esp_hidh_dev_free_inner(dev);
|
||||
ESP_LOGE(TAG, "esp_ble_gattc_open failed: %d", ret);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -10,7 +10,7 @@
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_hidd.h"
|
||||
#include "esp_hidd_api.h"
|
||||
#include "esp_hidd_private.h"
|
||||
#include "esp_private/esp_hidd_private.h"
|
||||
#include "esp_log.h"
|
||||
#include "osi/mutex.h"
|
||||
#include "string.h"
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "bt_hidh.h"
|
||||
#if CONFIG_BT_HID_HOST_ENABLED
|
||||
#include "esp_hidh_private.h"
|
||||
#include "esp_private/esp_hidh_private.h"
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@ -185,7 +185,7 @@ static void open_failed_cb(esp_hidh_dev_t *dev, esp_hidh_status_t status, esp_hi
|
||||
if (dev != NULL) {
|
||||
esp_hidh_dev_lock(dev);
|
||||
if (dev->connected) {
|
||||
esp_bt_hid_host_disconnect(dev->bda);
|
||||
esp_bt_hid_host_disconnect(dev->addr.bda);
|
||||
} else {
|
||||
dev->in_use = false;
|
||||
}
|
||||
@ -750,7 +750,7 @@ static esp_err_t esp_bt_hidh_dev_close(esp_hidh_dev_t *dev)
|
||||
ret = ESP_ERR_INVALID_STATE;
|
||||
break;
|
||||
}
|
||||
ret = esp_bt_hid_host_disconnect(dev->bda);
|
||||
ret = esp_bt_hid_host_disconnect(dev->addr.bda);
|
||||
} while (0);
|
||||
return ret;
|
||||
}
|
||||
@ -797,7 +797,7 @@ static esp_err_t esp_bt_hidh_dev_report_write(esp_hidh_dev_t *dev, size_t map_in
|
||||
len = len + 1;
|
||||
}
|
||||
|
||||
ret = esp_bt_hid_host_send_data(dev->bda, data, len);
|
||||
ret = esp_bt_hid_host_send_data(dev->addr.bda, data, len);
|
||||
if (p_data) {
|
||||
free(p_data);
|
||||
}
|
||||
@ -844,7 +844,7 @@ static esp_err_t esp_bt_hidh_dev_set_report(esp_hidh_dev_t *dev, size_t map_inde
|
||||
len = len + 1;
|
||||
}
|
||||
|
||||
ret = esp_bt_hid_host_set_report(dev->bda, report_type, data, len);
|
||||
ret = esp_bt_hid_host_set_report(dev->addr.bda, report_type, data, len);
|
||||
if (p_data) {
|
||||
free(p_data);
|
||||
}
|
||||
@ -875,7 +875,7 @@ static esp_err_t esp_bt_hidh_dev_report_read(esp_hidh_dev_t *dev, size_t map_ind
|
||||
ret = ESP_FAIL;
|
||||
break;
|
||||
}
|
||||
ret = esp_bt_hid_host_get_report(dev->bda, report_type, report_id, max_length);
|
||||
ret = esp_bt_hid_host_get_report(dev->addr.bda, report_type, report_id, max_length);
|
||||
if (ret == ESP_OK) {
|
||||
dev->trans_type = ESP_HID_TRANS_GET_REPORT;
|
||||
dev->report_id = report_id;
|
||||
@ -899,7 +899,7 @@ static esp_err_t esp_bt_hidh_dev_get_idle(esp_hidh_dev_t *dev)
|
||||
ret = ESP_ERR_INVALID_STATE;
|
||||
break;
|
||||
}
|
||||
ret = esp_bt_hid_host_get_idle(dev->bda);
|
||||
ret = esp_bt_hid_host_get_idle(dev->addr.bda);
|
||||
if (ret == ESP_OK) {
|
||||
set_trans(dev, ESP_HID_TRANS_GET_IDLE);
|
||||
}
|
||||
@ -922,7 +922,7 @@ static esp_err_t esp_bt_hidh_dev_set_idle(esp_hidh_dev_t *dev, uint8_t idle_time
|
||||
ret = ESP_ERR_INVALID_STATE;
|
||||
break;
|
||||
}
|
||||
ret = esp_bt_hid_host_set_idle(dev->bda, idle_time);
|
||||
ret = esp_bt_hid_host_set_idle(dev->addr.bda, idle_time);
|
||||
if (ret == ESP_OK) {
|
||||
set_trans(dev, ESP_HID_TRANS_SET_IDLE);
|
||||
}
|
||||
@ -945,7 +945,7 @@ static esp_err_t esp_bt_hidh_dev_get_protocol(esp_hidh_dev_t *dev)
|
||||
ret = ESP_ERR_INVALID_STATE;
|
||||
break;
|
||||
}
|
||||
ret = esp_bt_hid_host_get_protocol(dev->bda);
|
||||
ret = esp_bt_hid_host_get_protocol(dev->addr.bda);
|
||||
if (ret == ESP_OK) {
|
||||
set_trans(dev, ESP_HID_TRANS_GET_PROTOCOL);
|
||||
}
|
||||
@ -969,7 +969,7 @@ static esp_err_t esp_bt_hidh_dev_set_protocol(esp_hidh_dev_t *dev, uint8_t proto
|
||||
ret = ESP_ERR_INVALID_STATE;
|
||||
break;
|
||||
}
|
||||
ret = esp_bt_hid_host_set_protocol(dev->bda, protocol_mode);
|
||||
ret = esp_bt_hid_host_set_protocol(dev->addr.bda, protocol_mode);
|
||||
if (ret == ESP_OK) {
|
||||
set_trans(dev, ESP_HID_TRANS_SET_PROTOCOL);
|
||||
}
|
||||
@ -980,7 +980,7 @@ static esp_err_t esp_bt_hidh_dev_set_protocol(esp_hidh_dev_t *dev, uint8_t proto
|
||||
|
||||
static void esp_bt_hidh_dev_dump(esp_hidh_dev_t *dev, FILE *fp)
|
||||
{
|
||||
fprintf(fp, "BDA:" ESP_BD_ADDR_STR ", Status: %s, Connected: %s, Handle: %d, Usage: %s\n", ESP_BD_ADDR_HEX(dev->bda), s_esp_hh_status_names[dev->status], dev->connected ? "YES" : "NO", dev->bt.handle, esp_hid_usage_str(dev->usage));
|
||||
fprintf(fp, "BDA:" ESP_BD_ADDR_STR ", Status: %s, Connected: %s, Handle: %d, Usage: %s\n", ESP_BD_ADDR_HEX(dev->addr.bda), s_esp_hh_status_names[dev->status], dev->connected ? "YES" : "NO", dev->bt.handle, esp_hid_usage_str(dev->usage));
|
||||
fprintf(fp, "Name: %s, Manufacturer: %s, Serial Number: %s\n", dev->config.device_name ? dev->config.device_name : "", dev->config.manufacturer_name ? dev->config.manufacturer_name : "", dev->config.serial_number ? dev->config.serial_number : "");
|
||||
fprintf(fp, "PID: 0x%04x, VID: 0x%04x, VERSION: 0x%04x\n", dev->config.product_id, dev->config.vendor_id, dev->config.version);
|
||||
fprintf(fp, "Report Map Length: %d\n", dev->config.report_maps[0].len);
|
||||
@ -1077,7 +1077,7 @@ static esp_hidh_dev_t *hidh_dev_ctor(esp_bd_addr_t bda)
|
||||
dev->reports_len = 0;
|
||||
dev->tmp = NULL;
|
||||
dev->tmp_len = 0;
|
||||
memcpy(dev->bda, bda, sizeof(esp_bd_addr_t));
|
||||
memcpy(dev->addr.bda, bda, sizeof(esp_bd_addr_t));
|
||||
dev->bt.handle = 0xff;
|
||||
|
||||
dev->close = esp_bt_hidh_dev_close;
|
||||
@ -1106,7 +1106,7 @@ esp_hidh_dev_t *esp_bt_hidh_dev_open(esp_bd_addr_t bda)
|
||||
}
|
||||
|
||||
if (!dev->connected) {
|
||||
esp_bt_hid_host_connect(dev->bda);
|
||||
esp_bt_hid_host_connect(dev->addr.bda);
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_log.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_hid_common.h"
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "esp_hidd.h"
|
||||
#include "esp_hidd_private.h"
|
||||
#include "esp_private/esp_hidd_private.h"
|
||||
#include "esp_event_base.h"
|
||||
|
||||
#if CONFIG_GATTS_ENABLE || CONFIG_BT_NIMBLE_ENABLED
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "sys/queue.h"
|
||||
#include "esp_hidh_private.h"
|
||||
#include "esp_private/esp_hidh_private.h"
|
||||
#include "bt_hidh.h"
|
||||
#include "ble_hidh.h"
|
||||
#include <string.h>
|
||||
@ -340,21 +340,13 @@ esp_err_t esp_hidh_dev_set_protocol(esp_hidh_dev_t *dev, uint8_t protocol_mode)
|
||||
const uint8_t *esp_hidh_dev_bda_get(esp_hidh_dev_t *dev)
|
||||
{
|
||||
uint8_t *ret = NULL;
|
||||
#if CONFIG_BLUEDROID_ENABLED
|
||||
#if CONFIG_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED
|
||||
if (esp_hidh_dev_exists(dev)) {
|
||||
esp_hidh_dev_lock(dev);
|
||||
ret = dev->bda;
|
||||
ret = dev->addr.bda;
|
||||
esp_hidh_dev_unlock(dev);
|
||||
}
|
||||
#endif /* CONFIG_BLUEDROID_ENABLED */
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
if (esp_hidh_dev_exists(dev)) {
|
||||
esp_hidh_dev_lock(dev);
|
||||
ret = dev->bda;
|
||||
esp_hidh_dev_unlock(dev);
|
||||
}
|
||||
#endif /* CONFIG_BT_NIMBLE_ENABLED */
|
||||
#endif /* CONFIG_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -754,7 +746,7 @@ esp_hidh_dev_t *esp_hidh_dev_get_by_bda(esp_bd_addr_t bda)
|
||||
esp_hidh_dev_t * d = NULL;
|
||||
lock_devices();
|
||||
TAILQ_FOREACH(d, &s_esp_hidh_devices, devices) {
|
||||
if (memcmp(bda, d->bda, sizeof(esp_bd_addr_t)) == 0) {
|
||||
if (memcmp(bda, d->addr.bda, sizeof(esp_bd_addr_t)) == 0) {
|
||||
unlock_devices();
|
||||
return d;
|
||||
}
|
||||
@ -856,7 +848,7 @@ esp_hidh_dev_t *esp_hidh_dev_get_by_bda(uint8_t *bda)
|
||||
esp_hidh_dev_t * d = NULL;
|
||||
lock_devices();
|
||||
TAILQ_FOREACH(d, &s_esp_hidh_devices, devices) {
|
||||
if (memcmp(bda, d->bda, sizeof(uint8_t) * 6) == 0) {
|
||||
if (memcmp(bda, d->addr.bda, sizeof(uint8_t) * 6) == 0) {
|
||||
unlock_devices();
|
||||
return d;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -8,7 +8,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "ble_hidd.h"
|
||||
#include "esp_hidd_private.h"
|
||||
#include "esp_private/esp_hidd_private.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "ble_hidh.h"
|
||||
#include "esp_hidh_private.h"
|
||||
#include "esp_private/esp_hidh_private.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
@ -847,7 +847,7 @@ static esp_err_t esp_ble_hidh_dev_report_read(esp_hidh_dev_t *dev, size_t map_in
|
||||
|
||||
static void esp_ble_hidh_dev_dump(esp_hidh_dev_t *dev, FILE *fp)
|
||||
{
|
||||
fprintf(fp, "BDA:" ESP_BD_ADDR_STR ", Appearance: 0x%04x, Connection ID: %d\n", ESP_BD_ADDR_HEX(dev->bda),
|
||||
fprintf(fp, "BDA:" ESP_BD_ADDR_STR ", Appearance: 0x%04x, Connection ID: %d\n", ESP_BD_ADDR_HEX(dev->addr.bda),
|
||||
dev->ble.appearance, dev->ble.conn_id);
|
||||
fprintf(fp, "Name: %s, Manufacturer: %s, Serial Number: %s\n", dev->config.device_name ? dev->config.device_name : "",
|
||||
dev->config.manufacturer_name ? dev->config.manufacturer_name : "",
|
||||
@ -978,7 +978,7 @@ esp_hidh_dev_t *esp_ble_hidh_dev_open(uint8_t *bda, uint8_t address_type)
|
||||
|
||||
dev->in_use = true;
|
||||
dev->transport = ESP_HID_TRANSPORT_BLE;
|
||||
memcpy(dev->bda, bda, sizeof(dev->bda));
|
||||
memcpy(dev->addr.bda, bda, sizeof(dev->addr.bda));
|
||||
dev->ble.address_type = address_type;
|
||||
dev->ble.appearance = ESP_HID_APPEARANCE_GENERIC;
|
||||
|
||||
|
@ -401,16 +401,13 @@ components/console/linenoise/linenoise.h
|
||||
components/esp_eth/src/ksz8851.h
|
||||
components/esp_event/host_test/esp_event_unit_test/main/esp_event_test.cpp
|
||||
components/esp_event/host_test/fixtures.hpp
|
||||
components/esp_hid/include/esp_hid_common.h
|
||||
components/esp_hid/include/esp_hidd.h
|
||||
components/esp_hid/include/esp_hidd_gatts.h
|
||||
components/esp_hid/include/esp_hidd_transport.h
|
||||
components/esp_hid/include/esp_hidh.h
|
||||
components/esp_hid/include/esp_hidh_bluedroid.h
|
||||
components/esp_hid/include/esp_hidh_gattc.h
|
||||
components/esp_hid/private/bt_hidd.h
|
||||
components/esp_hid/private/bt_hidh.h
|
||||
components/esp_hid/private/esp_hidd_private.h
|
||||
components/esp_local_ctrl/src/esp_local_ctrl_handler.c
|
||||
components/esp_local_ctrl/src/esp_local_ctrl_priv.h
|
||||
components/esp_local_ctrl/src/esp_local_ctrl_transport_ble.c
|
||||
|
Loading…
Reference in New Issue
Block a user