From patchwork Thu Aug 22 09:46:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benedek Kupper X-Patchwork-Id: 13773164 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2111.outbound.protection.outlook.com [40.107.249.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23AF413C9CB for ; Thu, 22 Aug 2024 09:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.111 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724320019; cv=fail; b=PTAzUZ12S8GkZStcOLEMzizttPWfO42mvpWMBPJPc/eiT5J//+DQ9gNtoIzkMOgEI1PdxWeG+5lqiQh8b13A/JRcFvBaov+K/XBZ2q13NTv4hg200YuwW3Jn6Pzr+jeJPe/prkSAI6PoePheS8jdkOnrgA91eOMdkgAggLglyZ0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724320019; c=relaxed/simple; bh=bUudXkEh78apf8u4+4+KjkYy4bmuokxczVw5qdp5imE=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version: References; b=ibvmTRoHnSSA18CrjWNJedWpCafmmEnaYN5BcIW/Uv9DjzvObH/zl44CKBLPy9Gkv5q/5YRuYamNXRrx+Ryx5qgFFv9JyNSmoxyDHs44VvzA/P971UC1n7mUqG9MnbuBYkxdjmwx41YVZKctkMNiLAce1lYXYoGEM2OxT6wPN9A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=epitome.inc; spf=pass smtp.mailfrom=epitome.inc; dkim=pass (2048-bit key) header.d=epitome.inc header.i=@epitome.inc header.b=PG4RZtiu; arc=fail smtp.client-ip=40.107.249.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=epitome.inc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=epitome.inc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=epitome.inc header.i=@epitome.inc header.b="PG4RZtiu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dWGxu9FxSPJUVw0vFBd9RrlHqIGCYFeZWTuIzmt8GuajpwR2G6E192aJL+UFjmgAfulW4X7Bsf2LQF1+5aF4l7/p3tw6vjEXkBBHckOG2jPiAn99zh5O1PYCmcf9KI1UXF7T9GYi3O7xG3RP82xRp4okz3raNLK+g52k8uuzzUIjTXqBg8tNtHS+XrpQlujBde5EDiOAo9lreZjI1FmS7tY9JtzhXZRXnaVrhi4MgjQMo5KkBVagqudLG+bhl3YCVAKVw9e0UtPau27cTFRqlCgr36B6pdvOxa3ajw3uEEAmjp1+2137feLsgt6V7OVKVlNB9FWQZYdkKoW/6rO0RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eBq1VkEni7p9ogS2fR2dsa1LygO5mH5h3VBN4GXITJY=; b=U7ivkWCeCTsaUpKXH2b4yUN+0FggPK3WL0ND0Dm3Xtzr7JxH0xs5dSSeiO+utJAHFPiyLDVdVcpFMX1DuDThgLzAqbXdx9kcLiw2Vh37c67r3etbgAUqt8eK6zK1gVJDmd/QkUxY1utYsUpLRnB1xEeiG6x8UcyloOsZJ7kSaZ0qAE3LjwSfshhYg1tLlgdPxI+NN3jD4inyGd/2100fhaKXSlUVL+XN+YCyIjl8D11S1GIsrcTOgFOiLJQNINDmenjatmKzKqDLXW3Dv+d03kx44YJzcafFLl36Ha7iw53vwgTMzpEPBIGyy3i+syhF/x1lm+bYBlzI266/dF07Xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 20.79.222.204) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=epitome.inc; dmarc=pass (p=none sp=none pct=100) action=none header.from=epitome.inc; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epitome.inc; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eBq1VkEni7p9ogS2fR2dsa1LygO5mH5h3VBN4GXITJY=; b=PG4RZtiuPaIOzun1yeNlFv9iThbTCpVMO/TiWgCxjPYVTU52CNl6yTAMJQHxGHK+iWGJ6C7CK+I/ZYfn6IA8UtWuvmKuJVFln7p6dZUHAj6O4s+mFowSUZZ+aAvlWr+L/I8+RwFn5WGlOfoO07sZIMeKtWfNRF9QHl3UresGn90aow3u8SmkfXeqR8FUhK6nMNf1AoaDiogYNZl4/zZGA/2i8GLNilo3O9RPelIonbiT77yiD8xWU5XogLeQcDUBVtQS3zu9sZlcFPsafDX+JSIdVJ+K2MLtymw09VyqewPk27vEpfQNnXeLETFgFvC6JnYbIV1r/3mPSktbnCPHTA== Received: from DB9PR01CA0025.eurprd01.prod.exchangelabs.com (2603:10a6:10:1d8::30) by FRZP189MB2828.EURP189.PROD.OUTLOOK.COM (2603:10a6:d10:137::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25; Thu, 22 Aug 2024 09:46:52 +0000 Received: from DU6PEPF0000A7E3.eurprd02.prod.outlook.com (2603:10a6:10:1d8:cafe::73) by DB9PR01CA0025.outlook.office365.com (2603:10a6:10:1d8::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18 via Frontend Transport; Thu, 22 Aug 2024 09:46:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.79.222.204) smtp.mailfrom=epitome.inc; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=epitome.inc; Received-SPF: Pass (protection.outlook.com: domain of epitome.inc designates 20.79.222.204 as permitted sender) receiver=protection.outlook.com; client-ip=20.79.222.204; helo=de2-emailsignatures-cloud.codetwo.com; pr=C Received: from de2-emailsignatures-cloud.codetwo.com (20.79.222.204) by DU6PEPF0000A7E3.mail.protection.outlook.com (10.167.8.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 09:46:49 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (104.47.17.104) by de2-emailsignatures-cloud.codetwo.com with CodeTwo SMTP Server (TLS12) via SMTP; Thu, 22 Aug 2024 09:46:48 +0000 Received: from AS1P189MB1963.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:4a1::5) by AM7P189MB0929.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.16; Thu, 22 Aug 2024 09:46:47 +0000 Received: from AS1P189MB1963.EURP189.PROD.OUTLOOK.COM ([fe80::45d6:2ceb:e6db:f61]) by AS1P189MB1963.EURP189.PROD.OUTLOOK.COM ([fe80::45d6:2ceb:e6db:f61%6]) with mapi id 15.20.7875.019; Thu, 22 Aug 2024 09:46:47 +0000 From: Benedek Kupper To: "linux-bluetooth@vger.kernel.org" Subject: [PATCH BlueZ] gatt-client: allow AcquireNotify when characteristic has indicate flag Thread-Topic: [PATCH BlueZ] gatt-client: allow AcquireNotify when characteristic has indicate flag Thread-Index: AQHa9He3yYrcKxbTHkWLLe2GwKmwtw== Date: Thu, 22 Aug 2024 09:46:46 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epitome.inc; x-ms-traffictypediagnostic: AS1P189MB1963:EE_|AM7P189MB0929:EE_|DU6PEPF0000A7E3:EE_|FRZP189MB2828:EE_ X-MS-Office365-Filtering-Correlation-Id: 4150fc0e-b362-49fb-d4a9-08dcc28f5875 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|366016|1800799024|38070700018; X-Microsoft-Antispam-Message-Info-Original: IFRrELzqOwtsf4NJ7bz6zzeUnidRwwosqCfKh8bMNXjoozi+Ud6f99fsF7PEdVvF45Ra8KipQ1psljKDz9lHfr1S4enYpIY/Myi4v0/ygtpXAn+fAfuCJARgJ/yE/t3lwIhWrwrqJC0eN8sW5mIBFiE95L9MszlXQwAFucxB5GUEU4YXh/QtnK9XrFc49jRZj7nsoU8Poj0giEXJOgcmxGNvecYVgGuOH2aNuFe36bFhQMhLP+JtS9boadr0vlNU2yU/l8DfCzJTsv3s1aKruU1JPeUFkK7IzXf19aSPbZCJLDx86mgKqBaejTKbCnqndI9Jh/0CDMx3i/YjQWm2zNNOPIYKvfxYHKv3H+MrrARYc1nMhRU9iF8lsZY2If77EAZtNOKtNYVLjWbX7zEIxziicLHLS5hOPtB9ZYQvkHRp4nOfiRZEkHA/bU9y0uf21tIuiWpZxVnz/Ygw74cSa026NFdUu689IWRXA+GrvUSomXvjK29Ix1bVP7s/CJ6mXG6vNkXrPyAB8MEt0RKRThJ//aIjnO4Bmnba+ImtoaWSto2aL+BSR8gMocq7OCvP3YeYbKXXUXqUB2xPN8EcLJHMQTc8Kk1P4eFd6Xd/1bz/D/w9TDHSd9qfGG6oNTum0sa+HIXKfLG1EB3gWP8eKGNVSwqKuyUQHvORISamofzeZeHpvtLHQFwDwROjHcQuKMmdRwQZsrNQ8fJ2C8UzioUeebgqDR2mKA2ZmML4+fSUu1+gvdR2NS44FG5QdHJHysIQA+Pq5od5YibCvkbnwO4wtU5lEIRF/36gAZ8gxUAxS9D0H+K09Qe6pMZ7kLa6UJUafpKpcBcPl79FwyMgMI2MqmxLg13gTdCgg/AinnA53S+/NG55IAp2jtVuAxodUblUBWA2xn+eCkYVOuSPb/AMjAGINTm68B6lm44LR53lDUrYrCMQj0AOyAksXSe2S7De6vXNVknYAjZks057/TKFxX845f07uK5S4Bs/dAU4q2Q+WyvGiXG9qeOE26py9fSpAJ3N0pc6q1dpsVxzaguO8K/SFW1SfoBcmySDklpWef4BnA4aL2tVP1Y8EfFFrwQ0VR6LtOgJchCgT4gJDHbs+3kjRb1LmH5bsYzJMDPTGRsOZKVbfW8iiCI3rTGgdzVNEZG9iqG39a5Z3CPKig== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS1P189MB1963.EURP189.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(38070700018);DIR:OUT;SFP:1102; Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P189MB0929 X-CodeTwo-MessageID: d48b2951-30b5-4bed-8e6c-beb9efa4f354.20240822094648@de2-emailsignatures-cloud.codetwo.com References: <0d55b509-ba21-4999-bad5-095c8efc4b48.66d5fd0b-0f5e-4168-b99e-0d55f52992ba.7f6ae423-2ec8-48f0-998d-7616d5fa8ce1@emailsignatures365.codetwo.com> X-CodeTwoProcessed: true X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU6PEPF0000A7E3.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 776b5fd9-ca4d-44d1-7d2e-08dcc28f56b3 X-Microsoft-Antispam: BCL:0;ARA:13230040|35042699022|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?iso-8859-1?q?39kXd/4LJg5QF22XDmv/Hc3nA2?= =?iso-8859-1?q?DTeEaI1cQo1mTMFWoBSU0YuLMeiJIU9OH0bZhHU+Vi78uwCQL+us/GsxsEqA?= =?iso-8859-1?q?lhTVVEBeYDnfgsB+rOm2lgWmdVAOB7R/0nOUS8E0li/AaGt+XHVXhclCKSIb?= =?iso-8859-1?q?vSfsZP00qfGcIoHhfYt+/vv0E199a/jz0L0HH+DfLL4oPSgUpdhG8ZYDlCTV?= =?iso-8859-1?q?PH4/BrCrUgtOKshtdnDLMx1BJyY/ly0lkUrw0rtvTqNdhnYCZlpLh5G53zD1?= =?iso-8859-1?q?JoO2CgkygqGlEsdxz2blb0dgKEboFLf7rxEsaWsk4iublgvCCaZ/ECMtVC/M?= =?iso-8859-1?q?GFUUkLrMaBszUahkkA+/BxzZv2r5HWOm6u/JpyY9dYeOOXsUVoOY8D+4ON4W?= =?iso-8859-1?q?XMoBKqxVfQj2jjuoXp9VX3X8CwDFOxCsS7N+MyXGrP5h6ltXy/sBxx1cUU+m?= =?iso-8859-1?q?K7mxPof/Qj/Ly+AZW44yrQGPrguJ1IR5MFNYWpGjbbFFk7Nw5iMpmXG8zjQd?= =?iso-8859-1?q?5lisCJ0l7h/QVJT+jRRKjTecIzBKSRkEZYHwkaxCyMjW/MegNHTUb7eY6Rt5?= =?iso-8859-1?q?zFfQAAu98zTacNLUIM2pezJttSXUgvSsjKlmmOOgBssDvZ4FCR3L/mnKQFVC?= =?iso-8859-1?q?KdrBozy6Seq3jcsNsCNWgyXTVFKyu9CClr1bf/pB9tjYSIB5ROBkhN+EfRB3?= =?iso-8859-1?q?17m4oQb7psdEeqVxhTAJsGQuXLYmG0KjypAi3PacTtlXRjJ7ljBlUyU8TueQ?= =?iso-8859-1?q?ByFDtjc6zUoLNquMvWc06stwnK7ktnZLGx0vxaCEaGAlda6KImVW6hLol/od?= =?iso-8859-1?q?+SVVP9IuYFn3T9L9EGmExe9NRHf1O6NefDVTmDn2u3tQkfQSEv4fXh2qgUCU?= =?iso-8859-1?q?i7yDFAQPk3iBTCbZr/fzB5T0pevEODg6uBeHzbnJeTsrYciVIti7mTfuw2u2?= =?iso-8859-1?q?Sf5gdg3mz8d4rOCnfZOLpxceQY8kMHh/tnGkhb+pXLArtq57PVG1VbV8BZlG?= =?iso-8859-1?q?1V4uVPeMZ7mAR0Uxdzxr1TfmYgaOfgirwJGc21WP+VdmfAkofPa3dMMt1p+c?= =?iso-8859-1?q?shQxuIRAYsdN1cUtxToSDJLS2m2AdjAmQ/NLewxyKoWRuJr2G9pg6rTMNICl?= =?iso-8859-1?q?CZDLx4lcxrkqT/o9c+z+x9fmwCnKVpt8eS2DBZlH7/owXonn3QoPFcCihWUF?= =?iso-8859-1?q?mhc0N+br/CffgRwtL5Qvzywilz6vCxhWHLH3Q7/2CE6IYmvqGsO05UNatJec?= =?iso-8859-1?q?HWrNkd50cAcU39EQh5vza+inqm7yrsjPOceuDRELda1OLGG3FfZCxv/g0sLi?= =?iso-8859-1?q?D+9IESOOk/ANKtJkj5H2Bc023inDEa2kBr9nVzjaQJp7DW20vGE5IRDYrTIx?= =?iso-8859-1?q?swtfWHxN6cTLj85ASl2NQwthROv2PFyUPm8oMr5Vv7rT6awjGwZUzb6sYH40?= =?iso-8859-1?q?I2?= X-Forefront-Antispam-Report: CIP:20.79.222.204;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:de2-emailsignatures-cloud.codetwo.com;PTR:de2-emailsignatures-cloud.codetwo.com;CAT:NONE;SFS:(13230040)(35042699022)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1102; X-OriginatorOrg: epitome.inc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 09:46:49.8434 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4150fc0e-b362-49fb-d4a9-08dcc28f5875 X-MS-Exchange-CrossTenant-Id: 45f49ae7-56ae-4b12-9ef5-c2d16e3e82af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=45f49ae7-56ae-4b12-9ef5-c2d16e3e82af;Ip=[20.79.222.204];Helo=[de2-emailsignatures-cloud.codetwo.com] X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000A7E3.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRZP189MB2828 From 412a8a7b3f5b3cc3ef160f49648648a184210c18 Mon Sep 17 00:00:00 2001 From: Benedek Kupper Date: Thu, 22 Aug 2024 11:36:51 +0200 Subject: [PATCH] gatt-client: allow AcquireNotify when characteristic has indicate flag StartNotify / StopNotify already correctly allows usage when the characteristic indicate is present (simplify this check though), apply the same to AcquireNotify. --- src/gatt-client.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gatt-client.c b/src/gatt-client.c index 8d83a9577..a67e04eee 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -1556,7 +1556,8 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn, if (!queue_isempty(chrc->notify_clients)) return btd_error_in_progress(msg); - if (!(chrc->props & BT_GATT_CHRC_PROP_NOTIFY)) + if (!(chrc->props & (BT_GATT_CHRC_PROP_NOTIFY | + BT_GATT_CHRC_PROP_INDICATE))) return btd_error_not_supported(msg); client = notify_client_create(chrc, sender); @@ -1601,8 +1602,8 @@ static DBusMessage *characteristic_start_notify(DBusConnection *conn, if (chrc->notify_io) return btd_error_not_permitted(msg, "Notify acquired"); - if (!(chrc->props & BT_GATT_CHRC_PROP_NOTIFY || - chrc->props & BT_GATT_CHRC_PROP_INDICATE)) + if (!(chrc->props & (BT_GATT_CHRC_PROP_NOTIFY | + BT_GATT_CHRC_PROP_INDICATE))) return btd_error_not_supported(msg); /* Each client can only have one active notify session. */ -- 2.34.1