HID Keyboard Example Crashes Windows Bluetooth Driver

gnorkus
Posts: 35
Joined: Thu Mar 22, 2018 12:41 pm

HID Keyboard Example Crashes Windows Bluetooth Driver

Postby gnorkus » Tue Mar 27, 2018 1:42 pm

Hi All,

I'm a new developer here. Windows doesn't seem to like the HID Keyboard example from asterics (https://github.com/asterics/esp32_mouse_keyboard). The device connects fine, but after a short while, however, my Bluetooth driver on the Windows device hangs and all the Bluetooth devices, including keyboard and mouse, stop functioning. Only a reboot will help. I've cobbled together a somewhat working HID Keyboard example using as a basis for my own, to perhaps avoid the problem, but to no avail.

My own HID example is similar to asterics, but provides no mouse output. The idea is to use BLE only (not dual mode), and allow a user to send 3 different keystrokes to an attached computer. I modified the above mentioned code by removing most of the mouse/keyboard events and replacing it with a task called button_reader. I changed the appearance to BTM_BLE_APPEARANCE_HID_KEYBOARD, set the device mode to ESP_BT_MODE_BLE, set the debug logging to verbose in make menuconfig (I don't have a jtag debugger, until tomorrow) and the iocap to ESP_IO_CAP_NONE so that I don't need a PIN.

I'm running a Sparkfun ESP32 Thing with the "make menuconfig" set to autodetect the xtal frequency, and debug log messages sending out to COM8. Below is the code I used to replace the ble_hidd_demo_main.c file from asterics. It builds and flashes fine. I'm using the esp-idf from yesterday (from GitHub).

Since none of my other devices are causing such a problem, it's a sure bet that the ESP32 code is causing the problem. Can anyone give me a hand with this? I've been banging my head for a month on this, and I'll probably get fired for it. On a side note, the ESP32 seems to be drawing a lot more power than I would expect for BLE. The example used in Arduino for BLE to turn on an LED from an Android phone draws only 150 or so mA, whereas the heat coming from the ESP32 seems to suggest a lot higher draw (I still have to check).

After the code is a dump of my log over the COM8 port. My windows system log doesn't seem to note anything, so the Windows driver (chegewara had a nice adjective to describe it) seems to be choking, perhaps overflowing some buffer??? To repeat this failure, you may need to invoke the sending of the keystroke about 100 times. The hid_dev_send_report messages in the log reflect my button presses being sent as keystrokes (two for everypress).

Much Thanks In Advance To Any Who Reply!
Gerhard Norkus

My ble_hidd_demo_main.c

Code: Select all

// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Adaptions done:
// Copyright 2017 Benjamin Aigner <beni@asterics-foundation.org>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event_loop.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_bt.h"

#include "config.h"

#include "esp_hidd_prf_api.h"
#include "esp_bt_defs.h"
#include "esp_gap_ble_api.h"
#include "esp_gatts_api.h"
#include "esp_gatt_defs.h"
#include "esp_bt_main.h"
#include "esp_bt_device.h"
#include "bt_trace.h"
#include "driver/gpio.h"
#include "driver/uart.h"
#include "hid_dev.h"
#include "keyboard.h"
#include "btm_ble_api.h"

#define GATTS_TAG "EnvisicPedal"

static uint16_t hid_conn_id = 0;
static bool sec_conn = false;
static config_data_t config;


#define CHAR_DECLARATION_SIZE   (sizeof(uint8_t))

static void hidd_event_callback(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param);

const char hid_device_name_fabi[] = "EnvisicPedal";
static uint8_t hidd_service_uuid128[] = {
    /* LSB <--------------------------------------------------------------------------------> MSB */
    //first uuid, 16bit, [12],[13] is the value
    0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x12, 0x18, 0x00, 0x00,
};

static esp_ble_adv_data_t hidd_adv_data = {
    .set_scan_rsp = false,
    .include_name = true,
    .include_txpower = true,
    .min_interval = 0x20,
    .max_interval = 0x30,
    .appearance = BTM_BLE_APPEARANCE_HID_KEYBOARD,       //HID Keyboard 0x03C1
    .manufacturer_len = 0,
    .p_manufacturer_data =  NULL,
    .service_data_len = 0,
    .p_service_data = NULL,
    .service_uuid_len = sizeof(hidd_service_uuid128),
    .p_service_uuid = hidd_service_uuid128,
    .flag = 0x6,
};

static esp_ble_adv_params_t hidd_adv_params = {
    .adv_int_min        = 0x20,
    .adv_int_max        = 0x30,
    .adv_type           = ADV_TYPE_IND,
    .own_addr_type      = BLE_ADDR_TYPE_PUBLIC,
    //.peer_addr            =
    //.peer_addr_type       =
    .channel_map        = ADV_CHNL_ALL,
    .adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
};


static void hidd_event_callback(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param)
{
    switch(event) {
        case ESP_HIDD_EVENT_REG_FINISH: {
            if (param->init_finish.state == ESP_HIDD_INIT_OK) {
                //esp_bd_addr_t rand_addr = {0x04,0x11,0x11,0x11,0x11,0x05};
                esp_ble_gap_set_device_name(hid_device_name_fabi);
                esp_ble_gap_config_adv_data(&hidd_adv_data);
                
            }
            break;
        }
        case ESP_BAT_EVENT_REG: {
            break;
        }
        case ESP_HIDD_EVENT_DEINIT_FINISH:
	     break;
		case ESP_HIDD_EVENT_BLE_CONNECT: {
            hid_conn_id = param->connect.conn_id;
            sec_conn = true; //TODO: right here?!?
            LOG_ERROR("%s(), ESP_HIDD_EVENT_BLE_CONNECT", __func__);
            break;
        }
        case ESP_HIDD_EVENT_BLE_DISCONNECT: {
            sec_conn = false;
            hid_conn_id = 0;
            LOG_ERROR("%s(), ESP_HIDD_EVENT_BLE_DISCONNECT", __func__);
            esp_ble_gap_start_advertising(&hidd_adv_params);
            break;
        }
        default:
            break;
    }
    return;
}

static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{
    switch (event) {
    case ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT:
        esp_ble_gap_start_advertising(&hidd_adv_params);
        break;
     /*case ESP_GAP_BLE_SEC_REQ_EVT:
        for(int i = 0; i < ESP_BD_ADDR_LEN; i++) {
             LOG_DEBUG("%x:",param->ble_security.ble_req.bd_addr[i]);
        }
        esp_ble_gap_security_rsp(param->ble_security.ble_req.bd_addr, true);
	 break;*/
     case ESP_GAP_BLE_AUTH_CMPL_EVT:
        sec_conn = true;
        if(param->ble_security.auth_cmpl.success)
            LOG_INFO("status = success, ESP_GAP_BLE_AUTH_CMPL_EVT");
        else 
            LOG_INFO("status = fail, ESP_GAP_BLE_AUTH_CMPL_EVT");
        break;
    //unused events 
    case ESP_GAP_BLE_ADV_START_COMPLETE_EVT: break;
    //do we need this? occurs on win10 connect.
    case ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT: break;
    
    case ESP_GAP_BLE_PASSKEY_REQ_EVT:                           /* passkey request event */
        //esp_ble_passkey_reply(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, true, 0x00);
        LOG_INFO("ESP_GAP_BLE_PASSKEY_REQ_EVT");
        break;
    case ESP_GAP_BLE_OOB_REQ_EVT:                                /* OOB request event */
        LOG_INFO("ESP_GAP_BLE_OOB_REQ_EVT");
        break;
    case ESP_GAP_BLE_LOCAL_IR_EVT:                               /* BLE local IR event */
        LOG_INFO("ESP_GAP_BLE_LOCAL_IR_EVT");
        break;
    case ESP_GAP_BLE_LOCAL_ER_EVT:                               /* BLE local ER event */
        LOG_INFO("ESP_GAP_BLE_LOCAL_ER_EVT");
        break;
    case ESP_GAP_BLE_NC_REQ_EVT:
        LOG_INFO("ESP_GAP_BLE_NC_REQ_EVT");
        break;
    case ESP_GAP_BLE_SEC_REQ_EVT:
        /* send the positive(true) security response to the peer device to accept the security request.
        If not accept the security request, should sent the security response with negative(false) accept value*/
        esp_ble_gap_security_rsp(param->ble_security.ble_req.bd_addr, true);
        LOG_INFO("ESP_GAP_BLE_SEC_REQ_EVT");
        break;
    
    case ESP_GAP_BLE_PASSKEY_NOTIF_EVT:  ///the app will receive this evt when the IO  has Output capability and the peer device IO has Input capability.
        ///show the passkey number to the user to input it in the peer deivce.
        LOG_INFO("The passkey Notify number:%d", param->ble_security.key_notif.passkey);
        break;
    case ESP_GAP_BLE_KEY_EVT:
        //shows the ble key info share with peer device to the user.
        LOG_INFO("key type = %d", param->ble_security.ble_key.key_type);
        break;
    
    default:
        LOG_WARN("unhandled event: %d",event);
        break;
    }
}

void update_config()
{
    nvs_handle my_handle;
    esp_err_t err = nvs_open("envisic_c", NVS_READWRITE, &my_handle);
    if(err != ESP_OK) ESP_LOGE("MAIN","error opening NVS");
    err = nvs_set_u8(my_handle, "btname_i", config.bt_device_name_index);
    if(err != ESP_OK) ESP_LOGE("MAIN","error saving NVS - bt name");
    err = nvs_set_u8(my_handle, "locale", config.locale);
    if(err != ESP_OK) ESP_LOGE("MAIN","error saving NVS - locale");
    printf("Committing updates in NVS ... ");
    err = nvs_commit(my_handle);
    printf((err != ESP_OK) ? "Failed!\n" : "Done\n");
    nvs_close(my_handle);
}

void button_reader(void *pvParameters)
{
    static uint8_t keycode = 0;
	long butlevel;
	static long lastlevel=1;

	gpio_set_direction(GPIO_NUM_0, GPIO_MODE_INPUT);

    while(1)
    {
		butlevel = gpio_get_level(GPIO_NUM_0);
		if (butlevel==0 && (butlevel!=lastlevel))
		{
			//vTaskDelay(1000 / portTICK_PERIOD_MS);
			
			// Send the letter 'z' to the connected device
			keycode = 29;
			esp_hidd_send_keyboard_value(hid_conn_id, 0, &keycode, 1);
			keycode = 0;
			esp_hidd_send_keyboard_value(hid_conn_id, 0, &keycode, 1);
		}

		lastlevel = butlevel;
        vTaskDelay(50 / portTICK_PERIOD_MS);
    }
}


void app_main()
{
    esp_err_t ret;

    // Initialize NVS.
    ret = nvs_flash_init();
    if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }
    ESP_ERROR_CHECK( ret );
    
    // Read config
    nvs_handle my_handle;
    ret = nvs_open("envisic_c", NVS_READWRITE, &my_handle);
    if(ret != ESP_OK) ESP_LOGE("MAIN","error opening NVS");
    ret = nvs_get_u8(my_handle, "btname_i", &config.bt_device_name_index);
    if(ret != ESP_OK) 
    {
        ESP_LOGE("MAIN","error reading NVS - bt name, setting to Envisic");
        config.bt_device_name_index = 0;
    }
    ret = nvs_get_u8(my_handle, "locale", &config.locale);
    if(ret != ESP_OK || config.locale >= LAYOUT_MAX) 
    {
        ESP_LOGE("MAIN","error reading NVS - locale, setting to US_INTERNATIONAL");
        config.locale = LAYOUT_US_INTERNATIONAL;
    }
    nvs_close(my_handle);
    

    esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
    ret = esp_bt_controller_init(&bt_cfg);
    if (ret) {
        ESP_LOGE(GATTS_TAG, "%s initialize controller failed\n", __func__);
        return;
    }

    ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
    if (ret) {
        ESP_LOGE(GATTS_TAG, "%s enable controller failed\n", __func__);
        return;
    }

    ret = esp_bluedroid_init();
    if (ret) {
        LOG_ERROR("%s init bluedroid failed\n", __func__);
        return;
    }

    ret = esp_bluedroid_enable();
    if (ret) {
        LOG_ERROR("%s init bluedroid failed\n", __func__);
        return;
    }
    
    //load HID country code for locale before initialising HID
    hidd_set_countrycode(get_hid_country_code(config.locale));

    if((ret = esp_hidd_profile_init()) != ESP_OK) {
        LOG_ERROR("%s init bluedroid failed\n", __func__);
    }

    ///register the callback function to the gap module
    esp_ble_gap_register_callback(gap_event_handler);
    esp_hidd_register_callbacks(hidd_event_callback);

    /* set the security iocap & auth_req & key size & init key response key parameters to the stack*/
    esp_ble_auth_req_t auth_req = ESP_LE_AUTH_BOND;     //bonding with peer device after authentication
    /** Do not use "NONE", HID over GATT requires something more than NONE */
    esp_ble_io_cap_t iocap = ESP_IO_CAP_NONE;           //set the IO capability to No output No input
    /** CAP_OUT & CAP_IO work with Winsh***t, but you need to enter a pin which is shown in "make monitor" */
    //esp_ble_io_cap_t iocap = ESP_IO_CAP_OUT;           //set the IO capability to No output No input
    //esp_ble_io_cap_t iocap = ESP_IO_CAP_IO;           //set the IO capability to No output No input
    /** CAP_IN: host shows you a pin, you have to enter it (unimplemented now) */
    //esp_ble_io_cap_t iocap = ESP_IO_CAP_IN;           //set the IO capability to No output No input
    
    uint8_t key_size = 16;      //the key size should be 7~16 bytes
    uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
    uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
    esp_ble_gap_set_security_param(ESP_BLE_SM_AUTHEN_REQ_MODE, &auth_req, sizeof(uint8_t));
    esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t));
    esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &key_size, sizeof(uint8_t));
    /* If your BLE device act as a Slave, the init_key means you hope which types of key of the master should distribut to you,
    and the response key means which key you can distribut to the Master;
    If your BLE device act as a master, the response key means you hope which types of key of the slave should distribut to you, 
    and the init key means which key you can distribut to the slave. */
    esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t));
    esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t));

	xTaskCreate(&button_reader, "buttonread", 2048, NULL, tskIDLE_PRIORITY, NULL);
}


