Error on modyfying hid_ble report after ble_disable

Hello

I am developping a HID BLE device with a nRF52840. Seems my device can emulate AZERTY and QWERTY keyboard I am trying to use the bcountrycode in the hid descriptor to let the central know I am from France or United State so the smartphone put a suitable default keyboard.

So I would like to be able to change the hid_ble descriptor after the bluetooth has been enable. I tried to : disable the bluetooth, modyfy my descriptor and start bt again, but I have errors.

Here is my code

I tried with and without the delay

And my LOGs : 

I tried to do this disable/enable when I am connected and after the reconnection, when I send something in HID the device crash.

Is there any better way to change the hid_ble report dynamicaly ?

Best regards

Thibaud

Related