summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* lib/uuid: Add BASS UUIDsIulia Tanasescu2023-05-051-0/+5
| | | | This adds BASS UUIDs which will be used by Basic Audio Profile.
* Split bt_iso_qos into dedicated structuresIulia Tanasescu2023-03-311-13/+33
| | | | | Split bt_iso_qos into dedicated unicast and broadcast structures and add additional broadcast parameters.
* l2test: Fix setting mode for BR/EDR l2cap socketSimon Mikuda2023-03-281-0/+2
| | | | | BT_MODE_* enums are used only for socket SOL_BLUETOOTH, option BT_MODE Otherwise we should use L2CAP_MODE_* enums.
* mgmt: Use BIT macro when defining bitfieldsLuiz Augusto von Dentz2023-02-131-56/+61
| | | | | This makes use of BIT macro when defining bitfields which makes it clearer what bit it is toggling.
* lib: Add defines for MGMT setting bits for CIS feature supportPauli Virtanen2023-02-131-0/+2
|
* lib/uuid: Add CSIS UUIDsSathish Narasimman2022-12-201-0/+7
| | | | | This adds Coordinated Set Identification Service UUIDs which will be used by Coordinated Set Identification Profile.
* lib/uuid: Add GMCS UUIDsAbhay Maheta2022-10-181-0/+15
| | | | This adds GMCS UUIDs which will be used by Media Control Profile.
* lib: Add defines of new MGMT opcodes and eventsBrian Gix2022-09-221-0/+6
| | | | | Populated new opcodes and events into static mgmt_ev and mgmt_op string arrays.
* lib/uuid: Add VCS UUIDsSathish Narasimman2022-09-151-0/+7
| | | | | This adds Volume Control Service UUIDs which will be used by Volume Control Profile.
* lib: Add mgmt opcodes and events for MeshBrian Gix2022-09-011-0/+47
|
* lib/uuid: Add PACS/ASCS UUIDsLuiz Augusto von Dentz2022-08-291-0/+18
| | | | This adds PACS/ASCS UUIDs which will be used by Basic Audio Profile.
* lib: Add definitions for ISO socketLuiz Augusto von Dentz2022-07-222-1/+79
|
* advertising: Fix attempting to set scan_rspLuiz Augusto von Dentz2022-06-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2450 • If extended advertising PDU types are being used (bit 4 = 0) then: The advertisement shall not be both connectable and scannable. So instead this attempts to set name as part of Advertising Data rather then setting it as Scan Response: bluetoothctl> advertise.secondary 2M bluetoothctl> advertise.name Intel-3 bluetoothctl> advertise on < HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25 Handle: 0x01 Properties: 0x0001 Connectable Min advertising interval: 1280.000 msec (0x0800) Max advertising interval: 1280.000 msec (0x0800) Channel map: 37, 38, 39 (0x07) Own address type: Public (0x00) Peer address type: Public (0x00) Peer address: 00:00:00:00:00:00 (OUI 00-00-00) Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00) TX power: Host has no preference (0x7f) Primary PHY: LE 1M (0x01) Secondary max skip: 0x00 Secondary PHY: LE 2M (0x02) SID: 0x00 Scan request notifications: Disabled (0x00) > HCI Event: Command Complete (0x0e) plen 5 LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 1 Status: Success (0x00) TX power (selected): 7 dbm (0x07) < HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 4 Handle: 0x01 Operation: Complete extended advertising data (0x03) Fragment preference: Minimize fragmentation (0x01) Data length: 0x00 @ MGMT Event: Command Complete (0x0001) plen 7 Add Extended Advertising Parameters (0x0054) plen 4 Status: Success (0x00) Instance: 1 TX power: 7 dbm (0x07) Available adv data len: 31 Available scan rsp data len: 31 > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Advertising Data (0x08|0x0037) ncmd 1 Status: Success (0x00) @ MGMT Command: Add Extended Advertising Data (0x0055) plen 23 Instance: 1 Advertising data length: 12 Name (complete): Intel-3 Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported Scan response length: 0 < HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 16 Handle: 0x01 Operation: Complete extended advertising data (0x03) Fragment preference: Minimize fragmentation (0x01) Data length: 0x0c Name (complete): Intel-3 Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Advertising Data (0x08|0x0037) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Extended Scan Response Data (0x08|0x0038) plen 4 Handle: 0x01 Operation: Complete scan response data (0x03) Fragment preference: Minimize fragmentation (0x01) Data length: 0x00 > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Scan Response Data (0x08|0x0038) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 6 Extended advertising: Enabled (0x01) Number of sets: 1 (0x01) Entry 0 Handle: 0x01 Duration: 0 ms (0x00) Max ext adv events: 0 > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2 Status: Success (0x00) @ MGMT Event: Command Complete (0x0001) plen 4 Add Extended Advertising Data (0x0055) plen 1 Status: Success (0x00) Instance: 1
* monitor/att: Add decoding support for ASE Sink/SourceLuiz Augusto von Dentz2022-05-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds decoding support for ASE Sink/Source attributes: > ACL Data RX: Handle 42 flags 0x02 dlen 9 Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0} ATT: Read Request (0x0a) len 2 Handle: 0x002a Type: Sink ASE (0x2bc4) < ACL Data TX: Handle 42 flags 0x00 dlen 9 Channel: 64 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0} ATT: Read Response (0x0b) len 2 Value: 0300 ASE ID: 1 State: Idle (0x00) < ACL Data TX: Handle 42 flags 0x00 dlen 55 Channel: 64 len 51 sdu 49 [PSM 39 mode Enhanced Credit (0x81)] {chan 0} ATT: Handle Multiple Value Notification (0x23) len 48 Length: 0x0023 Handle: 0x0024 Type: Sink ASE (0x2bc4) Data: 01010000000a00204e00409c00204e00409c0006000000000a02010302020103042800 ASE ID: 1 State: Codec Configured (0x01) Framing: Unframed PDUs supported (0x00) PHY: 0x00 RTN: 0 Max Transport Latency: 10 Presentation Delay Min: 20000 us Presentation Delay Max: 40000 us Preferred Presentation Delay Min: 20000 us Preferred Presentation Delay Max: 40000 us Codec: LC3 (0x06) Codec Specific Configuration #0: len 0x02 type 0x01 Codec Specific Configuration: 03 Codec Specific Configuration #1: len 0x02 type 0x02 Codec Specific Configuration: 01 Codec Specific Configuration #2: len 0x03 type 0x04 Codec Specific Configuration: 2800 < ACL Data TX: Handle 42 flags 0x00 dlen 37 Channel: 64 len 33 sdu 31 [PSM 39 mode Enhanced Credit (0x81)] {chan 0} ATT: Handle Multiple Value Notification (0x23) len 30 Length: 0x0011 Handle: 0x0024 Type: Sink ASE (0x2bc4) Data: 0102000010270000022800020a00409c00 ASE ID: 1 State: QoS Configured (0x02) CIG ID: 0x00 CIS ID: 0x00 SDU Interval: 10000 usec Framing: Unframed (0x00) PHY: 0x02 LE 2M PHY (0x02) Max SDU: 40 RTN: 2 Max Transport Latency: 10 Presentation Delay: 40000 us < ACL Data TX: Handle 42 flags 0x00 dlen 33 Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0} ATT: Handle Multiple Value Notification (0x23) len 26 Length: 0x000d Handle: 0x002a Type: Source ASE (0x2bc5) Data: 03030000060304030202000000 ASE ID: 3 State: Enabling (0x03) CIG ID: 0x00 CIS ID: 0x00 Metadata #0: len 0x03 type 0x04 Metadata: 0302 Metadata #1: len 0x02 type 0x00 < ACL Data TX: Handle 42 flags 0x00 dlen 39 Channel: 64 len 35 sdu 33 [PSM 39 mode Enhanced Credit (0x81)] {chan 0} ATT: Handle Multiple Value Notification (0x23) len 32 Length: 0x000d Handle: 0x002a Type: Source ASE (0x2bc5) Data: 03040000060304030202000000 ASE ID: 3 State: Streaming (0x04) CIG ID: 0x00 CIS ID: 0x00 Metadata #0: len 0x03 type 0x04 Metadata: 0302 Metadata #1: len 0x02 type 0x00 < ACL Data TX: Handle 42 flags 0x00 dlen 33 Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0} ATT: Handle Multiple Value Notification (0x23) len 26 Length: 0x000d Handle: 0x002a Type: Source ASE (0x2bc5) Data: 03050000060304030202000000 ASE ID: 3 State: Disabling (0x05) CIG ID: 0x00 CIS ID: 0x00 Metadata #0: len 0x03 type 0x04 Metadata: 0302 Metadata #1: len 0x02 type 0x00
* lib: fix hci_strtolm crashYun-Hao Chung2022-02-151-1/+1
| | | | | | | |str| can be NULL in the case of reading lm value. Calling strcasestr could lead to a crash. Reviewed-by: Archie Pusaka <apusaka@chromium.org>
* uuid: Fix crashing if a NULL string is passed to bt_string_to_uuidLuiz Augusto von Dentz2022-02-091-0/+3
| | | | | bt_string_to_uuid shall chack if the string is valid before attempting to access its contents.
* mgmt: Add NAME_REQUEST_FAILED flag for device_found eventArchie Pusaka2021-11-291-3/+4
| | | | | | | | Report failure when resolving remote name to userspace. This is useful so the userspace can make an informed decision when to retry name resolving procedure. Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
* lib: Add definitions of the Adv Monitor Device Found/Lost eventsManish Mandlik2021-11-221-0/+18
| | | | | | | | This patch adds definitions of the new Advertisement Monitor Device Found and Device Lost events to indicate that the controller has started/stopped tracking a particular device. Reviewed-by: Miao-chen Chou <mcchou@google.com>
* adapter: Set Device Privacy ModeLuiz Augusto von Dentz2021-11-091-1/+2
| | | | | This adds support for setting Device Privacy flag when enabled in main.conf via Privacy = device,limited-device.
* lib: Fix HCI_MAX_ACL_SIZELuiz Augusto von Dentz2021-09-221-2/+3
| | | | | | | HCI_MAX_ACL_SIZE actually includes the maximum frames in AMP controller so this changes it to properly define the max ACL frames on non-AMP controllers and introduces a dedicated define for AMP controller as HCI_MAX_AMP_SIZE.
* lib: Inclusive language changesArchie Pusaka2021-09-212-13/+21
| | | | | | | | 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>
* lib: Fix variable-length array declarations in hci structuresPeter A. Bigot2021-09-171-8/+8
| | | | | | | | Use of zero as the size for arrays as the last element of a structure is a GNU C extension, which as of GCC 10 produces diagnostics when values in the extended array are referenced. Switch to the C99 standard idiom for flexible array members, already in use in a few other headers.
* tools/sco-tester: add test cases to get offload codecsKiran K2021-09-071-0/+18
| | | | Add a test case to query offload codecs supported over sco
* gatt: Add support for Central Address Resolution characteristicLuiz Augusto von Dentz2021-07-281-0/+1
| | | | | This adds Central Address Resolution characteristic so peripherals can use directed advertising using RPA as initiator address.
* lib: Align mgmt header with documentTedd Ho-Jeong An2021-05-261-1/+6
| | | | | This patch updates the mgmt header to align with the mgmt api document (doc/mgmt-api.txt)
* mgmt: Add missing opcodes to mgmt_opLuiz Augusto von Dentz2021-05-241-0/+3
| | | | This adds the missing opcodes to mgmt_op so they are properly decoded.
* lib/uuid: Fix string to uuid32 conversionArchie Pusaka2021-05-241-1/+1
| | | | | | Use strtoul to prevent 32 bit overflow Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
* advertising: Create and use scannable adv param flagDaniel Winkler2021-03-221-0/+1
| | | | | | | | | | | | | | | In order for the advertising parameters hci request to indicate that an advertising set uses a scannable PDU, we pass a scannable flag along with the initial parameters MGMT request. This flag is populated based on the existence of any scan response data requested by the client. Without this patch, a broadcast advertisement with a scan response will either be rejected by the controller, or will ignore the requested scan response. The patch is tested by performing the above and confirming that the scan response is retrievable from a peer as expected. Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
* advertising: Add SupportedFeatures to LEAdvertisingManager1Daniel Winkler2021-03-171-0/+2
| | | | | | | | | | | | | | The new SupportedFeatures member tells advertising clients whether the platform has hardware support for advertising or capability to set tx power of advertisements. Additionally, fix small typo in "secondary_exists" function name. Change is tested on hatch and kukui chromebooks by using dbus-send to verify that SupportedFeatures always exists, and is only populated when extended advertising is available. Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
* lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcodeArchie Pusaka2021-01-151-0/+15
| | | | The new op is to utilize RSSI in advertisement monitor
* btdev: Add support for multiple connectionsLuiz Augusto von Dentz2020-12-171-0/+1
| | | | | This adds support for assigning different handles for connection instead of always using fixed handles.
* lib: Fix the unchecked return valueTedd Ho-Jeong An2020-11-242-3/+6
| | | | This patch fixes the unchecked return value.
* advertising: Query LE TX range at manager initializationDaniel Winkler2020-10-291-4/+10
| | | | | | | | | | | This patch calls the new MGMT command to get controller capabilities, and parses the min and max LE tx power range when the manager is initialized. This will be used to populate a client-facing dbus entry so that the client will know the advertising capabilities of the controller before registering an advertisement. This patch is tested by manually verifying the data is parsed correctly from the MGMT response.
* advertising: Use new mgmt interface for advertising addDaniel Winkler2020-10-291-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows bluetoothd to use the new extended advertising add mgmt interface if it is available. The new interface will be used by default, as it allows the client to set advertising intervals, and tx power if the controller and kernel support extended advertising. Each new registered advertisement will submit two requests to kernel; the first sets the advertising parameters for the advertising instance, and the second sets the advertising data and scan response for the instance. The parameters MGMT request will return the tx power selected by the controller (if applicable), which is propagated to the client via a dbus Set method. Note: This patch also fixes a small bug in the packet monitor, where the tx power value 0xff is considered as "Host has no preference". However, the spec states this value to be 0x7f. It is corrected in this patch This change has been tested extensively on Hatch (extended advertising) and Kukui (no extended advertising) chromebooks. Manual tests do the following: - Configure advertisement with custom intervals, tx power with valid and invalid values and combinations - Ensure that with valid parameters, they are propagated and set in hci requests. With invalid parameters, ensure that the registration fails. Automatic tests verify 25 advertising usage scenarios involving single and multi-advertising registration, over-registration, parameter validation, etc. These tests don't test new intervals and tx power, but validate that the new MGMT interface does not regress compatibility in these 25 scenarios.
* advertising: Detect if extended advertising mgmt commands are supportedDaniel Winkler2020-10-291-0/+4
| | | | | | | | | | We need to know if kernel supports the new MGMT interface. To do so, we check the return from adapter's MGMT_OP_READ_COMMANDS call for the new commands. This will later be used to route our requests for new advertisements. The change is tested by manually verifying that the correct MGMT commands are used when the feature is and is not available in kernel.
* lib: Fix using spaces to align BT_PKT_STATUSLuiz Augusto von Dentz2020-10-221-1/+1
|
* lib: Add BT_PKT_STATUSLuiz Augusto von Dentz2020-10-191-0/+4
| | | | | BT_PKT_STATUS has been introduced to the kernel but userspace has not been updated to reflect that.
* lib: Replace malloc/memset(..0..) with bt_malloc0Aravind Machiry2020-10-073-24/+18
| | | | | This patch replaces various instances of malloc and subsequent memset(..,0,..) with bt_malloc0 (i.e., calloc) for efficiency.
* lib/sdp.c: Validate attribute search return valueAravind Machiry2020-10-071-0/+16
| | | | | | The calls to gen_[searchseq|attridseq]_seq functions return negative value on failure. The return value should be checked to gracefully exit with a proper exit code.
* lib: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-2119-261/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- GPL-2.0-or-later : 18 GPL-2.0-only : 1 License: GPL-2.0-or-later lib/sco.h lib/sdp.c lib/a2mp.h lib/uuid.h lib/bluetooth.h lib/hidp.h lib/rfcomm.h lib/hci.c lib/sdp.h lib/sdp_lib.h lib/bluetooth.c lib/mgmt.h lib/hci.h lib/uuid.c lib/l2cap.h lib/bnep.h lib/hci_lib.h lib/cmtp.h License: GPL-2.0-only lib/amp.h
* lib: Update company identifiersMarcel Holtmann2020-09-051-0/+292
|
* mgmt: Add controller suspend and resume eventsAbhishek Pandit-Subedi2020-08-311-0/+14
| | | | Add the controller suspend and resume events.
* device: Support marking a device with wake allowedAbhishek Pandit-Subedi2020-07-071-0/+2
| | | | | | | | | | | | | | | | If a device is allowed to wake the host system from suspend, it should be marked as wake allowed. We add support for a new property that is sent to the kernel via set device flags mgmt op. We also add the dbus endpoint to allow the wake allowed setting to be controlled. In order for wake allowed to be set, the profile must also support wake. This setting isn't exposed to the user but must be set by profiles that intend to support wake from suspend. If a device is connecting for the first time, it will be marked WakeAllowed if the profile supports it. On subsequent reloads of bluez, the stored setting "WakeAllowed" will be used to override any other setting.
* mgmt: Add mgmt op and events for device flagsAbhishek Pandit-Subedi2020-07-071-0/+31
| | | | Add Get Device Flags, Set Device Flags and Device Flags Changed.
* lib: Correct the string for a mgmt opMiao-chen Chou2020-06-171-1/+1
| | | | | This corrects the string of MGMT_OP_ADD_ADV_PATTERNS_MONITOR to match mgmt-api.txt.
* lib: Correct the name command definitionMiao-chen Chou2020-06-161-1/+1
| | | | | | This renames MGMT_OP_ADD_ADV_MONITOR to MGMT_OP_ADD_ADV_PATTERNS_MONITOR as this command is only used for patterns.
* lib: Move HOG UUID definitionManish Mandlik2020-06-161-0/+1
| | | | | HOG UUID is defined at multiple places in the code. Move that definition to lib/uuid.h where all other UUIDs are defined.
* mgmt: syncing configuration commands to the documentation.Alain Michaud2020-06-121-11/+19
| | | | | This patch simply fixes the definition names (and corresponding implemenation) to the adopted documentation.
* lib: Add definitions for advertisement monitor featuresMiao-chen Chou2020-06-111-0/+51
| | | | | | | | | | This adds the following command opcodes, event codes and the corresponding structures. - MGMT_OP_READ_ADV_MONITOR_FEATURES - MGMT_OP_ADD_ADV_PATTERNS_MONITOR - MGMT_OP_REMOVE_ADV_MONITOR - MGMT_EV_ADV_MONITOR_ADDED - MGMT_EV_ADV_MONITOR_REMOVED
* mgmt: Add load default system configuration definitionsAlain Michaud2020-06-041-0/+20
| | | | This change adds the load default system configuration definitions