This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux: error "Encryption is insufficient"

Other Parts Discussed in Thread: WL1837

Tool/software: Linux

Hello,

my board :

wl1837
Bluetopia Platform Manager 4.2.1.1.1.0
After rebooting my board, I have a problem to write an encrypted characteristic, 
I have the error "Encryption is insufficient" with Ios.
After this reboot, I observed a change in the BTPMLECFG.btc file.
the parameter SC-00000000 has changed:
before the reboot :
SC-00000000=AED4F5DBF5F40203FFFF
after the reboot:
SC-00000000=AED4F5DBF5F400000000
My pairing configuration :
st_authResponseInfo.BD_ADDR   = pst_iRequestData->BD_ADDR;
st_authResponseInfo.AuthenticationAction  = DEVM_AUTHENTICATION_ACTION_IO_CAPABILITIES_RESPONSE;
 
if(!LowEnergy)
{
  st_authResponseInfo.AuthenticationDataLength                                   = sizeof(st_authResponseInfo.AuthenticationData.IOCapabilities);
  st_authResponseInfo.AuthenticationData.IOCapabilities.IO_Capability            = (GAP_LE_IO_Capability_t)icDisplayOnly;
  st_authResponseInfo.AuthenticationData.IOCapabilities.MITM_Protection_Required = true;
  st_authResponseInfo.AuthenticationData.IOCapabilities.OOB_Data_Present         = false;
}
else
{
 st_authResponseInfo.AuthenticationAction                                       |= DEVM_AUTHENTICATION_ACTION_LOW_ENERGY_OPERATION_MASK;
 st_authResponseInfo.AuthenticationDataLength                                    = sizeof(st_authResponseInfo.AuthenticationData.LEIOCapabilities);
 st_authResponseInfo.AuthenticationData.LEIOCapabilities.IO_Capability           = (GAP_LE_IO_Capability_t)licDisplayOnly;
 st_authResponseInfo.AuthenticationData.LEIOCapabilities.Bonding_Type            = lbtBonding;
 st_authResponseInfo.AuthenticationData.LEIOCapabilities.MITM                    = true;
 st_authResponseInfo.AuthenticationData.LEIOCapabilities.SC                      = true;
 st_authResponseInfo.AuthenticationData.LEIOCapabilities.P256DebugMode           = false;
 st_authResponseInfo.AuthenticationData.LEIOCapabilities.OOB_Present             = false;
 st_authResponseInfo.AuthenticationData.LEIOCapabilities.Keypress                = false;
}

My question :
What is this SC parameter in the BTPMLECFG.btc file and why is it changed?
 

Best regards,

