summaryrefslogtreecommitdiff
path: root/emulator
Commit message (Collapse)AuthorAgeFilesLines
* tools/iso-tester: Add Broadcast tests for encrypted BIGIulia Tanasescu2023-04-193-2/+15
| | | | | | | This adds the following tests for encrypted broadcast: ISO Broadcaster Encrypted - Success ISO Broadcaster Receiver Encrypted - Success
* btdev: Fix not setting CIS parameters properlyLuiz Augusto von Dentz2023-04-121-5/+6
| | | | | The code was assuming only index 0 was to be used which doesn't work when there are multiple CIS being programmed with different parameters.
* Split bt_iso_qos into dedicated structuresIulia Tanasescu2023-03-311-14/+17
| | | | | Split bt_iso_qos into dedicated unicast and broadcast structures and add additional broadcast parameters.
* vhci: Add support to trigger devcoredump and read the dump fileManish Mandlik2023-03-302-1/+62
| | | | | | Add vhci support to trigger the hci devcoredump by writing to force_devcoredump debugfs entry and read the generated devcoredump file.
* bthost: Allow sending ISO packets with sequence number and timestampPauli Virtanen2023-02-272-14/+34
| | | | | | | | Change bthost_send_iso to take packet sequence number and timestamp, and allow it to send timestamped HCI ISO data packets. Currently, btdev passes through ISO packets, so this can also be used to test RX timestamping.
* bthost: Add callback to accept ISO connectionsLuiz Augusto von Dentz2022-12-062-5/+21
| | | | | This enables setting an accept callback which can return reject reason if the connection shall not be accepted.
* vhci: Add function to interact with force_static_addressLuiz Augusto von Dentz2022-10-102-0/+11
| | | | | This adds functions that can be used to set debugfs force_static_address.
* btdev: Add support for setting bdaddrLuiz Augusto von Dentz2022-10-102-0/+12
| | | | | This adds btdev_set_bdaddr so it is possible to set an arbritrary address.
* bthost: Add destroy callback to bthost_add_iso_hookLuiz Augusto von Dentz2022-08-222-2/+9
| | | | | This adds a destroy callback to bthost_add_iso_hook so its user can detect when the hook is freed when the connection is disconnected.
* bthost: Add qos support to bthost_set_cig_paramsLuiz Augusto von Dentz2022-08-052-12/+18
| | | | This enables setting QoS other then the mandatory 16_2_1.
* btdev: Fix not checking if a CIG has any active CISLuiz Augusto von Dentz2022-07-111-0/+17
| | | | | | | | | | | Bluetooth Core specification says the CIG must be in configurable state in order to accept the SetCIGParameters: BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2553: 'If the Host issues this command when the CIG is not in the configurable state, the Controller shall return the error code Command Disallowed (0x0C).'
* btdev: Fix not removing connection and advertising set on resetLuiz Augusto von Dentz2022-05-021-36/+40
| | | | | This makes sure that all connections and advertising sets are cleanup on reset.
* btdev: Fix CIS EstablishedLuiz Augusto von Dentz2022-04-141-4/+4
| | | | | CIS Established was using the ISO latency instead of SDU interval for transport latency.
* bthost: Fix not setting all parameters when using Create BIG cmdLuiz Augusto von Dentz2022-04-141-1/+4
| | | | Create BIG shall set proper values for interval, latency, rtn and phy.
* bthost: Add support for Create CISLuiz Augusto von Dentz2022-04-143-1/+49
| | | | This introduces bthost_set_cig_params and bthost_create_cis.
* btdev: Fix not cleanup ssp_status and ssp_auto_completeLuiz Augusto von Dentz2022-04-131-0/+5
| | | | This resets ssp_status and ssp_auto_complete flags on auth_complete.
* btdev: Fix BIG Create SyncLuiz Augusto von Dentz2022-04-061-7/+10
| | | | This fixes status return to BIG Create Sync command.
* btdev: Add support for sending LE BIG Info Adv ReportsLuiz Augusto von Dentz2022-04-061-1/+39
| | | | | This adds support for sending LE BIG Info Adv Reports if LE Create BIG has been called.
* btdev: Check parameter for CIG related commandsLuiz Augusto von Dentz2022-04-011-1/+59
| | | | | This checks if the parameters given to Set CIG Parameters and Remove CIG are in the valid range.
* btdev: Fix response to LE Set Extended Advertising ParametersLuiz Augusto von Dentz2022-03-081-8/+9
| | | | | The response should both the status and TX Power regardless if the command succeeds or not.
* bthost: Add support for Create BIGLuiz Augusto von Dentz2022-03-072-0/+14
| | | | This adds bthost_create_big
* bthost: Add support for Periodic AdvertisingLuiz Augusto von Dentz2022-03-072-0/+25
| | | | This adds bthost_set_pa_params and bthost_set_pa_enable.
* bthost: Add support for BT_H4_ISO_PKTLuiz Augusto von Dentz2022-03-073-42/+326
| | | | This adds sending and receiving BT_H4_ISO_PKT packets.
* btdev: Implements BT_HCI_CMD_LE_BIG_TERM_SYNCLuiz Augusto von Dentz2022-03-071-2/+37
| | | | | This sends BT_HCI_EVT_DISCONNECT_COMPLETE when handling BT_HCI_CMD_LE_BIG_TERM_SYNC.
* btdev: Implements BT_HCI_CMD_LE_BIG_CREATE_SYNCLuiz Augusto von Dentz2022-03-071-9/+149
| | | | | This sends BT_HCI_EVT_LE_BIG_SYNC_ESTABLISHED when handling BT_HCI_CMD_LE_BIG_CREATE_SYNC.
* monitor: Rename Periodic Advertising terms to PA/paLuiz Augusto von Dentz2022-03-071-88/+80
| | | | This renames the use of Periodic Advertising in the API to just PA.
* btdev: Send BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if remote start paLuiz Augusto von Dentz2022-03-071-66/+78
| | | | | | This sends BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if remote device start to periodic advertise when BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC is pending.
* btdev: Send BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED when scan is initiatedLuiz Augusto von Dentz2022-03-071-66/+86
| | | | | This sends BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if scan is initiated while BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC is pending.
* btdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_TERM_SYNCLuiz Augusto von Dentz2022-03-071-2/+15
| | | | This adds implementation of BT_HCI_CMD_LE_PERIODIC_ADV_TERM_SYNC.
* btdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCELLuiz Augusto von Dentz2022-03-071-3/+27
| | | | | | This adds implementation of BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL generating BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if necessary.
* btdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNCLuiz Augusto von Dentz2022-03-071-3/+96
| | | | | | This adds implementation of BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC generating BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED and BT_HCI_EVT_LE_PER_ADV_REPORT.
* monitor: Fix Create BIG PDULuiz Augusto von Dentz2022-03-071-1/+1
| | | | | | The PDU of Create BIG is actually fixed size as the num_bis is related to the number of indexes to be connected and not the BIS parameters.
* build: Fix errors with glibc < 2.25Fabrice Fontaine2022-02-152-4/+2
| | | | | | | | | | | | | | | | | | getrandom and sys/random.h are only available since glibc 2.25: https://www.gnu.org/software/gnulib/manual/html_node/sys_002frandom_002eh.html resulting in the following build failures since version 5.63 and https://git.kernel.org/pub/scm/bluetooth/bluez.git/log/?qt=grep&q=getrandom: plugins/autopair.c:20:24: fatal error: sys/random.h: No such file or directory #include <sys/random.h> ^ To fix this build failure, add util_getrandom and a fallback (borrowed from pipewire and licensed under MIT): https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/utils.c Fixes: - http://autobuild.buildroot.org/results/6b8870d12e0804d6154230a7322c49416c1dc0e2
* bthost: Increase number of creditsLuiz Augusto von Dentz2022-02-091-1/+1
| | | | | This increase the number of credits so bigger packets can be sent by the likes of rfcomm-tester.
* bthost: Fix length calculation for RFCOMM headerLuiz Augusto von Dentz2022-02-091-3/+10
| | | | | This fixes the length calculation for large packets that requires more than 1 byte.
* bthost: Fix not handling ACL fragmentationLuiz Augusto von Dentz2022-02-091-21/+100
| | | | | Large packets requires the support of ACL fragmentation in order to be properly processed.
* btdev: Fix response to BT_HCI_CMD_LE_REMOVE_CIGLuiz Augusto von Dentz2022-01-311-1/+2
| | | | | BT_HCI_CMD_LE_REMOVE_CIG should respond with the CIG ID from the command instead of always responding with 0x00.
* btdev: Fix command status of BT_HCI_CMD_LE_TERM_BIGLuiz Augusto von Dentz2022-01-311-1/+1
| | | | | The status was reporting BT_HCI_CMD_DISCONNECT instead of BT_HCI_CMD_LE_TERM_BIG.
* btdev: Add implementation for BT_HCI_CMD_LE_TERM_BIGLuiz Augusto von Dentz2022-01-271-3/+19
| | | | | | This adds handler for BT_HCI_CMD_LE_TERM_BIG and generate BT_HCI_EVT_LE_BIG_TERMINATE to indicate to the host stack that the BIG has been terminated.
* emulator: Add support for vendor commandsLuiz Augusto von Dentz2022-01-055-8/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for vendor commands reserving a single opcode (0xfc10) so it can be extended using subcommands, similar to how MSFT works. The first subcommand (0x00) enables the emulator to generate arbitrary events using the commands parameters: > tools/hcitool cmd 3f 10 00 22 24 d0 d0 d0 d0 d0 d0 ff ff < HCI Command: Vendor (0x3f|0x0010) plen 11 00 22 24 d0 d0 d0 d0 d0 d0 ff ff ."$........ Bluetooth: hci0: Malformed HCI Event: 0x22 > HCI Event: Inquiry Result with R.. (0x22) plen 9 Num responses: 36 Page scan repetition mode: Reserved (0xff) Page period mode: Reserved (0xff) Class: 0xffffd0 Major class: Uncategorized, specific device code not specified Minor class: 0x34 Limited Discoverable Mode invalid service class Clock offset: 0x6368 RSSI: 105 dBm (0x69) > HCI Event: Command Complete (0x0e) plen 4 Vendor (0x3f|0x0010) ncmd 1 Status: Success (0x00)
* btdev: Add support for BT_HCI_CMD_LE_CREATE_CONN_CANCELLuiz Augusto von Dentz2021-12-101-0/+14
| | | | | This adds support for BT_HCI_CMD_LE_CREATE_CONN_CANCEL so it is able to generate proper command complete.
* emulator: Replace random number generation functionTedd Ho-Jeong An2021-12-082-4/+17
| | | | | | | | This patch replaces the rand() function to the getrandom() syscall. It was reported by the Coverity scan rand() should not be used for security-related applications, because linear congruential algorithms are too easy to break
* emulator: fix potential resource leakTedd Ho-Jeong An2021-11-221-1/+3
| | | | | This patch releases the allocated fd to prevent the potential resource leak. This was reported by the Coverity scan.
* emulator: Fix uninitiailzed scalar variableTedd Ho-Jeong An2021-11-151-0/+3
| | | | | This patch fixes the uninitiailzed varialble(CWE-457) reported by the Coverity scan.
* btdev: Add support for LE Set Privacy modeLuiz Augusto von Dentz2021-11-091-1/+46
| | | | | | | | | | | | This adds support for LE Set Privacy mode which is required when using Device Privacy mode: < HCI Command: LE Set Priva.. (0x08|0x004e) plen 8 Peer Identity address type: Public (0x00) Peer Identity address: BC:9A:78:56:34:12 (OUI BC-9A-78) Privacy Mode: Use Device Privacy (0x01) > HCI Event: Command Complete (0x0e) plen 4 LE Set Privacy Mode (0x08|0x004e) ncmd 1
* emulator: Add support to get the advertising addressTedd Ho-Jeong An2021-10-254-2/+41
| | | | | This patch add supprt emulator to get the advertising address of the central device.
* emulator: bthost: Add support LE Ext Adv ReportTedd Ho-Jeong An2021-10-252-0/+123
| | | | This patch adds support LE_Extended_Advertising_Report Eevnt in bthost.
* emulator: Add support to config the accept and resolve listTedd Ho-Jeong An2021-10-254-8/+65
| | | | | This patch adds interfaces to config the accept list and resolve list in the btdev.
* btdev: Fix using the callback return as command completeLuiz Augusto von Dentz2021-10-251-36/+84
| | | | | Command callback can only be used when generating a command status as command complete can carry more than just the status.
* btdev: Set Local RPA when own_addr_type is 0x03Luiz Augusto von Dentz2021-10-211-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This enables the emulator to properly emulate the generation of a Local RPA so it always set the random_addr when Create Connection sets 0x03 as own_addr_type 0x03: < HCI Command: LE Extended.. (0x08|0x0043) plen 26 Filter policy: Accept list is not used (0x00) Own address type: Random (0x03) Peer address type: Public (0x00) Peer address: 00:AA:01:01:00:00 (Intel Corporation) Initiating PHYs: 0x01 Entry 0: LE 1M Scan interval: 60.000 msec (0x0060) Scan window: 60.000 msec (0x0060) Min connection interval: 30.00 msec (0x0018) Max connection interval: 50.00 msec (0x0028) Connection latency: 0 (0x0000) Supervision timeout: 420 msec (0x002a) Min connection length: 0.000 msec (0x0000) Max connection length: 0.000 msec (0x0000) > HCI Event: Command Status (0x0f) plen 4 LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 31 LE Enhanced Connection Complete (0x0a) Status: Success (0x00) Handle: 42 Role: Central (0x00) Peer address type: Public (0x00) Peer address: 00:AA:01:01:00:00 (Intel Corporation) Local resolvable private address: 60:0C:C5:B9:10:5D (Resolvable) Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable) Connection interval: 50.00 msec (0x0028) Connection latency: 0 (0x0000) Supervision timeout: 420 msec (0x002a) Central clock accuracy: 0x00