summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSal Savage <salsavage@google.com>2023-11-28 13:09:02 -0800
committerSal Savage <salsavage@google.com>2023-11-28 13:09:02 -0800
commit40bff94fa14b9c7bfcf1f1a65d930b9f355554dc (patch)
tree8dddb9e24f1f8a1c1c27324e55fade8bb41e1aba
parentc9206b50f89c16802c13c1172249f8062d10d6ad (diff)
downloadcar-40bff94fa14b9c7bfcf1f1a65d930b9f355554dc.tar.gz
Update car COD to account for format bits so we can be Car Audio again
Our minor class is 0x8 - Car Audio, but that is supposed to set the 5th bit to account for the format bits, not the 3rd bit. This is causing our device to be interpreted as an 0x2 - Handsfree Device by remote devices This change updates the byte in question, as well as the documentation so its clearer how COD gets applied by spec, in case we ever need to change it in the future. Bug: 312759291 Test: make -j; adb logcat | grep -ie "Using class of device" Test: Boot device, check HCI snoop logs for HCI COD Write packet Change-Id: Idbb6b0403b52939663d38f7b4653639a4eec1ba5
-rw-r--r--emulator/usbpt/bluetooth/bluetooth.prop38
1 files changed, 31 insertions, 7 deletions
diff --git a/emulator/usbpt/bluetooth/bluetooth.prop b/emulator/usbpt/bluetooth/bluetooth.prop
index fdd00c0..e84275d 100644
--- a/emulator/usbpt/bluetooth/bluetooth.prop
+++ b/emulator/usbpt/bluetooth/bluetooth.prop
@@ -1,11 +1,35 @@
# The default Bluetooth Class of Device
-# Service Field: 0x26 -> 38
-# - Bit 17: Networking
-# - Bit 18: Rendering
-# - Bit 21: Audio
-# Major Class: 0x04 -> 4 (Audio / Video)
-# Minor Class: 0x08 -> 8 (Car Audio)
-bluetooth.device.class_of_device=38,4,8
+#
+# Bluetooth uses "format 1" for class of device, which consists of 4 fields:
+# * Major Service Class
+# * Major Device Class
+# * Minor Device Class
+# * Format indicator (Fixed: 0b00)
+#
+# Class of device is represented by a 3-tuple. However, each value in the tuple does
+# *NOT* correspond to a field. Instead, class of device is stored internally as 24 bits,
+# and each value in the tuple corresponds to an octet.
+#
+# Format (24 Bits):
+# Service Major Minor fmt
+# (11 bits) (5 bits) (6 bits) 0b00
+# |23 13|12 8|7 2|1 0|
+# |<------------------->|<------->|<--------->|<->|
+# |0|0|1|0|0|1|1|0|0|0|0|0|0|1|0|0|0|0|1|0|0|0|0|0|
+# |<------------->|<------------->|<------------->|
+# |23 16|15 8|7 0|
+# | octet[0] = 38 | octet[1] = 4 | octet[2] = 32 |
+#
+# Major Service Class:
+# - Bit 21: Audio
+# - Bit 18: Rendering
+# - Bit 17: Networking
+# Major Device Class:
+# - Bit 10: Audio / Video
+# Minor Device Class:
+# - Bit 5: Car Audio
+# Format Bits (Fixed): 0b00 -> "Format 1"
+bluetooth.device.class_of_device=38,4,32
bluetooth.device.default_name=gCar Emulator
# The Bluetooth profiles that cars expect to have enabled. All other profiles