@@ -544,6 +544,20 @@ def on_ll_control_pdu(
544544 self .on_le_cis_disconnected (packet .cig_id , packet .cis_id )
545545 case ll .EncReq ():
546546 self .on_le_encrypted (connection )
547+ case ll .FeatureReq () | ll .PeripheralFeatureReq ():
548+ connection .send_ll_control_pdu (
549+ ll .FeatureRsp (
550+ feature_set = self .le_features .value .to_bytes (8 , 'little' )
551+ )
552+ )
553+ case ll .FeatureRsp (feature_set ):
554+ self .send_hci_packet (
555+ hci .HCI_LE_Read_Remote_Features_Complete_Event (
556+ status = hci .HCI_ErrorCode .SUCCESS ,
557+ connection_handle = connection .handle ,
558+ le_features = feature_set ,
559+ )
560+ )
547561
548562 def on_ll_advertising_pdu (self , packet : ll .AdvertisingPdu ) -> None :
549563 logger .debug ("[%s] <<< Advertising PDU: %s" , self .name , packet )
@@ -2084,7 +2098,7 @@ def on_hci_le_read_remote_features_command(
20842098
20852099 handle = command .connection_handle
20862100
2087- if not self .find_connection_by_handle (handle ):
2101+ if not ( connection := self .find_le_connection_by_handle (handle ) ):
20882102 self ._send_hci_command_status (
20892103 hci .HCI_ErrorCode .INVALID_COMMAND_PARAMETERS_ERROR , command .op_code
20902104 )
@@ -2093,14 +2107,16 @@ def on_hci_le_read_remote_features_command(
20932107 # First, say that the command is pending
20942108 self ._send_hci_command_status (hci .HCI_COMMAND_STATUS_PENDING , command .op_code )
20952109
2096- # Then send the remote features
2097- self .send_hci_packet (
2098- hci .HCI_LE_Read_Remote_Features_Complete_Event (
2099- status = hci .HCI_ErrorCode .SUCCESS ,
2100- connection_handle = handle ,
2101- le_features = bytes .fromhex ('dd40000000000000' ),
2110+ if connection .role == hci .Role .CENTRAL :
2111+ connection .send_ll_control_pdu (
2112+ ll .FeatureReq (feature_set = self .le_features .value .to_bytes (8 , 'little' ))
2113+ )
2114+ else :
2115+ connection .send_ll_control_pdu (
2116+ ll .PeripheralFeatureReq (
2117+ feature_set = self .le_features .value .to_bytes (8 , 'little' )
2118+ )
21022119 )
2103- )
21042120 return None
21052121
21062122 def on_hci_le_rand_command (
0 commit comments