From patchwork Mon May 18 20:56:33 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: 11556355 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 E28B613B1 for ; Mon, 18 May 2020 20:56:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C926420758 for ; Mon, 18 May 2020 20:56:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="txADvoHo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726847AbgERU4k (ORCPT ); Mon, 18 May 2020 16:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgERU4k (ORCPT ); Mon, 18 May 2020 16:56:40 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D234EC061A0C for ; Mon, 18 May 2020 13:56:39 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id a13so3177904pls.8 for ; Mon, 18 May 2020 13:56:39 -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=tHIUr6OI2tzpztosBH4ZilMc0GllNIQQ/6Oyt/MLLiY=; b=txADvoHoXFuTKvxxvUZ5uBhNuTrq8SfLGWeIsAnl5ZeEGvRwbEbmnJIL5URIN+Ixv4 NfFJS/PXYaodm5kQUVm6SFdPy0enHC9Mr3Jxh1TswNfdYb6TdzuBkQNbuP8C322WC6Ep yjThoFVQTzGKov6cRQYtGNX4LV2mmSKwLJV7fXX39/49oIHb7iIRE2OtpigIxZ+coEjm Drs1djqI4FmQ9nOt7YlzYi8r5CwBCRCwcPMAo51d8FQC4YRNF1Mx8o65rSVIh5gPjoun oCrIH+HItOb9PsLi+C1T0TSAJ+/2nbKSypjO5opml1PGJBMOVnJwnjBHXnOQk8xc0AF0 iIPw== 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=tHIUr6OI2tzpztosBH4ZilMc0GllNIQQ/6Oyt/MLLiY=; b=ImHeXXfJ1QrJNfb4pKpytp0E35m5MdFvrRZ2E2l1b1asL+XbLEsE6zfZpvAg1kxjmS 7yaxWr84B6KDc8W+gOVMvznF/Hlr3WxROp5Jmh+Tt9HWEFXISr4CjUqff9RDvYVnekdZ 6NdDetSVKo38sIGJRtDWIoyCRW7t60hkQdojip3+ierUY41L9V77U5nQsgMidjcOZl2B eHG8HSwffTaCBC0B76nc2baolGXEsqMl26HMdWbflqJHF4rNYeNXqPdi/Ef8E58/+30o DvGuQYhqQCxysqnTUKEe/4dn+9nzb6gB36/ZFWJm8TZB89LRDa46WTTCHvm4wrzk54jp TVvA== X-Gm-Message-State: AOAM533lBS2x9KYQXFyqqkfmyRAUQs525i47i21IHicoZWenfzSkdXEq qGQNPtLbFEa+AxkFlSZTpUDs4lO7 X-Google-Smtp-Source: ABdhPJz9cEkXnP/W7K16qhppLqGdQ7eXvJ8MlCtc/TGdqQotr0YTwDUrZB3TGSBn2Wdbw2LbdWFYBw== X-Received: by 2002:a17:902:d208:: with SMTP id t8mr18534109ply.324.1589835398309; Mon, 18 May 2020 13:56:38 -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 q18sm8519808pgn.34.2020.05.18.13.56.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 13:56:37 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/4] a2dp: Fix caching endpoints for unkown version Date: Mon, 18 May 2020 13:56:33 -0700 Message-Id: <20200518205636.139184-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 unkown 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 20:56:34 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: 11556357 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 441F0618 for ; Mon, 18 May 2020 20:56:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20BBD20758 for ; Mon, 18 May 2020 20:56:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tt8o8htN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727076AbgERU4l (ORCPT ); Mon, 18 May 2020 16:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgERU4l (ORCPT ); Mon, 18 May 2020 16:56:41 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A8F0C05BD09 for ; Mon, 18 May 2020 13:56:40 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id y198so3936767pfb.4 for ; Mon, 18 May 2020 13:56:40 -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=tt8o8htNfbhVVdJsV8BI0nj1NdnSxDmZQ4GzGOhCMkY/ogxMb6rNaV5vnmch+wzo+O Y3CqtQRs16lXxMJ0oBQp0zsrJvNLOq/z/R2Rc5A8Q2cR4R7JEsVXJUGGrdx2BtBqdJT4 d5QpW02iPdoTecPLLpwT/dEuWSZPQxZTe24AfoEvfZcZe3Z33XyDznqPkeIyaeu/tABo kRPSMXoB7tWGEa7RmV5b2J5NlFrozg4+S9kQLdbFslLdc1jB/iT0GTpWj9FMgf8Bz7eW ZLZ/MLfuQTIzIktyYrNsUVp0PH2O3luXBi9CwC06//XRXX7rNHQgBWDb5+yn4rymXXHG b2YA== 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=kyczgtXpdC33/XI/F0s3clgTy71FoSE67NpiqrwHfQi9uAXoH3YFNPExB/WiU11D8P uK729YyOZx2bl8i9vX9z/NXHXbqV5hjTMoTYHJTDahv/3fHF5SOtjYwJgoQ4SYANb1yw gCp3Dmq6xh7mmIZJQBacK4cjsOk9IAmcPNKT+lSzQJNp21ge2TO3m/4DcWc7raYfeAV6 uOvJtgydeV0azzfZRk/4bPcrVuURgU+L4mV99f2cFTAPD1Uh9VGlqNODsKcZJtAyOa1H G/2jYYn6n/dgZSzce85VGbssWrTnBP7vdUUOcW3gXRzsx6tWX0n0TB9sD2mJl3JRWKAI Rv8Q== X-Gm-Message-State: AOAM532pHK+7jh3aR5DBWx3l6J1eJfIO81QKOnOH4QAGGyUocUrfqYOn N6Y7JyMnq5uLsvHofhWV5IkM7dv6 X-Google-Smtp-Source: ABdhPJzZcQiuuPNiqOQJCORzN1Pgs1B48mZcGJjQH2sX14fDrN0eLM3Kd9oB7iFZ6sFU+EdOZPNdgg== X-Received: by 2002:aa7:9f8c:: with SMTP id z12mr15317624pfr.304.1589835399185; Mon, 18 May 2020 13:56:39 -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 q18sm8519808pgn.34.2020.05.18.13.56.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 13:56:38 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/4] doc/media-api: Add documentation for DelayReporting Date: Mon, 18 May 2020 13:56:34 -0700 Message-Id: <20200518205636.139184-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200518205636.139184-1-luiz.dentz@gmail.com> References: <20200518205636.139184-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 20:56:35 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: 11556359 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 EA18E14C0 for ; Mon, 18 May 2020 20:56:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CBC8920756 for ; Mon, 18 May 2020 20:56:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BmcHDNVJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727799AbgERU4m (ORCPT ); Mon, 18 May 2020 16:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbgERU4l (ORCPT ); Mon, 18 May 2020 16:56:41 -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 3DE9EC061A0C for ; Mon, 18 May 2020 13:56:41 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id f6so5409917pgm.1 for ; Mon, 18 May 2020 13:56:41 -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=BmcHDNVJeAKYcKA/WXduWM1FGafwAkfiybUtZUL7V5v9JeD9RQTvlP5u4e2gRreuO7 fSKuXDYl8ib4ArA3ByNJNqmXXMpa21BuyvkEgMtFJ49Kf9GI+m521rI2VI9ZitB1pWmn St6GcCpV8knkS1nBd4MiwfV2kZIkBvVhAX0LDpkx3OLagCLxgTcihhyLGGTbEBotWQs0 cSgdPMB90hBMeRRC7etko5Enh+wo8pIfFvfIY60akgM6e3okNxUEeO6yQ0qdjTcGgBmz Dh/L0uvZutNGglD86nlHZUIX1/DMQpNhdDxnOvqW7ja2xpuaWATIbyIYWJx7t0XW0Du7 z2aQ== 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=qA4OefHeLTYdeUCdAyrCNyoSyFysyd8lC+7Yp76p6wPw0UB3xDFC1eSupkwbFiEKNj nGMjbcf4EZR3nGCMf/FiMgPFcHT55XHAWJHUVycjgjQqr19tX48FB00GNSdTJNbYPy2H Pen1YqBxnmlCl6M6uB6ocNXQ/UTY5RpYvkptEasN2HfCNraLbeiHVbPdceExLapPEHXS Buja06Ms32FKsxkuAfLYk0wqXuT3gX4+mmX0GgAYc0Lbf06TupNjfFeoY469LUbBsf3n kQtttPX/SlALzucnUHB7qaNF2FEY4c7VnWmdrBwbb3SvKEtfqd7y7q9g35WFP2cIjv7G j/Wg== X-Gm-Message-State: AOAM532ypsTZmEOLlLIRKSlZiPGlAX5Eicw0lz8mSg4Uz9oT9M8mt9+6 hs/xNG57Z1plt61Xb1QA7QeDYJ5E X-Google-Smtp-Source: ABdhPJyGEeoFoxCYJXhnnarwXAYYoOh7QacO0vQqJGQ6Z0DSO7wxR3uoMFi2EfKTPR8pyRgf+uStgg== X-Received: by 2002:a63:a062:: with SMTP id u34mr16921351pgn.62.1589835400345; Mon, 18 May 2020 13:56:40 -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 q18sm8519808pgn.34.2020.05.18.13.56.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 13:56:39 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 3/4] a2dp: Store Delay Reporting capability Date: Mon, 18 May 2020 13:56:35 -0700 Message-Id: <20200518205636.139184-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200518205636.139184-1-luiz.dentz@gmail.com> References: <20200518205636.139184-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 20:56:36 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: 11556361 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 7F2A013B1 for ; Mon, 18 May 2020 20:56:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 644CC20758 for ; Mon, 18 May 2020 20:56:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k7/6kGSr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727819AbgERU4n (ORCPT ); Mon, 18 May 2020 16:56:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbgERU4m (ORCPT ); Mon, 18 May 2020 16:56:42 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EF6FC061A0C for ; Mon, 18 May 2020 13:56:42 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id b12so4708793plz.13 for ; Mon, 18 May 2020 13:56:42 -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=k7/6kGSr1oMr0vkveaS/ONB3o8MPx3LP01nOpaiGAfh/K8VDgJZmh4EUWXjjNMxW9D OC24PMXGsDYAcrdCoAxWUg58XeyV7ALAXKyN4nejWfdCNoI11oHyJFvqw7j6i+q7V3Ry WDP345HqJ3GViyhbpI/riuWpCf+lKMhmGFJwcf1dK2cICrbs/HdWGzwa7iroEoosmJhP hi0FnJ//0lXSQ6z2U4TE0thB1LPVTaNGDdJ53KMLMVmkQSh+cSBAkOq3cnlzQT9LSYfU wM8DRIK55obbO/y0/JLx1uHHsLB4trMvWSzcO9MLWz0+o63NIeefWhpc6gTc51SFVFuC oZTA== 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=f6zFYwG6lTSKG9p58z16cRNnxTVuDHUTyMyrz8rC1DuvjvXHNnl3SJidNc6nBkTkN/ VqTrqY7Vq5OJRiPbjWardlER6BftIuUGsSCnWOVQh6d6fZ2B0DJDWhbNh7GpNa0uQePP UmiEGiQYZZzV8SrOoh2uP8AOPTkJrtIXeKej6sQDwn+WN41wrVH7VJdVOca8/osB/YCI HyZB7b/wnfgODSE6zVp/UKQkk+wRbDEFlgh6fwlM3Dj3axaKw8t+JJDOk/Ylqt9zDBNO FLyGJ5PKVo8Apsc9k6o6xR5bRn7nxRZlRzPgA22BWDJmgeG77UE0PA6v9D2NmxixWk6w 4+5w== X-Gm-Message-State: AOAM5338w6ekJ+OKjh5qUInp/9ViQwg6L6t5Oh7UTfmOPLHb3vA3P8tM 4d+GXWZpXaTqCfatDKeKVfwCbgVF X-Google-Smtp-Source: ABdhPJwAu1u9yiD0I7nDM37/YUbHUN6Jmjk75o7p8zHFVHhT4eSByAhdYyK99xjb+kbAi5tOQf/C3w== X-Received: by 2002:a17:902:9a43:: with SMTP id x3mr18057657plv.332.1589835401575; Mon, 18 May 2020 13:56:41 -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 q18sm8519808pgn.34.2020.05.18.13.56.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 13:56:40 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 4/4] doc/settings-storage: Update documentation of Endpoints Date: Mon, 18 May 2020 13:56:36 -0700 Message-Id: <20200518205636.139184-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200518205636.139184-1-luiz.dentz@gmail.com> References: <20200518205636.139184-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 ================