AnsweredAssumed Answered

How to use hrs.py script on my linux host to send command to kw41z blackbox?

Question asked by Devang Dixit on Mar 28, 2018
Latest reply on Apr 3, 2018 by Devang Dixit

$ python hrs.py
usage: hrs.py [-h] [-p] <serial_port ble_fsci_black_box>
hrs.py: error: too few arguments

 

I have flashed hybrid black box binary in my kw41z dev kit.

and using the above script as follows to send command to the black box:

 

$ python hrs.py /dev/ttyACM2 -p
Namespace(dev='/dev/ttyACM2', pair=True)
[Command 0] /dev/ttyACM2: FSCICPUResetRequest -> { }
[Command 1] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x1801 }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 2] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x1801 }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 3] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0', '0x0', '0x0'] , Uuid: 0x2a05 , MaxValueLength: 0x0 , CharacteristicProperties: 0x12 , InitialValueLength: 0x4 , ValueAccessPermissions: 0x0 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 4] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0', '0x0', '0x0'] , Uuid: 0x2a05 , MaxValueLength: 0x0 , CharacteristicProperties: 0x12 , InitialValueLength: 0x4 , ValueAccessPermissions: 0x0 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 5] /dev/ttyACM2: GATTDBDynamicAddCccdRequest -> { }
No response for the previous command GATTDBDynamicAddCccdRequest
[Command 6] /dev/ttyACM2: GATTDBDynamicAddCccdRequest -> { }
No response for the previous command GATTDBDynamicAddCccdRequest
[Command 7] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x1800 }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 8] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x1800 }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 9] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x4b696e6574697320424c4500 , Uuid: 0x2a00 , MaxValueLength: 0x14 , CharacteristicProperties: 0x2 , InitialValueLength: 0xc , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 10] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x4b696e6574697320424c4500 , Uuid: 0x2a00 , MaxValueLength: 0x14 , CharacteristicProperties: 0x2 , InitialValueLength: 0xc , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 11] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0'] , Uuid: 0x2a01 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x2 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 12] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0'] , Uuid: 0x2a01 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x2 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 13] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0xA', '0x0', '0x10', '0x0', '0x64', '0x0', '0xE2', '0x4'] , Uuid: 0x2a04 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x8 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 14] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0xA', '0x0', '0x10', '0x0', '0x64', '0x0', '0xE2', '0x4'] , Uuid: 0x2a04 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x8 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 15] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x180d }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 16] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x180d }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 17] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0xB4'] , Uuid: 0x2a37 , MaxValueLength: 0x16 , CharacteristicProperties: 0x10 , InitialValueLength: 0x2 , ValueAccessPermissions: 0x0 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 18] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0xB4'] , Uuid: 0x2a37 , MaxValueLength: 0x16 , CharacteristicProperties: 0x10 , InitialValueLength: 0x2 , ValueAccessPermissions: 0x0 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 19] /dev/ttyACM2: GATTDBDynamicAddCccdRequest -> { }
No response for the previous command GATTDBDynamicAddCccdRequest
[Command 20] /dev/ttyACM2: GATTDBDynamicAddCccdRequest -> { }
No response for the previous command GATTDBDynamicAddCccdRequest
[Command 21] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x1'] , Uuid: 0x2a38 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x1 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 22] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x1'] , Uuid: 0x2a38 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x1 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 23] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0'] , Uuid: 0x2a39 , MaxValueLength: 0x0 , CharacteristicProperties: 0x8 , InitialValueLength: 0x1 , ValueAccessPermissions: 0x10 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 24] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0'] , Uuid: 0x2a39 , MaxValueLength: 0x0 , CharacteristicProperties: 0x8 , InitialValueLength: 0x1 , ValueAccessPermissions: 0x10 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 25] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x180f }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 26] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x180f }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 27] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x5A'] , Uuid: 0x2a19 , MaxValueLength: 0x0 , CharacteristicProperties: 0x12 , InitialValueLength: 0x1 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 28] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x5A'] , Uuid: 0x2a19 , MaxValueLength: 0x0 , CharacteristicProperties: 0x12 , InitialValueLength: 0x1 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 29] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDescriptorRequest -> { DescriptorAccessPermissions: 0x1 , UuidType: 0x1 , DescriptorValueLength: 0x7 , Uuid: 0x2904 , Value: ['0x4', '0x0', '0xAD', '0x27', '0x1', '0x0', '0x0'] }
No response for the previous command GATTDBDynamicAddCharacteristicDescriptorRequest
[Command 30] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDescriptorRequest -> { DescriptorAccessPermissions: 0x1 , UuidType: 0x1 , DescriptorValueLength: 0x7 , Uuid: 0x2904 , Value: ['0x4', '0x0', '0xAD', '0x27', '0x1', '0x0', '0x0'] }
No response for the previous command GATTDBDynamicAddCharacteristicDescriptorRequest
[Command 31] /dev/ttyACM2: GATTDBDynamicAddCccdRequest -> { }
No response for the previous command GATTDBDynamicAddCccdRequest
[Command 32] /dev/ttyACM2: GATTDBDynamicAddCccdRequest -> { }
No response for the previous command GATTDBDynamicAddCccdRequest
[Command 33] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x180a }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 34] /dev/ttyACM2: GATTDBDynamicAddPrimaryServiceDeclarationRequest -> { UuidType: 0x1 , Uuid: 0x180a }
No response for the previous command GATTDBDynamicAddPrimaryServiceDeclarationRequest
[Command 35] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x4e585000 , Uuid: 0x2a29 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x4 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 36] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x4e585000 , Uuid: 0x2a29 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x4 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 37] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x4b696e6574697320424c4500 , Uuid: 0x2a24 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0xc , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 38] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x4b696e6574697320424c4500 , Uuid: 0x2a24 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0xc , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 39] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x424c45534e303100 , Uuid: 0x2a25 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x8 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 40] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x424c45534e303100 , Uuid: 0x2a25 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x8 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 41] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x5553422d4b5734315a2d4b32324600 , Uuid: 0x2a27 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0xf , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 42] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x5553422d4b5734315a2d4b32324600 , Uuid: 0x2a27 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0xf , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 43] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x312e312e3100 , Uuid: 0x2a26 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x6 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 44] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x312e312e3100 , Uuid: 0x2a26 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x6 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 45] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x312e312e3400 , Uuid: 0x2a28 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x6 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 46] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: 0x312e312e3400 , Uuid: 0x2a28 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x6 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 47] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0', '0x0', '0xFE', '0xFF', '0x9F', '0x4', '0x0'] , Uuid: 0x2a23 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x8 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 48] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0', '0x0', '0xFE', '0xFF', '0x9F', '0x4', '0x0'] , Uuid: 0x2a23 , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x8 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 49] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0', '0x0', '0x0'] , Uuid: 0x2a2a , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x4 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 50] /dev/ttyACM2: GATTDBDynamicAddCharacteristicDeclarationAndValueRequest -> { UuidType: 0x1 , InitialValue: ['0x0', '0x0', '0x0', '0x0'] , Uuid: 0x2a2a , MaxValueLength: 0x0 , CharacteristicProperties: 0x2 , InitialValueLength: 0x4 , ValueAccessPermissions: 0x1 }
No response for the previous command GATTDBDynamicAddCharacteristicDeclarationAndValueRequest
[Command 51] /dev/ttyACM2: GAPReadPublicDeviceAddressRequest -> { }
No response for the previous command GAPReadPublicDeviceAddressRequest
[Command 52] /dev/ttyACM2: GAPReadPublicDeviceAddressRequest -> { }
No response for the previous command GAPReadPublicDeviceAddressRequest
[Command 53] /dev/ttyACM2: GAPRegisterDeviceSecurityRequirementsRequest -> { SecurityRequirements: <com.nxp.wireless_connectivity.commands.ble.frames.SecurityRequirements object at 0x8e20f2c> , SecurityRequirementsIncluded: 0x1 }
[Command 54] /dev/ttyACM2: GAPSetLocalPasskeyRequest -> { Passkey: 0xf423f }
[Command 55] /dev/ttyACM2: GAPSetAdvertisingDataRequest -> { AdvertisingDataIncluded: 0x1 , ScanResponseData: None , ScanResponseDataIncluded: 0x0 , AdvertisingData: <com.nxp.wireless_connectivity.commands.ble.frames.AdvertisingData object at 0x8e2084c> }
No response for the previous command GAPSetAdvertisingDataRequest
[Command 56] /dev/ttyACM2: GAPSetAdvertisingDataRequest -> { AdvertisingDataIncluded: 0x1 , ScanResponseData: None , ScanResponseDataIncluded: 0x0 , AdvertisingData: <com.nxp.wireless_connectivity.commands.ble.frames.AdvertisingData object at 0x8e2612c> }
No response for the previous command GAPSetAdvertisingDataRequest
Traceback (most recent call last):
File "hrs.py", line 886, in <module>
main(args)
File "hrs.py", line 835, in main
dev.gatt_server_register_for_write_notifications(gBleSig_BatteryService_d)
File "hrs.py", line 607, in gatt_server_register_for_write_notifications
AttributeHandles=[self.handles[service_uuid]],
KeyError: 6159

Outcomes