From 06867de316d738e6a6b859ccc27b6a01dad26cbe Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Wed, 22 May 2024 09:12:06 -0700 Subject: RootCanal: Send well formatted Apcf command complete event The android stack panics if the LE Apcf Transport Discovery Service command complete event is shortened, even with an error status code Bug: 336513624 Test: m root-canal Flag: EXEMPT, tool change Change-Id: I3a0e7c954ba21d4f89b7dbd7e0b8fa7ae613e337 --- tools/rootcanal/model/controller/dual_mode_controller.cc | 10 ++++++++-- tools/rootcanal/packets/hci_packets.pdl | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/rootcanal/model/controller/dual_mode_controller.cc b/tools/rootcanal/model/controller/dual_mode_controller.cc index dbf888f52d..a7b106b3d7 100644 --- a/tools/rootcanal/model/controller/dual_mode_controller.cc +++ b/tools/rootcanal/model/controller/dual_mode_controller.cc @@ -3108,11 +3108,17 @@ void DualModeController::LeApcf(CommandView command) { break; } case bluetooth::hci::ApcfOpcode::TRANSPORT_DISCOVERY_SERVICE: { + auto subcommand_view = + bluetooth::hci::LeApcfServiceDataView::Create(command_view); + CHECK_PACKET_VIEW(subcommand_view); + DEBUG(id_, "<< LE APCF Transport Discovery Service"); + DEBUG(id_, " action={}", + bluetooth::hci::ApcfActionText(subcommand_view.GetApcfAction())); - send_event_(bluetooth::hci::LeApcfCompleteBuilder::Create( + send_event_(bluetooth::hci::LeApcfTransportDiscoveryServiceCompleteBuilder::Create( kNumCommandPackets, ErrorCode::INVALID_HCI_COMMAND_PARAMETERS, - command_view.GetApcfOpcode(), std::vector{})); + subcommand_view.GetApcfAction(), 0)); break; } case bluetooth::hci::ApcfOpcode::AD_TYPE_FILTER: { diff --git a/tools/rootcanal/packets/hci_packets.pdl b/tools/rootcanal/packets/hci_packets.pdl index 363002aa48..2b404bdff1 100644 --- a/tools/rootcanal/packets/hci_packets.pdl +++ b/tools/rootcanal/packets/hci_packets.pdl @@ -5995,6 +5995,17 @@ packet LeApcfAdTypeFilterComplete : LeApcfComplete (apcf_opcode = AD_TYPE_FILTER apcf_available_spaces : 8, } +packet LeApcfTransportDiscoveryService : LeApcf (apcf_opcode = TRANSPORT_DISCOVERY_SERVICE) { + apcf_action : ApcfAction, + apcf_filter_index : 8, + apcf_transport_discovery_data : 8[], +} + +packet LeApcfTransportDiscoveryServiceComplete : LeApcfComplete (apcf_opcode = TRANSPORT_DISCOVERY_SERVICE) { + apcf_action : ApcfAction, + apcf_available_spaces : 8, +} + packet LeApcfReadExtendedFeatures : LeApcf (apcf_opcode = READ_EXTENDED_FEATURES) { } -- cgit v1.2.3-59-g8ed1b