bluetooth: COIL: Replace P1 terms

Swap out slave and master from BT codes.

BUG=b:184584466
TEST=none

Change-Id: Ie16a8ceb3c90bdee2c73319334daa65327577fc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/chameleon/+/2821425
Reviewed-by: Michael Sun <michaelfsun@google.com>
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
Tested-by: Archie Pusaka <apusaka@chromium.org>
Commit-Queue: Archie Pusaka <apusaka@chromium.org>
diff --git a/chameleond/utils/bluetooth_hid.py b/chameleond/utils/bluetooth_hid.py
index 6c9f735..e68ba4b 100644
--- a/chameleond/utils/bluetooth_hid.py
+++ b/chameleond/utils/bluetooth_hid.py
@@ -118,8 +118,8 @@
         result = self.SetAuthenticationMode(self.authentication_mode)\
           and result
 
-      # Set RN-42 to work as a slave.
-      result = self.SetSlaveMode() and result
+      # Set RN-42 to work as a peripheral.
+      result = self.SetPeripheralMode() and result
 
       # Set a temporary pin code for testing purpose.
       # Only do this when we want to use a pin code.
diff --git a/chameleond/utils/bluetooth_nrf52.py b/chameleond/utils/bluetooth_nrf52.py
index abac23f..a8f73ae 100644
--- a/chameleond/utils/bluetooth_nrf52.py
+++ b/chameleond/utils/bluetooth_nrf52.py
@@ -191,8 +191,7 @@
   def GetOperationMode(self):
     """Get the operation mode.
 
-    This is master/slave in Bluetooth BR/EDR; the Bluetooth LE equivalent is
-    central/peripheral. For legacy reasons, we call it MASTER or SLAVE only.
+    This is CENTRAL or PERIPHERAL for both BR/EDR and LE.
     Not all kits may support all modes.
 
     nRF52 only supports peripheral role
@@ -201,35 +200,35 @@
       The operation mode of the kit.
     """
     logging.debug('GetOperationMode is a NOP on nRF52')
-    return 'SLAVE'
+    return 'PERIPHERAL'
 
-  def SetMasterMode(self):
-    """Set the kit to master/central mode.
+  def SetCentralMode(self):
+    """Set the kit to central mode.
 
     nRF52 application only acts as a peripheral
 
     Returns:
-      True if master/central mode was set successfully.
+      True if central mode was set successfully.
 
     Raises:
-      A kit-specific exception if master/central mode is unsupported.
+      A kit-specific exception if central mode is unsupported.
     """
-    error_msg = 'Failed to set master/central mode'
+    error_msg = 'Failed to set central mode'
     logging.error(error_msg)
     raise nRF52Exception(error_msg)
 
-  def SetSlaveMode(self):
-    """Set the kit to slave/peripheral mode.
+  def SetPeripheralMode(self):
+    """Set the kit to peripheral mode.
 
     Silently succeeds, because the nRF52 application is always a peripheral
 
     Returns:
-      True if slave/peripheral mode was set successfully.
+      True if peripheral mode was set successfully.
 
     Raises:
-      A kit-specific exception if slave/peripheral mode is unsupported.
+      A kit-specific exception if peripheral mode is unsupported.
     """
-    logging.debug('SetSlaveMode is a NOP on nRF52')
+    logging.debug('SetPeripheralMode is a NOP on nRF52')
     return True
 
   def GetAuthenticationMode(self):
diff --git a/chameleond/utils/bluetooth_peripheral_kit.py b/chameleond/utils/bluetooth_peripheral_kit.py
index 1bc5a06..7530c6c 100644
--- a/chameleond/utils/bluetooth_peripheral_kit.py
+++ b/chameleond/utils/bluetooth_peripheral_kit.py
@@ -348,12 +348,11 @@
     """
     raise NotImplementedError('Not Implemented')
 
-  # TODO(alent): check spec about master/slave roles applicable to LE
+  # TODO(alent): check spec about central/peripheral roles applicable to LE
   def GetOperationMode(self):
     """Get the operation mode.
 
-    This is master/slave in Bluetooth BR/EDR; the Bluetooth LE equivalent is
-    central/peripheral. For legacy reasons, we call it MASTER or SLAVE only.
+    This is CENTRAL or PERIPHERAL for both BR/EDR and LE.
     Not all kits may support all modes.
 
     Returns:
@@ -361,25 +360,25 @@
     """
     raise NotImplementedError('Not Implemented')
 
-  def SetMasterMode(self):
-    """Set the kit to master/central mode.
+  def SetCentralMode(self):
+    """Set the kit to central mode.
 
     Returns:
-      True if master/central mode was set successfully.
+      True if central mode was set successfully.
 
     Raises:
-      A kit-specific exception if master/central mode is unsupported.
+      A kit-specific exception if central mode is unsupported.
     """
     raise NotImplementedError('Not Implemented')
 
