Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Device Identification Profile for esp_hidd component (IDFGH-11794) #12889

Open
wants to merge 13 commits into
base: release/v5.2
Choose a base branch
from

Conversation

mitchellcairns
Copy link

This adds the following

  • Vendor ID
  • Product ID
  • Version

Additionally, this implements an sdk config parameter for the esp_hidd tasks to allow task resizing.

mitchellcairns and others added 8 commits December 27, 2023 23:58
Add BT HID task size config option
add #ifndef BT_HID_DEVICE_TASK_SIZE to set a default
add defined BT_HID_DEVICE_TASK_SIZE
Add defined BT_HID_DEVICE_TASK_SIZE
Increase default to 4096
Update default HID task size to 4096 bytes
- Add necessary attributes that get passed along from the esp_hidd component
@CLAassistant
Copy link

CLAassistant commented Dec 28, 2023

CLA assistant check
All committers have signed the CLA.

Copy link

github-actions bot commented Dec 28, 2023

Fails
🚫
    The target branch for this pull request should be `master`.

    If you would like to add this feature to the release branch, please state this in the PR description and we will consider backporting it.
Warnings
⚠️

Some issues found for the commit messages in this MR:

  • the commit message Merge branch 'release/v5.2' of https://github.com/mitchellcairns/esp-idf into release/v5.2 appears to be a temporary or automatically generated message
  • the commit message Update Kconfig.in appears to be a temporary or automatically generated message
  • the commit message Update Kconfig.in appears to be a temporary or automatically generated message
  • the commit message Update Kconfig.in appears to be a temporary or automatically generated message
  • the commit message Update ble_hidd.c appears to be a temporary or automatically generated message
  • the commit message Update bt_hidd.c appears to be a temporary or automatically generated message
  • the commit message Update esp_hid_common.h appears to be a temporary or automatically generated message
  • the commit message Update esp_hid_common.h appears to be a temporary or automatically generated message

Please consider updating these commit messages.

Messages
📖 You might consider squashing your 13 commits (simplifying branch history).

👋 Welcome mitchellcairns, thank you for your first contribution to espressif/esp-idf project!

📘 Please check Contributions Guide for the contribution checklist, information regarding code and documentation style, testing and other topics.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for espressif/esp-idf project.

Pull request review and merge process you can expect

Espressif develops the ESP-IDF project in an internal repository (Gitlab). We do welcome contributions in the form of bug reports, feature requests and pull requests via this public GitHub repository.

  1. An internal issue has been created for the PR, we assign it to the relevant engineer
  2. They review the PR and either approve it or ask you for changes or clarifications
  3. Once the Github PR is approved, we synchronize it into our internal git repository
  4. In the internal git repository we do the final review, collect approvals from core owners and make sure all the automated tests are passing
    • At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
  5. If the change is approved and passes the tests it is merged into the master branch
  6. On next sync from the internal git repository merged change will appear in this public Github repository

🔁 You can re-run automatic PR checks by retrying the DangerJS action

Generated by 🚫 dangerJS against c37523a

Add BT HID task size config option
Update esp_hid_common.h

add #ifndef BT_HID_DEVICE_TASK_SIZE to set a default
Update ble_hidd.c

add defined BT_HID_DEVICE_TASK_SIZE
Update bt_hidd.c

Add defined BT_HID_DEVICE_TASK_SIZE
Update esp_hid_common.h

Increase default to 4096
Update Kconfig.in

Update default HID task size to 4096 bytes
Implement DID for Bluetooth Classic HID Device

- Add necessary attributes that get passed along from the esp_hidd component

Remove unneeded comment
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 28, 2023
@github-actions github-actions bot changed the title Implement Device Identification Profile for esp_hidd component Implement Device Identification Profile for esp_hidd component (IDFGH-11794) Dec 28, 2023
uint16_t vendor_id; /*!< HID Vendor ID */
uint16_t product_id; /*!< HID Product ID */
uint16_t version; /*!< HID Product Version */
uint8_t vendor_id_source; /*!< HID Country Code */
Copy link
Collaborator

