net/bluetooth/aosp.c
Source file repositories/reference/linux-study-clean/net/bluetooth/aosp.c
File Facts
- System
- Linux kernel
- Corpus path
net/bluetooth/aosp.c- Extension
.c- Size
- 5185 bytes
- Lines
- 211
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/bluetooth/bluetooth.hnet/bluetooth/hci_core.haosp.h
Detected Declarations
struct aosp_rp_le_get_vendor_capastruct aosp_bqr_cpfunction aosp_do_openfunction aosp_do_closefunction enable_quality_reportfunction disable_quality_reportfunction aosp_has_quality_reportfunction aosp_set_quality_report
Annotated Snippet
struct aosp_rp_le_get_vendor_capa {
/* v0.95: 15 octets */
__u8 status;
__u8 max_advt_instances;
__u8 offloaded_resolution_of_private_address;
__le16 total_scan_results_storage;
__u8 max_irk_list_sz;
__u8 filtering_support;
__u8 max_filter;
__u8 activity_energy_info_support;
__le16 version_supported;
__le16 total_num_of_advt_tracked;
__u8 extended_scan_support;
__u8 debug_logging_supported;
/* v0.96: 16 octets */
__u8 le_address_generation_offloading_support;
/* v0.98: 21 octets */
__le32 a2dp_source_offload_capability_mask;
__u8 bluetooth_quality_report_support;
/* v1.00: 25 octets */
__le32 dynamic_audio_buffer_support;
} __packed;
#define VENDOR_CAPA_BASE_SIZE 15
#define VENDOR_CAPA_0_98_SIZE 21
void aosp_do_open(struct hci_dev *hdev)
{
struct sk_buff *skb;
struct aosp_rp_le_get_vendor_capa *rp;
u16 version_supported;
if (!hdev->aosp_capable)
return;
bt_dev_dbg(hdev, "Initialize AOSP extension");
/* LE Get Vendor Capabilities Command */
skb = __hci_cmd_sync(hdev, hci_opcode_pack(0x3f, 0x153), 0, NULL,
HCI_CMD_TIMEOUT);
if (IS_ERR_OR_NULL(skb)) {
if (!skb)
skb = ERR_PTR(-EIO);
bt_dev_err(hdev, "AOSP get vendor capabilities (%ld)",
PTR_ERR(skb));
return;
}
/* A basic length check */
if (skb->len < VENDOR_CAPA_BASE_SIZE)
goto length_error;
rp = (struct aosp_rp_le_get_vendor_capa *)skb->data;
version_supported = le16_to_cpu(rp->version_supported);
/* AOSP displays the version number like v0.98, v1.00, etc. */
bt_dev_info(hdev, "AOSP extensions version v%u.%02u",
version_supported >> 8, version_supported & 0xff);
/* Do not support very old versions. */
if (version_supported < 95) {
bt_dev_warn(hdev, "AOSP capabilities version %u too old",
version_supported);
goto done;
}
if (version_supported < 98) {
bt_dev_warn(hdev, "AOSP quality report is not supported");
goto done;
}
if (skb->len < VENDOR_CAPA_0_98_SIZE)
goto length_error;
/* The bluetooth_quality_report_support is defined at version
* v0.98. Refer to
* https://cs.android.com/android/platform/superproject/+/
* master:system/bt/gd/hci/controller.cc;l=477
*/
if (rp->bluetooth_quality_report_support) {
hdev->aosp_quality_report = true;
bt_dev_info(hdev, "AOSP quality report is supported");
}
goto done;
length_error:
bt_dev_err(hdev, "AOSP capabilities length %d too short", skb->len);
Annotation
- Immediate include surface: `net/bluetooth/bluetooth.h`, `net/bluetooth/hci_core.h`, `aosp.h`.
- Detected declarations: `struct aosp_rp_le_get_vendor_capa`, `struct aosp_bqr_cp`, `function aosp_do_open`, `function aosp_do_close`, `function enable_quality_report`, `function disable_quality_report`, `function aosp_has_quality_report`, `function aosp_set_quality_report`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.