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

Example esp_hid_device EDR can not be found on IPAD (IDFGH-12624) #13622

Closed
3 tasks done
jankens opened this issue Apr 16, 2024 · 23 comments
Closed
3 tasks done

Example esp_hid_device EDR can not be found on IPAD (IDFGH-12624) #13622

jankens opened this issue Apr 16, 2024 · 23 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@jankens
Copy link

jankens commented Apr 16, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

5.1

Espressif SoC revision.

ESP32 PICO

Operating System used.

Windows

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

CMD

Development Kit.

ESP32-PICO-MINI-02

Power Supply used.

USB

What is the expected behavior?

I use example "esp_hid_device" to implement a hid keyboard device, I found that BLE device works well on all host including WIN11, Android Phone, IPhone; But the EDR device works well only on WIN11 and Android Phone, on IPHONE, the host could not discover the hid device. how can I deal with this problem?

here is the report infomation
const unsigned char keybdReportMap[] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)

   	0x85, 0x01,             // Report ID

	0x05, 0x07,             //     USAGE PAGE (Key Codes)
	0x19, 0xe0,             //     USAGE MINIMUM (224)
	0x29, 0xe7,             //     USAGE MAXIMUM (231)
	0x15, 0x00,             //     LOGICAL_MINIMUM (0)
	0x25, 0x01,             //     LOGICAL_MAXIMUM (1)

	0x75, 0x01,             //     REPORT_SIZE (1)
	0x95, 0x08,             //     REPORT_COUNT (8)
	0x81, 0x02,             //     INPUT (Data,Var,Abs); Modifier byte

	0x95, 0x01,             //     REPORT_COUNT (1)
	0x75, 0x08,             //     REPORT_SIZE (8)
	0x81, 0x01,             //     INPUT (Constant); Reserved byte

	0x95, 0x05,             //     REPORT_COUNT (5)
	0x75, 0x01,             //     REPORT_SIZE (1)
	0x05, 0x08,             //     USAGE PAGE (Page# for LEDs)
	0x19, 0x01,             //     USAGE MINIMUM (1)
	0x29, 0x05,             //     USAGE MAXIMUM (5)
	0x91, 0x02,             //     OUTPUT (Data, Variable, Absolute); LED report

	0x95, 0x01,             //     REPORT_COUNT (1)
	0x75, 0x03,             //     REPORT_SIZE (3)
	0x91, 0x01,             //     OUTPUT (Constant); LED report padding

	0x95, 0x06,             //     REPORT_COUNT (6)
	0x75, 0x08,             //     REPORT_SIZE (8)
	0x15, 0x00,             //     LOGICAL_MINIMUM (0)
	0x26, 0xff, 0x00,  //0x25, 0xff,//0x25, 0x65,             //     LOGICAL_MAXIMUM (101)
	0x05, 0x07,             //     USAGE PAGE (Key Codes)
	0x19, 0x00,             //     USAGE MINIMUM (0)
	0x29, 0xff,             //     USAGE MAXIMUM (101)
	0x81, 0x00,             //     INPUT (Data, Array); Key arrays (6 bytes)  

	0xc0,

};

What is the actual behavior?

Iphone cannot discover and list the EDR hid device

Steps to reproduce.

  1. Step
  2. Step
  3. Step
    ...

Debug Logs.

No response

More Information.

No response

@jankens jankens added the Type: Bug bugs in IDF label Apr 16, 2024
@github-actions github-actions bot changed the title Example esp_hid_device EDR can not be found on IPAD Example esp_hid_device EDR can not be found on IPAD (IDFGH-12624) Apr 16, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Apr 16, 2024
@esp-zhp
Copy link
Collaborator

esp-zhp commented Apr 18, 2024

@jankens
The issue seems to be related to the iPhone. I tried versions 15.5 and 17.4.1 of iOS, and found that version 15.5 works fine, but version 17.4.1 cannot detect ESP32 devices.
What version of iPad are you using? Could you try different versions of iPad or phone devices?

@jankens
Copy link
Author

