[Rootcanal] Miscellaneous bugfixes for SCO
Fix an inequality sign, and mask out the air coding bits from the voice
setting, since the spec says they don't have to match.
Bug: 245578454
Test: atest pts-bot:HFP
Ignore-AOSP-First: Cherry-picked from AOSP
Merged-In: I5627e28430f03f3978039485228a5abacf62ae58
Change-Id: I5627e28430f03f3978039485228a5abacf62ae58
diff --git a/tools/rootcanal/model/controller/dual_mode_controller.cc b/tools/rootcanal/model/controller/dual_mode_controller.cc
index 7a74a19..9b1ce3b 100644
--- a/tools/rootcanal/model/controller/dual_mode_controller.cc
+++ b/tools/rootcanal/model/controller/dual_mode_controller.cc
@@ -843,7 +843,8 @@
if (status == ErrorCode::SUCCESS) {
status = link_layer_controller_.SetupSynchronousConnection(
command_view.GetConnectionHandle(), transmit_bandwidth,
- receive_bandwidth, command_view.GetMaxLatency(), 0 /* Voice_Setting */,
+ receive_bandwidth, command_view.GetMaxLatency(),
+ link_layer_controller_.GetVoiceSetting(),
static_cast<uint8_t>(command_view.GetRetransmissionEffort()),
command_view.GetPacketType(), datapath);
}
@@ -988,7 +989,7 @@
if (status == ErrorCode::SUCCESS) {
status = link_layer_controller_.AcceptSynchronousConnection(
command_view.GetBdAddr(), transmit_bandwidth, receive_bandwidth,
- command_view.GetMaxLatency(), 0 /* Voice_Setting */,
+ command_view.GetMaxLatency(), link_layer_controller_.GetVoiceSetting(),
static_cast<uint8_t>(command_view.GetRetransmissionEffort()),
command_view.GetPacketType());
}
diff --git a/tools/rootcanal/model/controller/sco_connection.cc b/tools/rootcanal/model/controller/sco_connection.cc
index 8ab7a4f..a96d599 100644
--- a/tools/rootcanal/model/controller/sco_connection.cc
+++ b/tools/rootcanal/model/controller/sco_connection.cc
@@ -185,14 +185,8 @@
uint8_t transmission_interval;
uint16_t packet_length;
- unsigned latency = 1250;
uint8_t air_coding = voice_setting & 0x3;
- if (max_latency != 0xffff && max_latency < latency) {
- LOG_WARN("SCO Max latency must be less than 1250 us");
- return {};
- }
-
if (packet_type & (uint16_t)SynchronousPacketTypeBits::HV3_ALLOWED) {
transmission_interval = 6;
packet_length = 30;
@@ -233,7 +227,9 @@
return false;
}
- if (peer.voice_setting != parameters_.voice_setting) {
+ // mask out the air coding format bits before comparison, as per 5.3 Vol
+ // 4E 6.12
+ if ((peer.voice_setting & ~0x3) != (parameters_.voice_setting & ~0x3)) {
LOG_WARN("Voice setting requirements cannot be met");
LOG_WARN("Remote voice setting: 0x%04x",
static_cast<unsigned>(parameters_.voice_setting));