Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa9200cd authored by Myles Watson's avatar Myles Watson
Browse files

HCI: Add more PDL tests

Bug: 182216573
Test: atest bluetooth_test_gd
      libbt_packets_test
Tag: #gd-refactor
Change-Id: I083066083a519c19a8d5c3a4928b306e2495c512
parent 9856c2c1
Loading
Loading
Loading
Loading
+259 −0
Original line number Diff line number Diff line
@@ -852,16 +852,32 @@ packet Inquiry : DiscoveryCommand (op_code = INQUIRY) {
  num_responses : 8, // 0x00 unlimited
}

test Inquiry {
  "\x01\x04\x05\x33\x8b\x9e\xaa\xbb",
}

packet InquiryStatus : CommandStatus (command_op_code = INQUIRY) {
}

test InquiryStatus {
  "\x0f\x04\x00\x01\x01\x04",
}

packet InquiryCancel : DiscoveryCommand (op_code = INQUIRY_CANCEL) {
}

test InquiryCancel {
  "\x02\x04\x00",
}

packet InquiryCancelComplete : CommandComplete (command_op_code = INQUIRY_CANCEL) {
  status : ErrorCode,
}

test InquiryCancelComplete {
  "\x0e\x04\x01\x02\x04\x00",
}

packet PeriodicInquiryMode : DiscoveryCommand (op_code = PERIODIC_INQUIRY_MODE) {
  max_period_length : 16, // Range 0x0003 to 0xffff (times 1.28s)
  min_period_length : 16, // Range 0x0002 to 0xfffe (times 1.28s)
@@ -870,17 +886,33 @@ packet PeriodicInquiryMode : DiscoveryCommand (op_code = PERIODIC_INQUIRY_MODE)
  num_responses : 8, // 0x00 unlimited
}

test PeriodicInquiryMode {
  "\x03\x04\x09\x12\x34\x56\x78\x11\x8b\x9e\x9a\xbc",
}

packet PeriodicInquiryModeComplete : CommandComplete (command_op_code = PERIODIC_INQUIRY_MODE) {
  status : ErrorCode,
}

test PeriodicInquiryModeComplete {
  "\x0e\x04\x01\x03\x04\x00",
}

packet ExitPeriodicInquiryMode : DiscoveryCommand (op_code = EXIT_PERIODIC_INQUIRY_MODE) {
}

test ExitPeriodicInquiryMode {
  "\x04\x04\x00",
}

packet ExitPeriodicInquiryModeComplete : CommandComplete (command_op_code = EXIT_PERIODIC_INQUIRY_MODE) {
  status : ErrorCode,
}

test ExitPeriodicInquiryModeComplete {
  "\x0e\x04\x01\x04\x04\x00",
}