@boblane1 boblane1 Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Device Identification Profile Specification or Device Information Service, the filed vendor_id_source designates which organization assigned the vendor_id.

vendor_id_source in Device Identification Profile Specification has two bytes defined values:

  • 0x0001 = Bluetooth SIG assigned Device ID Vendor ID value from the Assigned Numbers document
  • 0x0002 = USB Implementer’s Forum assigned Vendor ID value
  • 0x0000, 0x0003 – 0xFFFF = Reserved for future use

vendor_id_source in Device Information Service has one byte defined values:

  • 0x01 = Bluetooth SIG assigned Device ID Vendor ID value from the Assigned Numbers document
  • 0x02 = USB Implementer’s Forum assigned Vendor ID value
  • 0x00, 0x03 – 0xFF = Reserved for future use

I think this field can be set as two bytes and added into esp_hid_device_config_t, since BLE and BR/EDR HID Device both need it for the device information. And vendor_id_source validity also should be checked in esp_ble_hidd_dev_init or esp_bt_hidd_dev_init.

Btw, the following code in /esp-idf/components/esp_hid/src/ble_hidd.c shall be modified from

...
        uint8_t pnp_val[7] = {
            0x02, //0x1=BT, 0x2=USB
            dev->config.vendor_id & 0xFF, (dev->config.vendor_id >> 8) & 0xFF, //VID
            dev->config.product_id & 0xFF, (dev->config.product_id >> 8) & 0xFF, //PID
            dev->config.version & 0xFF, (dev->config.version >> 8) & 0xFF  //VERSION
        };
...

to

...
        uint8_t pnp_val[7] = {
            dev->config.vendor_id_source & 0xFF, //0x1=BT, 0x2=USB
            dev->config.vendor_id & 0xFF, (dev->config.vendor_id >> 8) & 0xFF, //VID
            dev->config.product_id & 0xFF, (dev->config.product_id >> 8) & 0xFF, //PID
            dev->config.version & 0xFF, (dev->config.version >> 8) & 0xFF  //VERSION
        };
...

@@ -144,6 +144,13 @@ config BT_HID_DEVICE_ENABLED
help
This enables the BT HID Device

config BT_HID_DEVICE_TASK_SIZE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this configuration option can be put into the esp_hid component and it would be better to have different configuration options for BLE HIDD and BR/EDR HIDD.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can separate these and put it in the esp_hid_component as its own kconfig

@@ -175,6 +175,16 @@ void bta_hd_register_act(tBTA_HD_DATA *p_data)
p_app_data->subclass, p_app_data->d_len, p_app_data->d_data);
bta_sys_add_uuid(UUID_SERVCLASS_HUMAN_INTERFACE);

// Set DID Profile SDP Record
tBTA_DI_RECORD bqb_device_info;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bqb prefix has specific meaning for Bluetooth, device_info is OK.

@@ -23,6 +23,11 @@ extern "C" {
#include <stdbool.h>
#include <stdio.h>

/* HID BT Task Size Def */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to use the configuration option in Kconfig, code needs to be modified as:

#include "sdkconfig.h"

#ifdef CONFIG_BT_HID_DEVICE_TASK_SIZE
#define BT_HID_DEVICE_TASK_SIZE            CONFIG_BT_HID_DEVICE_TASK_SIZE
#else
#define BT_HID_DEVICE_TASK_SIZE            4096
#endif

mitchellcairns and others added 3 commits July 1, 2024 21:41
- Ignore boot mode change command or at least pass it through before taking action
- Increase SDP padding size
@Zucchy00
Copy link

Zucchy00 commented Dec 5, 2024

Is this workin now?

@boblane1
Copy link
Collaborator

boblane1 commented Dec 6, 2024

@Zucchy00 This is working now in release/v5.4 or after. BTW, ESP32 Classic Bluetooth have integrated DIP into SDP API, users call create their own DIP records even if they don't use HID. Thanks for your PR again @mitchellcairns !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants