Proper BT-SETTINGS Behavior #bluetoothmesh #bluetooth #ble


bob@...
 
Edited

Hi,

Thanks in advance for all replies.

I've created a ble keyboard peripheral, using the native_posix board, to control my amazon firestick.

It seems to work fine, except I'm unsure if the CONFIG-BT-SETTINGS persistent storage is working properly.

From a snippet of my syslog, you can see my app (hogInput.exe) send 2 keyboard reports. Then I restart my firestick which causes my 3 report notifies to become disabled and the connection is broken. 

hogInput.exe[829]: ***Send Report: x02, x41, x00, x00: Sent:0***
hogInput.exe[829]: ***Send Report: x02, x00, x00, x00: Sent:0***
hogInput.exe[829]: hog: input_ccc_changed: disabled
hogInput.exe[829]: message repeated 2 times: [ hog: input_ccc_changed: disabled]
hogInput.exe[829]: Disconnected (reason 0x08)

python3[830]: b'[00:02:34.352,704] \x1b[1;31m bt_gatt: Failed to store CCCs (err -2)'

python3[830]: b'[00:02:34.352,704] \x1b[1;31m bt_gatt: Failed to store Client Features (err -2)'
After the firestick becomes disconnected, the bt gatt module attempts to store my ccc and client features to persistent storage but fails. 

Is this normal to save to settings after a disconnect? If it's normal, anyone know what my be the problem and how to fix it?

Update:

my prj.conf file content. here i try to use a filesystem backend for Posix persistent use:

# Incresed stack due to settings API usage
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_RING_BUFFER=y
 
CONFIG_SETTINGS=y
CONFIG_SETTINGS_RUNTIME=y
CONFIG_SETTINGS_FS=y
CONFIG_BT_SETTINGS=y
 
CONFIG_BT=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DIS=y
CONFIG_BT_BAS=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME="smartRemotes 5.1"
CONFIG_BT_DEVICE_APPEARANCE=961
 
#uart i/o
CONFIG_SERIAL=y
CONFIG_UART_NATIVE_POSIX=y
# CONFIG_UART_NATIVE_POSIX_PORT_1_ENABLE=y
 
#ble security
CONFIG_BT_SMP=y
CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE=y
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y

Update:

i changed my prj.conf file to try using a flash backend instead of a filesystem for persistent storage.

# Incresed stack due to settings API usage
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_RING_BUFFER=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
 
CONFIG_SETTINGS=y
#CONFIG_SETTINGS_RUNTIME=y
#CONFIG_SETTINGS_NONE=n
#CONFIG_SETTINGS_FS=y
CONFIG_BT_SETTINGS=y
 
CONFIG_BT=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DIS=y
CONFIG_BT_BAS=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME="smartRemotes 5.1"
CONFIG_BT_DEVICE_APPEARANCE=961
 
#uart i/o
CONFIG_SERIAL=y
CONFIG_UART_NATIVE_POSIX=y
# CONFIG_UART_NATIVE_POSIX_PORT_1_ENABLE=y
 
#ble security
CONFIG_BT_SMP=y
CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE=y
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
This fixed my problem and no longer get error messages when saving BT settings!

But, I have no idea why it works this way with Posix on my Ubuntu laptop. I did not think I had any flash memory on my laptop and can't understand why using a filesystem backend did not work? Can anyone explain this? I did notice a file named 'flash.bin' was created on my laptop. Maybe some sort of flash emulation?