summaryrefslogtreecommitdiff
path: root/emulator
Commit message (Collapse)AuthorAgeFilesLines
...
* emulator: Add initial support for MSFT vendor commandsLuiz Augusto von Dentz2021-10-212-24/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the initial support for MSFT vendor commands and enable them when in btvirt: < HCI Command: Microsoft Ex.. (0x3f|0x001e) plen 1 Read Supported Features (0x00) > HCI Event: Command Complete (0x0e) plen 14 Microsoft Extension (0x3f|0x001e) ncmd 1 Read Supported Features (0x00) Status: Success (0x00) Features: 0x3f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 RSSI Monitoring feature for BR/EDR RSSI Monitoring feature for LE connections RSSI Monitoring of LE advertisements Advertising Monitoring of LE advertisements Verifying the validity of P-192 and P-256 keys Continuous Advertising Monitoring Event prefix length: 0 Event prefix: < HCI Command: Microsoft Ex.. (0x3f|0x001e) plen 2 LE Set Advertisement Filter Enable (0x05) Enable: All filter conditions (0x01) > HCI Event: Command Complete (0x0e) plen 5 Microsoft Extension (0x3f|0x001e) ncmd 1 LE Set Advertisement Filter Enable (0x05) Status: Success (0x00)
* btdev: Use Linux Foundation as manufacturerLuiz Augusto von Dentz2021-10-211-1/+1
| | | | | | This makes the emulator use Linux Foundation manufacturer id which shall be simpler to distinguish emulator instances since it is unlikely there will be other vendors using it.
* emulator/vhci: Fix writing msft_opcode using binary formatLuiz Augusto von Dentz2021-10-211-1/+10
| | | | debugfs expects values in string format not binary format.
* mgmt-tester: Make use of vhci_set_force_suspend/vhci_set_force_wakeupLuiz Augusto von Dentz2021-10-182-0/+9
| | | | | | This replaces the direct setting debugfs to use vhci instance which properly stores the controller index so it can be used even if there are real controllers in the system.
* vhci: Add functions to interface with debugfsLuiz Augusto von Dentz2021-10-184-2/+95
| | | | This adds functions that can be used to set debugfs options.
* hciemu: Use vhci_open to instanciate a vhci btdevLuiz Augusto von Dentz2021-10-182-54/+81
| | | | | This makes use of vhci_open to isntanciate the vhci btdev since that has proper support for reading the index assigned to it.
* vhci: Use io.h instead of mainloop.hLuiz Augusto von Dentz2021-10-181-36/+31
| | | | | | The likes of mainloop_add_fd is not implemented in mainloop-glib.c while io_set_read_handler so this makes it possible to use vhci instance with both libshared-glib and libshared-mainloop.
* vhci: Read the controller indexLuiz Augusto von Dentz2021-10-183-44/+54
| | | | | | This makes vhci instance read its controller index assigned by the kernel and also introduces vhci_get_btdev so it can be used by the likes of hciemu.
* emulator: Inclusive language changesArchie Pusaka2021-09-215-138/+139
| | | | | | | | BT core spec 5.3 promotes the usage of inclusive languages. This CL replaces some terms with the more appropriate counterparts, such as "central", "peripheral", and "accept list". Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* monitor: Inclusive language changesArchie Pusaka2021-09-213-49/+49
| | | | | | | | BT core spec 5.3 promotes the usage of inclusive languages. This CL replaces some terms with the more appropriate counterparts, such as "central", "peripheral", "link key", and "accept list" Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* btdev: Fix removing advertising set if it was terminatedLuiz Augusto von Dentz2021-08-191-1/+1
| | | | | Consider the advertising set disabled but don't remove it as the host may still reuse it.
* btdev: Fix order of BT_HCI_EVT_LE_ADV_SET_TERMLuiz Augusto von Dentz2021-08-191-6/+8
| | | | | | BT_HCI_EVT_LE_ADV_SET_TERM shall come after BT_HCI_EVT_LE_ENHANCED_CONN_COMPLETE otherwise the host doesn't know the connection handle.
* btdev: Fix sending terminate advertising event to the wrong deviceLuiz Augusto von Dentz2021-08-191-1/+1
| | | | | The device where the event should be sent is the same that had created not the connection one.
* emulator: Add support enhanced SCO connectionKiran K2021-08-171-1/+57
| | | | | Add support for enhanced_setup_synchronous_connection command in btdev
* bthost: Fix not initializing address types properlyLuiz Augusto von Dentz2021-08-131-6/+12
| | | | | | | | | | The address type given to the init_conn is the peer address type (btdev) not the bthost address type, the old code assume it could use since only BDADDR_BREDR or BDADDR_LE_PUBLIC was tested but with the upcoming support for LL Privacy the peer address type would become BDADDR_LE_RANDOM which cannot be used as address type of bthost as that doesn't support random addresses and would likely cause SMP to fail when pairing.
* bthost: Add bthost_debug and use it on smp.cLuiz Augusto von Dentz2021-08-124-30/+46
| | | | | This adds bthost_debug which wraps util_debug and make use of it in smp.c.
* btdev: Add proper handling for own_address_type 0x03Luiz Augusto von Dentz2021-08-061-8/+78
| | | | | | | When own_address_type is set to 0x03 the host expects the controller to generate RPAs using the stored IRK from the resolving list and in addition to that set the generated RPA as Local RPA in LE Enhanced Connection Complete.
* btdev: Fix not checking conditions for LE Set Random AddressLuiz Augusto von Dentz2021-07-191-0/+13
| | | | | | | | | | | | | The spec says LE Set Random Address cannot be used when scan is enabled or with legacy advertising: BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E page 2480 'If the Host issues this command when any of advertising (created using legacy advertising commands), scanning, or initiating are enabled, the Controller shall return the error code Command Disallowed (0x0C).'
* btdev: Add proper checks for own_addr_type for LE scan/advLuiz Augusto von Dentz2021-07-191-22/+79
| | | | | | | | | | | | | | | | | | | | | own_addr_type 0x01 and 0x03 shall check that a random address has properly been set: BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E page 2496: 'If LE_Scan_Enable is set to 0x01, the scanning parameters' Own_Address_Type parameter is set to 0x01 or 0x03, and the random ddress for the device has not been initialized, the Controller shall return the error code Invalid HCI Command Parameters (0x12).' BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E page 2614: 'If Enable is set to 0x01, the scanning parameters' Own_Address_Type parameter is set to 0x01 or 0x03, and the random address for the device has not been initialized, the Controller shall return the error code Invalid HCI Command Parameters (0x12).'
* emulator/btdev: Add support HCI_READ_CLOCK commandTedd Ho-Jeong An2021-07-161-0/+18
| | | | This patch adds support HCI_READ_CLOCK command in btdev.
* btdev: Add proper checks for own_addr_type for extended advertisingLuiz Augusto von Dentz2021-07-141-0/+44
| | | | | | | | | | | | | | | | | | | | | | | own_addr_type 0x01 and 0x03 shall check that a random address has properly been set and in case of 0x03 the resolving list actually contains the irk of the identity address: BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E page 2596 'If the advertising set's Own_Address_Type parameter is set to 0x01 and the random address for the advertising set has not been initialized, the Controller shall return the error code Invalid HCI Command Parameters (0x12).' BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E page 2597 'If the advertising set's Own_Address_Type parameter is set to 0x03, the controller's resolving list did not contain a matching entry, and the random address for the advertising set has not been initialized, the Controller shall return the error code Invalid HCI Command Parameters (0x12).'
* emulator/btdev: clean up the queue before closing the testTedd Ho-Jeong An2021-07-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch clean up the queue for connection before closing the test to prevent the potential memory leak. ==50== 32 bytes in 1 blocks are definitely lost in loss record 18 of 32 ==50== at 0x483A809: malloc (vg_replace_malloc.c:307) ==50== by 0x14A37E: btd_malloc (util.c:33) ==50== by 0x149D9D: queue_new (queue.c:47) ==50== by 0x13B3C0: btdev_create (btdev.c:6042) ==50== by 0x13178E: create_vhci (hciemu.c:229) ==50== by 0x13178E: hciemu_new_num (hciemu.c:403) ==50== by 0x130E2C: read_index_list_callback (mgmt-tester.c:357) ==50== by 0x14AD91: request_complete (mgmt.c:264) ==50== by 0x14BD34: can_read_data (mgmt.c:356) ==50== by 0x14E794: watch_callback (io-glib.c:157) ==50== by 0x48B578E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6400.6) ==50== by 0x48B5B17: ??? (in /usr/lib64/libglib-2.0.so.0.6400.6) ==50== by 0x48B5E32: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6400.6) ==50== ==50== 32 bytes in 1 blocks are definitely lost in loss record 19 of 32 ==50== at 0x483A809: malloc (vg_replace_malloc.c:307) ==50== by 0x14A37E: btd_malloc (util.c:33) ==50== by 0x149D9D: queue_new (queue.c:47) ==50== by 0x13B3C0: btdev_create (btdev.c:6042) ==50== by 0x1318F7: hciemu_client_new (hciemu.c:332) ==50== by 0x1318F7: hciemu_new_num (hciemu.c:412) ==50== by 0x130E2C: read_index_list_callback (mgmt-tester.c:357) ==50== by 0x14AD91: request_complete (mgmt.c:264) ==50== by 0x14BD34: can_read_data (mgmt.c:356) ==50== by 0x14E794: watch_callback (io-glib.c:157) ==50== by 0x48B578E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6400.6) ==50== by 0x48B5B17: ??? (in /usr/lib64/libglib-2.0.so.0.6400.6) ==50== by 0x48B5E32: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6400.6)
* emulator/bthost: Create ext adv params before setting adv dataTedd Ho-Jeong An2021-06-232-6/+21
| | | | | | | Based on the SPEC 5.2 Vol 4, Part E, Section 7.8.54, the LE_Set_Extended_Advertising_Data_Command may be issued after an advertising set identifed by the Advertising_Handle has been created using the HCI_LE_Set_Extended_Advertising_Parameters command.
* emulator/btdev: Add support HCI LE Adv Set Terminated eventLuiz Augusto von Dentz2021-06-231-3/+61
| | | | | This patch adds support the HCI_LE_Advertising_Set_Terminated event in btdev.
* emulator/btdev: Add support multiple instance of extended advertisingTedd Ho-Jeong An2021-06-231-96/+323
| | | | This patch adds support multiple instance of extended advertising.
* btdev: Check advertising/scanning states when changing Resolving ListLuiz Augusto von Dentz2021-06-091-0/+40
| | | | | | | | | Resolving List cannot be changed when advertising/scanning: • Advertising (other than periodic advertising) is enabled, • Scanning is enabled, or • an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection, or HCI_LE_Periodic_Advertising_Create_Sync command is outstanding.
* btdev: Check advertising/scanning states when changing White ListLuiz Augusto von Dentz2021-06-091-0/+68
| | | | | | | | | | | | White List cannot be changed when advertising/scanning: • any advertising filter policy uses the White List and advertising is enabled, • the scanning filter policy uses the White List and scanning is enabled, or • the initiator filter policy uses the White List and an HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection command is outstanding.
* btdev: Remove debugsLuiz Augusto von Dentz2021-06-041-9/+0
| | | | Remove left-over util_debugs.
* btdev: Fix handling of white/resolving listLuiz Augusto von Dentz2021-06-041-55/+103
| | | | | | | | le_cig.cis entries was not properly checked which could lead to overwriting le_wl/le_rl field. While at it this also makes changes so have proper struct/fields for le_wl and le_rl so they easier to manage.
* btdev: Fix crash when generating disconnected event for BISLuiz Augusto von Dentz2021-06-031-2/+4
| | | | | When generating disconnected event for a BIS it would not have any link as the ISO is in fact we are broadcasting and don't have an ACL.
* emulator/btdev: Enable LE Privacy featureTedd Ho-Jeong An2021-06-011-0/+1
| | | | This patch enables LE Privacy to support LL Privacy feature.
* btdev: Add resolving list supportLuiz Augusto von Dentz2021-05-171-1/+210
| | | | This adds support for commands related to resolving list.
* btdev: Add support for Add/Remove White ListLuiz Augusto von Dentz2021-05-171-4/+100
| | | | This adds support for Add to/Remove from White List.
* btdev: Fix crashing if ISO link is in fact a BISLuiz Augusto von Dentz2021-05-131-1/+2
| | | | | BIS doesn't not have necessarily needs a link if there is no sync in place.
* btdev: Mark LE Periodic Advertising bit as supportedLuiz Augusto von Dentz2021-05-101-0/+1
| | | | | | | | | | | | | | | | | | | This enables LE Periodic Advertising bit on LE Read Local Supported Features: > HCI Event: Command Complete (0x0e) plen 12 LE Read Local Supported Features (0x08|0x0003) ncmd 1 Status: Success (0x00) Features: 0x00 0x39 0x00 0xf0 0x01 0x00 0x00 0x00 LE 2M PHY LE Coded PHY LE Extended Advertising LE Periodic Advertising Connected Isochronous Stream - Master Connected Isochronous Stream - Slave Isochronous Broadcaster Synchronized Receiver Isochronous Channels (Host Support)
* emulator/btdev: Add missing commandsTedd Ho-Jeong An2021-04-261-0/+37
| | | | | This patch adds missing commands HCI_Read_RSSI and HCI_Read_Transmit_Power_Level commands.
* btdev: Fix invalid BIG Complete eventLuiz Augusto von Dentz2021-04-081-5/+23
| | | | | Fields were not being initialized properly and no connection was created so other commands using the same handle wouldn't work.
* emulator: Add Create BIG command in emulatorKeyur Parekh2021-04-061-3/+30
| | | | | | | This adds support for Create BIG command HCI command in emulator. These changes are needed for making the emulator useful for testing LE Audio broadcast feature.
* btdev: Set CIG ID and CIS ID when generating CIS requestedLuiz Augusto von Dentz2021-03-261-2/+2
| | | | | This is required in order for the host to properly accept/reject the connection.
* btdev: Always set connection handle on CIS establishedLuiz Augusto von Dentz2021-03-261-1/+1
| | | | | This is required in order for the host to be able to distinguished errors if there are multiple CIS connections outstanding.
* emulator: Periodic Advertising CommandKeyur Parekh2021-03-151-6/+44
| | | | | | | This adds support for Periodic Advertising HCI command in the emulator. These changes are the first step in making the emulator useful for testing the LE Audio Broadcast feature
* btdev: Add support for Configure Data PathLuiz Augusto von Dentz2021-03-021-1/+18
| | | | | | | | | > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00) Commands: 169 entries ... Configure Data Path (Octet 45 - Bit 5)
* btdev: Add support Read Local Supported Controller DelayLuiz Augusto von Dentz2021-03-021-1/+20
| | | | | | | | | > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00) Commands: 168 entries ... Read Local Supported Controller Delay (Octet 45 - Bit 4)
* monitor: Add support for decoding Read Local Controller DelayLuiz Augusto von Dentz2021-03-021-1/+1
| | | | | | | | | | | | | | < HCI Command: Read Local Supported Controller Delay (0x04|0x000f) plen 8 Codec: mSBC (0x05) Logical Transport Type: 0x02 Codec supported over BR/EDR SCO and eSCO Direction: Input (Host to Controller) (0x00) Length Codec Configuration: 0 > HCI Event: Command Complete (0x0e) plen 10 Read Local Supported Controller Delay (0x04|0x000f) ncmd 1 Status: Success (0x00) Minimum Controller delay: 0 us (0x000000) Maximum Controller delay: 0 us (0x000000)
* btdev: Add support Read Local Supported Codec CapabilitiesLuiz Augusto von Dentz2021-03-021-1/+19
| | | | | | | | | > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00) Commands: 167 entries ... Read Local Supported Codec Capabilities (Octet 45 - Bit 3)
* btdev: Add support Read Local Supported Codecs V2Luiz Augusto von Dentz2021-03-021-1/+34
| | | | | | | | | > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00) Commands: 167 entries ... Read Local Supported Codecs V2 (Octet 45 - Bit 2)
* btdev: Fix not sending ISO packetsLuiz Augusto von Dentz2021-02-191-14/+20
| | | | | ISO packets were not correctly parsed causing them to not be sent properly.
* emulator: Add option for enabling debug with btvirtLuiz Augusto von Dentz2021-02-191-1/+19
| | | | | This adds -d/--debug options which enables debug of vhci instance on btvirt.
* vhci: Add vhci_set_debugLuiz Augusto von Dentz2021-02-192-0/+14
| | | | This enables debug with btdev_set_debug.
* btdev: Fix auto-disable Extended Adv SetLuiz Augusto von Dentz2021-01-221-2/+4
| | | | | For a Set to be disable there is a dedicated event that terminates the set otherwise it should be considered enabled even when connected.