My COM8 log output

Code: Select all

ets Mar  27 2018 07:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:5672
load:0x40078000,len:0
ho 12 tail 0 room 4
load:0x40078000,len:13900
entry 0x40078fd4
[0;32mI (29) boot: ESP-IDF v3.1-dev-578-g9ea38560 2nd stage bootloader[0m
[0;32mI (30) boot: compile time 08:27:40[0m
[0;32mI (39) boot: Enabling RNG early entropy source...[0m
[0;32mI (39) boot: SPI Speed      : 80MHz[0m
[0;32mI (39) boot: SPI Mode       : DIO[0m
[0;32mI (43) boot: SPI Flash Size : 4MB[0m
[0;32mI (47) boot: Partition Table:[0m
[0;32mI (51) boot: ## Label            Usage          Type ST Offset   Length[0m
[0;32mI (58) boot:  0 nvs              WiFi data        01 02 00009000 00006000[0m
[0;32mI (66) boot:  1 phy_init         RF data          01 01 0000f000 00001000[0m
[0;32mI (73) boot:  2 factory          factory app      00 00 00010000 00100000[0m
[0;32mI (81) boot: End of partition table[0m
[0;32mI (85) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x33264 (209508) map[0m
[0;32mI (154) esp_image: segment 1: paddr=0x0004328c vaddr=0x3ffc0000 size=0x02e24 ( 11812) load[0m
[0;32mI (158) esp_image: segment 2: paddr=0x000460b8 vaddr=0x40080000 size=0x00400 (  1024) load[0m
[0;32mI (161) esp_image: segment 3: paddr=0x000464c0 vaddr=0x40080400 size=0x09b50 ( 39760) load[0m
[0;32mI (184) esp_image: segment 4: paddr=0x00050018 vaddr=0x400d0018 size=0x7ebf8 (519160) map[0m
[0;32mI (333) esp_image: segment 5: paddr=0x000cec18 vaddr=0x40089f50 size=0x03c14 ( 15380) load[0m
[0;32mI (339) esp_image: segment 6: paddr=0x000d2834 vaddr=0x400c0000 size=0x00000 (     0) load[0m
[0;32mI (348) boot: Loaded app from partition at offset 0x10000[0m
[0;32mI (348) boot: Disabling RNG early entropy source...[0m
[0;32mI (352) cpu_start: Pro cpu up.[0m
[0;32mI (355) cpu_start: Starting app cpu, entry point is 0x40080f44[0m
[0;32mI (0) cpu_start: App cpu up.[0m
[0;32mI (366) heap_init: Initializing. RAM available for dynamic allocation:[0m
D (372) heap_init: New heap initialised at 0x3ffaff10[0m
[0;32mI (378) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
D (384) heap_init: New heap initialised at 0x3ffcd698[0m
[0;32mI (389) heap_init: At 3FFCD698 len 00012968 (74 KiB): DRAM[0m
[0;32mI (395) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (401) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
D (408) heap_init: New heap initialised at 0x4008db64[0m
[0;32mI (413) heap_init: At 4008DB64 len 0001249C (73 KiB): IRAM[0m
[0;32mI (419) cpu_start: Pro cpu start user code[0m
D (431) clk: RTC_SLOW_CLK calibration value: 3231409[0m
V (105) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args[0m
V (105) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE[0m
D (110) intr_alloc: Connected src 46 to int 2 (cpu 0)[0m
V (115) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args[0m
V (121) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xC0E[0m
D (129) intr_alloc: Connected src 57 to int 3 (cpu 0)[0m
V (135) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args[0m
V (141) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E[0m
D (149) intr_alloc: Connected src 24 to int 9 (cpu 0)[0m
[0;32mI (155) cpu_start: Starting scheduler on PRO CPU.[0m
V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): checking args[0m
V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): Args okay. Resulting flags 0x40E[0m
D (10) intr_alloc: Connected src 25 to int 2 (cpu 1)[0m
[0;32mI (10) cpu_start: Starting scheduler on APP CPU.[0m
D (204) heap_init: New heap initialised at 0x3ffe0440[0m
D (204) heap_init: New heap initialised at 0x3ffe4350[0m
V (214) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args[0m
V (214) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE[0m
D (214) intr_alloc: Connected src 16 to int 12 (cpu 0)[0m
D (234) nvs: nvs_flash_init_custom partition=nvs start=9 count=6[0m
D (254) nvs: nvs_open_from_partition envisic_c 1[0m
D (254) nvs: nvs_get btname_i 1[0m
[0;31mE (254) MAIN: error reading NVS - bt name, setting to Envisic[0m
D (254) nvs: nvs_get locale 1[0m
[0;31mE (254) MAIN: error reading NVS - locale, setting to US_INTERNATIONAL[0m
D (264) nvs: nvs_close 1[0m
D (264) BTDM_INIT: .data initialise [0x3ffae6e0] <== [0x4000d890]
[0m
D (274) BTDM_INIT: .bss initialise [0x3ffb0000] - [0x3ffb09a8]
[0m
D (284) BTDM_INIT: .bss initialise [0x3ffb09a8] - [0x3ffb1ddc]
[0m
D (284) BTDM_INIT: .bss initialise [0x3ffb1ddc] - [0x3ffb2730]
[0m
D (294) BTDM_INIT: .bss initialise [0x3ffb2730] - [0x3ffb8000]
[0m
D (304) BTDM_INIT: .bss initialise [0x3ffb8000] - [0x3ffbbb28]
[0m
D (304) BTDM_INIT: .bss initialise [0x3ffbbb28] - [0x3ffbdb28]
[0m
D (314) BTDM_INIT: .bss initialise [0x3ffbdb28] - [0x3ffc0000]
[0m
[0;32mI (314) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE[0m
D (564) phy_init: loading PHY init data from application binary[0m
D (564) nvs: nvs_open_from_partition phy 0[0m
D (564) nvs: nvs_get cal_version 4[0m
V (564) phy_init: phy_get_rf_cal_version: 383
[0m
D (564) nvs: nvs_get_str_or_blob cal_mac[0m
D (574) nvs: nvs_get_str_or_blob cal_data[0m
D (584) nvs: nvs_close 2[0m
V (584) phy_init: register_chipv7_phy, init_data=0x3f432ab4, cal_data=0x3ffd3e18, mode=0[0m
[0;32mI (654) phy: phy_version: 383.0, 79a622c, Jan 30 2018, 15:38:06, 1, 0[0m
D (664) nvs: nvs_open_from_partition bt_config.conf 1[0m
D (664) nvs: nvs_get_str_or_blob bt_cfg_key0[0m
D (664) nvs: nvs_get_str_or_blob bt_cfg_key0[0m
D (674) nvs: nvs_close 3[0m
D (674) nvs: nvs_open_from_partition bt_config.conf 1[0m
D (674) nvs: nvs_set_blob bt_cfg_key0 216[0m
D (694) nvs: nvs_close 4[0m
[0;31mE (714) BT: esp_hidd_prf_cb_hdl(), start added the hid service to the stack database. incl_handle = 40[0m
[0;31mE (714) BT: hid svc handle = 2d[0m
[0;31mE (14614) BT: Call back not found for application conn_id=3[0m
[0;31mE (14614) BT: ESP_GAP_BLE_SEC_REQ_EVT[0m
D (15164) nvs: nvs_open_from_partition bt_config.conf 1[0m
D (15164) nvs: nvs_set_blob bt_cfg_key0 250[0m
D (15164) nvs: nvs_close 5[0m
D (15164) nvs: nvs_open_from_partition bt_config.conf 1[0m
D (15174) nvs: nvs_set_blob bt_cfg_key0 317[0m
D (15174) nvs: nvs_close 6[0m
D (15174) nvs: nvs_open_from_partition bt_config.conf 1[0m
D (15184) nvs: nvs_set_blob bt_cfg_key0 331[0m
D (15194) nvs: nvs_close 7[0m
[0;31mE (15194) BT: key type = 16[0m
[0;31mE (15194) BT: key type = 32[0m
[0;31mE (15194) BT: status = success, ESP_GAP_BLE_AUTH_CMPL_EVT[0m
[0;31mE (62074) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (62074) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (63824) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (63824) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (64424) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (64424) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (64724) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (64724) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (65374) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (65374) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (68324) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (68324) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (68974) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (68974) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (69424) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (69424) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (69874) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (69874) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70174) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70174) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70474) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70484) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70984) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (70984) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (71284) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (71284) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (71584) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (71584) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (71834) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (71834) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72034) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72034) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72284) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72284) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72484) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72484) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (72734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (332134) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (332134) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (332584) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (332584) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (333084) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (333084) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (333834) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (333834) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (334184) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (334184) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (334734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (334734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335034) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335034) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335334) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335334) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335584) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335584) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335834) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (335844) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (336104) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (336104) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (336354) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (336354) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (336654) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (336654) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (337004) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (337004) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (337354) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (337364) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (337864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (337864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (338264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (338264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (338614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (338614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339364) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339364) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (339964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (340264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (340264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (340564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (340564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (340814) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (340814) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (341164) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (341164) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (341464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (341464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (341764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (341764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (342064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (342064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (342414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (342414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (342664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (342664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (343864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (344214) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (344214) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (344464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (344464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (344814) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (344814) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (345114) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (345114) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (345414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (345414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (345764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (345764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (346114) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (346114) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (346464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (346464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (346714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (346714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347914) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (347914) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (348264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (348264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (348564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (348564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (348864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (348864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (349164) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (349164) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (349514) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (349514) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (349864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (349864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (350114) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (350114) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (350414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (350414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (350714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (350714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (351864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (352164) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (352164) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (352464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (352464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (352764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (352764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (353064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (353064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (353464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (353464) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (354414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (354414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (354714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (354714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355364) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355364) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (355964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (356264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (356264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (356564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (356564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (356864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (356864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (357214) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (357224) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (357524) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (357524) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (357824) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (357824) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (358224) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (358234) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (358494) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (358494) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (358794) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (358794) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359094) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359094) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359394) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359394) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359694) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359694) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359944) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (359944) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (360294) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (360294) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (360544) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (360544) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (360894) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (360894) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (361194) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (361194) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (361444) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (361444) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (361744) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (361744) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362044) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362044) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362294) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362294) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362594) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362594) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362894) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (362904) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (363264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (363264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (363564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (363564) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (363914) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (363914) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (367414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (367414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (367864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (367864) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (368364) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (368364) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (368764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (368764) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (369314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (369314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (369614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (369614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (369964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (369964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (370314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (370314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (370664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (370664) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (371064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (371064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (371414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (371414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (371714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (371714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (372064) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (372074) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (372384) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (372384) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (372734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (372734) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (373134) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (373144) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (373454) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (373454) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (373804) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (373804) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (374154) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (374154) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (374504) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (374504) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (374854) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (374854) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (375204) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (375204) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (375504) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (375504) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (375854) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (375854) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (376204) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (376204) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (376504) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (376504) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (376804) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (376804) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (377154) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (377154) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (377454) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (377454) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (377754) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (377754) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (378104) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (378104) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (378404) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (378404) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (378704) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (378714) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379014) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379314) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (379964) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (380264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (380264) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (380614) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (380624) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (380934) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (380934) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (381234) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (381244) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (381604) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (381604) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (381954) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (381954) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (382254) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (382254) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (382604) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (382604) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (382904) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (382904) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (383254) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (383254) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (384254) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (384254) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (384754) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (384754) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (385104) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (385104) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (385404) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (385414) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (385774) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (385774) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (386024) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (386024) BT: hid_dev_send_report(), send the report, handle = 61[0m
[0;31mE (389314) BT: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0008[0m
[0;31mE (389324) BT: hidd_event_callback(), ESP_HIDD_EVENT_BLE_DISCONNECT[0m
[0;31mE (389324) BT: hidd_event_callback(), ESP_HIDD_EVENT_BLE_DISCONNECT[0m


gnorkus
Posts: 35
Joined: Thu Mar 22, 2018 12:41 pm

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby gnorkus » Thu Mar 29, 2018 11:06 am

To any who might be able to help but want to know my setup, please do the following:
1. Go to your esp-idf workspace
2. git clone https://github.com/asterics/esp32_mouse_keyboard
3. Replace the ble_hidd_demo_main.c with the code I have in my first post.
4. make menuconfig (use your own setup, crystal, COM port, etc...)
5. make flash
6. On Windows 10, go to the Bluetooth device in settings and connect the device
7. Keep pressing the button attached to GPIO_0 until the system no longer accepts button presses

Thanks!

gnorkus
Posts: 35
Joined: Thu Mar 22, 2018 12:41 pm

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby gnorkus » Thu Mar 29, 2018 11:09 am

To the board moderator: Is it possible to send a message to the user chegewara, kindly requesting assistance, or is that considered poor etiquette?

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

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby chegewara » Thu Mar 29, 2018 3:44 pm

I will try to help (studying code now), but here is the first issue:

Code: Select all

xTaskCreate(&button_reader, "buttonread", 2048, NULL, tskIDLE_PRIORITY, NULL);
https://github.com/espressif/esp-idf/is ... -375378695

And try with higher stack, maybe 8-10kB.

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby Deouss » Thu Mar 29, 2018 5:17 pm

Very interesting - how does ESP32 report itself as HID/USB device to PC OS?

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

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby chegewara » Thu Mar 29, 2018 5:28 pm

Deouss wrote:Very interesting - how does ESP32 report itself as HID/USB device to PC OS?
With special set of characteristics. There is also characteristic which value is report map with all informations about HID device and how values will be packed in structure and send when hid peripheral has something to report.

gnorkus
Posts: 35
Joined: Thu Mar 22, 2018 12:41 pm

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby gnorkus » Thu Mar 29, 2018 5:37 pm

In this case, it reports itself as keyboard with the name
"EnvisicPedal"

In ble_hidd_demo_main.c, that name is assigned to hid_device_name_fabi at line 59, and sent to the Windows OS via the hidd_event_callback at line 100 using the esp_ble_gap_set_device_name function.

gnorkus
Posts: 35
Joined: Thu Mar 22, 2018 12:41 pm

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby gnorkus » Thu Mar 29, 2018 5:58 pm

Hi Chegewara and Deouss,

First off.. THANKS!

Second, the replies I am sending are delayed because the moderator needs me to be a part of the forum just a little more time before the replies are immediately posted.

I modified the code to the following:
xTaskCreate(&button_reader, "buttonread", 8192, NULL, tskIDLE_PRIORITY+1, NULL);

And now it works! Amazing, but it also seems to find it's way to reconnecting if I disconnect the device. I am going to modify the code so that the device can go into deep sleep, be woken up by a button press, and then check if it can reconnect.

Chegewara, I'm guessing that the idle priority was killing the ability to send properly timed responses back to the Windows driver. I'm also guessing that the stack size was more likely the culprit, due to the fact that the original code had '5' instead of idle priority.

Should I assume that the reconnect should now occur without troubles, or do I need to add anything extra to the nvs lines?

Thanks again!

gnorkus
Posts: 35
Joined: Thu Mar 22, 2018 12:41 pm

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby gnorkus » Thu Mar 29, 2018 6:06 pm

Hi Chegewara,

Well. That's not the issue, evidently. But it slows down the onset of the problems.

If I leave the device connected for a few minutes, the windows settings starts toggling the Envisic Pedal from Connected to Paired at a rate of about 1 time every 2 to 3 seconds. Hmmm.... After that starts happening, I cannot reconnect the device until I do a restart.

Something else must be going on...

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: HID Keyboard Example Crashes Windows Bluetooth Driver

Postby Deouss » Thu Mar 29, 2018 6:46 pm

Can you describe that process?
Booting must be changed or flashed?
Maybe you could direct me with some materials
Thanks

Who is online

Users browsing this forum: jainil and 110 guests