diff --git a/bumble/hci.py b/bumble/hci.py index a8403b9..9b5793d 100644 --- a/bumble/hci.py +++ b/bumble/hci.py @@ -2102,7 +2102,7 @@ class HCI_Link_Key_Request_Negative_Reply_Command(HCI_Command): fields=[ ('bd_addr', Address.parse_address), ('pin_code_length', 1), - ('pin_code', '*'), + ('pin_code', 16), ], return_parameters_fields=[ ('status', STATUS_SPEC), diff --git a/tests/hci_test.py b/tests/hci_test.py index 6529885..af68e86 100644 --- a/tests/hci_test.py +++ b/tests/hci_test.py @@ -215,12 +215,18 @@ def test_HCI_Command(): # ----------------------------------------------------------------------------- def test_HCI_PIN_Code_Request_Reply_Command(): + pin_code = b'1234' + pin_code_length = len(pin_code) + # here to make the test pass, we need to + # pad pin_code, as HCI_Object.format_fields + # does not do it for us + padded_pin_code = pin_code + bytes(16 - pin_code_length) command = HCI_PIN_Code_Request_Reply_Command( bd_addr=Address( '00:11:22:33:44:55', address_type=Address.PUBLIC_DEVICE_ADDRESS ), - pin_code_length=4, - pin_code=b'1234', + pin_code_length=pin_code_length, + pin_code=padded_pin_code, ) basic_check(command)