-  def SetSlaveMode(self):
-    """Set the kit to slave/peripheral mode.
+  def SetPeripheralMode(self):
+    """Set the kit to peripheral mode.
 
     Returns:
-      True if slave/peripheral mode was set successfully.
+      True if peripheral mode was set successfully.
 
     Raises:
-      A kit-specific exception if slave/peripheral mode is unsupported.
+      A kit-specific exception if peripheral mode is unsupported.
     """
     raise NotImplementedError('Not Implemented')
 
diff --git a/chameleond/utils/bluetooth_rn42.py b/chameleond/utils/bluetooth_rn42.py
index bc93b76..b5f3434 100644
--- a/chameleond/utils/bluetooth_rn42.py
+++ b/chameleond/utils/bluetooth_rn42.py
@@ -71,10 +71,10 @@
   CMD_GET_ADVERTISED_NAME = 'GN'
   CMD_GET_FIRMWARE_VERSION = 'V'
 
-  # operation modes: master or slave
+  # operation modes: central or peripheral
   CMD_GET_OPERATION_MODE = 'GM'
-  CMD_SET_MASTER_MODE = 'SM,1'
-  CMD_SET_SLAVE_MODE = 'SM,0'
+  CMD_SET_CENTRAL_MODE = 'SM,1'
+  CMD_SET_PERIPHERAL_MODE = 'SM,0'
 
   # authentication mode
   CMD_GET_AUTHENTICATION_MODE = 'GA'
@@ -255,10 +255,10 @@
 
   # the operation mode
   OPERATION_MODE = {
-      'Slav': 'SLAVE',      # slave mode
-      'Mstr': 'MASTER',     # master mode
+      'Slav': 'PERIPHERAL', # peripheral mode
+      'Mstr': 'CENTRAL',    # central mode
       'Trig': 'TRIGGER',    # trigger mode
-      'Auto': 'AUTO',       # auto connect master mode
+      'Auto': 'AUTO',       # auto connect central mode
       'DTR': 'DTR',         # auto connect DTR mode
       'Any': 'ANY',         # auto connect any mode
       'Pair': 'PAIR'        # paring mode
@@ -451,7 +451,7 @@
   def GetOperationMode(self):
     """Get the operation mode.
 
-    This is master/slave in Bluetooth BR/EDR.
+    This is CENTRAL or PERIPHERAL in Bluetooth BR/EDR.
 
     Returns:
       The operation mode of the kit.
@@ -460,26 +460,26 @@
                                     msg='getting operation mode')
     return self.OPERATION_MODE.get(result)
 
-  def SetMasterMode(self):
-    """Set the kit to master mode.
+  def SetCentralMode(self):
+    """Set the kit to central mode.
 
     Returns:
-      True if master mode was set successfully.
+      True if central mode was set successfully.
     """
-    self.SerialSendReceive(self.CMD_SET_MASTER_MODE,
+    self.SerialSendReceive(self.CMD_SET_CENTRAL_MODE,
                            expect=self.AOK,
-                           msg='setting master mode')
+                           msg='setting central mode')
     return True
 
-  def SetSlaveMode(self):
-    """Set the kit to slave mode.
+  def SetPeripheralMode(self):
+    """Set the kit to peripheral mode.
 
     Returns:
-      True if slave mode was set successfully.
+      True if peripheral mode was set successfully.
     """
-    self.SerialSendReceive(self.CMD_SET_SLAVE_MODE,
+    self.SerialSendReceive(self.CMD_SET_PERIPHERAL_MODE,
                            expect=self.AOK,
-                           msg='setting slave mode')
+                           msg='setting peripheral mode')
     return True
 
   def GetAuthenticationMode(self):
diff --git a/chameleond/utils/bluez_service_consts.py b/chameleond/utils/bluez_service_consts.py
index cf236ee..ca792c9 100644
--- a/chameleond/utils/bluez_service_consts.py
+++ b/chameleond/utils/bluez_service_consts.py
@@ -61,7 +61,7 @@
 }
 
 """
-Both AVRCP and A2DP profiles will try to role switch into master role on any
+Both AVRCP and A2DP profiles will try to role switch into central role on any
 L2CAP connection, which causes unexpected behavior when emulating a HID device.
 Here, we remove the bluetoothd avrcp and a2dp modules if we aren't emulating an
 audio device.
diff --git a/utils/raspberrypi_setup b/utils/raspberrypi_setup
index d3c5e2a..6ae8e70 100644
--- a/utils/raspberrypi_setup
+++ b/utils/raspberrypi_setup
@@ -13,7 +13,7 @@
 #          blank while execute from the host (autotest server).
 # e.g., raspberrypi_setup 100.100.100.100 test0000
 
-SSH_KEY_TARBALL="https://chromium.googlesource.com/chromiumos/chromite/+archive/master/ssh_keys.tar.gz"
+SSH_KEY_TARBALL="https://chromium.googlesource.com/chromiumos/chromite/+archive/main/ssh_keys.tar.gz"
 
 PI_IP="$1"
 IF_PI="$3"