BLE server + windows 10 as client

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

BLE server + windows 10 as client

Postby chegewara » Sun Dec 17, 2017 9:53 pm

Hi, im trying to implement ble hid interface, in this case its hid keyboard, and im having one small issue. It works as suppose to be with old android phone (samsung galaxy S4 with android 5.0). I can connect, send characters etc. It all works with or without security in
ble stack on esp32. As far as i know windows 8.1 and up requires to establish secured connection with hid device. Since its working with anroid device i assumed that all should works with windows 10. Nothing more wrong.
This is what ive found after thorough investigating logs. We have characteristic that needs to send 63 bytes to initialize hid keyboard, when i watched logs during connection to android phone it is send in 3 packets, 2 times 22 bytes + 19 bytes. It just works. Now situation with windows is not as simple. Esp32 is sending only first packet 22 bytes and then is doing other stuff. Windows is missing 2 packets(41 bytes) and such hid driver cant be initialized.

Any help would be welcome.


There is more behind scene. I dont know too much about ble security yet, but this may be some clue. Windows is exchanging only 2 keys with esp32 during negotiation (ESP_LE_KEY_LENC and ESP_LE_KEY_LID):

Code: Select all

D (1222538) BLEUtils: Received a GAP event: ESP_GAP_BLE_KEY_EVT
D (1222538) BLEUtils: *** dumpGapEvent: Logger not coded ***
D (1222541) BLEServer: BLEServer ... handling GAP event!
I (1222546) BLEServer: key type = ESP_LE_KEY_LENC
D (1222552) BLEUtils: Received a GAP event: ESP_GAP_BLE_KEY_EVT
D (1222558) BLEUtils: *** dumpGapEvent: Logger not coded ***
D (1222564) BLEServer: BLEServer ... handling GAP event!
I (1222569) BLEServer: key type = ESP_LE_KEY_LID
D (1222574) BLEUtils: Received a GAP event: ESP_GAP_BLE_AUTH_CMPL_EVT

EDIT Ive found it. For some reason windows is sending read request with flag is_long set to 0.
EDIT2 its issue with MTU in application. Windows 10 is negotiating MTU to 517 and app does not have ESP_GATTS_MTU_EVT implemented.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: BLE server + windows 10 as client

Postby chegewara » Mon Dec 18, 2017 9:44 pm

Ok. I have esp32 ble hid keyboard and its working with android device.
https://www.youtube.com/watch?v=CI2FSw8P7xQ

I can also connect and register keyboard with windows 10 laptop. All drivers are initialized and i see no problems in windows device manager. The only thing is that windows does not register for notifications on Input characteristic.

Im sure im missing something obvious, so im asking for some help or clue.

Thanks.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: BLE server + windows 10 as client

Postby chegewara » Wed Jan 03, 2018 5:42 pm

After hours of research (with no result), different code configurations and reverse engineering bluetooth devices ive found reason why i couldnt connect esp32-mouse to windows 10 laptop. It really sucks because reason is trivial but there is not even 1 info i could find on internet. Windows 10 hid driver is very stupid and is hardcoded that every hid mouse has to have a wheel, a stupid wheel.
It does not matter if we have physical wheel or something that will imitate wheel, report map needs to have data field which will represent wheel. Also data send thru input report needs to byte which will represent wheel value. If we dont have wheel then it will be 0x00.

If someone got the same issues then happy New Year. HID library will be implemented soon, also for arduino users.

JuanPotato
Posts: 3
Joined: Sat Jan 13, 2018 9:37 pm

Re: BLE server + windows 10 as client

Postby JuanPotato » Sun Jan 14, 2018 3:56 pm

chegewara wrote:After hours of research (with no result), different code configurations and reverse engineering bluetooth devices ive found reason why i couldnt connect esp32-mouse to windows 10 laptop. It really sucks because reason is trivial but there is not even 1 info i could find on internet. Windows 10 hid driver is very stupid and is hardcoded that every hid mouse has to have a wheel, a stupid wheel.
It does not matter if we have physical wheel or something that will imitate wheel, report map needs to have data field which will represent wheel. Also data send thru input report needs to byte which will represent wheel value. If we dont have wheel then it will be 0x00.

If someone got the same issues then happy New Year. HID library will be implemented soon, also for arduino users.
Can you give me a link to said library?
EDIT: i think its the same as the one you linked me in the other thread, no need to reply if so

jonnyjain
Posts: 1
Joined: Thu Nov 01, 2018 7:02 am

Re: BLE server + windows 10 as client

Postby jonnyjain » Thu Nov 01, 2018 7:14 am

Hi, After Upgrade my operating system into window 10 I am unable to connect my wireless printer to my laptop I didn't understand what I can do then I can call Dell to support them and it can provide Update Dell Bluetooth Driver that can solve the connectivity issue.

Who is online

Users browsing this forum: No registered users and 116 guests