From patchwork Thu Apr 11 13:39:29 2024 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: 788413 Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (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 200C614E2F6 for ; Thu, 11 Apr 2024 13:39:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712842776; cv=none; b=k7pAttBP+djiJ9X64ivggQI2Ei1IsJg1oaallKhC8CR/0NQU+M5th8lt43dNaOm97Bavu68ddvig6Y+lTNdIw7Q+B2wcoohoF7QlfDWDBmMPW+eDc//i63edHv07azhxUHCfzUCsiwMvs6LOrrrba9aXxTZ8J+7emUk/RuP2S3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712842776; c=relaxed/simple; bh=2zd2aErHG1lZPkrmYGGNWy8rR9E2GG4suFCJDjI8SaE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=tMvBp00EhPf8Y9DfeJ3w4NT8aXP+ydrPucjNXlbovhEfyowugHYKpfdZkRWwGGJNWsY49Hb3S5MAyA495xXZAI1oviJnOhCpidkW7aVc2HYl0lt0BJ8b9Bz6iEaVhIG6FI+VRuabOaf2qKqxSyCwJ66N4+7XAecdyWY5qeypEEc= 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=OOsGoCag; arc=none smtp.client-ip=209.85.217.51 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OOsGoCag" Received: by mail-vs1-f51.google.com with SMTP id ada2fe7eead31-479e12bde9fso2391339137.2 for ; Thu, 11 Apr 2024 06:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712842773; x=1713447573; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=+hANOqpWi5mccCXObOolBPcIhoSeVd6fCezYfr1BhRY=; b=OOsGoCagJHOSzzzakQQDwcESGAmmsZTlk1tBgbN4tDN3Z8tGANaAqX672cJcZXVOTI kTd3tMgxWrnYWLmSpO76dBZgUrwdqfMkFr0XSXe7jLGGjrImCAFJ+blcyKPfh+6gKzLA B7Xz8wAv0uUW5X9CuB3EuneLURcHytV/E/ZdzKdr3Icczh76sQwgaiBQ1TzecyAlUA+V BJu6vkJorRPywrfJdjJVTZ7gPW0C8aD70dbkEIaZ+uR8dKkilSfaay7ju5qQQ5e7j1IG qhwM1b8YXptoiRTBnW4az7j0goGaeOlwvto9fZTlMvt0CG9fxaYTURhgrlhGAA7PKd3R 6lqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712842773; x=1713447573; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+hANOqpWi5mccCXObOolBPcIhoSeVd6fCezYfr1BhRY=; b=WvF/KdES28KGNzW8JaYurL1mz0r+4EuPYI8fVYXYtbmRlm5w8ZDxjaEoyeqc8FNQxf bT63BzieGMczcjTB29i28/f4j2UJArbVR9ilctru2IbywAIu0BxXi1Rc7Y1rltZS8YxY P4aZ00au95sLXd0Q2nr1v0h3oD6PGMbfGAwdLzjrVGiZLwZ/elXWloe0CIbeQgZsI3ko cNSYLOFeL8tMNmzJNTS65FFtSUCxzq1/TVB5gylD9VIwq26zEcbdgUra/d0UFTcX3PwI hFiDw5gZ2Yvm5hWz0jfRrI70VKGxYYzGGySKiyZjIkXOtA3qT8EIfrX7AKsDm492ESGd NpqQ== X-Gm-Message-State: AOJu0YzcEgv55xPuOKxgebbarNiI8AcqjrsvJsbHKCdLqrl4KYM5hm/y +Fi6tar03wurdjInbpf22vXIEWI8MOlviDFYWhiSin8zhA3CzTflWZz7+Q== X-Google-Smtp-Source: AGHT+IFXF98U3VBANGsfssldzFCAW6bzFWojLgXdtfr3erEpJ+IBpw5uBdQQuVl7m6FOY8DXL11PHQ== X-Received: by 2002:a05:6102:f08:b0:47a:233f:9fce with SMTP id v8-20020a0561020f0800b0047a233f9fcemr5179286vss.19.1712842772830; Thu, 11 Apr 2024 06:39:32 -0700 (PDT) Received: from lvondent-mobl4.. (107-146-107-067.biz.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id dd2-20020a056102568200b0046d2de55f2csm217918vsb.15.2024.04.11.06.39.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 06:39:32 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 1/2] shared/bap: Fix not updating location Date: Thu, 11 Apr 2024 09:39:29 -0400 Message-ID: <20240411133930.96265-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz Fix not updating map.location when selecting. --- src/shared/bap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index f553096dfcc6..b452461ac715 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -5163,12 +5163,10 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac, /* Check if there are any channels left to select */ map.count &= ~(map.count & rc->count); - if (!map.count) - break; - /* Check if there are any locations left to select */ map.location &= ~(map.location & rc->location); - if (!map.location) + + if (!map.count || !map.location) break; /* Check if device require AC*(i) settings */ From patchwork Thu Apr 11 13:39:30 2024 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: 788019 Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) (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 4D42214D456 for ; Thu, 11 Apr 2024 13:39:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712842778; cv=none; b=h/3EAEpDSGDLg7O4rw0A8lLTS13KEeDcsnrS95DBF0Kqcn6Ie3O6qWJdjtXuR98TwFrmoIYPHEan5gAich3munbPdL4o5VE9TVMs4hY2NKvyv4GgrcrD/zws00efKd9fUBpm0oi0TZqpngoR1trSJadABCgWJET9B0RIWpkHN9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712842778; c=relaxed/simple; bh=uGW8/FMRWXjE/nAQfYCQHNRcHQmpZXnzVrVpRregbSk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mAOEBCQUEdtoQ7hUeL/afLvz4wPml0XbA9dfD5fwTVLxtPm+wauN9CRFQyjZfOLvqPUCu82l+xsiP/pW+pQ37KJdVyxPbuKhTrClnZXpiW0rZJv1oaWjOguBDUWYc0T1mxlm76KUs1gWFGRmTro9zsolbGHARy9ptuMj4Iz60uE= 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=USnvDfIE; arc=none smtp.client-ip=209.85.222.46 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="USnvDfIE" Received: by mail-ua1-f46.google.com with SMTP id a1e0cc1a2514c-7e6cbbc20deso1429271241.2 for ; Thu, 11 Apr 2024 06:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712842775; x=1713447575; 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=mEicXI2HW1zpP9FBpdDgWncBq7v9rc6WBL/5xRW3AEY=; b=USnvDfIEDZXuxLzJnA4FyKAKdNrs9o4JdhOZ1yTpfXH6yCfrWqz3peLusqpYgC5ipJ 3oLGlWu0IvXZmBwd9iRNwZA1+E7koDCJsF8sDIG7pDiNZ6WvmY4LW9IaAV1+9psf080F AtQguOqFIkTpGZEaq5FzJ0wvGoUA9L3K4uR1zjKxpJRNTZGlc0w6y2o+O94K2tepDFVK lvHKuwLPID0tMEQTJBkvmKL3NMh3uRJcLNZHHhWXUA3c3ZmR9Jk4GfahDHDdo5pTuv6J dgLQqh5n4yNuihfoR1W/u+Pjv8rcLderH0Y1AGin12hbKjGhESayzKHlFrKtE7BWto/Q Crng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712842775; x=1713447575; 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=mEicXI2HW1zpP9FBpdDgWncBq7v9rc6WBL/5xRW3AEY=; b=iaPqSxD5nSSSa1aZFRVWab10eHrgCsYAd/bqlI4tDSH9ggFo/H5AYSUYn43ksRP1pE wbOYXQIiNkFZ7mQek0QN+WeYDLWHaFZ5xcd+WhowcsImgcecV7YAtxxsjzY1L/gCZwxm SvphUtBnULAbDfVRkllOu7h1fewodBnu8B81LHfIAU1ap6q6ADZ7pzvEtHqOHuQlznCl Z0HHqRahRWupI2iTT/C16lk6BhLsjnm3w1u0EzclDr2ue0AGQLgCazKol0FwX2h+6wh6 FR9TEAElV7u1DCwV6z1oxZNz8kHUUKSCJiw4ZXzhbNvoDDbQQMiRZnGXp4O0byDYKMst Ysbg== X-Gm-Message-State: AOJu0YzrmFE0vvFa9z68L1comevBsfwSvktOwWCnyX3A27kLKSgBoeID FkJbg4Os2WbAjOFmph33j1sg9/DnJ0uoVOLVe9zuUM89yfvZGU756mgW5Q== X-Google-Smtp-Source: AGHT+IH7xFlWt/oi6NX9Cu71gT0K2odltgngCXR5nAKrsKjIGp0q6YU51Ewg1aY3xw/tKiEhubgH6g== X-Received: by 2002:a05:6102:2ad3:b0:47a:38b0:79f0 with SMTP id eh19-20020a0561022ad300b0047a38b079f0mr1649087vsb.14.1712842774960; Thu, 11 Apr 2024 06:39:34 -0700 (PDT) Received: from lvondent-mobl4.. (107-146-107-067.biz.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id dd2-20020a056102568200b0046d2de55f2csm217918vsb.15.2024.04.11.06.39.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 06:39:33 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 2/2] shared/bap: Make bt_bap_select fallback in case of no channel allocation Date: Thu, 11 Apr 2024 09:39:30 -0400 Message-ID: <20240411133930.96265-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411133930.96265-1-luiz.dentz@gmail.com> References: <20240411133930.96265-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 From: Luiz Augusto von Dentz If channel allocation could not be matched attempt to call .select without a channel allocation as the device might require a different matching algorithm. Fixes: https://github.com/bluez/bluez/issues/793 --- src/shared/bap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index b452461ac715..5368115565fa 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -5116,6 +5116,7 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac, void *user_data) { const struct queue_entry *lchan, *rchan; + int selected = 0; if (!lpac || !rpac || !func) return -EINVAL; @@ -5158,8 +5159,7 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac, rc->location, &rpac->qos, func, user_data, lpac->user_data); - if (count) - (*count)++; + selected++; /* Check if there are any channels left to select */ map.count &= ~(map.count & rc->count); @@ -5175,6 +5175,16 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac, } } + /* Fallback to no channel allocation since none could be matched. */ + if (!selected) { + lpac->ops->select(lpac, rpac, 0, &rpac->qos, func, user_data, + lpac->user_data); + selected++; + } + + if (count) + *count = selected; + return 0; }