From patchwork Thu Jul 22 05:26:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 860D2C6377D for ; Thu, 22 Jul 2021 05:59:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6446060FE7 for ; Thu, 22 Jul 2021 05:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbhGVFSu (ORCPT ); Thu, 22 Jul 2021 01:18:50 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:43673 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbhGVFSt (ORCPT ); Thu, 22 Jul 2021 01:18:49 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210722055923epoutp044cab1af8c2eafd042de7ce12bbc73c11~UB3TZ8BIS0449404494epoutp04d for ; Thu, 22 Jul 2021 05:59:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210722055923epoutp044cab1af8c2eafd042de7ce12bbc73c11~UB3TZ8BIS0449404494epoutp04d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933563; bh=z8qo1DRvdeaa9Y6VJE/6/pYv3iElbhwzP1M8LlRop5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JIIm7eNRR6rp3qEyQ77Mgy7Swf3rggpGcsVKFyfv18kqPwhnBJLxfwCsvLkHTps87 Sy+ZgFcSb8H1QWtlTKuRwVXHVgSELokXsJSuMmJzyVAThrOBr6mvHXjIEQIuReRA6X aa2vlcqIxVlcxCwVTtiQBlwxct+/EglireEzVp8c= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20210722055923epcas5p2253770474b588230c66cb64c39aaac94~UB3S2YfBt0624106241epcas5p2E; Thu, 22 Jul 2021 05:59:23 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id F8.CA.11627.A3909F06; Thu, 22 Jul 2021 14:59:22 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20210722052738epcas5p3b6074e49f088159e8282bba3457d56ba~UBblEuFkt1662316623epcas5p3p; Thu, 22 Jul 2021 05:27:38 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722052738epsmtrp2f8c86706eabc85674b610cb46bc3f80f~UBblD0ur40040400404epsmtrp2e; Thu, 22 Jul 2021 05:27:38 +0000 (GMT) X-AuditID: b6c32a4b-04849a8000022d6b-9b-60f9093add3d Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 24.F8.08289.AC109F06; Thu, 22 Jul 2021 14:27:38 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052737epsmtip2a08f797289b9e422c437643e15a776ae~UBbkUBwF-0848408484epsmtip2K; Thu, 22 Jul 2021 05:27:37 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 1/7] doc/adapter-api: Add SupportedPhyConfiguration property Date: Thu, 22 Jul 2021 10:56:34 +0530 Message-Id: <20210722052640.5863-2-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7bCmlq4V588Eg45zZhZ3VltbzLnWx2yx bV07swOzR9+WVYwenzfJBTBFcdmkpOZklqUW6dslcGUsWnWGveAYe8WrPVsZGxifsHYxcnJI CJhI/Djwk6WLkYtDSGA3o8TtSSsZIZxPjBIv7z5nhnA+M0q0nVrMDtOycNEuNojELkaJv6vu sMG1bFl4lhGkik1AU+L1xy9MILaIgLLEs32HwWxmAV2JM+/XsYHYwgIhEnvbpgNN5eBgEVCV uHLfASTMK2Al0T3tHSPEMnmJ1RsOMIPYnALWEjN634BdJCEwnV2i7eA6JogiF4kfx1uhGoQl Xh3fAnWplMTnd3vZIBqaGSV2bN7IDuH0MEo8+NHNBlFlL3Gu6RkryBXMQFev36UPEZaVmHpq HdTRfBK9v59ALeOV2DEPxlaR2LCqE27Zx2MLmUHGSAh4SKw+GQ8JlD5GiZaHZ5knMMrNQtiw gJFxFaNkakFxbnpqsWmBcV5quV5xYm5xaV66XnJ+7iZGcDRree9gfPTgg94hRiYOxkOMEhzM SiK8KkVfE4R4UxIrq1KL8uOLSnNSiw8xSnOwKInzsscDpQTSE0tSs1NTC1KLYLJMHJxSDUxh D3xfOoQfVGO+KvXirsapmtyrbhcfJfLfuiEU+FLkR3rT47UF2X9rneu7XsSUB+2Qy2IO9L6/ d/6C8rbm91u5Ys7sinn5rCV8t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dXXJx4C1Ond9JL8tLdoTeidx8+FMsXk5h4W3 n2OZzz9DePvv7/pSSy3nLc9c99dHLXu9zeVzZ2x7JyqxFGckGmoxFxUnAgBD6RA7hAIAAA== X-CMS-MailID: 20210722052738epcas5p3b6074e49f088159e8282bba3457d56ba X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052738epcas5p3b6074e49f088159e8282bba3457d56ba References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change add a new property to retrieve the PHYs supported by the controller. Reviewed-by: Anupam Roy --- doc/adapter-api.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt index 464434a81..25e370d75 100644 --- a/doc/adapter-api.txt +++ b/doc/adapter-api.txt @@ -335,3 +335,24 @@ Properties string Address [readonly] "peripheral": Supports the peripheral role. "central-peripheral": Supports both roles concurrently. + + array{string} SupportedPhyConfiguration [readonly] + + List of PHYs supported by the controller. + + Possible values: + "BR1M1SLOT" + "BR1M3SLOT" + "BR1M5SLOT" + "EDR2M1SLOT" + "EDR2M3SLOT" + "EDR2M5SLOT" + "EDR3M1SLOT" + "EDR3M3SLOT" + "EDR3M5SLOT" + "LE1MTX" + "LE1MRX" + "LE2MTX" + "LE2MRX" + "LECODEDTX" + "LECODEDRX" From patchwork Thu Jul 22 05:26:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89652C63793 for ; Thu, 22 Jul 2021 05:59:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71BAF60FE7 for ; Thu, 22 Jul 2021 05:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbhGVFSx (ORCPT ); Thu, 22 Jul 2021 01:18:53 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:17554 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbhGVFSw (ORCPT ); Thu, 22 Jul 2021 01:18:52 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210722055926epoutp024251ba0666935f185e150e73b5fa8ba9~UB3WT0dKZ1391413914epoutp02C for ; Thu, 22 Jul 2021 05:59:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210722055926epoutp024251ba0666935f185e150e73b5fa8ba9~UB3WT0dKZ1391413914epoutp02C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933567; bh=Ku/hEMoSqpFJ2TAHVmgIJESpqg6Bhi5eAy2IC3xCa1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejs2XbQOSjE3nmOOnkk69i253Po6uIPrXXlG4GLhN9AnK+1h9x34XQbahBWaTksdZ lFiR68JFkpH/IipKO4YYIQ7NWFwxG/lagFAGuUV9DUpsHv3+HspdSe9Jkhv+C3773m CbUUmeFwD/YDQi4fZ+4yOxXiTNG/slY7tkE8YHCo= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20210722055926epcas5p4c238feec53c177d5bc8d6fb89258882a~UB3WAuiN32438924389epcas5p4c; Thu, 22 Jul 2021 05:59:26 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id D7.72.55882.E3909F06; Thu, 22 Jul 2021 14:59:26 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210722052739epcas5p4412d38b394f51ab195c77c887f0a0aaf~UBbmB86bY2447724477epcas5p46; Thu, 22 Jul 2021 05:27:39 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722052739epsmtrp287b826e05c2c798175234d12796d584f~UBbl-kJAb0040400404epsmtrp2j; Thu, 22 Jul 2021 05:27:39 +0000 (GMT) X-AuditID: b6c32a49-f4fff7000001da4a-54-60f9093e854f Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id D4.F8.08289.AC109F06; Thu, 22 Jul 2021 14:27:39 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052738epsmtip2efdea6c9199f0f6fc4db7e5134eb1350~UBblOVKN20837908379epsmtip2l; Thu, 22 Jul 2021 05:27:38 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 2/7] doc/adapter-api: Add PhyConfiguration property Date: Thu, 22 Jul 2021 10:56:35 +0530 Message-Id: <20210722052640.5863-3-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@sam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PJMWRmVeSWpSXmKPExsWy7bCSvO5pxp8JBv1HGC3urLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4Mp4MuMic8Ep9or2R7eYGhj/s3YxcnJI CJhI9E3bxgJiCwnsYJRYfECki5EDKC4l8XiZDkSJsMTKf8/Zuxi5gEo+MEo87n8F1ssmoCnx +uMXJhBbREBZ4tm+w2A2s4C+xNML1xlBbGEBT4ln92YygsxkEVCVWPWqDMTkFbCSaO8vgxgv L7F6wwFmEJtTwFpiRu8bZohrrCSWftnLNoGRbwEjwypGydSC4tz03GLDAqO81HK94sTc4tK8 dL3k/NxNjOAw0dLawbhn1Qe9Q4xMHIyHGCU4mJVEeFWKviYI8aYkVlalFuXHF5XmpBYfYpTm YFES573QdTJeSCA9sSQ1OzW1ILUIJsvEwSnVwJTp4dvrFqy67Fxk15W473skQ65tYF3Oto9R cu3VCy1cjpWtdW/+avCdWlnEsfKLSAxnTHlGrpEG+zRb5Qkxq6//4so8v911nktZ682iDS1L C+O2flvHemft71n3Tqtc/3nw2fVDF8r2Lt9id75haav7CaOkWrnaaQefu+y5NG/xpzMeex45 HGyruZVSK/YgzWWHWNKuNq8JPpf0LJ8uuWDxijFO/9/z/X9mHbZdlnTOLWiOSnHkS6Hz01yM Jm0K5Z6vs6xx2SvBm67+3J0F7Xw+l3OTj8q3Fkj4fLknpijglx8+4cJ3h/Wml63FVpuuVQna pbjyDccTrRm6pbz82RvUjGSzT63fGfKBc9O/zSxKLMUZiYZazEXFiQCpOuSyggIAAA== X-CMS-MailID: 20210722052739epcas5p4412d38b394f51ab195c77c887f0a0aaf X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052739epcas5p4412d38b394f51ab195c77c887f0a0aaf References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change add a new property which will allow the user to get the controller's current selected PHYs and to change it at any point of time. Reviewed-by: Anupam Roy --- doc/adapter-api.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt index 25e370d75..97af8e70b 100644 --- a/doc/adapter-api.txt +++ b/doc/adapter-api.txt @@ -356,3 +356,17 @@ Properties string Address [readonly] "LE2MRX" "LECODEDTX" "LECODEDRX" + + array{string} PhyConfiguration [readwrite] + + Set/Get the default PHYs to the controller. + + These PHYs will be used for all the + subsequent scanning and connection initiation. + + The value of this property is persistent. After + restart or unplugging of the adapter it will continue + with the last set PHYs. + + Refer SupportedPhyConfiguration property + for the possible values. From patchwork Thu Jul 22 05:26:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88ABCC6377D for ; Thu, 22 Jul 2021 05:59:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 648AB60FE7 for ; Thu, 22 Jul 2021 05:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbhGVFS5 (ORCPT ); Thu, 22 Jul 2021 01:18:57 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:43777 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbhGVFS4 (ORCPT ); Thu, 22 Jul 2021 01:18:56 -0400 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210722055931epoutp047ed3cba0a902c1885ef076da4a8c0984~UB3aUun000482404824epoutp04N for ; Thu, 22 Jul 2021 05:59:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210722055931epoutp047ed3cba0a902c1885ef076da4a8c0984~UB3aUun000482404824epoutp04N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933571; bh=8U5CBh6ZNg6S2y27qfyL25GAfE4R9EU8YGFjHonZbrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h97EPTXfWfCZwE3ChVPmtjAlAH0oflNajmoVaMMAHK4RBvUdR9cquHj6OOQsklX5D O4t+LxaSXDyoTXKd5jiUZ2na/WWtfJBSrWOLejzEwig6LDjaMvj8tQM0WCNWdOOeV3 KzRlFVqEBz0SmhpeVWMBW11d/kDrHglTKjwmtIjM= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20210722055930epcas5p45f14bdd66e56954538f130bd26ee512c~UB3ZxZAXR1890418904epcas5p4K; Thu, 22 Jul 2021 05:59:30 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 8A.72.55882.24909F06; Thu, 22 Jul 2021 14:59:30 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20210722052740epcas5p1fce869a24434f376d111e9e5d4b208eb~UBbnAK4ky2035920359epcas5p1I; Thu, 22 Jul 2021 05:27:40 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722052740epsmtrp20b4173b2eb91d40fc903a3c7c1f2d0ef~UBbm-coZU0094500945epsmtrp2B; Thu, 22 Jul 2021 05:27:40 +0000 (GMT) X-AuditID: b6c32a49-f65ff7000001da4a-63-60f909427cca Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 35.F8.08289.BC109F06; Thu, 22 Jul 2021 14:27:39 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052739epsmtip23067e73199277b3a5ef702f5ed841b40~UBbmIIm000694006940epsmtip2U; Thu, 22 Jul 2021 05:27:39 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 3/7] adapter: Add support for get/set phy configuration property Date: Thu, 22 Jul 2021 10:56:36 +0530 Message-Id: <20210722052640.5863-4-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7bCmlq4T588Eg2W3hSzurLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4Mq4u/ABW8Edz4qT7xexNzAetOli5OSQ EDCRuLT+EmMXIxeHkMBuRomlrw6zQzifGCVm/jzEBuF8ZpT4sXwdM0zL3B9tUIldjBJ/b58A S0C03DAHsdkENCVef/zCBGKLCChLPNt3GMxmFtCVOPN+HRuILSwQIfHuzQewXhYBVYmvLy6x g9i8AlYSp2+9glomL7F6wwEwm1PAWmJG7xtmkMUSAv3sElv3vWKCKHKR2PRpI1SDsMSr41vY IWwpic/v9rJBNDQzSuzYvJEdwulhlHjwo5sNospe4lzTM9YuRg6g8zQ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bUgtQgmy8TBKdXAdIzhyqn4I6sVfFX4dGJaZ26LVmAuvPbjrLSx x/Vy1eK/TDIbJbdqXDsrV1qYskz3xYTdifzuu7geTL/TPLUmn7Mg1jU9vCXzPM+cI1Gy21XX tGSvfnBgb5PcrodnXKaIPzCoP8q470jDXWuuTMd5zyZy6uw3vx/Rs+X1i+3LPb9XnJ6mvJ7d o2HhvY/Xlu+INrhr9tJuSp5FwqWcRV0fPcpVTO+Vdjj9Op9661Sx8u5nCdMmnTL8lbR9n6uI Sp7rdIMlNxh52O1PMD4JWtXIWCUZHSHyv43RcRdvJ3vDxdAPdRNDVVLXvWCd0vlkst5Uhud7 vder/mNYGrVpr1OY2Zew850nfaZeaKh9qO7hq8RSnJFoqMVcVJwIANLDrw2EAgAA X-CMS-MailID: 20210722052740epcas5p1fce869a24434f376d111e9e5d4b208eb X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052740epcas5p1fce869a24434f376d111e9e5d4b208eb References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change introduces a new adapter property(PhyConfiguration) which will be used to read and set controller's PHY. This property is based upon MGMT_OP_GET_PHY_CONFIGURATION and MGMT_OP_SET_PHY_CONFIGURATION operations. Reviewed-by: Anupam Roy --- src/adapter.c | 282 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 282 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index 12e4ff5c0..fd4c654dc 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -285,6 +285,11 @@ struct btd_adapter { bool le_simult_roles_supported; bool quality_report_supported; + + uint32_t supported_phys; + uint32_t configurable_phys; + uint32_t selected_phys; + uint32_t pending_phys; }; typedef enum { @@ -3245,6 +3250,237 @@ static gboolean property_get_roles(const GDBusPropertyTable *property, return TRUE; } +static struct phys_config { + uint32_t flag; + const char *name; +} phys_str[] = { + { MGMT_PHY_BR_1M_1SLOT, "BR1M1SLOT" }, + { MGMT_PHY_BR_1M_3SLOT, "BR1M3SLOT" }, + { MGMT_PHY_BR_1M_5SLOT, "BR1M5SLOT" }, + { MGMT_PHY_EDR_2M_1SLOT, "EDR2M1SLOT" }, + { MGMT_PHY_EDR_2M_3SLOT, "EDR2M3SLOT" }, + { MGMT_PHY_EDR_2M_5SLOT, "EDR2M5SLOT" }, + { MGMT_PHY_EDR_3M_1SLOT, "EDR3M1SLOT" }, + { MGMT_PHY_EDR_3M_3SLOT, "EDR3M3SLOT" }, + { MGMT_PHY_EDR_3M_5SLOT, "EDR3M5SLOT" }, + { MGMT_PHY_LE_1M_TX, "LE1MTX" }, + { MGMT_PHY_LE_1M_RX, "LE1MRX" }, + { MGMT_PHY_LE_2M_TX, "LE2MTX" }, + { MGMT_PHY_LE_2M_RX, "LE2MRX" }, + { MGMT_PHY_LE_CODED_TX, "LECODEDTX" }, + { MGMT_PHY_LE_CODED_RX, "LECODEDRX" } +}; + +static void append_phys_str(DBusMessageIter *array, uint32_t phys) +{ + unsigned int i; + + for (i = 0; i < NELEM(phys_str); i++) { + if (phys & phys_str[i].flag) + dbus_message_iter_append_basic(array, DBUS_TYPE_STRING, + &phys_str[i].name); + } +} + +static bool parse_phys_str(DBusMessageIter *array, uint32_t *phys) +{ + const char *str; + unsigned int i; + + *phys = 0; + + do { + if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_STRING) + return false; + + dbus_message_iter_get_basic(array, &str); + + for (i = 0; i < NELEM(phys_str); i++) { + if (!strcmp(str, phys_str[i].name)) { + *phys |= phys_str[i].flag; + break; + } + } + + if (i == NELEM(phys_str)) + return false; + } while (dbus_message_iter_next(array)); + + return true; +} + +static void set_default_phy_complete(uint8_t status, uint16_t length, + const void *param, void *user_data) +{ + struct property_set_data *data = user_data; + struct btd_adapter *adapter = data->adapter; + + if (status != MGMT_STATUS_SUCCESS) { + adapter->pending_phys = 0; + btd_error(adapter->dev_id, + "Failed to set PHY configuration: %s (0x%02x)", + mgmt_errstr(status), status); + g_dbus_pending_property_error(data->id, ERROR_INTERFACE ".Failed", + mgmt_errstr(status)); + return; + } + + /* The default phys are successfully set. */ + btd_info(adapter->dev_id, "PHY configuration successfully set"); + + adapter->selected_phys = adapter->pending_phys; + adapter->pending_phys = 0; + + g_dbus_pending_property_success(data->id); + + g_dbus_emit_property_changed(dbus_conn, adapter->path, + ADAPTER_INTERFACE, "PhyConfiguration"); +} + +static int set_default_phy(struct btd_adapter *adapter, uint32_t phys, + GDBusPendingPropertySet id) +{ + struct mgmt_cp_set_phy_confguration cp; + struct property_set_data *data; + uint32_t unconfigure_phys; + + if (!phys) { + btd_error(adapter->dev_id, + "Set PHY configuration failed: No supplied phy(s)"); + return -EINVAL; + } + + if (phys & ~(adapter->supported_phys)) { + btd_error(adapter->dev_id, + "Set PHY configuration failed: supplied phy(s) is not supported"); + return -EINVAL; + } + + if (phys == adapter->selected_phys) { + DBG("PHYs are already set [0x%x]", phys); + g_dbus_pending_property_success(id); + return 0; + } + + unconfigure_phys = adapter->supported_phys & ~(adapter->configurable_phys); + + if ((phys & unconfigure_phys) != unconfigure_phys) { + btd_error(adapter->dev_id, + "Set PHY configuration failed: supplied phy(s) must include PHYs %u", + unconfigure_phys); + return -EINVAL; + } + + if (adapter->pending_phys) { + btd_error(adapter->dev_id, + "Set PHY configuration failed: Operation in progress"); + return -EINPROGRESS; + } + + adapter->pending_phys = phys; + + cp.selected_phys = cpu_to_le32(phys); + + data = g_try_new0(struct property_set_data, 1); + if (!data) + goto failed; + + data->adapter = adapter; + data->id = id; + + DBG("sending set phy configuration command for index %u", adapter->dev_id); + + if (mgmt_send(adapter->mgmt, MGMT_OP_SET_PHY_CONFIGURATION, + adapter->dev_id, sizeof(cp), &cp, + set_default_phy_complete, data, g_free) > 0) + return 0; + + g_free(data); + +failed: + btd_error(adapter->dev_id, "Failed to set PHY configuration for index %u", + adapter->dev_id); + adapter->pending_phys = 0; + + return -EIO; +} + +static gboolean property_get_phy_configuration( + const GDBusPropertyTable *property, + DBusMessageIter *iter, void *user_data) +{ + struct btd_adapter *adapter = user_data; + DBusMessageIter array; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "s", &array); + + append_phys_str(&array, adapter->selected_phys); + + dbus_message_iter_close_container(iter, &array); + + return TRUE; +} + +static void property_set_phy_configuration( + const GDBusPropertyTable *property, + DBusMessageIter *iter, + GDBusPendingPropertySet id, void *user_data) +{ + struct btd_adapter *adapter = user_data; + DBusMessageIter array; + uint32_t phys; + int ret; + + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY) { + ret = -EINVAL; + goto failed; + } + + dbus_message_iter_recurse(iter, &array); + + if (!(adapter->supported_settings & MGMT_SETTING_PHY_CONFIGURATION)) { + ret = -ENOTSUP; + goto failed; + } + + if (!parse_phys_str(&array, &phys)) { + ret = -EINVAL; + goto failed; + } + + ret = set_default_phy(adapter, phys, id); + + /* + * gdbus_pending_property_success event will be sent when success status + * will be received from mgmt. + */ + if (!ret) + return; + +failed: + switch (-ret) { + case EINVAL: + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".InvalidArguments", + "Invalid arguments in method call"); + break; + case ENOTSUP: + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".NotSupported", + "Operation is not supported"); + break; + case EINPROGRESS: + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".InProgress", + "Operation is in progress"); + break; + default: + g_dbus_pending_property_error(id, ERROR_INTERFACE ".Failed", + strerror(-ret)); + break; + } +} + static DBusMessage *remove_device(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -3517,6 +3753,8 @@ static const GDBusPropertyTable adapter_properties[] = { { "Modalias", "s", property_get_modalias, NULL, property_exists_modalias }, { "Roles", "as", property_get_roles }, + { "PhyConfiguration", "as", property_get_phy_configuration, + property_set_phy_configuration }, { } }; @@ -9389,6 +9627,43 @@ static void read_exp_features(struct btd_adapter *adapter) btd_error(adapter->dev_id, "Failed to read exp features info"); } +static void read_phy_configuration_resp(uint8_t status, uint16_t length, + const void *param, void *user_data) +{ + const struct mgmt_rp_get_phy_confguration *rp = param; + struct btd_adapter *adapter = user_data; + + if (status != MGMT_STATUS_SUCCESS) { + btd_error(adapter->dev_id, + "Failed to get PHY configuration info: %s (0x%02x)", + mgmt_errstr(status), status); + return; + } + + if (length < sizeof(*rp)) { + btd_error(adapter->dev_id, "Response too small"); + return; + } + + adapter->supported_phys = get_le32(&rp->supported_phys); + adapter->configurable_phys = get_le32(&rp->configurable_phys); + adapter->selected_phys = get_le32(&rp->selected_phys); + + DBG("Supported phys: [0x%x]", adapter->supported_phys); + DBG("Configurable phys: [0x%x]", adapter->configurable_phys); + DBG("Selected phys: [0x%x]", adapter->selected_phys); +} + +static void read_phy_configuration(struct btd_adapter *adapter) +{ + if (mgmt_send(adapter->mgmt, MGMT_OP_GET_PHY_CONFIGURATION, + adapter->dev_id, 0, NULL, read_phy_configuration_resp, + adapter, NULL) > 0) + return; + + btd_error(adapter->dev_id, "Failed to read phy configuration info"); +} + static void read_info_complete(uint8_t status, uint16_t length, const void *param, void *user_data) { @@ -9498,6 +9773,13 @@ static void read_info_complete(uint8_t status, uint16_t length, (missing_settings & MGMT_SETTING_FAST_CONNECTABLE)) set_mode(adapter, MGMT_OP_SET_FAST_CONNECTABLE, 0x01); + if (btd_opts.experimental && + btd_has_kernel_features(KERNEL_EXP_FEATURES)) + read_exp_features(adapter); + + if (adapter->supported_settings & MGMT_SETTING_PHY_CONFIGURATION) + read_phy_configuration(adapter); + err = adapter_register(adapter); if (err < 0) { btd_error(adapter->dev_id, "Unable to register new adapter"); From patchwork Thu Jul 22 05:26:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9338C63793 for ; Thu, 22 Jul 2021 05:59:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9A1C61244 for ; Thu, 22 Jul 2021 05:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbhGVFTB (ORCPT ); Thu, 22 Jul 2021 01:19:01 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:47922 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbhGVFTA (ORCPT ); Thu, 22 Jul 2021 01:19:00 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210722055935epoutp01936c2614460ae78fc4ce0730e3999872~UB3d7zqnp1854918549epoutp019 for ; Thu, 22 Jul 2021 05:59:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210722055935epoutp01936c2614460ae78fc4ce0730e3999872~UB3d7zqnp1854918549epoutp019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933575; bh=+10zOpJewNqhRy9kORWki5Ijl1Zb0ULOKm2TwsGLDds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hKqTMeSzMsJbzYu0IQ03ru3tCGxECObqjMWG0Dns6PF5OjndDZ7Ko8V18gnCG+mwn oq1Ru54gk9+BfGpYug/80X8CxmUlFaxD+gemojOvl427QuQIfvvi5gD6UEHrda8KKb CMMwqzmjSTESyXhW4ZOLBtGOd7kgfp8VfeOz4Va0= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20210722055934epcas5p3ca56e66230f501759022bed00fafccf8~UB3c8mdBN0717107171epcas5p3A; Thu, 22 Jul 2021 05:59:34 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 27.6A.09595.54909F06; Thu, 22 Jul 2021 14:59:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20210722052741epcas5p2cb3cbad65a301b0ec0cf1780c0920103~UBbnw4ITq3201732017epcas5p2F; Thu, 22 Jul 2021 05:27:41 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722052741epsmtrp16bce4c6d74546d41fe923e1a9891d685~UBbnwGyhK2024420244epsmtrp1c; Thu, 22 Jul 2021 05:27:41 +0000 (GMT) X-AuditID: b6c32a4a-ed5ff7000000257b-25-60f9094535cc Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 20.91.08394.CC109F06; Thu, 22 Jul 2021 14:27:40 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052740epsmtip251830a0fa8c2109661a8174e713ef5ec~UBbnCUWL70837808378epsmtip2V; Thu, 22 Jul 2021 05:27:40 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 4/7] adapter: Add support for the get supported phy property Date: Thu, 22 Jul 2021 10:56:37 +0530 Message-Id: <20210722052640.5863-5-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7bCmpq4r588Eg58XdS3urLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4MroOrCFseADV8X9tduYGxj/cHQxcnJI CJhIfDiwihnEFhLYzSjRcUami5ELyP7EKHFk4wQ2COcbo8Tpy7cZYTpm/17ABJHYyyhxb/5R driWaVM2g1WxCWhKvP74hQnEFhFQlni27zCYzSygK3Hm/To2EFtYIERiadtKdhCbRUBV4nt3 I1gNr4CVxLr/7awQ2+QlVm84AHYfp4C1xIzeN8wgyyQEJrNL/J83E6rIRWLJ4oNQtrDEq+Nb 2CFsKYmX/W3sEA3NjBI7Nm+EcnoYJR786GaDqLKXONf0DKibA+g8TYn1u/QhwrISU0+tg7qa T6L39xMmiDivxI55MLaKxIZVnXDLPh5byAxhe0gsXH2PCRKqfYwSyx8HTWCUm4WwYQEj4ypG ydSC4tz01GLTAqO81HK94sTc4tK8dL3k/NxNjOBo1vLawfjwwQe9Q4xMHIyHGCU4mJVEeFWK viYI8aYkVlalFuXHF5XmpBYfYpTmYFES52WPB0oJpCeWpGanphakFsFkmTg4pRqYNhxfdJ5f OmxV/MSXL9TL5sxatcfCwq9v/paJlW5r4pbPfvxNPzzS+JtwUs3D8GVFgvkCCb3h3xf+khZd tzT79Q27Nc96/PRVmm6W7qsxPHHf+/m07zGS8rIJx+Pvs1YU6fxREG6bf1r0XtfB1MDql44v Z034LCoQbmrMFmlQFuIrZiV4uIXV8NqpX6HRK07/j5X9HxCZbpF97P/t5MU60me/dRSx8lZt 658THy/7J0+m3vpDR3rix/p7QjfuWsut4nM/Ff/tesHma3ksdVYZO8+JeXFeqmfZtbFM0/sX 47lHJw7unaodUDhLqMYrd2/m5JM/Emt2GZU0ZF1U3tl+aHbqzz1r1LbWic5vtt+ixFKckWio xVxUnAgAacMFE1UDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIJMWRmVeSWpSXmKPExsWy7bCSvO4Zxp8JBsf2WlncWW1tMedaH7PF tnXtzA7MHn1bVjF6fN4kF8AUxWWTkpqTWZZapG+XwJXRdWALY8EHror7a7cxNzD+4ehi5OSQ EDCRmP17AVMXIxeHkMBuRomZtx8ydzFyACWkJB4v04GoEZZY+e85O4gtJPCBUeLcWU8Qm01A U+L1xy9MILaIgLLEs32HwWxmAX2JpxeuM4LYwgJBEucef2IBsVkEVCW+dzeC1fAKWEms+9/O CjFfXmL1hgPMIDangLXEjN43zBC7rCSWftnLNoGRbwEjwypGydSC4tz03GLDAsO81HK94sTc 4tK8dL3k/NxNjOBQ0dLcwbh91Qe9Q4xMHIyHGCU4mJVEeFWKviYI8aYkVlalFuXHF5XmpBYf YpTmYFES573QdTJeSCA9sSQ1OzW1ILUIJsvEwSnVwNS9rujpt8c/rv87xLfi+AemPS1sjzvP RXRWL+GV2rf86YJkwWZ2m1rd8/J7Wjm66nZq7vpWxFf1YZeIiXGqg9bm3+npXrv4MuvkZj9/ +K+fX1tY+dn88x89+RtjjXpW2taUeHbsuty7cWeG+LavXyzP2PSs3BrqLzxb/UDgLRkOj8zN 8R999ezSvydebkkKE1dRe9RwWFGmNnRloXK8087JG7e9ebT0dUnzznUh9hy3yxfuv2P25kjS yWdX15QfEpoid2qHzmnFTb9UJFfF8praBIksP2eVLvC7jdfL8cGfWyuCljzOin1ySG3J1Ke9 55Mb+xNtTEImecZYhlqkfDLd0OnNrR3bH3lr2wGPP0osxRmJhlrMRcWJAIqsDqWEAgAA X-CMS-MailID: 20210722052741epcas5p2cb3cbad65a301b0ec0cf1780c0920103 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052741epcas5p2cb3cbad65a301b0ec0cf1780c0920103 References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change introduces a new adapter property which will allow user to get the adapter supported PHYs. Reviewed-by: Anupam Roy --- src/adapter.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index fd4c654dc..c64a5333d 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -3405,6 +3405,22 @@ failed: return -EIO; } +static gboolean property_get_supported_phy( + const GDBusPropertyTable *property, + DBusMessageIter *iter, void *user_data) +{ + struct btd_adapter *adapter = user_data; + DBusMessageIter array; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "s", &array); + + append_phys_str(&array, adapter->supported_phys); + + dbus_message_iter_close_container(iter, &array); + + return TRUE; +} + static gboolean property_get_phy_configuration( const GDBusPropertyTable *property, DBusMessageIter *iter, void *user_data) @@ -3753,6 +3769,8 @@ static const GDBusPropertyTable adapter_properties[] = { { "Modalias", "s", property_get_modalias, NULL, property_exists_modalias }, { "Roles", "as", property_get_roles }, + { "SupportedPhyConfiguration", "as", property_get_supported_phy, + NULL}, { "PhyConfiguration", "as", property_get_phy_configuration, property_set_phy_configuration }, { } From patchwork Thu Jul 22 05:26:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 752E9C6377D for ; Thu, 22 Jul 2021 05:59:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57ED861244 for ; Thu, 22 Jul 2021 05:59:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230088AbhGVFTE (ORCPT ); Thu, 22 Jul 2021 01:19:04 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:17714 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbhGVFTD (ORCPT ); Thu, 22 Jul 2021 01:19:03 -0400 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210722055938epoutp02b2518824b564edfb229ef0f4c5cb3667~UB3grX3h31391413914epoutp02I for ; Thu, 22 Jul 2021 05:59:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210722055938epoutp02b2518824b564edfb229ef0f4c5cb3667~UB3grX3h31391413914epoutp02I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933578; bh=VYi8m00j+Zc7e8blA7w08sfGYaVxcsRHyuW/+Vw29hI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0lbf3L9Njut7vZRxCZaib4PRPADksqYAgMn3Q0WCim4JRUESaLloPgKUbHNwQYML GDD+FqgmP6R2brEtYU6X+Ds9Esal1t6t0jUbVbj4yfvBEM6dAU4S2WEx/xFjXhOk35 s310ZHRCzy0IQFjPDkzLLovvskcoL+GlC/YWnGYU= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20210722055937epcas5p4d66c2b9da389f37e00b9d1f1c7934d2c~UB3gCdkFW2202722027epcas5p4I; Thu, 22 Jul 2021 05:59:37 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id BD.72.55882.84909F06; Thu, 22 Jul 2021 14:59:36 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20210722052742epcas5p1b53db2cd68028170a86f291bd052bf14~UBbotMaDg1801618016epcas5p1g; Thu, 22 Jul 2021 05:27:42 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722052742epsmtrp2a46cd7161b8fe3adebc48c3490e39b4c~UBbosljIJ0094500945epsmtrp2D; Thu, 22 Jul 2021 05:27:42 +0000 (GMT) X-AuditID: b6c32a49-f4fff7000001da4a-7a-60f909482b58 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 95.F8.08289.DC109F06; Thu, 22 Jul 2021 14:27:41 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052741epsmtip262374b4d09145238197a36e68e0a226b~UBbn8oVbT0848808488epsmtip2I; Thu, 22 Jul 2021 05:27:41 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 5/7] adapter: Add support for PHY Configuration Changed event Date: Thu, 22 Jul 2021 10:56:38 +0530 Message-Id: <20210722052640.5863-6-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7bCmlq4n588EgzuuFndWW1vMudbHbLFt XTuzA7NH35ZVjB6fN8kFMEVx2aSk5mSWpRbp2yVwZdz9ep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NB3nLGLkYtDSGAHo8TnGf+AHA6ghJTE42U6EDXCEiv/PWeHqPnAKDHx8HJ2kASbgKbE 649fmEBsEQFliWf7DoPZzAL6Ek8vXAebIywQLHH6YgyIySKgKnHoeRKIyStgJXFjHdQF8hKr NxxgBrE5BawlZvS+AbOFgEqWftnLNoGRbwEjwypGydSC4tz03GLDAqO81HK94sTc4tK8dL3k /NxNjOAw0dLawbhn1Qe9Q4xMHIyHGCU4mJVEeFWKviYI8aYkVlalFuXHF5XmpBYfYpTmYFES 573QdTJeSCA9sSQ1OzW1ILUIJsvEwSnVwKR01TW0WkfiUJ68wFUhjYeNkZd/LObbkvBBzeGW 1JNjd2q+Sc3+GKuopbXfjpf38PKN7kJrbR/2JThMs+w1O63xptmsXoMltb5JeJqLeM4Wr14b VYOyluSMdfYhO5p339sUPu/ALG/JLJ+Nmi9+TNu0UC0zSPya2Rth09bdWtbTV/UALUkwf1Jy syLga2LSmp8Ss85ayZrafWtcHb39i/n8/X+e1DOXSus+WNoQ2pT577JvjkqA2//SL2rbjkxc X14V8rheK9nEa9WxwFcTLT7dK3U+tingMOc09w9FE1Zqy7+YlP3zd97bgOeHl3kdWpwoebVt e6j6pytM/v+8KgRetbmc+qW47RVD9CYfJZbijERDLeai4kQAUoJf94ICAAA= X-CMS-MailID: 20210722052742epcas5p1b53db2cd68028170a86f291bd052bf14 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052742epcas5p1b53db2cd68028170a86f291bd052bf14 References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change will subscribe the MGTM PHY Configuration Changed event. This event will come whenever the controller PHYs changed. Upon receiving the event, it will notify the user by emitting "PhyConfiguration" property changed event. Reviewed-by: Anupam Roy --- src/adapter.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index c64a5333d..84dd2e5bd 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -9682,6 +9682,28 @@ static void read_phy_configuration(struct btd_adapter *adapter) btd_error(adapter->dev_id, "Failed to read phy configuration info"); } +static void phy_configuration_changed_callback(uint16_t index, + uint16_t length, const void *param, + void *user_data) +{ + const struct mgmt_ev_phy_configuration_changed *ev = param; + struct btd_adapter *adapter = user_data; + + if (length < sizeof(*ev)) { + btd_error(adapter->dev_id, + "Too small PHY configuration changed event"); + return; + } + + adapter->selected_phys = get_le32(&ev->selected_phys); + info("PHYs changed, New PHYs [0x%x]", adapter->selected_phys); + + adapter->pending_phys = 0; + + g_dbus_emit_property_changed(dbus_conn, adapter->path, + ADAPTER_INTERFACE, "PhyConfiguration"); +} + static void read_info_complete(uint8_t status, uint16_t length, const void *param, void *user_data) { @@ -9917,6 +9939,11 @@ static void read_info_complete(uint8_t status, uint16_t length, controller_resume_callback, adapter, NULL); + mgmt_register(adapter->mgmt, MGMT_EV_PHY_CONFIGURATION_CHANGED, + adapter->dev_id, + phy_configuration_changed_callback, + adapter, NULL); + set_dev_class(adapter); set_name(adapter, btd_adapter_get_name(adapter)); From patchwork Thu Jul 22 05:26:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 995EEC63793 for ; Thu, 22 Jul 2021 05:59:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EEC26120C for ; Thu, 22 Jul 2021 05:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbhGVFTH (ORCPT ); Thu, 22 Jul 2021 01:19:07 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:48038 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbhGVFTG (ORCPT ); Thu, 22 Jul 2021 01:19:06 -0400 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210722055941epoutp01e09889a6a81be821ebc976f67474c463~UB3joKRr41867818678epoutp011 for ; Thu, 22 Jul 2021 05:59:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210722055941epoutp01e09889a6a81be821ebc976f67474c463~UB3joKRr41867818678epoutp011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933581; bh=EUChzWKcOMrlauR7u+IEDeWBTjjDHcEGJ3f050q2Uec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QRb9t1l1TJfpxNT6d4jPMO3QMpVWsJUhPpI8+iQzb7MDGJMurZk2jHWiCZQ/0bZW8 Laq6xZkzJbhg9kavDEwuOikeECp7U1ac/EwNZ7LWLtO4esU5qJ3UXJ7CkCl4VeICtH BKn0qPmsWwau/n+gFK+Y77D5n3gx8XVc9waXv/6I= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20210722055940epcas5p381c52bf95fdff4d4a527cd150ad8b150~UB3jSubBH0717107171epcas5p3E; Thu, 22 Jul 2021 05:59:40 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id CD.6A.09595.C4909F06; Thu, 22 Jul 2021 14:59:40 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20210722052743epcas5p34af6f55c11db2e8909c2730fae7e1cac~UBbpl7Orb1662316623epcas5p33; Thu, 22 Jul 2021 05:27:43 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722052743epsmtrp2c71eef4f0532502dc569bb90005b1be6~UBbplNlk70094500945epsmtrp2F; Thu, 22 Jul 2021 05:27:43 +0000 (GMT) X-AuditID: b6c32a4a-eebff7000000257b-40-60f9094cd075 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F0.91.08394.EC109F06; Thu, 22 Jul 2021 14:27:42 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052742epsmtip2238d96986118fbf5fb0810618db16aee~UBbo2sDSM0837808378epsmtip2W; Thu, 22 Jul 2021 05:27:42 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 6/7] client: Add support for get/set PHY configuration in bluetoothctl Date: Thu, 22 Jul 2021 10:56:39 +0530 Message-Id: <20210722052640.5863-7-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7bCmhq4P588Egx/PFC3urLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4Mro2JxSME+morVpKXsD42vxLkZODgkB E4nur51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5b/n7BA1Hxgljp5YwgiSYBPQlHj9 8QsTiC0ioCzxbN9hMJtZQF/i6YXrYDXCAjESUx89BouzCKhKdD5bzQ5i8wpYSfx+uYMZYoG8 xOoNB8BsTgFriRm9b8BsIaCapV/2sk1g5FvAyLCKUTK1oDg3PbfYsMAwL7Vcrzgxt7g0L10v OT93EyM4VLQ0dzBuX/VB7xAjEwfjIUYJDmYlEV6Voq8JQrwpiZVVqUX58UWlOanFhxilOViU xHkvdJ2MFxJITyxJzU5NLUgtgskycXBKNTBdMP7RUcb6bPFkr02ia6ZHzj24qK61dOabeYV3 NIumLT11vWnf/Pm7Dim7rdeyZj7t8fD9QtV5i2ZuqZvs6/DV0ny25q8L/u+mfNiWnz71Hvee l9O4jjVd91d2awiTPn4t7toL5vlFP49InNu8yzzlYb/76vcTtoT7mS+s3pwe3GBQuyzHwYfp EnMFS7hllihzm0li9YfSK93uC4676/Cmy2vF113vLVI6kMMpLRkukSLxOoehOidd8GvMjnnn Xrtel40qiDv3XnDdp199AvdvxcW6XJ58WvaNd9hjeZfmh4+fPf7y2brKW+bPhPTOfc+E911Z eGOJXUDuL9El19Pn7S8IYJpivKH8kYl4ra+QEktxRqKhFnNRcSIA5BPu4YQCAAA= X-CMS-MailID: 20210722052743epcas5p34af6f55c11db2e8909c2730fae7e1cac X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052743epcas5p34af6f55c11db2e8909c2730fae7e1cac References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Verification logs based on BT 5.0 controller ============================================== [bluetooth] default-phy LE1MTX LE2MTX LE1MRX LE2MRX LECODEDTX LECODEDRX [bluetooth] Changing PHY Configuration succeeded Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE1MTX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE1MRX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE2MTX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LE2MRX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LECODEDTX Controller D6:C9:16:E8:6A:D9 PhyConfiguration: LECODEDRX Verification logs based on BT 4.0 controller ============================================= [bluetooth]# default-phy Supported phys: BR1M1SLOT Supported phys: BR1M3SLOT Supported phys: BR1M5SLOT Supported phys: EDR2M1SLOT Supported phys: EDR2M3SLOT Supported phys: EDR2M5SLOT Supported phys: EDR3M1SLOT Supported phys: EDR3M3SLOT Supported phys: EDR3M5SLOT Supported phys: LE1MTX Supported phys: LE1MRX Selected phys: BR1M1SLOT Selected phys: LE1MTX Selected phys: LE1MRX [bluetooth]# default-phy BR1M1SLOT LE1MTX LE1MRX BR1M3SLOT Changing PHY Configuration succeeded [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: BR1M1SLOT [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: BR1M3SLOT [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: LE1MTX [CHG] Controller 00:1A:7D:DA:71:14 PhyConfiguration: LE1MRX Reviewed-by: Anupam Roy --- client/main.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/client/main.c b/client/main.c index c1a62edb7..ab925769b 100644 --- a/client/main.c +++ b/client/main.c @@ -934,6 +934,8 @@ static void cmd_show(int argc, char *argv[]) print_property(adapter->proxy, "Modalias"); print_property(adapter->proxy, "Discovering"); print_property(adapter->proxy, "Roles"); + print_property(adapter->proxy, "SupportedPhyConfiguration"); + print_property(adapter->proxy, "PhyConfiguration"); if (adapter->ad_proxy) { bt_shell_printf("Advertising Features:\n"); @@ -2038,6 +2040,37 @@ static void cmd_disconn(int argc, char *argv[]) proxy_address(proxy)); } +static void get_phy_configuration(void) +{ + print_property_with_label(default_ctrl->proxy, + "SupportedPhyConfiguration", "Supported phys"); + + print_property_with_label(default_ctrl->proxy, "PhyConfiguration", + "Selected phys"); +} + +static void cmd_phy_configuration(int argc, char *argv[]) +{ + char **phys = NULL; + size_t phys_len = 0; + + if (check_default_ctrl() == FALSE) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + if (argc < 2 || !strlen(argv[1])) + return get_phy_configuration(); + + phys = g_strdupv(&argv[1]); + phys_len = g_strv_length(phys); + + g_dbus_proxy_set_property_array(default_ctrl->proxy, + "PhyConfiguration", DBUS_TYPE_STRING, phys, + phys_len, generic_callback, "PHY Configuration", + NULL); + + g_strfreev(phys); +} + static void cmd_list_attributes(int argc, char *argv[]) { GDBusProxy *proxy; @@ -3033,6 +3066,12 @@ static const struct bt_shell_menu main_menu = { dev_generator }, { "disconnect", "[dev]", cmd_disconn, "Disconnect device", dev_generator }, + { "default-phy", "[LE1MTX] [LE1MRX] [LE2MTX] [LE2MRX] " + "[LECODEDTX] [LECODEDRX] " + "[BR1M1SLOT] [BR1M3SLOT] [BR1M5SLOT] " + "[EDR2M1SLOT] [EDR2M3SLOT] [EDR2M5SLOT] " + "[EDR3M1SLOT] [EDR3M3SLOT] [EDR3M5SLOT]", + cmd_phy_configuration, "Get/Set PHY Configuration" }, { } }, }; From patchwork Thu Jul 22 05:26:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAC8EC6377D for ; Thu, 22 Jul 2021 05:59:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 934F660FE7 for ; Thu, 22 Jul 2021 05:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230330AbhGVFTN (ORCPT ); Thu, 22 Jul 2021 01:19:13 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:48114 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbhGVFTK (ORCPT ); Thu, 22 Jul 2021 01:19:10 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210722055945epoutp01b00239ee135cc4af52ffc545d7e0f947~UB3nh4-BL1720917209epoutp01O for ; Thu, 22 Jul 2021 05:59:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210722055945epoutp01b00239ee135cc4af52ffc545d7e0f947~UB3nh4-BL1720917209epoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933585; bh=yvLhXLJo1gC7HS333Qbuv5u1JDJYWuVzLFpYxe56V20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mZllkImtjMLq+H0gzLJr9bDIfTzDZMxwg4DUUYTStDi3hHSpVnVPtOWbAiXNES7fP uiTg+UE8UFZFIraYVStJKRkDA4EyPsdFMIHHEqUd1s5mUEkqL3zwNA772TR3EGJ4A3 t4HmxMNU3mZVfJumwqGk0/Ij6l8CuxaxA2Uw1Muo= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20210722055944epcas5p40b71697b2264707675b2ddb5c57585b7~UB3m_q-6m1890418904epcas5p4d; Thu, 22 Jul 2021 05:59:44 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 78.DA.11627.05909F06; Thu, 22 Jul 2021 14:59:44 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210722052744epcas5p46996d48d12500c39b4b63dfcecd30d37~UBbqkvSTs2470224702epcas5p46; Thu, 22 Jul 2021 05:27:44 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722052744epsmtrp2ea4a84d369d2fd698dcbba2fde7cb175~UBbqj1DrS0094500945epsmtrp2I; Thu, 22 Jul 2021 05:27:44 +0000 (GMT) X-AuditID: b6c32a4b-acdff70000022d6b-e0-60f90950e30c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 46.F8.08289.FC109F06; Thu, 22 Jul 2021 14:27:43 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210722052743epsmtip2ea20deabdf9a767dfa56b4d092af9aaa~UBbpwbzwe0848408484epsmtip2N; Thu, 22 Jul 2021 05:27:43 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 7/7] adapter: Save PHY Configuration in storage and read it at init Date: Thu, 22 Jul 2021 10:56:40 +0530 Message-Id: <20210722052640.5863-8-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722052640.5863-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7bCmpm4A588Eg+Pd4hZ3VltbzLnWx2yx bV07swOzR9+WVYwenzfJBTBFcdmkpOZklqUW6dslcGU8uDGLpaBXsuLR7jksDYyf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8TzXdeAHA6ghJTE42U6EDXCEiv/PWeHqPnAKLH41X5mkASbgKbE 649fmEBsEQFliWf7DoPZzAL6Ek8vXGcEsYUFIiVmznoFVs8ioCpxqns6G4jNK2Alcb9nCzvE AnmJ1RsOgNVwClhLzOh9A2YLAdUs/bKXbQIj3wJGhlWMkqkFxbnpucWGBUZ5qeV6xYm5xaV5 6XrJ+bmbGMHBoqW1g3HPqg96hxiZOBgPMUpwMCuJ8KoUfU0Q4k1JrKxKLcqPLyrNSS0+xCjN waIkznuh62S8kEB6YklqdmpqQWoRTJaJg1OqganI++kRQ5mlPowh6yao7klgV/Q7FPJw5aLJ M9T75fae8tV97nNV9O29vg9e2ncFpt+77pZ+5XeT45cd/Gr7je+wLrdzyLv2Y0FfkR2PcpM8 55EjL8x+Kt194Cgft+vqx//qT240z94fGGIpwfxpUeHdmnt3ar/5ljjUN1y6x8KfueSeYnbh rsRfCa5r5Kf6/axbnLrl64ONIjd4frC6FibbGHaJnLf+M/H6+0e9AnFXHvF929lcGdso5DXl aol22u6sLRPWvd4X1vKgiTfq+aE7bkpz+yVf3OraVP9TMGz1dC6fszf/uy7zeDJZa/vCWOcf KpLPK3fG5/989+vo9s4kY2lf6w+FXWlGx3yWxCorsRRnJBpqMRcVJwIASwF8soUCAAA= X-CMS-MailID: 20210722052744epcas5p46996d48d12500c39b4b63dfcecd30d37 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722052744epcas5p46996d48d12500c39b4b63dfcecd30d37 References: <20210722052640.5863-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change will save the current selected PHY configuration in the storage when PHY Configuration Changed Event is received. It will also load and set the stored PHY configuration when controller initialized. Thus it enables the user to continue with the last selected PHYs on controller restart. Reviewed-by: Anupam Roy --- src/adapter.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/adapter.c b/src/adapter.c index 84dd2e5bd..3861ade8a 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -288,7 +288,8 @@ struct btd_adapter { uint32_t supported_phys; uint32_t configurable_phys; - uint32_t selected_phys; + uint32_t selected_phys; /* Current selected PHYs */ + uint32_t stored_phys; /* Stored last selected PHYs */ uint32_t pending_phys; }; @@ -508,6 +509,10 @@ static void store_adapter_info(struct btd_adapter *adapter) g_key_file_set_string(key_file, "General", "Alias", adapter->stored_alias); + if (adapter->stored_phys) + g_key_file_set_integer(key_file, "General", "PhyConfiguration", + adapter->stored_phys); + snprintf(filename, PATH_MAX, STORAGEDIR "/%s/settings", btd_adapter_get_storage_dir(adapter)); @@ -3329,10 +3334,13 @@ static void set_default_phy_complete(uint8_t status, uint16_t length, btd_info(adapter->dev_id, "PHY configuration successfully set"); adapter->selected_phys = adapter->pending_phys; + adapter->stored_phys = adapter->pending_phys; adapter->pending_phys = 0; g_dbus_pending_property_success(data->id); + store_adapter_info(adapter); + g_dbus_emit_property_changed(dbus_conn, adapter->path, ADAPTER_INTERFACE, "PhyConfiguration"); } @@ -6548,6 +6556,15 @@ static void load_config(struct btd_adapter *adapter) gerr = NULL; } + /* Get PHY Configuration */ + adapter->stored_phys = g_key_file_get_integer(key_file, + "General", "PhyConfiguration", &gerr); + if (gerr) { + adapter->stored_phys = 0; + g_error_free(gerr); + gerr = NULL; + } + g_key_file_free(key_file); } @@ -9670,6 +9687,13 @@ static void read_phy_configuration_resp(uint8_t status, uint16_t length, DBG("Supported phys: [0x%x]", adapter->supported_phys); DBG("Configurable phys: [0x%x]", adapter->configurable_phys); DBG("Selected phys: [0x%x]", adapter->selected_phys); + + /* + * Set the default PHYs to the last selected PHYs on which the + * controller was operating before shutting down. + */ + if (adapter->supported_settings & MGMT_SETTING_PHY_CONFIGURATION) + set_default_phy(adapter, adapter->stored_phys, -1); } static void read_phy_configuration(struct btd_adapter *adapter) @@ -9696,10 +9720,14 @@ static void phy_configuration_changed_callback(uint16_t index, } adapter->selected_phys = get_le32(&ev->selected_phys); + adapter->stored_phys = adapter->selected_phys; + info("PHYs changed, New PHYs [0x%x]", adapter->selected_phys); adapter->pending_phys = 0; + store_adapter_info(adapter); + g_dbus_emit_property_changed(dbus_conn, adapter->path, ADAPTER_INTERFACE, "PhyConfiguration"); }