enum PageScanRepetitionMode : 8 {
  R0 = 0x00,
  R1 = 0x01,
@@ -1794,19 +1826,35 @@ packet WriteConnectionAcceptTimeoutComplete : CommandComplete (command_op_code =
packet ReadPageTimeout : DiscoveryCommand (op_code = READ_PAGE_TIMEOUT) {
}

test ReadPageTimeout {
  "\x17\x0c\x00",
}

packet ReadPageTimeoutComplete : CommandComplete (command_op_code = READ_PAGE_TIMEOUT) {
  status : ErrorCode,
  page_timeout : 16,
}

test ReadPageTimeoutComplete {
  "\x0e\x06\x01\x17\x0c\x00\x11\x22",
}

packet WritePageTimeout : DiscoveryCommand (op_code = WRITE_PAGE_TIMEOUT) {
  page_timeout : 16,
}

test WritePageTimeout {
  "\x18\x0c\x02\x00\x20",
}

packet WritePageTimeoutComplete : CommandComplete (command_op_code = WRITE_PAGE_TIMEOUT) {
  status : ErrorCode,
}

test WritePageTimeoutComplete {
  "\x0e\x04\x01\x18\x0c\x00",
}

enum ScanEnable : 8 {
  NO_SCANS = 0x00,
  INQUIRY_SCAN_ONLY = 0x01,
@@ -1851,21 +1899,37 @@ packet WritePageScanActivityComplete : CommandComplete (command_op_code = WRITE_
packet ReadInquiryScanActivity : DiscoveryCommand (op_code = READ_INQUIRY_SCAN_ACTIVITY) {
}

test ReadInquiryScanActivity {
  "\x1d\x0c\x00",
}

packet ReadInquiryScanActivityComplete : CommandComplete (command_op_code = READ_INQUIRY_SCAN_ACTIVITY) {
  status : ErrorCode,
  inquiry_scan_interval : 16, // Range: 0x0012 to 0x1000; only even values are valid * 0x625 ms
  inquiry_scan_window : 16, // Range: 0x0011 to 0x1000
}

test ReadInquiryScanActivityComplete {
  "\x0e\x08\x01\x1d\x0c\x00\xaa\xbb\xcc\xdd",
}

packet WriteInquiryScanActivity : DiscoveryCommand (op_code = WRITE_INQUIRY_SCAN_ACTIVITY) {
  inquiry_scan_interval : 16, // Range: 0x0012 to 0x1000; only even values are valid * 0x625 ms
  inquiry_scan_window : 16, // Range: 0x0011 to 0x1000
}

test WriteInquiryScanActivity {
  "\x1e\x0c\x04\x00\x08\x12\x00",
}

packet WriteInquiryScanActivityComplete : CommandComplete (command_op_code = WRITE_INQUIRY_SCAN_ACTIVITY) {
  status : ErrorCode,
}

test WriteInquiryScanActivityComplete {
  "\x0e\x04\x01\x1e\x0c\x00",
}

enum AuthenticationEnable : 8 {
  NOT_REQUIRED = 0x00,
  REQUIRED = 0x01,
@@ -2036,10 +2100,18 @@ packet HostBufferSize : Command (op_code = HOST_BUFFER_SIZE) {
  host_total_num_synchronous_data_packets : 16,
}

test HostBufferSize {
  "\x33\x0c\x07\x9b\x06\xff\x14\x00\x0a\x00",
}

packet HostBufferSizeComplete : CommandComplete (command_op_code = HOST_BUFFER_SIZE) {
  status : ErrorCode,
}

test HostBufferSizeComplete {
  "\x0e\x04\x01\x33\x0c\x00",
}

struct CompletedPackets {
  connection_handle : 12,
  _reserved_ : 4,
@@ -2082,29 +2154,53 @@ packet WriteLinkSupervisionTimeoutComplete : CommandComplete (command_op_code =
packet ReadNumberOfSupportedIac : DiscoveryCommand (op_code = READ_NUMBER_OF_SUPPORTED_IAC) {
}

test ReadNumberOfSupportedIac {
  "\x38\x0c\x00",
}

packet ReadNumberOfSupportedIacComplete : CommandComplete (command_op_code = READ_NUMBER_OF_SUPPORTED_IAC) {
  status : ErrorCode,
  num_support_iac : 8,
}

test ReadNumberOfSupportedIacComplete {
  "\x0e\x05\x01\x38\x0c\x00\x99",
}

packet ReadCurrentIacLap : DiscoveryCommand (op_code = READ_CURRENT_IAC_LAP) {
}

test ReadCurrentIacLap {
  "\x39\x0c\x00",
}

packet ReadCurrentIacLapComplete : CommandComplete (command_op_code = READ_CURRENT_IAC_LAP) {
  status : ErrorCode,
  _count_(laps_to_read) : 8,
  laps_to_read : Lap[],
}

test ReadCurrentIacLapComplete {
  "\x0e\x0b\x01\x39\x0c\x00\x02\x11\x8b\x9e\x22\x8b\x9e",
}

packet WriteCurrentIacLap : DiscoveryCommand (op_code = WRITE_CURRENT_IAC_LAP) {
  _count_(laps_to_write) : 8,
  laps_to_write : Lap[],
}

test WriteCurrentIacLap {
  "\x3a\x0c\x07\x02\x11\x8b\x9e\x22\x8b\x9e",
}

packet WriteCurrentIacLapComplete : CommandComplete (command_op_code = WRITE_CURRENT_IAC_LAP) {
  status : ErrorCode,
}

test WriteCurrentIacLapComplete {
  "\x0e\x04\x01\x3a\x0c\x00",
}

packet SetAfhHostChannelClassification : Command (op_code = SET_AFH_HOST_CHANNEL_CLASSIFICATION) {
  afh_host_channel_classification : 8[10],
}
@@ -2241,10 +2337,18 @@ packet WriteSimplePairingMode : SecurityCommand (op_code = WRITE_SIMPLE_PAIRING_
  simple_pairing_mode : Enable,
}

test WriteSimplePairingMode {
  "\x56\x0c\x01\x01",
}

packet WriteSimplePairingModeComplete : CommandComplete (command_op_code = WRITE_SIMPLE_PAIRING_MODE) {
  status : ErrorCode,
}

test WriteSimplePairingModeComplete {
  "\x0e\x04\x01\x56\x0c\x00",
}

packet ReadLocalOobData : SecurityCommand (op_code = READ_LOCAL_OOB_DATA) {
}

@@ -2302,10 +2406,18 @@ packet WriteLeHostSupport : Command (op_code = WRITE_LE_HOST_SUPPORT) {
  simultaneous_le_host : Enable,  // According to the spec, this should be 0x00 since 4.1
}

test WriteLeHostSupport {
  "\x6d\x0c\x02\x01\x01",
}

packet WriteLeHostSupportComplete : CommandComplete (command_op_code = WRITE_LE_HOST_SUPPORT) {
  status : ErrorCode,
}

test WriteLeHostSupportComplete {
  "\x0e\x04\x01\x6d\x0c\x00",
}

packet ReadSecureConnectionsHostSupport : Command (op_code = READ_SECURE_CONNECTIONS_HOST_SUPPORT) {
}

@@ -2318,10 +2430,18 @@ packet WriteSecureConnectionsHostSupport : SecurityCommand (op_code = WRITE_SECU
  secure_connections_host_support : Enable,
}

test WriteSecureConnectionsHostSupport {
  "\x7a\x0c\x01\x01",
}

packet WriteSecureConnectionsHostSupportComplete : CommandComplete (command_op_code = WRITE_SECURE_CONNECTIONS_HOST_SUPPORT) {
  status : ErrorCode,
}

test WriteSecureConnectionsHostSupportComplete {
  "\x0e\x04\x01\x7a\x0c\x00",
}

packet ReadLocalOobExtendedData : SecurityCommand (op_code = READ_LOCAL_OOB_EXTENDED_DATA) {
}

@@ -2362,6 +2482,10 @@ packet ConfigureDataPathComplete : CommandComplete (command_op_code = CONFIGURE_
packet ReadLocalVersionInformation : Command (op_code = READ_LOCAL_VERSION_INFORMATION) {
}

test ReadLocalVersionInformation {
  "\x01\x10\x00",
}

enum HciVersion : 8 {
  V_1_0B = 0x00,
  V_1_1 = 0x01,
@@ -2403,14 +2527,26 @@ packet ReadLocalVersionInformationComplete : CommandComplete (command_op_code =
  local_version_information : LocalVersionInformation,
}

test ReadLocalVersionInformationComplete {
  "\x0e\x0c\x01\x01\x10\x00\x09\x00\x00\x09\x1d\x00\xbe\x02",
}

packet ReadLocalSupportedCommands : Command (op_code = READ_LOCAL_SUPPORTED_COMMANDS) {
}

test ReadLocalSupportedCommands {
  "\x02\x10\x00",
}

packet ReadLocalSupportedCommandsComplete : CommandComplete (command_op_code = READ_LOCAL_SUPPORTED_COMMANDS) {
  status : ErrorCode,
  supported_commands : 8[64],
}

test ReadLocalSupportedCommandsComplete {
  "\x0e\x44\x01\x02\x10\x00\xff\xff\xff\x03\xce\xff\xef\xff\xff\xff\xff\x7f\xf2\x0f\xe8\xfe\x3f\xf7\x83\xff\x1c\x00\x00\x00\x61\xff\xff\xff\x7f\xbe\x20\xf5\xff\xf0\xff\xff\xff\xff\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
}

packet ReadLocalSupportedFeatures : Command (op_code = READ_LOCAL_SUPPORTED_FEATURES) {
}

@@ -2423,6 +2559,12 @@ packet ReadLocalExtendedFeatures : Command (op_code = READ_LOCAL_EXTENDED_FEATUR
  page_number : 8,
}

test ReadLocalExtendedFeatures {
  "\x04\x10\x01\x00",
  "\x04\x10\x01\x01",
  "\x04\x10\x01\x02",
}

packet ReadLocalExtendedFeaturesComplete : CommandComplete (command_op_code = READ_LOCAL_EXTENDED_FEATURES) {
  status : ErrorCode,
  page_number : 8,
@@ -2430,9 +2572,19 @@ packet ReadLocalExtendedFeaturesComplete : CommandComplete (command_op_code = RE
  extended_lmp_features : 64,
}

test ReadLocalExtendedFeaturesComplete {
  "\x0e\x0e\x01\x04\x10\x00\x00\x02\xff\xfe\x8f\xfe\xd8\x3f\x5b\x87",
  "\x0e\x0e\x01\x04\x10\x00\x01\x02\x07\x00\x00\x00\x00\x00\x00\x00",
  "\x0e\x0e\x01\x04\x10\x00\x02\x02\x45\x03\x00\x00\x00\x00\x00\x00",
}

packet ReadBufferSize : Command (op_code = READ_BUFFER_SIZE) {
}

test ReadBufferSize {
  "\x05\x10\x00",
}

packet ReadBufferSizeComplete : CommandComplete (command_op_code = READ_BUFFER_SIZE) {
  status : ErrorCode,
  acl_data_packet_length : 16,
@@ -2441,14 +2593,26 @@ packet ReadBufferSizeComplete : CommandComplete (command_op_code = READ_BUFFER_S
  total_num_synchronous_data_packets : 16,
}

test ReadBufferSizeComplete {
  "\x0e\x0b\x01\x05\x10\x00\x00\x04\x3c\x07\x00\x08\x00",
}

packet ReadBdAddr : Command (op_code = READ_BD_ADDR) {
}

test ReadBdAddr {
  "\x09\x10\x00",
}

packet ReadBdAddrComplete : CommandComplete (command_op_code = READ_BD_ADDR) {
  status : ErrorCode,
  bd_addr : Address,
}

test ReadBdAddrComplete {
  "\x0e\x0a\x01\x09\x10\x00\x14\x8e\x61\x5f\x36\x88",
}

packet ReadDataBlockSize : Command (op_code = READ_DATA_BLOCK_SIZE) {
}

@@ -2701,11 +2865,19 @@ struct LeBufferSize {
  total_num_le_packets : 8,
}

test LeReadBufferSizeV1 {
  "\x02\x20\x00",
}

packet LeReadBufferSizeV1Complete : CommandComplete (command_op_code = LE_READ_BUFFER_SIZE_V1) {
  status : ErrorCode,
  le_buffer_size : LeBufferSize,
}

test LeReadBufferSizeV1Complete {
  "\x0e\x07\x01\x02\x20\x00\xfb\x00\x10",
}

packet LeReadLocalSupportedFeatures : Command (op_code = LE_READ_LOCAL_SUPPORTED_FEATURES) {
}

@@ -2828,6 +3000,10 @@ packet LeSetScanParameters : LeScanningCommand (op_code = LE_SET_SCAN_PARAMETERS
  scanning_filter_policy : LeScanningFilterPolicy,
}

test LeSetScanParameters {
  "\x0b\x20\x07\x01\x12\x00\x12\x00\x01\x00",
}

packet LeSetScanParametersComplete : CommandComplete (command_op_code = LE_SET_SCAN_PARAMETERS) {
  status : ErrorCode,
}
@@ -2837,6 +3013,10 @@ packet LeSetScanEnable : LeScanningCommand (op_code = LE_SET_SCAN_ENABLE) {
  filter_duplicates : Enable,
}

test LeSetScanEnable {
  "\x0c\x20\x02\x01\x00",
}

packet LeSetScanEnableComplete : CommandComplete (command_op_code = LE_SET_SCAN_ENABLE) {
  status : ErrorCode,
}
@@ -2874,11 +3054,19 @@ packet LeCreateConnectionCancelComplete : CommandComplete (command_op_code = LE_
packet LeReadConnectListSize : Command (op_code = LE_READ_CONNECT_LIST_SIZE) {
}

test LeReadConnectListSize {
  "\x0f\x20\x00",
}

packet LeReadConnectListSizeComplete : CommandComplete (command_op_code = LE_READ_CONNECT_LIST_SIZE) {
  status : ErrorCode,
  connect_list_size : 8,
}

test LeReadConnectListSizeComplete {
  "\x0e\x05\x01\x0f\x20\x00\x80",
}

packet LeClearConnectList : LeConnectionManagementCommand (op_code = LE_CLEAR_CONNECT_LIST) {
}

@@ -3289,10 +3477,18 @@ packet LeSetExtendedAdvertisingRandomAddress : LeAdvertisingCommand (op_code = L
  advertising_random_address : Address,
}

test LeSetExtendedAdvertisingRandomAddress {
  "\x35\x20\x07\x00\x77\x58\xeb\xd3\x1c\x6e",
}

packet LeSetExtendedAdvertisingRandomAddressComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS) {
  status : ErrorCode,
}

test LeSetExtendedAdvertisingRandomAddressComplete {
  "\x0e\x04\x01\x35\x20\x00",
}

// The lower 4 bits of the advertising event properties
enum LegacyAdvertisingProperties : 4 {
  ADV_IND = 0x3,
@@ -3359,6 +3555,11 @@ packet LeSetExtendedAdvertisingParameters : LeAdvertisingCommand (op_code = LE_S
  scan_request_notification_enable : Enable,
}

test LeSetExtendedAdvertisingParameters {
  "\x36\x20\x19\x00\x13\x00\x90\x01\x00\xc2\x01\x00\x07\x01\x00\x00\x00\x00\x00\x00\x00\x00\xf9\x01\x00\x01\x01\x00",
  "\x36\x20\x19\x01\x13\x00\x90\x01\x00\xc2\x01\x00\x07\x01\x00\x00\x00\x00\x00\x00\x00\x00\xf9\x01\x00\x01\x01\x00",
}

packet LeSetExtendedAdvertisingParametersComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_PARAMETERS) {
  status : ErrorCode,
  selected_tx_power : 8, // -127 to +20
@@ -3387,6 +3588,10 @@ packet LeSetExtendedAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_EXT
  advertising_data : GapData[],
}

test LeSetExtendedAdvertisingData {
  "\x37\x20\x12\x00\x03\x01\x0e\x02\x01\x02\x0a\x09\x50\x69\x78\x65\x6c\x20\x33\x20\x58",
}

packet LeSetExtendedAdvertisingDataRaw : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_DATA) {
  advertising_handle : 8,
  operation : Operation,
@@ -3401,6 +3606,10 @@ packet LeSetExtendedAdvertisingDataComplete : CommandComplete (command_op_code =
  status : ErrorCode,
}

test LeSetExtendedAdvertisingDataComplete {
  "\x0e\x04\x01\x37\x20\x00",
}

packet LeSetExtendedAdvertisingScanResponse : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE) {
  advertising_handle : 8,
  operation : Operation,
@@ -3454,10 +3663,18 @@ packet LeSetExtendedAdvertisingEnable : LeAdvertisingCommand (op_code = LE_SET_E
  enabled_sets : EnabledSet[],
}

test LeSetExtendedAdvertisingEnable {
  "\x39\x20\x06\x00\x01\x01\x00\x00\x00",
}

packet LeSetExtendedAdvertisingEnableComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) {
  status : ErrorCode,
}

test LeSetExtendedAdvertisingEnableComplete {
  "\x0e\x04\x01\x39\x20\x00",
}

packet LeReadMaximumAdvertisingDataLength : Command (op_code = LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH) {
}

@@ -3478,10 +3695,18 @@ packet LeRemoveAdvertisingSet : LeAdvertisingCommand (op_code = LE_REMOVE_ADVERT
  advertising_handle : 8,
}

test LeRemoveAdvertisingSet {
  "\x3c\x20\x01\x01",
}

packet LeRemoveAdvertisingSetComplete : CommandComplete (command_op_code = LE_REMOVE_ADVERTISING_SET) {
  status : ErrorCode,
}

test LeRemoveAdvertisingSetComplete {
  "\x0e\x04\x01\x3c\x20\x00",
}

packet LeClearAdvertisingSets : LeAdvertisingCommand (op_code = LE_CLEAR_ADVERTISING_SETS) {
}

@@ -3536,10 +3761,19 @@ packet LeSetExtendedScanParameters : LeScanningCommand (op_code = LE_SET_EXTENDE
  parameters : PhyScanParameters[],
}

test LeSetExtendedScanParameters {
  "\x41\x20\x08\x01\x00\x01\x01\x12\x00\x12\x00",
  "\x41\x20\x08\x01\x00\x01\x01\x99\x19\x99\x19",
}

packet LeSetExtendedScanParametersComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_SCAN_PARAMETERS) {
  status : ErrorCode,
}

test LeSetExtendedScanParametersComplete {
  "\x0e\x04\x01\x41\x20\x00",
}

enum FilterDuplicates : 8 {
  DISABLED = 0,
  ENABLED = 1,
@@ -3553,10 +3787,19 @@ packet LeSetExtendedScanEnable : LeScanningCommand (op_code = LE_SET_EXTENDED_SC
  period : 16, // 0 - Scan continuously,  N * 1.28 sec
}

test LeSetExtendedScanEnable {
  "\x42\x20\x06\x01\x00\x00\x00\x00\x00",
  "\x42\x20\x06\x00\x01\x00\x00\x00\x00",
}

packet LeSetExtendedScanEnableComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_SCAN_ENABLE) {
  status : ErrorCode,
}

test LeSetExtendedScanEnableComplete {
  "\x0e\x04\x01\x42\x20\x00",
}

struct LeCreateConnPhyScanParameters {
  scan_interval : 16, // 0x0004-0xFFFF
  scan_window : 16, // < = LeScanInterval
@@ -3577,6 +3820,10 @@ packet LeExtendedCreateConnection : LeConnectionManagementCommand (op_code = LE_
  phy_scan_parameters : LeCreateConnPhyScanParameters[],
}

test LeExtendedCreateConnection {
  "\x43\x20\x2a\x01\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x08\x30\x00\x18\x00\x28\x00\x00\x00\xf4\x01\x00\x00\x00\x00\x00\x08\x30\x00\x18\x00\x28\x00\x00\x00\xf4\x01\x00\x00\x00\x00",
}

packet LeExtendedCreateConnectionStatus : CommandStatus (command_op_code = LE_EXTENDED_CREATE_CONNECTION) {
}

@@ -4122,6 +4369,10 @@ packet LeSetTransmitPowerReportingEnableComplete : CommandComplete (command_op_c
packet LeGetVendorCapabilities : VendorCommand (op_code = LE_GET_VENDOR_CAPABILITIES) {
}

test LeGetVendorCapabilities {
  "\x53\xfd\x00",
}

struct VendorCapabilities {
  is_supported : 8,
  max_advt_instances: 8,
@@ -4552,11 +4803,19 @@ packet ControllerBqr : VendorCommand(op_code = CONTROLLER_BQR) {
  bqr_minimum_report_interval : 16,
}

test ControllerBqr {
  "\x5e\xfd\x07\x00\x1f\x00\x07\x00\x88\x13",
}

packet ControllerBqrComplete : CommandComplete (command_op_code = CONTROLLER_BQR) {
  status : ErrorCode,
  current_quality_event_mask : 32
}

test ControllerBqrComplete {
  "\x0e\x08\x01\x5e\xfd\x00\x1f\x00\x07\x00",
}

// HCI Event Packets

packet InquiryComplete : Event (event_code = INQUIRY_COMPLETE) {