Dear Nordic Team!
I think I found a bug in the ble_db_discovery module of Nordic SDK 15.3.0, maybe other SDKs are affected too. I am implementing a BLE central device for HID devices(mouse, keyboard). I have a Rapoo mouse which I think supports only BLE 4.0. When the central discovers the services, if more than one descriptors are available under a characteristic, it only finds one descriptor. HID device report characteristics can have two descriptors: Client characteristic configuration and Report reference descriptors. After investigation the issue with a BLE packet sniffer I discovered the problem: The peripheral device sends back only one descriptor info when find information request is sent with multiple handles, and the central device doesn't read the remaining descriptors info:
4025 35.585504 Master_0xba266bbd Slave_0xba266bbd ATT 35 Sent Find Information Request, Handles: 0x001c..0x001d 4026 35.585504 Slave_0xba266bbd Master_0xba266bbd LE LL 26 Empty PDU 4027 35.615716 Master_0xba266bbd Slave_0xba266bbd LE LL 26 Empty PDU 4028 35.615716 Slave_0xba266bbd Master_0xba266bbd ATT 36 Rcvd Find Information Response, Handle: 0x001c (Unknown: Report: Client Characteristic Configuration) 4029 35.645973 Master_0xba266bbd Slave_0xba266bbd ATT 35 Sent Find Information Request, Handles: 0x0020..0x0021 4030 35.645973 Slave_0xba266bbd Master_0xba266bbd LE LL 26 Empty PDU 4031 35.676251 Master_0xba266bbd Slave_0xba266bbd LE LL 26 Empty PDU 4032 35.677247 Slave_0xba266bbd Master_0xba266bbd ATT 36 Rcvd Find Information Response, Handle: 0x0020 (Unknown: Report: Client Characteristic Configuration) 4033 35.705859 Master_0xba266bbd Slave_0xba266bbd ATT 35 Sent Find Information Request, Handles: 0x0024..0x0024 4034 35.706893 Slave_0xba266bbd Master_0xba266bbd LE LL 26 Empty PDU 4035 35.735916 Master_0xba266bbd Slave_0xba266bbd LE LL 26 Empty PDU 4036 35.735916 Slave_0xba266bbd Master_0xba266bbd ATT 36 Rcvd Find Information Response, Handle: 0x0024 (Unknown: Report: Report Reference) 4037 35.796626 Master_0xba266bbd Slave_0xba266bbd ATT 35 Sent Find Information Request, Handles: 0x0029..0x0029 4038 35.798618 Slave_0xba266bbd Master_0xba266bbd LE LL 26 Empty PDU 4039 35.826564 Master_0xba266bbd Slave_0xba266bbd LE LL 26 Empty PDU 4040 35.829556 Slave_0xba266bbd Master_0xba266bbd ATT 36 Rcvd Find Information Response, Handle: 0x0029 (Unknown: Boot Keyboard Input Report)
If I connect with my phone to the device, nrfConnect app reads information correctly. it does read the remaining informations:
4986 18.979904 Master_0xaf9ab46d Slave_0xaf9ab46d ATT 35 Sent Find Information Request, Handles: 0x001c..0x001d 4987 18.980913 Slave_0xaf9ab46d Master_0xaf9ab46d LE LL 26 Empty PDU 4988 18.986918 Master_0xaf9ab46d Slave_0xaf9ab46d LE LL 26 Empty PDU 4989 18.987910 Slave_0xaf9ab46d Master_0xaf9ab46d ATT 36 Rcvd Find Information Response, Handle: 0x001c (Human Interface Device: Report: Client Characteristic Configuration) 4990 18.994864 Master_0xaf9ab46d Slave_0xaf9ab46d ATT 35 Sent Find Information Request, Handles: 0x001d..0x001d 4991 18.995861 Slave_0xaf9ab46d Master_0xaf9ab46d LE LL 26 Empty PDU 4992 19.002870 Master_0xaf9ab46d Slave_0xaf9ab46d LE LL 26 Empty PDU 4993 19.002870 Slave_0xaf9ab46d Master_0xaf9ab46d ATT 36 Rcvd Find Information Response, Handle: 0x001d (Human Interface Device: Report: Report Reference) 4994 19.009824 Master_0xaf9ab46d Slave_0xaf9ab46d ATT 35 Sent Find Information Request, Handles: 0x0020..0x0021 4995 19.010821 Slave_0xaf9ab46d Master_0xaf9ab46d LE LL 26 Empty PDU 4996 19.017802 Master_0xaf9ab46d Slave_0xaf9ab46d LE LL 26 Empty PDU 4997 19.017802 Slave_0xaf9ab46d Master_0xaf9ab46d ATT 36 Rcvd Find Information Response, Handle: 0x0020 (Human Interface Device: Report: Client Characteristic Configuration) 4998 19.024784 Master_0xaf9ab46d Slave_0xaf9ab46d ATT 35 Sent Find Information Request, Handles: 0x0021..0x0021 4999 19.025781 Slave_0xaf9ab46d Master_0xaf9ab46d LE LL 26 Empty PDU 5000 19.032763 Master_0xaf9ab46d Slave_0xaf9ab46d LE LL 26 Empty PDU 5001 19.032763 Slave_0xaf9ab46d Master_0xaf9ab46d ATT 36 Rcvd Find Information Response, Handle: 0x0021 (Human Interface Device: Report: Report Reference) 5002 19.039776 Master_0xaf9ab46d Slave_0xaf9ab46d ATT 35 Sent Find Information Request, Handles: 0x0024..0x0024 5003 19.040740 Slave_0xaf9ab46d Master_0xaf9ab46d LE LL 26 Empty PDU 5004 19.047720 Master_0xaf9ab46d Slave_0xaf9ab46d LE LL 26 Empty PDU 5005 19.047720 Slave_0xaf9ab46d Master_0xaf9ab46d ATT 36 Rcvd Find Information Response, Handle: 0x0024 (Human Interface Device: Report: Report Reference) 5006 19.054702 Master_0xaf9ab46d Slave_0xaf9ab46d ATT 35 Sent Find Information Request, Handles: 0x0029..0x0029 5007 19.055699 Slave_0xaf9ab46d Master_0xaf9ab46d LE LL 26 Empty PDU 5008 19.062681 Master_0xaf9ab46d Slave_0xaf9ab46d LE LL 26 Empty PDU 5009 19.062681 Slave_0xaf9ab46d Master_0xaf9ab46d ATT 36 Rcvd Find Information Response, Handle: 0x0029 (Human Interface Device: Boot Keyboard Input Report)
Using NRF as a HID peripheral doesn't have a problem, I think only older devices are affected.
I made a fix in the ble_db_discovery module however I'd like to know what is your opinion.
Regards