Thomas.

  • Can, you take BTsnoop logs, from the beginning after reboot?

    Thanks
  • Hello Hari,

    you will find in attachment 2 logs.

    As you wished, a log after reboot (BTPMHCILog)

    And a second log named Log_with_paired, contains  the paired process and the error enrcrytion.

    thanks for the analysis

    Best regards

    Thomas

    4113.LOG.zip

  • Hi Thomas,

    I tried the scenario with 'LinuxGATM_SRV' demo and it seems to work fine.. I do not see any changes to the 'BTPMLECFG.btc' file either in between reboots or reconnects.. Attached is the log.. Can, you also try to reproduce with GATM_SRV demo?

    root@am335x-evm:~/BluetopiaPM-HFP# ./LinuxGATM_SRV

    ******************************************************************
    * Command Options: 1) Initialize *
    * 2) Cleanup *
    * 3) QueryDebugZoneMask *
    * 4) SetDebugZoneMask *
    * 5) SetDebugZoneMaskPID *
    * 6) ShutdownService *
    * 7) RegisterEventCallback, *
    * 8) UnRegisterEventCallback, *
    * 9) QueryDevicePower *
    * 10)SetDevicePower *
    * 11)QueryLocalDeviceProperties *
    * 12)SetLocalDeviceName *
    * 13)SetLocalClassOfDevice *
    * 14)SetDiscoverable *
    * 15)SetConnectable *
    * 16)SetPairable *
    * 17)StartDeviceDiscovery *
    * 18)StopDeviceDiscovery *
    * 19)QueryRemoteDeviceList *
    * 20)QueryRemoteDeviceProperties *
    * 21)AddRemoteDevice *
    * 22)DeleteRemoteDevice *
    * 23)UpdateRemoteDeviceAppData *
    * 24)DeleteRemoteDevices *
    * 25)PairWithRemoteDevice *
    * 26)CancelPairWithRemoteDevice *
    * 27)UnPairRemoteDevice *
    * 28)QueryRemoteDeviceServices *
    * 29)QueryRemoteDeviceServiceSupported *
    * 30)QueryRemoteDevicesForService *
    * 31)QueryRemoteDeviceServiceClasses *
    * 32)AuthenticateRemoteDevice *
    * 33)EncryptRemoteDevice *
    * 34)ConnectWithRemoteDevice *
    * 35)DisconnectRemoteDevice *
    * 36)SetRemoteDeviceLinkActive *
    * 37)CreateSDPRecord *
    * 38)DeleteSDPRecord *
    * 39)AddSDPAttribute *
    * 40)DeleteSDPAttribute *
    * 41)EnableBluetoothDebug *
    * 42)RegisterAuthentication *
    * 43)UnRegisterAuthentication *
    * 44)PINCodeResponse *
    * 45)PassKeyResponse *
    * 46)UserConfirmationResponse *
    * 47)ChangeSimplePairingParameters *
    * 48)RegisterGATTCallback *
    * 49)UnRegisterGATTCallback *
    * 50)QueryGATTConnections *
    * 51)SetLocalDeviceAppearance *
    * 52)StartAdvertising *
    * 53)StopAdvertising *
    * 54)RegisterService *
    * 55)UnRegisterService *
    * 56)IndicateCharacteristic *
    * 57)NotifyCharacteristic *
    * 58)ListCharacteristics *
    * 59)ListDescriptors *
    * 60)QueryPublishedServices *
    * 61)SetAdvertisingInterval *
    * 62)SetAndUpdateConnectionAndScanBLEParameters *
    * 63)SetAuthenticatedPayloadTimeout *
    * 64)QueryAuthenticatedPayloadTimeout *
    * 65)EnableSCOnly *
    * 66)RegenerateP256LocalKeys *
    * 67)OOBGenerateParameters *
    * 68)ChangeLEPairingParameters *
    * Help, Quit. *
    ******************************************************************
    GATM>1 1

    BTPM_Initialize() Success: 0.
    DEVM_RegisterEventCallback() Success: 5.
    GATM>10 1

    echo 3 > /sys/class/gpio/export
    sh: line 0: echo: write error: Device or resource busy
    echo out > /sys/class/gpio/gpio3/direction
    echo 0 > /sys/class/gpio/gpio3/value
    echo 1 > /sys/class/gpio/gpio3/value
    echo 0 > /sys/class/gpio/gpio3/value
    echo 1 > /sys/class/gpio/gpio3/value
    BT COMM PORT (/dev/ttyS1): 1
    Changing HCI baud rate to 921600
    Status: Executing BTS Script /lib/firmware/TIInit_11.8.32.bts.
    Status: BTS Script successfully executed.
    DEVM_PowerOnDevice() Success: 0.
    GATM>
    Device Powered On.
    GATM>registerauthentication

    DEVM_RegisterAuthentication() Success: 5.
    GATM>registergattcallback

    GATM_RegisterEventCallback() Success: 1.
    GATM>registerservice 5

    Registered Persistent UID: 0x02030208.
    Start Handle: 0x0203.
    End Handle: 0x0208.
    Registering Service, UUID: BC65B80102957A8B1410526C3A92FE6A
    Registered Service, Service ID: 1.
    Registered Characteristic, UUID: BC65B80102957A8B1410526CCB8DFE6A
    Registered Characteristic, UUID: BC65B80102957A8B1410526CB58EFE6A
    Service Registered.
    ******************************************************************
    Service Start Handle: 0x0203
    Service End Handle: 0x0208

    Include Attribute @ Handle: 0x0204
    Characteristic: : BC65B80102957A8B1410526CCB8DFE6A
    Characteristic Declaration @ Handle: 0x0205
    Characteristic Value @ Handle: 0x0206
    Characteristic: : BC65B80102957A8B1410526CB58EFE6A
    Characteristic Declaration @ Handle: 0x0207
    Characteristic Value @ Handle: 0x0208
    ******************************************************************
    GATM>startadvertising 0x76 100


    Local Device Properties Changed.
    Device Flags: 0x80020000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: TRUE, 0x00000064
    GATM>
    LE Advertising Started.
    GATM>DEVM_StartAdvertising() Success: Duration 100 seconds.
    GATM>enab^H^H

    Invalid Command.
    GATM>42 ^H

    DEVM_RegisterAuthentication() Failure: -10052, Authentication Handler already Registered.
    Function Error.
    GATM>41

    Usage: EnableBluetoothDebug [Enable (0/1)] [Type (1 - ASCII File, 2 - Terminal, 3 - FTS File)] [Debug
    Flags] [Debug Parameter String (no spaces)].
    Function Error.
    GATM>41 1 3 0 GattDebug2.log

    DEVM_EnableBluetoothDebug(TRUE) Success.
    GATM>
    Local Device Properties Changed.
    Device Flags: 0x80000000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: FALSE, 0x00000000
    GATM>
    LE Advertising Stopped.
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC002F085
    Resolv. BD_ADDR: 6511CA39F57A

    LE Connect State: TRUE
    GATM>
    GATT Connection Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    MTU: 23


    GATM>
    GATT Connection MTU Update Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    New MTU: 185


    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 1
    Attribute Offset: 4
    Attribute Value Offset: 0
    GATM_ReadResponse() success.


    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 2
    Attribute Offset: 4
    Attribute Value Offset: 184
    GATM_ReadResponse() success.


    GATM>listcharactr

    Invalid Command.
    GATM>listcharacteristics

    Key:
    x (xx), where X is the operation and XX are any security flags
    ENC = Encryption required, MITM = Man in the Middle protection required

    W = Writable
    WO = Write without Response
    R = Readable
    N = Notifiable
    I = Indicatable
    S = Signed Writes allowed

    Characteristic Handle: 0x0206 (518)
    Characteristic Properties: W.
    Characteristic Handle: 0x0208 (520)
    Characteristic Properties: R, WO (ENC).
    GATM>listdescriptors

    Key:
    x (xx), where X is the operation and XX are any security flags
    ENC = Encryption required, MITM = Man in the Middle protection required

    W = Writable
    R = Readable

    GATM>42 0^H^H

    DEVM_RegisterAuthentication() Failure: -10052, Authentication Handler already Registered.
    Function Error.
    GATM>41 0

    DEVM_EnableBluetoothDebug(FALSE) Success.

    =====================================================

    root@am335x-evm:~/BluetopiaPM-HFP# cat BTPMLECFG.btc
    [GATM]
    GP=0005
    DP=0003
    PU-00000001=02000202000203020800
    CC-704BE17B2842=
    CC-4C3275A5A12D=0000
    SC-00000000=2DA1A575324C4000FFFF
    CC-5FD3C48148AE=
    CC-6D8FB1B1FCEC=
    [FMPM]
    PU=0200020202000202
    root@am335x-evm:~/BluetopiaPM-HFP# cat BTPMLECFG.btc
    [GATM]
    GP=0005
    DP=0003
    PU-00000001=02000202000203020800
    CC-704BE17B2842=
    CC-4C3275A5A12D=0000
    SC-00000000=2DA1A575324C4000FFFF
    CC-5FD3C48148AE=
    CC-6D8FB1B1FCEC=
    [FMPM]
    PU=0200020202000202
    root@am335x-evm:~/BluetopiaPM-HFP# cat BTPMLECFG.btc
    [GATM]
    GP=0005
    DP=0003
    PU-00000001=0200020200
    CC-704BE17B2842=
    CC-4C3275A5A12D=0000
    SC-00000000=2DA1A575324C4000FFFF
    CC-5FD3C48148AE=
    CC-6D8FB1B1FCEC=
    [FMPM]
    PU=0200020202000202
    root@am335x-evm:~/BluetopiaPM-HFP# cat BTPMLECFG.btc
    [GATM]
    GP=0005
    DP=0003
    PU-00000001=0200020200
    CC-704BE17B2842=
    CC-4C3275A5A12D=0000
    SC-00000000=2DA1A575324C4000FFFF
    CC-5FD3C48148AE=
    CC-6D8FB1B1FCEC=
    [FMPM]
    PU=0200020202000202
    root@am335x-evm:~/BluetopiaPM-HFP# cat BTPMLECFG.btc
    [GATM]
    GP=0005
    DP=0003
    PU-00000001=02000202000203020800
    CC-704BE17B2842=
    CC-4C3275A5A12D=0000
    SC-00000000=2DA1A575324C4000FFFF
    CC-5FD3C48148AE=
    CC-6D8FB1B1FCEC=
    CC-6511CA39F57A=
    [FMPM]
    PU=0200020202000202
  • Hi Hari,

    Yes I can reproduce with GATM_SRV demo.

    I do the following actions :

    //start SS1BTPM and GATM_SRV

    SS1BTPM& ./LinuxGATM_SRV

    1 1

    10 1

    registerauthentication

    registergattcallback

    StartAdvertising 0x77 100

    41 1 3 0 GattDebug2.log

    ChangeLEPairingParameters 1 1 1 1 0

    registerservice 3

    //On the smartphone, I write the encrypted characteristic, with uuid :

    //{ 0x6A, 0xFE, 0x77, 0x51, 0x6C, 0x52, 0x10, 0x14, 0x8B, 0x7A, 0x95, 0x02, 0x01, 0xB8, 0x65, 0xBC  },

    //This action starts bonding process, I must confirm user :

    UserConfirmationResponse 1

    //I disconnect my smartphone. I must restart advertising :

    StartAdvertising 0x77 100

    //I write the same characteristic, it is ok

    //I stop GATM_SRV and kill SS1BTPM

    //I restart the scenario:

    SS1BTPM& ./LinuxGATM_SRV

    1 1

    10 1

    registerauthentication

    registergattcallback

    StartAdvertising 0x77 100

    41 1 3 0 GattDebug2.log

    ChangeLEPairingParameters 1 1 1 1 0

    registerservice 3

    //I try to write the same characteristic, but it is NOK.

    //I look the debug file (GattDebug2.log) with wireshark

    //and I see error "Insufficient Encryption"

    You will find in attachment the file GattDebug2.log.

    Thank you for your analysis.

    Thomas.

    GattDebug2.log.zip

  • Hi Hari,

    Did you manage to reproduce the problem with GATM_SRV demo ?

    Thomas.
  • Hi Thomas,

    Yes.. I was away and could n't get back earlier.. Will, get back in couple of days..

    Thanks
  • Hi Thomas,

    Instead of killing the daemon, on the 2nd try, i powered down the controller and restarted it.. It worked fine.. Can, you try this.. I wonder, if killing the BTPM sever is corrupting the BTC file..

    root@am335x-evm:~/BluetopiaPM-HFP# ./SS1BTPM &
    [1] 730
    root@am335x-evm:~/BluetopiaPM-HFP# ./LinuxGATM_SRV

    ******************************************************************
    * Command Options: 1) Initialize *
    * 2) Cleanup *
    * 3) QueryDebugZoneMask *
    * 4) SetDebugZoneMask *
    * 5) SetDebugZoneMaskPID *
    * 6) ShutdownService *
    * 7) RegisterEventCallback, *
    * 8) UnRegisterEventCallback, *
    * 9) QueryDevicePower *
    * 10)SetDevicePower *
    * 11)QueryLocalDeviceProperties *
    * 12)SetLocalDeviceName *
    * 13)SetLocalClassOfDevice *
    * 14)SetDiscoverable *
    * 15)SetConnectable *
    * 16)SetPairable *
    * 17)StartDeviceDiscovery *
    * 18)StopDeviceDiscovery *
    * 19)QueryRemoteDeviceList *
    * 20)QueryRemoteDeviceProperties *
    * 21)AddRemoteDevice *
    * 22)DeleteRemoteDevice *
    * 23)UpdateRemoteDeviceAppData *
    * 24)DeleteRemoteDevices *
    * 25)PairWithRemoteDevice *
    * 26)CancelPairWithRemoteDevice *
    * 27)UnPairRemoteDevice *
    * 28)QueryRemoteDeviceServices *
    * 29)QueryRemoteDeviceServiceSupported *
    * 30)QueryRemoteDevicesForService *
    * 31)QueryRemoteDeviceServiceClasses *
    * 32)AuthenticateRemoteDevice *
    * 33)EncryptRemoteDevice *
    * 34)ConnectWithRemoteDevice *
    * 35)DisconnectRemoteDevice *
    * 36)SetRemoteDeviceLinkActive *
    * 37)CreateSDPRecord *
    * 38)DeleteSDPRecord *
    * 39)AddSDPAttribute *
    * 40)DeleteSDPAttribute *
    * 41)EnableBluetoothDebug *
    * 42)RegisterAuthentication *
    * 43)UnRegisterAuthentication *
    * 44)PINCodeResponse *
    * 45)PassKeyResponse *
    * 46)UserConfirmationResponse *
    * 47)ChangeSimplePairingParameters *
    * 48)RegisterGATTCallback *
    * 49)UnRegisterGATTCallback *
    * 50)QueryGATTConnections *
    * 51)SetLocalDeviceAppearance *
    * 52)StartAdvertising *
    * 53)StopAdvertising *
    * 54)RegisterService *
    * 55)UnRegisterService *
    * 56)IndicateCharacteristic *
    * 57)NotifyCharacteristic *
    * 58)ListCharacteristics *
    * 59)ListDescriptors *
    * 60)QueryPublishedServices *
    * 61)SetAdvertisingInterval *
    * 62)SetAndUpdateConnectionAndScanBLEParameters *
    * 63)SetAuthenticatedPayloadTimeout *
    * 64)QueryAuthenticatedPayloadTimeout *
    * 65)EnableSCOnly *
    * 66)RegenerateP256LocalKeys *
    * 67)OOBGenerateParameters *
    * 68)ChangeLEPairingParameters *
    * Help, Quit. *
    ******************************************************************
    GATM>1 1

    BTPM_Initialize() Success: 0.
    DEVM_RegisterEventCallback() Success: 5.
    GATM>10 1

    echo 3 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio3/direction
    echo 0 > /sys/class/gpio/gpio3/value
    echo 1 > /sys/class/gpio/gpio3/value
    echo 0 > /sys/class/gpio/gpio3/value
    echo 1 > /sys/class/gpio/gpio3/value
    BT COMM PORT (/dev/ttyS1): 1
    Changing HCI baud rate to 921600
    Status: Executing BTS Script /lib/firmware/TIInit_11.8.32.bts.
    Status: BTS Script successfully executed.
    DEVM_PowerOnDevice() Success: 0.
    GATM>
    Device Powered On.
    GATM>registerauten^H^H

    Invalid Command.
    GATM>42

    DEVM_RegisterAuthentication() Success: 5.
    GATM>48

    GATM_RegisterEventCallback() Success: 1.
    GATM>[ 135.362802] NET: Registered protocol family 15
    [ 135.506235] Initializing XFRM netlink socket

    GATM>48

    Generic Attribute Profile Manager Event Callback already registered.
    Function Error.
    GATM>52 0x77 100


    Local Device Properties Changed.
    Device Flags: 0x80020000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: TRUE, 0x00000064
    GATM>
    LE Advertising Started.
    GATM>DEVM_StartAdvertising() Success: Duration 100 seconds.
    GATM>41 1 3 0 GattDebug2.log

    DEVM_EnableBluetoothDebug(TRUE) Success.
    GATM>changeLKe^H^H

    Invalid Command.
    GATM>chane

    Invalid Command.
    GATM>changeLEpairingparamters

    Invalid Command.
    GATM>68

    Usage: ChangeLEPairingParameters:
    [I/O Capability (0 = Display Only, 1 = Display Yes/No, 2 = Keyboard Only,
    3 = No Input/Output, 4 = Keyboard Display )]
    [Bonding Type (0 = No Bonding, 1 = Bonding)]
    [MITM Requirement (0 = No, 1 = Yes)]
    [SC Enable (0 = No, 1 = Yes)]
    [P256DebugMode (0 = No, 1 = Yes)]
    [OOBSupport (0 = No - Default, 1 = Yes)]
    [Keypress (0 = No - Default, 1 = Yes)].
    Function Error.
    GATM>68
    Local Device Properties Changed.
    Device Flags: 0x80000000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: FALSE, 0x00000000
    GATM>
    LE Advertising Stopped.
    GATM>
    LE Advertising Timeout.
    GATM> 1^H

    Usage: ChangeLEPairingParameters:
    [I/O Capability (0 = Display Only, 1 = Display Yes/No, 2 = Keyboard Only,
    3 = No Input/Output, 4 = Keyboard Display )]
    [Bonding Type (0 = No Bonding, 1 = Bonding)]
    [MITM Requirement (0 = No, 1 = Yes)]
    [SC Enable (0 = No, 1 = Yes)]
    [P256DebugMode (0 = No, 1 = Yes)]
    [OOBSupport (0 = No - Default, 1 = Yes)]
    [Keypress (0 = No - Default, 1 = Yes)].
    Function Error.
    GATM>68 1 1 1 1 0

    Current I/O Capabilities 1: Display Yes No.
    Bonding Mode 1: Bonding.
    MITM Protection: TRUE
    SC: TRUE
    P256DebugMode FALSE
    OOBSupport FALSE
    Keypress FALSE.
    GATM>54 3

    Registering Service, UUID: BC65B80102957A8B1410526CCE79FE6A
    Registered Service, Service ID: 1.
    Registered Characteristic, UUID: BC65B80102957A8B1410526C226FFE6A
    Registered Characteristic, UUID: BC65B80102957A8B1410526CFE6FFE6A
    Registered Descriptor, UUID: BC65B80102957A8B1410526CE770FE6A
    Registered Characteristic, UUID: BC65B80102957A8B1410526C5177FE6A
    Registered Characteristic, UUID: BC65B80102957A8B1410526C4678FE6A
    Registered Descriptor, UUID: BC65B80102957A8B1410526CFF78FE6A
    Service Registered.
    ******************************************************************
    Service Start Handle: 0x4000
    Service End Handle: 0x400B

    Include Attribute @ Handle: 0x4001
    Characteristic: : BC65B80102957A8B1410526C226FFE6A
    Characteristic Declaration @ Handle: 0x4002
    Characteristic Value @ Handle: 0x4003
    Characteristic: : BC65B80102957A8B1410526CFE6FFE6A
    Characteristic Declaration @ Handle: 0x4004
    Characteristic Value @ Handle: 0x4005
    Characteristic Descriptor: : BC65B80102957A8B1410526CE770FE6A
    Characteristic Descriptor @ Handle: 0x4006
    Characteristic: : BC65B80102957A8B1410526C5177FE6A
    Characteristic Declaration @ Handle: 0x4007
    Characteristic Value @ Handle: 0x4008
    Characteristic: : BC65B80102957A8B1410526C4678FE6A
    Characteristic Declaration @ Handle: 0x4009
    Characteristic Value @ Handle: 0x400A
    Characteristic Descriptor: : BC65B80102957A8B1410526CFF78FE6A
    Characteristic Descriptor @ Handle: 0x400B
    ******************************************************************
    GATM>52 0x77 100


    Local Device Properties Changed.
    Device Flags: 0x80020000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: TRUE, 0x00000064
    GATM>
    LE Advertising Started.
    GATM>DEVM_StartAdvertising() Success: Duration 100 seconds.
    GATM>
    Local Device Properties Changed.
    Device Flags: 0x80000000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: FALSE, 0x00000000
    GATM>
    LE Advertising Stopped.
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC002F085
    Resolv. BD_ADDR: 682E079F33F1

    LE Connect State: TRUE
    GATM>
    GATT Connection Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    MTU: 23


    GATM>
    GATT Connection MTU Update Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    New MTU: 185


    GATM>
    Authentication Request received for 4C3275A5A12D.
    I/O Capability Request: LE.
    DEVM_AuthenticationResponse() Success.
    GATM>
    Authentication Request received for 4C3275A5A12D.
    PassKey Indication LE.
    PassKey: 51195
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC001B085
    LE Encrypt State: TRUE
    GATM>
    LE Remote Device Pairing Status: 4C3275A5A12D, SUCCESS (0x80000000)
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    GATT Services Known: FALSE
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC003E085
    LE Paired State : TRUE
    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 1
    Attribute Offset: 6
    Attribute Value Offset: 0
    GATM_ReadResponse() success.


    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 2
    Attribute Offset: 6
    Attribute Value Offset: 184
    GATM_ReadResponse() success.


    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 3
    Attribute Offset: 6
    Attribute Value Offset: 368
    GATM_ReadResponse() success.


    GATM>
    Remote Device 4C3275A5A12D Services Status: LE, SUCCESS.
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC003F085
    GATT Services Known: TRUE
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC003F085
    Device Appearance: 64
    GATM>
    GATT Write Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 4
    Attribute Offset: 2
    Data Length: 1
    Value:
    48
    GATM_WriteResponse() success.


    GATM>
    GATT Write Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 5
    Attribute Offset: 2
    Data Length: 1
    Value:
    48
    GATM_WriteResponse() success.


    GATM>
    GATT Write Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 1
    Request ID: 6
    Attribute Offset: 2
    Data Length: 1
    Value:
    58
    GATM_WriteResponse() success.


    GATM>quit

    root@am335x-evm:~/BluetopiaPM-HFP#
    root@am335x-evm:~/BluetopiaPM-HFP#
    root@am335x-evm:~/BluetopiaPM-HFP#
    root@am335x-evm:~/BluetopiaPM-HFP# ./LinuxGATM_SRV

    ******************************************************************
    * Command Options: 1) Initialize *
    * 2) Cleanup *
    * 3) QueryDebugZoneMask *
    * 4) SetDebugZoneMask *
    * 5) SetDebugZoneMaskPID *
    * 6) ShutdownService *
    * 7) RegisterEventCallback, *
    * 8) UnRegisterEventCallback, *
    * 9) QueryDevicePower *
    * 10)SetDevicePower *
    * 11)QueryLocalDeviceProperties *
    * 12)SetLocalDeviceName *
    * 13)SetLocalClassOfDevice *
    * 14)SetDiscoverable *
    * 15)SetConnectable *
    * 16)SetPairable *
    * 17)StartDeviceDiscovery *
    * 18)StopDeviceDiscovery *
    * 19)QueryRemoteDeviceList *
    * 20)QueryRemoteDeviceProperties *
    * 21)AddRemoteDevice *
    * 22)DeleteRemoteDevice *
    * 23)UpdateRemoteDeviceAppData *
    * 24)DeleteRemoteDevices *
    * 25)PairWithRemoteDevice *
    * 26)CancelPairWithRemoteDevice *
    * 27)UnPairRemoteDevice *
    * 28)QueryRemoteDeviceServices *
    * 29)QueryRemoteDeviceServiceSupported *
    * 30)QueryRemoteDevicesForService *
    * 31)QueryRemoteDeviceServiceClasses *
    * 32)AuthenticateRemoteDevice *
    * 33)EncryptRemoteDevice *
    * 34)ConnectWithRemoteDevice *
    * 35)DisconnectRemoteDevice *
    * 36)SetRemoteDeviceLinkActive *
    * 37)CreateSDPRecord *
    * 38)DeleteSDPRecord *
    * 39)AddSDPAttribute *
    * 40)DeleteSDPAttribute *
    * 41)EnableBluetoothDebug *
    * 42)RegisterAuthentication *
    * 43)UnRegisterAuthentication *
    * 44)PINCodeResponse *
    * 45)PassKeyResponse *
    * 46)UserConfirmationResponse *
    * 47)ChangeSimplePairingParameters *
    * 48)RegisterGATTCallback *
    * 49)UnRegisterGATTCallback *
    * 50)QueryGATTConnections *
    * 51)SetLocalDeviceAppearance *
    * 52)StartAdvertising *
    * 53)StopAdvertising *
    * 54)RegisterService *
    * 55)UnRegisterService *
    * 56)IndicateCharacteristic *
    * 57)NotifyCharacteristic *
    * 58)ListCharacteristics *
    * 59)ListDescriptors *
    * 60)QueryPublishedServices *
    * 61)SetAdvertisingInterval *
    * 62)SetAndUpdateConnectionAndScanBLEParameters *
    * 63)SetAuthenticatedPayloadTimeout *
    * 64)QueryAuthenticatedPayloadTimeout *
    * 65)EnableSCOnly *
    * 66)RegenerateP256LocalKeys *
    * 67)OOBGenerateParameters *
    * 68)ChangeLEPairingParameters *
    * Help, Quit. *
    ******************************************************************
    GATM>1 1

    BTPM_Initialize() Success: 0.
    DEVM_RegisterEventCallback() Success: 5.
    GATM>10

    Usage: SetDevicePower [0/1 - Power Off/Power On].
    Function Error.
    GATM>10 0


    Device Powering Off Event, Timeout: 0x00000BB8.
    GATM>DEVM_PowerOffDevice() Success: 0.
    GATM>echo 0 > /sys/class/gpio/gpio3/value
    echo 0 > /sys/class/gpio/gpio3/value

    Device Powered Off.
    GATM>10 1

    echo 0 > /sys/class/gpio/gpio3/value
    echo 1 > /sys/class/gpio/gpio3/value
    echo 0 > /sys/class/gpio/gpio3/value
    echo 1 > /sys/class/gpio/gpio3/value
    BT COMM PORT (/dev/ttyS1): 2
    Changing HCI baud rate to 921600
    Status: Executing BTS Script /lib/firmware/TIInit_11.8.32.bts.
    Status: BTS Script successfully executed.
    DEVM_PowerOnDevice() Success: 0.
    GATM>
    Device Powered On.
    GATM>42

    DEVM_RegisterAuthentication() Success: 6.
    GATM>48

    GATM_RegisterEventCallback() Success: 1.
    GATM>68 1 1 1 1 0

    Current I/O Capabilities 1: Display Yes No.
    Bonding Mode 1: Bonding.
    MITM Protection: TRUE
    SC: TRUE
    P256DebugMode FALSE
    OOBSupport FALSE
    Keypress FALSE.
    GATM>54 3

    Registering Service, UUID: BC65B80102957A8B1410526CCE79FE6A
    Registered Service, Service ID: 2.
    Registered Characteristic, UUID: BC65B80102957A8B1410526C226FFE6A
    Registered Characteristic, UUID: BC65B80102957A8B1410526CFE6FFE6A
    Registered Descriptor, UUID: BC65B80102957A8B1410526CE770FE6A
    Registered Characteristic, UUID: BC65B80102957A8B1410526C5177FE6A
    Registered Characteristic, UUID: BC65B80102957A8B1410526C4678FE6A
    Registered Descriptor, UUID: BC65B80102957A8B1410526CFF78FE6A
    Service Registered.
    ******************************************************************
    Service Start Handle: 0x4000
    Service End Handle: 0x400B

    Include Attribute @ Handle: 0x4001
    Characteristic: : BC65B80102957A8B1410526C226FFE6A
    Characteristic Declaration @ Handle: 0x4002
    Characteristic Value @ Handle: 0x4003
    Characteristic: : BC65B80102957A8B1410526CFE6FFE6A
    Characteristic Declaration @ Handle: 0x4004
    Characteristic Value @ Handle: 0x4005
    Characteristic Descriptor: : BC65B80102957A8B1410526CE770FE6A
    Characteristic Descriptor @ Handle: 0x4006
    Characteristic: : BC65B80102957A8B1410526C5177FE6A
    Characteristic Declaration @ Handle: 0x4007
    Characteristic Value @ Handle: 0x4008
    Characteristic: : BC65B80102957A8B1410526C4678FE6A
    Characteristic Declaration @ Handle: 0x4009
    Characteristic Value @ Handle: 0x400A
    Characteristic Descriptor: : BC65B80102957A8B1410526CFF78FE6A
    Characteristic Descriptor @ Handle: 0x400B
    ******************************************************************
    GATM>
    GATM>52 0x77 100


    Local Device Properties Changed.
    Device Flags: 0x80020000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: TRUE, 0x00000064
    GATM>
    LE Advertising Started.
    GATM>DEVM_StartAdvertising() Success: Duration 100 seconds.
    GATM>
    Local Device Properties Changed.
    Device Flags: 0x80000000
    LE Scan Mode: FALSE, 0x00000000
    LE Adv Mode: FALSE, 0x00000000
    GATM>
    LE Advertising Stopped.
    GATM>
    GATT Connection Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    MTU: 23


    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC002F085
    LE Connect State: TRUE
    GATM>
    Remote Device Properties Changed.
    BD_ADDR: 4C3275A5A12D
    Address Type: Public
    LE Type: Dual Mode
    Device Flags: 0xC003F085
    LE Encrypt State: TRUE
    GATM>
    GATT Connection MTU Update Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    New MTU: 185


    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 2
    Request ID: 7
    Attribute Offset: 6
    Attribute Value Offset: 0
    GATM_ReadResponse() success.


    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 2
    Request ID: 8
    Attribute Offset: 6
    Attribute Value Offset: 184
    GATM_ReadResponse() success.


    GATM>
    GATT Read Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 2
    Request ID: 9
    Attribute Offset: 6
    Attribute Value Offset: 368
    GATM_ReadResponse() success.


    GATM>
    GATT Write Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 2
    Request ID: 10
    Attribute Offset: 2
    Data Length: 1
    Value:
    58
    GATM_WriteResponse() success.


    GATM>
    GATT Write Request Event
    Connection Type: LE
    Remote Address: 4C3275A5A12D
    Service ID: 2
    Request ID: 11
    Attribute Offset: 2
    Data Length: 1
    Value:
    58
    GATM_WriteResponse() success.
  • Hi Harry,

    I'm Thomas coworker. He is currently on vacation, he's coming back next week. I'll try to reproduce what you describe but i haven't got all elements for this.

    I will let Thomas try it and he'll respond you as soon as he came back.

    Thank you for your help.

  • Hi Harry,

    Yes, it works correctly without shutting down SS1BTPM (just a few tries).
    But we have to stop SS1BTPM (restart by user or by empty batteries).

    What do you advise?

    Best regards.
    Thomas
  • Hi Thomas,

    I believe, it is a question for general embedded linux forum. I would tend think, the file system should ensure to recover properly in the event of a power failure. It appears Journalling EXT3 file system would take care of it.. Please, check your host file system.

    Thanks
  • Hi Hari

    yes, I can ask this question on another forum but I have the impression that it's not a generic file problem. That's my opinion.

    I checked the integrity of the file by checksum (md5sum BTPMLECFG.btc)
    Before and after "Encryption is insufficient" error.
    The checksum is ok. the file is not corrupted.
    SS1BTPM seems manage to read but not write.

    My filesystem is EXT4, I think it's a good filesystem.
    Moreover, I never had a corrupted file after hard-reset or restart.

    I can write BTPMLECFG.btc to linux command "vi".
    Do you think SS1BTPM can't write it ? and why ?

    Thanks,

    Thomas.

  • Hi Thomas,

    Try, launching the daemon with sudo (i.e root privileges) and see if it helps..

    Thanks
  • Hi Hari,

    I'm always in root privileges.

    Thanks.

    Thomas

  • Hi Thomas,

    Not sure, what else could be causing the issue.. I will try some more tests early next week..

    Thanks
  • Hi Hari ?

    Did you try any tests?

    The mobile application would be released soon. encrypted chacteristic is necessary to start bonding process.

    it is becoming urgent, I really need help.

    I find some thing that could help us:

    At first everything works fine, the phone is paired, no encryption error.
    I disconnect the phone. I save the files (BTPMCFG.btc, BTPMDEV.btd, BTPMLECFG.btc)


    After a shutdown, or a sigterm of SS1BTPM, the encryption problem is always present.

    If I replace the configutaton files with those saved and I restart SS1BTPM.

    I don't have the encryption error, but only for the first connection.

    I tried to analyze the files but it's complicated for me.
    I noticed that when the "PropertiesLE" parameter (BTPMCFGd.btc) changed, it's not good.

    What is this parameter?

    Thank you for your help

  • Anyone ?

    This problem is blocking my business

  • Hi Thomas,

    I sent a message.. We, are simply not able to reproduce the issue with our EVMs, even after multiple power cycles..

    Thanks