jankens commented Apr 18, 2024

@zhp0406
I am using a iPad with iPadOS 17.4.1. could you please help me to resolve this problem cause IOS will force upgrade to the latest version. and it is not acceptable for us to announce that our product could not be connected by a newer iphone. thanks!

@jankens
Copy link
Author

jankens commented Apr 18, 2024

@zhp0406
Our product which has been released use another BT module before, and it is going to change to use ESP32-PICO.

@esp-zhp
Copy link
Collaborator

esp-zhp commented Apr 18, 2024

@jankens
Can you test with the latest release/v5.1 version?

@esp-zhp
Copy link
Collaborator

esp-zhp commented Apr 18, 2024

We previously fixed compatibility issues with Android devices (before iOS 17.4.1 was released), and I tested that the fix also works for iOS 17.4.1 devices. The commit that addressed this in the release/5.1 branch is 17752f9.
The latest version includes that fix.

@jankens
Copy link
Author

jankens commented Apr 18, 2024

@zhp0406
I am using the latest release/v5.1 version.

here is the git log message:
commit e088c37 (tag: v5.1.1)
Author: Aditya Patwardhan [email protected]
Date: Mon Aug 21 14:24:40 2023 +0550

versions: Update version to 5.1.1

commit 8d2dbd4
Merge: 5d78511 feecbad
Author: Jiang Jiang Jian [email protected]
Date: Fri Aug 18 14:36:25 2023 +0800

Merge branch 'bugfix/eapol_txdone_cb_issue_v5.1' into 'release/v5.1'

@esp-zhp
Copy link
Collaborator

esp-zhp commented Apr 18, 2024

@jankens
Version 5.1.1 does not include the fix. Please try the latest version instead.

@jankens
Copy link
Author

jankens commented Apr 18, 2024

@zhp0406
you mean's I need to update to Tag/v5.1.3? let me try and get back to you.

@esp-zhp
Copy link
Collaborator

esp-zhp commented Apr 18, 2024

@jankens
yes,please test ASAP

@jankens
Copy link
Author

jankens commented Apr 18, 2024

@zhp0406
My application combine serval examples and also change some code in component directory, so please give me sometime.

@esp-zhp
Copy link
Collaborator

esp-zhp commented Apr 18, 2024

For your convenience in testing, I have provided the library. You can directly replace the library at the following location: esp-idf/components/esp_phy/lib/esp32/libphy.a
IDFGH-12624.zip

@esp-zhp
Copy link
Collaborator

esp-zhp commented Apr 19, 2024

@jankens
You can directly replace the phy lib with v5.1.1,

@jankens
Copy link
Author

jankens commented Apr 19, 2024

@zhp0406
I build my project in v5.1.3 environment, but the problem still, my iPad cannot detect the EDR HID device. PC and android phone work well.

E:\Espressif\frameworks\esp-idf-v5.1.1\dev\cino_esp32>git log
commit e7771c7 (HEAD, tag: v5.1.3)
Author: Marius Vikhammer [email protected]
Date: Mon Feb 26 11:09:16 2024 +0800

versions: Update version to 5.1.3

commit d922d41
Merge: 931eaf7 f05aef3
Author: Island [email protected]
Date: Tue Feb 20 17:57:42 2024 +0800

Merge branch 'bugfix/fix_ble_free_all_crash_issue_5.1' into 'release/v5.1'

fix(ble): Fixed the free_all crash on esp32c6 and esp32h2

See merge request espressif/esp-idf!29108

commit f05aef3
Author: ShenWeilong [email protected]
Date: Mon Feb 19 20:00:29 2024 +0800

fix(ble): Fixed the free_all crash on esp32c6 and esp32h2

commit 931eaf7
Merge: 7380f96 f5a0d5d

@jankens
Copy link
Author

jankens commented Apr 21, 2024

@zhp0406
After tracing the inquiry data and process, I found that my iPad with ios17.4.1 could not detect the devices (including other bt devices) which response EIR data for host scanning. the response is something as following:
2f ff 01 b6 23 19 1c 06 10 01 00 00 05 00 81 2f d0 0c 09 41 37 38 30 42 54 2d 32 33 31 32 03 03
24 11 01 05 01 07 00 ... (257 bytes)

