From patchwork Mon May 18 22:29:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11556495 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E6C3138A for ; Mon, 18 May 2020 22:29:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56C0F2083E for ; Mon, 18 May 2020 22:29:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gIfE3swS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728566AbgERW3L (ORCPT ); Mon, 18 May 2020 18:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbgERW3L (ORCPT ); Mon, 18 May 2020 18:29:11 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58473C061A0C for ; Mon, 18 May 2020 15:29:11 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id f4so5477584pgi.10 for ; Mon, 18 May 2020 15:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=H/drnTK7oqzlA6HKd0xsBjyJ4zbDkXGVCB4bLg2dxp8=; b=gIfE3swSar8R7ZYDrxsEzUITRoLiTvGaSmjxvlL6H3I/7Lg+1503PuBZHCTaX/AQ06 r4MJrv4TUqjurzM06IwbgNVvnzSTesWuCP3pPN8OWfK4/eQdT5unPKbxD6eXx4blExX1 BQwigWIHWW2pGE0l5ZmAYQ+B65k0cwcoL04DGpg2t2eTlmwcFf9iGDYqrOzcl+lnKAjW QsxWDPqMdtH60J4aJRZPU8gCDNZjMVcue44adUir1Cj4EUsbebM0dPw78BK/TVYDn0Z5 CNiwC72Bb4otrsI7rEMfWs+YuZSPnq3T8H+Mq1r/+zIyrpI/aVLLb09nJ/LDOanEgMKX 5Tjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=H/drnTK7oqzlA6HKd0xsBjyJ4zbDkXGVCB4bLg2dxp8=; b=C3CQvMRrp7UiS6r9S+L2CORXeS2WCA/9SPbmoy6P35teZK108u4Csd8CbqAky9+WUN cgerWcuVaxtppkp+l6U/FFhaz7/Y4R7Ixa47p4iB1MvZjIIaN3gRPAGrUmOmQSmC7R/p aKhVKPzT0TVEb880Ds+qwowp3E4XpPNkDc5NuBR+x5jJB0erXiSxI+5T6GymtYHL1VhS FN6hzGs/iSgyo91XydXfjqPa7Xez3QTcviKNz+JLL9X+Ub6M71Va9RDNOhMzybG+p2qz Hobfzw3qJlhDyPzr2BfJGzCmySouB4l+50jX6Y8qq4j7p9hHsku9OUcNeZ2be0cx3L/R UUjw== X-Gm-Message-State: AOAM533eWBekV+vw4kOrDmk96NMzV4DnQGgSsKQMiogdUN1vaWqrpz4X IfyAv4ML7Nogtq+T326jsIhT8QXN X-Google-Smtp-Source: ABdhPJyXsDipd7QbfEJ4bxxFwBKx0YM3C/20sCWlYf72LUXjfCBzJzvbY05r1ICkBnGNyJK8PNigLw== X-Received: by 2002:a62:1e84:: with SMTP id e126mr2439643pfe.67.1589840950337; Mon, 18 May 2020 15:29:10 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 5sm8291733pgl.4.2020.05.18.15.29.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 15:29:09 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 1/4] a2dp: Fix caching endpoints for unknown version Date: Mon, 18 May 2020 15:29:04 -0700 Message-Id: <20200518222908.146911-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Don't cache the capabilities of endpoints which the version is unknown since so capabilities may not be available in such case. --- profiles/audio/a2dp.c | 11 +++++++++-- profiles/audio/avdtp.c | 7 ++++++- profiles/audio/avdtp.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index a2ce3204d..15e211b95 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -2667,15 +2667,22 @@ static void discover_cb(struct avdtp *session, GSList *seps, struct avdtp_error *err, void *user_data) { struct a2dp_setup *setup = user_data; + uint16_t version = avdtp_get_version(session); - DBG("err %p", err); + DBG("version 0x%04x err %p", version, err); setup->seps = seps; setup->err = err; if (!err) { g_slist_foreach(seps, register_remote_sep, setup->chan); - store_remote_seps(setup->chan); + + /* Only store version has been initialized as features like + * Delay Reporting may not be queried if the version in + * unknown. + */ + if (version) + store_remote_seps(setup->chan); } finalize_discover(setup); diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index b632e41c5..1fd2be051 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -2256,7 +2256,7 @@ static uint16_t get_version(struct avdtp *session) const sdp_record_t *rec; sdp_list_t *protos; sdp_data_t *proto_desc; - uint16_t ver = 0x0100; + uint16_t ver = 0x0000; rec = btd_device_get_record(session->device, A2DP_SINK_UUID); if (!rec) @@ -2396,6 +2396,11 @@ struct avdtp *avdtp_new(GIOChannel *chan, struct btd_device *device, return session; } +uint16_t avdtp_get_version(struct avdtp *session) +{ + return session->version; +} + static GIOChannel *l2cap_connect(struct avdtp *session) { GError *err = NULL; diff --git a/profiles/audio/avdtp.h b/profiles/audio/avdtp.h index ad2cb9bcb..f1e51d4e3 100644 --- a/profiles/audio/avdtp.h +++ b/profiles/audio/avdtp.h @@ -310,3 +310,4 @@ struct avdtp_server *avdtp_get_server(struct avdtp_local_sep *lsep); struct avdtp *avdtp_new(GIOChannel *chan, struct btd_device *device, struct queue *lseps); +uint16_t avdtp_get_version(struct avdtp *session); From patchwork Mon May 18 22:29:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11556499 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D37F138A for ; Mon, 18 May 2020 22:29:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B9B120829 for ; Mon, 18 May 2020 22:29:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cxQMM18w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728568AbgERW3N (ORCPT ); Mon, 18 May 2020 18:29:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbgERW3N (ORCPT ); Mon, 18 May 2020 18:29:13 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9733AC061A0C for ; Mon, 18 May 2020 15:29:13 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id 5so491987pjd.0 for ; Mon, 18 May 2020 15:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zy3uJZB5XsJzztjORyRIanJypmSXB+lz2legdKKnj/A=; b=cxQMM18waIIS9+gLnDqVR1XJ386RIdQGTngJAj6cV4oQurY86O3iN1Ryk2LCZ/OCfN Xty+BN/EXtDjyJgoui3QfRBO3zygI0cb+CWCgHrfGsA+BMevPwgE3/qKOC7qDc+W0QY0 d2B5a58HTSg9o2RkLDque7eahdCJvbKLErSNwCWnDinbHodU23dNHMop+PBCvatnTK7T 6+z+PU9SKte2E24F4CMEATRsSxvN6AG9U6PGEgJQx1yQoLZHqlg/42wkdtnRP71OohxQ MUhO9nN2JPs2D9gD0mvwzEMLlhaAAoiVcVgYnbgNW4cuvZNcXW9I18T179qz1QXGtPAe wczw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zy3uJZB5XsJzztjORyRIanJypmSXB+lz2legdKKnj/A=; b=gZzkoaMB0PBhqHQ9h4vJ9CtaOqV3SINbpArrWjgeB4vpFB6ZzeoFyDKxoRJlvMmuj7 /5euX8axTJYqThSzRv6OIMVXjGGjTrwDwfWRSZUceBD3nllMbUooUp16ZA1UKiU3t9cU 5qJfJmbkIMfcNOzLI9ohNgwMLUsK6Zm3tdjwQurd6qizkKV+M5gDCkWUd2eafrO2P+OJ PUkNapywt2WPPIkwoNGLkL0ubK/RACPMcHPRVRCry7ryhCtUtZb+ghDxE+DsaOkj7IuC 0aa5xd6UbyI9vuFdzNOCyTAN3QXrHRNCgviyTRdkDiw5EA++3HL/Qpuubsh74loJL8g2 J6Vw== X-Gm-Message-State: AOAM530g8UV17CuijtqFBSZm1uXGL8bWLCdbf81thmU5+w0Ul+kxLhTW I8dNgpeyGK4/iDoUA7V2xkFqoSU4 X-Google-Smtp-Source: ABdhPJwE2FtBVlP+a/kgeFq4VvMvmUdt0osJX7vBCOdED/P2y4pO6UDtWBxQ7gB3hsrmLxeDqIReMA== X-Received: by 2002:a17:90a:8509:: with SMTP id l9mr1625022pjn.113.1589840952813; Mon, 18 May 2020 15:29:12 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 5sm8291733pgl.4.2020.05.18.15.29.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 15:29:11 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 2/4] doc/media-api: Add documentation for DelayReporting Date: Mon, 18 May 2020 15:29:06 -0700 Message-Id: <20200518222908.146911-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200518222908.146911-1-luiz.dentz@gmail.com> References: <20200518222908.146911-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz The code was expecting the endpoint to expose MediaEndpoint.DelayReporting property in order to expose MediaTransport.Delay property. --- doc/media-api.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/media-api.txt b/doc/media-api.txt index 07f7ac3e0..dabc69936 100644 --- a/doc/media-api.txt +++ b/doc/media-api.txt @@ -580,6 +580,10 @@ Properties string UUID [readonly, optional]: Device object which the endpoint is belongs to. + bool DelayReporting [readonly, optional]: + + Indicates if endpoint supports Delay Reporting. + MediaTransport1 hierarchy ========================= From patchwork Mon May 18 22:29:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11556501 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4EF4913 for ; Mon, 18 May 2020 22:29:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C87CC2083E for ; Mon, 18 May 2020 22:29:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WcYQCy5D" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728583AbgERW3P (ORCPT ); Mon, 18 May 2020 18:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728579AbgERW3P (ORCPT ); Mon, 18 May 2020 18:29:15 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06FD3C061A0C for ; Mon, 18 May 2020 15:29:15 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id t40so483371pjb.3 for ; Mon, 18 May 2020 15:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZHnBHvh8bV1rZEkWFURX7iMYqMESD+h0Fuxywjn0HO8=; b=WcYQCy5DamMFz6QALCuftS46JCD95wHEGIam5YSPQGsp+do7X7KjJdUdJmLqXoGY9R TRSUZ3zLAEk8YczKVeLDDlo3Z2YR+Ul4yCFju9sU11Y4t1q34ExUAA47TDVWsRpxMmug EbuQBCTpPPF5OupUOP/IAz7yOSr305WLUxgxSqhMKsv3/iyLnlZTFPUtGNDmJjYZLvQP 1ArJdzujVJu1agixj92K3Q9tyDC0Q850po/PL5TX41+h9fL61Gk13dBOEx8rEcjLV/3+ c1Ra8EobhQ4bEUZkfjtVFS5hAKrByu8PbYzkmoFtUBiL7WxjW4w58+wY3FOywg/nlMn/ j5bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZHnBHvh8bV1rZEkWFURX7iMYqMESD+h0Fuxywjn0HO8=; b=JLJNuXCDr66uUMR05N6mhzNhQxyL0MgeMx3nbgUqLf3/Ky6KTxgip0sKAMhuOmdbjW IAGZk6Kw72AmRhEM48xnGh9JTkdfsvOTS+OPzlKxiMHK6+ShmAAzwDyUk6PZx9mQmbGR euFv3MwYFI5zD43E2Y+YjdJ6gzqVJ+4C5TTKZ2rtdD7fQHTJ3urBGghX3JlYVwDDSX9G MN9si1qN7m7SNOCz1xqfXyKjjZ4EpkMm6M4GPPEn+MinIfBOsJcHc8uRxpTUmHX+YmqR oYFdHE9jLJxOenL4OqigbvbWrzujHKRXP/YfgEcuv2FF8L2sK7CPUROfiLiD2EiPr5ay jNZw== X-Gm-Message-State: AOAM5314lDL3P89vzC22s7b19VFKZRtqn7G6S7esUJQ44cW8+yreyYOx q3phBOkrGMgMlHW84WcGYRL6lvD7 X-Google-Smtp-Source: ABdhPJyiRwCMZCmxdrf6dJ8mTmxDVQNOb4uM0r/Ip2uJjfrr91vDnOGtQFq4EHUmc5YHexV8VMNRng== X-Received: by 2002:a17:90a:150:: with SMTP id z16mr1763163pje.37.1589840953885; Mon, 18 May 2020 15:29:13 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 5sm8291733pgl.4.2020.05.18.15.29.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 15:29:13 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 3/4] a2dp: Store Delay Reporting capability Date: Mon, 18 May 2020 15:29:07 -0700 Message-Id: <20200518222908.146911-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200518222908.146911-1-luiz.dentz@gmail.com> References: <20200518222908.146911-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This stores Delay Reporting capability so it is properly restored when loading from cache. --- profiles/audio/a2dp.c | 57 +++++++++++++++++++++++++++++++++--------- profiles/audio/avdtp.c | 13 ++++++++-- profiles/audio/avdtp.h | 5 +++- 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index 15e211b95..e47187e5e 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -1847,11 +1847,25 @@ static gboolean get_device(const GDBusPropertyTable *property, return TRUE; } +static gboolean get_delay_reporting(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct a2dp_remote_sep *sep = data; + dbus_bool_t delay_report; + + delay_report = avdtp_get_delay_reporting(sep->sep); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &delay_report); + + return TRUE; +} + static const GDBusPropertyTable sep_properties[] = { { "UUID", "s", get_uuid, NULL, NULL }, { "Codec", "y", get_codec, NULL, NULL }, { "Capabilities", "ay", get_capabilities, NULL, NULL }, { "Device", "o", get_device, NULL, NULL }, + { "DelayReporting", "b", get_delay_reporting, NULL, NULL }, { } }; @@ -1935,10 +1949,14 @@ static void load_remote_sep(struct a2dp_channel *chan, GKeyFile *key_file, struct avdtp_remote_sep *rsep; uint8_t lseid, rseid; char *value; + bool delay_report; if (!seids) return; + delay_report = g_key_file_get_boolean(key_file, "Endpoints", + "DelayReporting", NULL); + for (; *seids; seids++) { uint8_t type; uint8_t codec; @@ -1979,7 +1997,8 @@ static void load_remote_sep(struct a2dp_channel *chan, GKeyFile *key_file, caps_add_codec(&l, codec, data, size / 2); - rsep = avdtp_register_remote_sep(chan->session, rseid, type, l); + rsep = avdtp_register_remote_sep(chan->session, rseid, type, l, + delay_report); if (!rsep) { warn("Unable to register Endpoint: seid %u", rseid); continue; @@ -2602,10 +2621,15 @@ static struct queue *a2dp_select_eps(struct avdtp *session, uint8_t type, return a2dp_find_eps(session, l, NULL); } +struct store_data { + GKeyFile *key_file; + bool delay_reporting; +}; + static void store_remote_sep(void *data, void *user_data) { struct a2dp_remote_sep *sep = data; - GKeyFile *key_file = (void *) user_data; + struct store_data *store = user_data; char seid[4], value[256]; struct avdtp_service_capability *service = avdtp_get_codec(sep->sep); struct avdtp_media_codec_capability *codec = (void *) service->data; @@ -2620,8 +2644,10 @@ static void store_remote_sep(void *data, void *user_data) for (i = 0; i < service->length - sizeof(*codec); i++) offset += sprintf(value + offset, "%02hhx", codec->data[i]); + g_key_file_set_string(store->key_file, "Endpoints", seid, value); - g_key_file_set_string(key_file, "Endpoints", seid, value); + if (!store->delay_reporting && avdtp_get_delay_reporting(sep->sep)) + store->delay_reporting = true; } static void store_remote_seps(struct a2dp_channel *chan) @@ -2629,9 +2655,9 @@ static void store_remote_seps(struct a2dp_channel *chan) struct btd_device *device = chan->device; char filename[PATH_MAX]; char dst_addr[18]; - GKeyFile *key_file; char *data; gsize length = 0; + struct store_data store; if (queue_isempty(chan->seps)) return; @@ -2641,26 +2667,33 @@ static void store_remote_seps(struct a2dp_channel *chan) snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", btd_adapter_get_storage_dir(device_get_adapter(device)), dst_addr); - key_file = g_key_file_new(); - g_key_file_load_from_file(key_file, filename, 0, NULL); + store.key_file = g_key_file_new(); + g_key_file_load_from_file(store.key_file, filename, 0, NULL); - data = g_key_file_get_string(key_file, "Endpoints", "LastUsed", NULL); + data = g_key_file_get_string(store.key_file, "Endpoints", "LastUsed", + NULL); /* Remove current endpoints since it might have changed */ - g_key_file_remove_group(key_file, "Endpoints", NULL); + g_key_file_remove_group(store.key_file, "Endpoints", NULL); - queue_foreach(chan->seps, store_remote_sep, key_file); + queue_foreach(chan->seps, store_remote_sep, &store); + + if (store.delay_reporting) + g_key_file_set_boolean(store.key_file, "Endpoints", + "DelayReporting", + store.delay_reporting); if (data) { - g_key_file_set_string(key_file, "Endpoints", "LastUsed", data); + g_key_file_set_string(store.key_file, "Endpoints", "LastUsed", + data); g_free(data); } - data = g_key_file_to_data(key_file, &length, NULL); + data = g_key_file_to_data(store.key_file, &length, NULL); g_file_set_contents(filename, data, length, NULL); g_free(data); - g_key_file_free(key_file); + g_key_file_free(store.key_file); } static void discover_cb(struct avdtp *session, GSList *seps, diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 1fd2be051..cf471cb22 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -3210,6 +3210,11 @@ struct avdtp_service_capability *avdtp_get_codec(struct avdtp_remote_sep *sep) return sep->codec; } +bool avdtp_get_delay_reporting(struct avdtp_remote_sep *sep) +{ + return sep->delay_reporting; +} + struct avdtp_service_capability *avdtp_service_cap_new(uint8_t category, void *data, int length) { @@ -3229,7 +3234,8 @@ struct avdtp_service_capability *avdtp_service_cap_new(uint8_t category, struct avdtp_remote_sep *avdtp_register_remote_sep(struct avdtp *session, uint8_t seid, uint8_t type, - GSList *caps) + GSList *caps, + bool delay_report) { struct avdtp_remote_sep *sep; GSList *l; @@ -3244,6 +3250,7 @@ struct avdtp_remote_sep *avdtp_register_remote_sep(struct avdtp *session, sep->type = type; sep->media_type = AVDTP_MEDIA_TYPE_AUDIO; sep->caps = caps; + sep->delay_reporting = delay_report; for (l = caps; l; l = g_slist_next(l)) { struct avdtp_service_capability *cap = l->data; @@ -3252,7 +3259,9 @@ struct avdtp_remote_sep *avdtp_register_remote_sep(struct avdtp *session, sep->codec = cap; } - DBG("seid %d type %d media %d", sep->seid, sep->type, sep->media_type); + DBG("seid %d type %d media %d delay_reporting %s", sep->seid, sep->type, + sep->media_type, + sep->delay_reporting ? "true" : "false"); return sep; } diff --git a/profiles/audio/avdtp.h b/profiles/audio/avdtp.h index f1e51d4e3..08b9063bc 100644 --- a/profiles/audio/avdtp.h +++ b/profiles/audio/avdtp.h @@ -226,7 +226,8 @@ struct avdtp_service_capability *avdtp_service_cap_new(uint8_t category, struct avdtp_remote_sep *avdtp_register_remote_sep(struct avdtp *session, uint8_t seid, uint8_t type, - GSList *caps); + GSList *caps, + bool delay_report); uint8_t avdtp_get_seid(struct avdtp_remote_sep *sep); @@ -234,6 +235,8 @@ uint8_t avdtp_get_type(struct avdtp_remote_sep *sep); struct avdtp_service_capability *avdtp_get_codec(struct avdtp_remote_sep *sep); +bool avdtp_get_delay_reporting(struct avdtp_remote_sep *sep); + int avdtp_discover(struct avdtp *session, avdtp_discover_cb_t cb, void *user_data); From patchwork Mon May 18 22:29:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11556503 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A0391391 for ; Mon, 18 May 2020 22:29:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52DBE2083E for ; Mon, 18 May 2020 22:29:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O43NZkqu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728589AbgERW3Q (ORCPT ); Mon, 18 May 2020 18:29:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728579AbgERW3P (ORCPT ); Mon, 18 May 2020 18:29:15 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3D3C061A0C for ; Mon, 18 May 2020 15:29:15 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id ci21so470983pjb.3 for ; Mon, 18 May 2020 15:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Crvasl2cLFymo7AJ0sHBn/fDUJwOc+UocOMVTyWbCD0=; b=O43NZkqu3YxlnGNgvbXmbwam6EWzT3cTPEaEz2KCm93h6FZYMT6bgOeJRIxkRunafJ L/XDrl6z3wdGxnMWbkim2btSkl0FJyiBxdCIIuK7ziePqLPcrYywwOdjWtSpjG+e2OkX KgAkkNcLZV2B9T+/aqkVAGMrcR2ACovvZ0U8AJV03IilEj3pRz+QoD0an7IEWxOwswXb k03rv9cwJkVJrvLqWnI+vBQg1EU7kFyYwUK/D0W13GabKIt7SyHPiyORm2K6s2hGXARx W0Uc6nEM9Lwv1/PIrnf+s14bCFUi2IaDREXOCMt1T5nL5EZca2WfAzbsV30QYmDkJhfS 8mcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Crvasl2cLFymo7AJ0sHBn/fDUJwOc+UocOMVTyWbCD0=; b=X/7p92DcX2XRnbZZYpFpmqtIvcwYAVxeA7+0PlBUkkEU/7kcsXLrYMZH2ZsHcqUQa9 1L1yh4PULNhJBh4a/1Ku5OKWzbnq5lw2zUcBD7RsyNYCSijmoOHNyOpP2KDAKzhdTBNa P5V4n+/dw3zvAPDTmnC6m+XYARjK2GjL/tpDjUKX2xieqaH6lzvamQbnNUXWKcehR4zE Sl/IvsTxpmYRwhaS4s6qY0EbbaRFV1PsrOS1fsjifnGOP6dthcoDEnHshRtnqOfklJX+ 6Gv/XKQnIik258GoUlLdsjxJRxd4KS0jA5CApGu8/8VcpwCmZlSO84CWOhJS5dI7/FGr 7Kew== X-Gm-Message-State: AOAM531Tbz+63rkF91CTrMdqUZKxD7MYyVyizXKxMvikRw480/e84UBO DHm2598ZDspMse+FZQE8OPUSRSBT X-Google-Smtp-Source: ABdhPJxfv3g9BCmjcNPFoWgvIBEXk/pLmfAyqVf2xovXr+jzlzjtBkF3ufNMjnqDYe1mrlUUSPjEJQ== X-Received: by 2002:a17:90a:32e9:: with SMTP id l96mr1729057pjb.76.1589840954748; Mon, 18 May 2020 15:29:14 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 5sm8291733pgl.4.2020.05.18.15.29.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 15:29:14 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 4/4] doc/settings-storage: Update documentation of Endpoints Date: Mon, 18 May 2020 15:29:08 -0700 Message-Id: <20200518222908.146911-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200518222908.146911-1-luiz.dentz@gmail.com> References: <20200518222908.146911-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Add documentation of DelayReporting storage as that has been added to the cache. --- doc/settings-storage.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/settings-storage.txt b/doc/settings-storage.txt index 5f6d25141..6e67ddc9c 100644 --- a/doc/settings-storage.txt +++ b/doc/settings-storage.txt @@ -225,6 +225,8 @@ Sample Attributes section: LastUsed:: String LastUsed has two fields which are the local and remote seids as hexadecimal encoded string. + DelayReporting: Bool DelayReporting indicates remote + support Delay Reporting feature. Info file format ================