From e641e63ec6f17e24829a64ea38368af59979ad0b Mon Sep 17 00:00:00 2001
From: Henri Chataing <henrichataing@google.com>
Date: Tue, 12 Apr 2022 16:43:26 +0000
Subject: [PATCH] gd: Fix typo in
 ErrorCode::UNSUPORTED_FEATURE_OR_PARAMETER_VALUE

Test: build libbluetooth
Change-Id: I1e5a5a5ad4174f7ba603045dc19dab436cf4554d
---
 system/gd/hci/hci_packets.pdl                         |  2 +-
 system/gd/hci/le_scanning_manager.cc                  |  2 +-
 system/main/shim/helpers.h                            |  4 ++--
 .../model/controller/dual_mode_controller.cc          | 11 ++++++-----
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/system/gd/hci/hci_packets.pdl b/system/gd/hci/hci_packets.pdl
index caae4744652..fa7373a3353 100644
--- a/system/gd/hci/hci_packets.pdl
+++ b/system/gd/hci/hci_packets.pdl
@@ -803,7 +803,7 @@ enum ErrorCode: 8 {
   CONNECTION_REJECTED_SECURITY_REASONS = 0x0E,
   CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR = 0x0F,
   CONNECTION_ACCEPT_TIMEOUT = 0x10,
-  UNSUPORTED_FEATURE_OR_PARAMETER_VALUE = 0x11,
+  UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE = 0x11,
   INVALID_HCI_COMMAND_PARAMETERS = 0x12,
   REMOTE_USER_TERMINATED_CONNECTION = 0x13,
   REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES = 0x14,
diff --git a/system/gd/hci/le_scanning_manager.cc b/system/gd/hci/le_scanning_manager.cc
index 6ba1c428620..1ee248fd433 100644
--- a/system/gd/hci/le_scanning_manager.cc
+++ b/system/gd/hci/le_scanning_manager.cc
@@ -1017,7 +1017,7 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback
   void batch_scan_read_results(ScannerId scanner_id, uint16_t total_num_of_records, BatchScanMode scan_mode) {
     if (!is_batch_scan_support_) {
       LOG_WARN("Batch scan is not supported");
-      int status = static_cast<int>(ErrorCode::UNSUPORTED_FEATURE_OR_PARAMETER_VALUE);
+      int status = static_cast<int>(ErrorCode::UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
       scanning_callbacks_->OnBatchScanReports(scanner_id, status, 0, 0, {});
       return;
     }
diff --git a/system/main/shim/helpers.h b/system/main/shim/helpers.h
index b7e4bc73f1e..7d023291eb7 100644
--- a/system/main/shim/helpers.h
+++ b/system/main/shim/helpers.h
@@ -180,9 +180,9 @@ inline tHCI_STATUS ToLegacyHciErrorCode(const hci::ErrorCode& reason) {
       return HCI_ERR_HOST_REJECT_DEVICE;
     case hci::ErrorCode::CONNECTION_ACCEPT_TIMEOUT:
       return HCI_ERR_HOST_TIMEOUT;
-    case hci::ErrorCode::UNSUPORTED_FEATURE_OR_PARAMETER_VALUE:
+    case hci::ErrorCode::UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE:
       return static_cast<tHCI_STATUS>(
-          hci::ErrorCode::UNSUPORTED_FEATURE_OR_PARAMETER_VALUE);
+          hci::ErrorCode::UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
     case hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS:
       return HCI_ERR_ILLEGAL_PARAMETER_FMT;
     case hci::ErrorCode::REMOTE_USER_TERMINATED_CONNECTION:
diff --git a/tools/rootcanal/model/controller/dual_mode_controller.cc b/tools/rootcanal/model/controller/dual_mode_controller.cc
index b9ada7bbdfa..af0c86c1485 100644
--- a/tools/rootcanal/model/controller/dual_mode_controller.cc
+++ b/tools/rootcanal/model/controller/dual_mode_controller.cc
@@ -1603,11 +1603,12 @@ void DualModeController::LeSetHostFeature(CommandView command) {
   auto command_view = gd_hci::LeSetHostFeatureView::Create(command);
   ASSERT(command_view.IsValid());
   // TODO: if the controller has active connections, return COMMAND_DISALLOED
-  ErrorCode error_code = properties_.SetLeHostFeature(
-                             static_cast<uint8_t>(command_view.GetBitNumber()),
-                             static_cast<uint8_t>(command_view.GetBitValue()))
-                             ? ErrorCode::SUCCESS
-                             : ErrorCode::UNSUPORTED_FEATURE_OR_PARAMETER_VALUE;
+  ErrorCode error_code =
+      properties_.SetLeHostFeature(
+          static_cast<uint8_t>(command_view.GetBitNumber()),
+          static_cast<uint8_t>(command_view.GetBitValue()))
+          ? ErrorCode::SUCCESS
+          : ErrorCode::UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
   send_event_(bluetooth::hci::LeSetHostFeatureCompleteBuilder::Create(
       kNumCommandPackets, error_code));
 }
-- 
GitLab