Our device which could be detect by my iPad use Standard Inquiry Mode and just response data as following.
07 ff 00 56 34 76 45 ce 25 46 36 38 30 42 54 2d 33 34 35 36 00 ... (257 byte)

I found that ESP32 can set the Inquiry Mode by the follow function:
tBTM_STATUS BTM_SetInquiryMode (UINT8 mode)
{
...
}

but I cound not find how to set the response data without EIR data.
Could you help me about how my app use standard response data for the host inquiry? thanks!!!

@espressif-bot espressif-bot assigned boblane1 and unassigned esp-zhp Apr 22, 2024
@boblane1
Copy link
Collaborator

Hi @jankens

Thanks for your reporting. This may be a compatibility issue. The HID version on ESP32 is v1.0, however, the IOS requires version v1.1 or later. There are some work to upgrade the HID version. When the human resource is available, the upgrade work will be put on the agenda.

@jankens
Copy link
Author

jankens commented Apr 23, 2024

@boblane1
Can I set the inquiry mode to BTM_INQ_RESULT_STANDARD and set inquiry data only with bt address and device name?

@boblane1
Copy link
Collaborator

@jankens device name can only be exposed in extended inquiry response. BTW, BTM_INQ_RESULT_STANDARD is the default inquiry mode. If you don't want to use EIR, you can disable these two macros in hcidefs.h.

#define HCI_LMP_INQ_RSSI_SUPPORTED(x)   (0)
#define HCI_EXT_INQ_RSP_SUPPORTED(x)   (0)

@jankens
Copy link
Author

jankens commented Apr 23, 2024

@boblane1
I tried to disable the macro macros you mantion, but the inquiry response doesn't change.

@boblane1
Copy link
Collaborator

@jankens,

The Inquiry_Mode configuration parameter indicates whether inquiry returns Inquiry Result events in the standard format, with RSSI, or with RSSI and extended inquiry response information. This parameter doesn't affect the EIR which the peer device has sent. After disabling HCI_EXT_INQ_RSP_SUPPORTED, BTM_WriteEIR will not work, so the local EIR will not be set.

@jankens
Copy link
Author

jankens commented Apr 30, 2024

@boblane1
I try:
#define HCI_LMP_INQ_RSSI_SUPPORTED(x) (0)
#define HCI_EXT_INQ_RSP_SUPPORTED(x) (0)
and got the standard inquiry response from PC capture by bushund as below:
07 ff 00 56 34 76 45 ce 25 46 36 38 30 42 54 2d 32 33 31 32 00 00 ...... (257 bytes)
BUT still cannot be detected by IPAD. I don't know why!!!
the device use CSR8811 which response the sam data can be detected by IPAD.

@boblane1
Copy link
Collaborator

Hi @jankens,

The PC captured standard inquiry response doesn't affect the peer device sending EIR response. As I said before, the Inquiry_Mode configuration parameter only change the format of the returned Inquiry Result events. BTW, is the captured data the raw data of HCI_Inquiry_Result? Can you provide the captured inquiry response data(with EIR) of both ESP32 and CSR8811?

@jankens
Copy link
Author

jankens commented May 28, 2024

@boblane1
do you have any plan to fix the problem about discovering ESP32 HID device on the latest version of IOS? please let me known, thanks a lot!!

@boblane1
Copy link
Collaborator

@jankens

We will fix this issue in the second half of the year.

@espressif-bot espressif-bot added the Status: Done Issue is done internally label Sep 4, 2024
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable and removed Status: Opened Issue is new labels Sep 4, 2024
espressif-bot pushed a commit that referenced this issue Sep 10, 2024
espressif-bot pushed a commit that referenced this issue Sep 11, 2024
espressif-bot pushed a commit that referenced this issue Sep 13, 2024
espressif-bot pushed a commit that referenced this issue Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants