BLE server + windows 10 as client
Posted: 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):
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.
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.