Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4394675ioa; Wed, 27 Apr 2022 02:55:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiWGPuBx7BkFb4xaiLDCYDhZf70KmZHdJndPklkXgkHP1Z56zjGjO3kwM/tcM5wRbMK8IE X-Received: by 2002:a17:902:f608:b0:158:29e6:c88 with SMTP id n8-20020a170902f60800b0015829e60c88mr27408900plg.174.1651053335862; Wed, 27 Apr 2022 02:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651053335; cv=none; d=google.com; s=arc-20160816; b=zity09W0sxODdJAQPW84dRssu6v1bYsLwoj/TJ+fu/9Of+xLnAlGs5JoV3qjFKb8yY pJrLE0UJvDTerV4vNn6XaxvxCZsTFK98fKVvL78AwH/D2kCNe0HF0MJOaB29R+jrFSnT 0h4fiNiCOtWGysJKY0EQF+Gg8IvWgJbEf423CzWpIPugP7W/jOt0hYueZuN5eCC404Tu TLYpMlPtXt/QrvT5I88ZTxjfZA1RUo2bCvx7OJdbuXE5Mktj6lUfxxtEgx/eBCCQED28 srLXCW18nSgn0pH8do/3d5CShJWjwBRJ187bPgqy5uVF49ua9Kub3B4NvA+4OAPeRGXi 7Agg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mSAUZ+oaGBwM/63LP16uwbTzIdQvEG2+1IRQIpGQ9jw=; b=X2fiMVWwDKH2bfDzGJA9mMUVeXAUg1yv84h/JVZussYQCfnk+4KijpFMTGytf4uWwN DwX/pZ99lJyUWZeAq9K0TchqLlzbPDxgumzQCWrRk55jjS9mCUSc14nN0cETj3uZlTuM OeU8KT2iEPMApO5eZpWpJAMrqbAvUDrX2iZe4/pNSRYwKJy2c21thy9SXBlYuuApbJYq PiQIfHJLx8cqjY/2KZfHl2eJaL8l3kltj1/O//Bbkb+AhOKxOqyHbBmZvQd6XHShmVwc 8iWE6mpjj0K6/0kSIjwTKGelddCiSa5xrq/3LQlvIOmdqi7MvjETAjh3MpaZDDHMqktD Mt9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LnbGJmQj; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a11-20020a17090a70cb00b001d777c96eb5si1252458pjm.155.2022.04.27.02.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 02:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LnbGJmQj; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 359112B97F7; Wed, 27 Apr 2022 02:25:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234676AbiDZXHA (ORCPT + 99 others); Tue, 26 Apr 2022 19:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355985AbiDZXG7 (ORCPT ); Tue, 26 Apr 2022 19:06:59 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABDFE8BF42 for ; Tue, 26 Apr 2022 16:03:50 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id g21so516541iom.13 for ; Tue, 26 Apr 2022 16:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mSAUZ+oaGBwM/63LP16uwbTzIdQvEG2+1IRQIpGQ9jw=; b=LnbGJmQjFxLD5B5afUnE3c93T2PUaFk1ugqjXHBd8LLst2VMgD7Q3q5Ritl9x9TlMc 9ciRZBw5oZ48fxXZceJOePh8ghsC/toIzz/zo/ZTQql9wWnKyry9DDe7GE8DOxMnrGmh ASq24tC10hi4ApojEQn7wymqxmclVttdUh8N6ruImg9JIsewdZhZimWR4k5Ni2OBIS3T VzM2V1+uto2ZLv/xyNbDYC5PvClGQXYg+gPQIDteHsR4hnC0EBiVTNLE6AT5+tvffKrR 1MbGhK/5tqCQJP0wzim68T9kK/rPHwPmackwpUZIyIPRIIDQxDk4bkiH8psyWbBAqYk6 x4Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mSAUZ+oaGBwM/63LP16uwbTzIdQvEG2+1IRQIpGQ9jw=; b=74+rBHbuND+rlA5KngKJ07JuVaQ0GHo9PefD2G0vcJAGpjYTR+25nJS+bTSo07Onem 8p3xqMQWLMIOv5jbYYV3qoktKFy6HQ7INJgxvfazA7hqXoKhttygykaPeauKyimMKBhg bVgOZioUqOxKmdR54kKZ1hRag56dVkU2xtH0QgVESidaYbNBvWn+JPzjrmvXrI/G5021 9VYHPlD3NmjLRjRtCKZ3q1AyPY4+RH7M7YauDk8ZDYhn7xxUK/hIUSYnBeZdkqM6NO3S c5zXSCxV58w9tS4gVzcs9GAULHRxef0Uuemnd5EwKlfcq+V/5rR7hsGAlNj/LKSVtE34 NWlw== X-Gm-Message-State: AOAM531fFKrDR4Dvo4EcGcWznjbG8mY+0LD28BQQn1M6an3oMizDkTm+ omfh+4LELo2JXWwuT1fbDE1mrChbmbo= X-Received: by 2002:a05:6602:398b:b0:657:ab5a:ce2a with SMTP id bw11-20020a056602398b00b00657ab5ace2amr1830772iob.78.1651014229790; Tue, 26 Apr 2022 16:03:49 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id m16-20020a056e020df000b002ccc1d58ca5sm8437194ilj.54.2022.04.26.16.03.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 16:03:49 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/4] btmon: Add support for decoding Broadcast Audio Annoucements Date: Tue, 26 Apr 2022 16:03:45 -0700 Message-Id: <20220426230347.857783-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220426230347.857783-1-luiz.dentz@gmail.com> References: <20220426230347.857783-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds support for decoding Broadcast Audio Announcements as shown on: Basic Audio Profile / Profile Specification Page 34 of 146 Table 3.14: Broadcast Source AD format when transmitting Broadcast Audio Announcements < HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 36 Handle: 0x00 Operation: Complete extended advertising data (0x03) Fragment preference: Minimize fragmentation (0x01) Data length: 0x20 Service Data: Broadcast Audio Announcement (0x1852) Broadcast ID: 904177 (0x0dcbf1) Name (complete): Broadcast Audio Source --- monitor/packet.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/monitor/packet.c b/monitor/packet.c index 471b0dd4d..b376d5a8b 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -3301,11 +3301,44 @@ static void print_uuid128_list(const char *label, const void *data, } } +static void print_broadcast_annoucement(const uint8_t *data, uint8_t data_len) +{ + uint32_t bid; + + if (data_len < 3) { + print_hex_field(" Data", data, data_len); + return; + } + + bid = get_le24(data); + print_field("Broadcast ID: %u (0x%06x)", bid, bid); +} + +static const struct service_data_decoder { + uint16_t uuid; + void (*func)(const uint8_t *data, uint8_t data_len); +} service_data_decoders[] = { + { 0x1852, print_broadcast_annoucement } +}; + static void print_service_data(const uint8_t *data, uint8_t data_len) { uint16_t uuid = get_le16(&data[0]); + size_t i; print_field("Service Data: %s (0x%4.4x)", bt_uuid16_to_str(uuid), uuid); + + for (i = 0; i < ARRAY_SIZE(service_data_decoders); i++) { + const struct service_data_decoder *decoder; + + decoder = &service_data_decoders[i]; + + if (decoder->uuid == uuid) { + decoder->func(&data[2], data_len - 2); + return; + } + } + print_hex_field(" Data", &data[2], data_len - 2); } -- 2.35.1