Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp38463lqn; Thu, 11 Apr 2024 13:03:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU48mibxcJ0u6Foj2vU/zRXAZfV9nN3yFo7+VtEeg3nooKUKGpNuUQ6zmzxZJVw8mqngU4DxJBbr8jqhfnpNgcmXA8roMcs8Dfuu4SaXA== X-Google-Smtp-Source: AGHT+IHIgV1cfJRM/+CJOU8tEsIhFD6ak9zGYido7weJcJviRpbPXErmnbqZeEurmomOBO8CzeZ5 X-Received: by 2002:a2e:be8b:0:b0:2da:357:ad29 with SMTP id a11-20020a2ebe8b000000b002da0357ad29mr226222ljr.19.1712865801216; Thu, 11 Apr 2024 13:03:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712865801; cv=pass; d=google.com; s=arc-20160816; b=lndi3Lu3Sa7Y8920BDVrVTKLhNnY8UtLCdpPZUTKnOls/ix6Zb4c58gvYZ3xnD46oW vmwVWGyA8USGHkBsHov87ztAyTKvfSVvxh86patBGI37q1gIyjsCRrcIVGIi78idoxZD WCg/yPzCmlS79tQljN4HHNdkUThflvAaK5J+UXInPKTdkw7w1zou2L5z2iXx/AwkQbbs 1iNHNg3yDK0ZqCdFSxPs88tGP7/p9ISW5t89KyuVnsSbDzafTDZHBfHn2jAW7FJhoUci 0K9YbKRrecRSgV8AfUC92zTVSrbjvtatxToeA/I9AxAjpyAwG7x/zrH0iLuVaBbX9RJ9 REiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=2fuv8XoZVaViKeL+r9IEV453m08ChD5Kn+dw5wsZl58=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=G1hhqp+ELUshmw3w4xOFe45bjQelHwLbCb1x7fvyVp07u4DK7gsSFwsKTIn0abiDV4 Xwf28VWBwFGUVwRs8n3QucotHNQ8lhUW38UM3Rvl84hnh/6I+WiHWXpjRKWjqtHfc80M 6mJLmSQJiNibZ0/rPJsP6TVupOkQOJpJ+kpv7fgNlwvk6mFSgJglSUGTfhOed+UUJ/gx jjGJ/gLYhfbFNiv91nefffFpeZ1hhgcShoRhWdyKpKWHeyI/GWHP7TL2/MQnYq/Mfjpp hxESJEZgWqes79QCtycli9v6kbq9HTxlFCusMWn5kpk4OozfY/EHBCdOmqAAF3NZ7Jsq WneA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dhrkjGBO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3497-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id el6-20020a056402360600b0056e6f4c5471si1031694edb.470.2024.04.11.13.03.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 13:03:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3497-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dhrkjGBO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3497-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E5F361F23BEA for ; Thu, 11 Apr 2024 20:03:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7088E17BB6; Thu, 11 Apr 2024 20:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dhrkjGBO" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8815B205E11 for ; Thu, 11 Apr 2024 20:03:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712865795; cv=none; b=i4hQF+x1A4rbf303vSd2UHRjAOfUfi2uGgfMCkhC3SEoccWgT85u2msP77iR+Ng4yDDDM4A7W2v+vauSh3LjIAyE+2ZK0YOnPh4c3XRFO8oK6FWO7nT3YFPoNKVNBO1dD+E4BfyF4q+jX88FfXfP9P3jX/uVDdlRM8RwsPQt4RQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712865795; c=relaxed/simple; bh=dtAPDI39QCjupB+FxpLOoqWcJaGUTH+LY0xeHsBvIv4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V/0CmV/FIm94eWVA8RFHhIYTpFQdl1+DR84Dr/rYFGKEEgeir6taQvdBPLHmckK+otdo+MieAxpITJYxAyQGpXV79Tch+RQZ1hVuw6POzy56pUGIMRUnHo6uivQJ0LiHzlPawU20f9eAj2yqYoyS9MR/6LmpIXmyJXgPR0LdKog= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dhrkjGBO; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6eb5511088aso169373a34.2 for ; Thu, 11 Apr 2024 13:03:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712865792; x=1713470592; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2fuv8XoZVaViKeL+r9IEV453m08ChD5Kn+dw5wsZl58=; b=dhrkjGBOsEUTaAJOiPI2iStczpsX/wvH28OUDuqVVvrjSOmTRY4cezdMrAxqIEqiF2 SEInJthUxggSA+fJwlvqM6QDvDMHY6sIW6u8OxsAkT+GpkIxPhciRIV28TvNU/n8UMEF 5D/+d+RLbOcjE70HtL73bgURmD26VaMl3y/7zCABORCpHsH/AAITJa7G5Wx+dpY13vVv GU9rwKnbuHQsdK7oRX8O81MXO++b1fNckbMFJbkvlAyw8z3I94IYPqJ+ml/IyLkc5IbC Py8JDyc4LpS3j2vjNqjk3fW5gi90DuA4bSimWkeSOiVE0wtNx7SbsZI94cnRa313uiWv v1Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712865792; x=1713470592; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2fuv8XoZVaViKeL+r9IEV453m08ChD5Kn+dw5wsZl58=; b=coyWZ0irSLMolNR5bLWh0jhLynRDeRD4WdeVjfkPYGLHB8qM81HHOIp2y4LXhlHmbj Ly9trawUZB0362zpJrAVV40+t6R4MfbDQYp5XUgx3UzQiJgULCUlC/fSAe2vhjEQfR1y 6hzHh3K5JjvSMzBSc/W5hdCy+lCHu/W+YEdxYGKqw+Nn1dAuK/WWY4IuFSBsWdTPKRdq fwiudrHehojM6HhgUav/+/JdNaLRJVXVUnW7Qs7V4yDp3g5UP+ANi1wSxQc9TrTtzsOE d5SdQ6kN+/jqEDIdZ7Kdi0Doi7am1KsDWrcp2Y/AH0nCsclJhVcLjHv8KSdaq4gGS0ke TuPQ== X-Gm-Message-State: AOJu0YzYG6i4dDrtyoqO7UyA4AGzUVTKkT2vzYqcKN9Xk28IzIUBBkWT 1D6reBsU/jVRj3pRrfftrRXbtr7vVps36Xc5qCxI5KQv+h2PEi6YBlpbTQ== X-Received: by 2002:a05:6808:212a:b0:3c3:d315:e769 with SMTP id r42-20020a056808212a00b003c3d315e769mr656028oiw.43.1712865792184; Thu, 11 Apr 2024 13:03:12 -0700 (PDT) Received: from lvondent-mobl4.. (107-146-107-067.biz.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id da2-20020a056130230200b007e6b31e535asm268110uab.29.2024.04.11.13.03.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 13:03:10 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v4 3/4] shared/bap: Fix not resuming reading attributes Date: Thu, 11 Apr 2024 16:03:04 -0400 Message-ID: <20240411200305.183703-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411200305.183703-1-luiz.dentz@gmail.com> References: <20240411200305.183703-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz If there is an unexpected disconnect and some attributes values where left uninitialized this attempts to resume reading them once a new session is attached. --- src/shared/bap.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index cc1fa1ffbe32..5fee7b4c54ca 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -4703,6 +4703,18 @@ clone: } } + /* Resume reading sink locations if supported */ + if (pacs->sink && pacs->sink_loc && !pacs->sink_loc_value) { + if (gatt_db_attribute_get_char_data(pacs->sink_loc, + NULL, &value_handle, + NULL, NULL, NULL)) { + bt_gatt_client_read_value(bap->client, + value_handle, + read_sink_pac_loc, + bap, NULL); + } + } + /* Resume reading sources if supported */ if (pacs->source && queue_isempty(bap->rdb->sources)) { if (gatt_db_attribute_get_char_data(pacs->source, @@ -4715,6 +4727,48 @@ clone: } } + /* Resume reading source locations if supported */ + if (pacs->source && pacs->source_loc && + !pacs->source_loc_value) { + if (gatt_db_attribute_get_char_data(pacs->source_loc, + NULL, &value_handle, + NULL, NULL, NULL)) { + bt_gatt_client_read_value(bap->client, + value_handle, + read_source_pac_loc, + bap, NULL); + } + } + + /* Resume reading supported contexts if supported */ + if (pacs->sink && pacs->supported_context && + !pacs->supported_sink_context_value && + !pacs->supported_source_context_value) { + if (gatt_db_attribute_get_char_data( + pacs->supported_context, + NULL, &value_handle, + NULL, NULL, NULL)) { + bt_gatt_client_read_value(bap->client, + value_handle, + read_pac_supported_context, + bap, NULL); + } + } + + /* Resume reading contexts if supported */ + if (pacs->sink && pacs->context && + !pacs->sink_context_value && + !pacs->source_context_value) { + if (gatt_db_attribute_get_char_data(pacs->context, + NULL, &value_handle, + NULL, NULL, NULL)) { + bt_gatt_client_read_value(bap->client, + value_handle, + read_pac_context, + bap, NULL); + } + } + queue_foreach(bap->remote_eps, bap_endpoint_foreach, bap); bap_cp_attach(bap); -- 2.44.0