From patchwork Thu Jul 22 05:49:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393149 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 80A1AC63793 for ; Thu, 22 Jul 2021 06:00:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 676BD6127C for ; Thu, 22 Jul 2021 06:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230376AbhGVFUU (ORCPT ); Thu, 22 Jul 2021 01:20:20 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:41591 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbhGVFUU (ORCPT ); Thu, 22 Jul 2021 01:20:20 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210722060054epoutp03ff929ccb8b5bbf768136c69b6257430c~UB4oA60cf0824508245epoutp03B for ; Thu, 22 Jul 2021 06:00:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210722060054epoutp03ff929ccb8b5bbf768136c69b6257430c~UB4oA60cf0824508245epoutp03B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933654; bh=VhAUX2KaLhcD0nEsXOQiKQD6baHytHOBPwc2nY0Hr9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wm4HjPXOh2qmpZz3KoQG6mA6tdeFKbiZrxEDiNdQLmcj1m918MLmDCN0ixlskeo2l mMeLONooD480bSV3xTRNdcV4XDETiJB2qg3TtKVXbIiULanEVg8bzylJvxhczfg/lI dHD7+QZSzyGuj/ptkleMx9lvDrZGVMU7k6s6tDVQ= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20210722060050epcas5p190ce885f3ed971de687fde4dc3ce24c6~UB4jxa9aa2840328403epcas5p1a; Thu, 22 Jul 2021 06:00:50 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 57.0B.09595.F8909F06; Thu, 22 Jul 2021 15:00:48 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20210722055009epcas5p25e4997aa7e53cb2a6e3780fdb7301785~UBvPGCgsX1311413114epcas5p2g; Thu, 22 Jul 2021 05:50:09 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722055009epsmtrp136c979ae9ef2327e87a48a66370ac37f~UBvPFQRT03119631196epsmtrp1e; Thu, 22 Jul 2021 05:50:09 +0000 (GMT) X-AuditID: b6c32a4a-eebff7000000257b-8b-60f9098fd051 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 08.6B.08289.11709F06; Thu, 22 Jul 2021 14:50:09 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055008epsmtip16e6be481b399800959be0f4b7b4eb380~UBvOWkjlC1099710997epsmtip1d; Thu, 22 Jul 2021 05:50:08 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 1/8] doc/device-api: Add Phy property Date: Thu, 22 Jul 2021 11:19:44 +0530 Message-Id: <20210722054951.8291-2-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7bCmhu4Ezp8JBu3TmSzurLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4MrovrmereAwR8X6A4eYGxi3sXUxcnJI CJhI3Fv+kL2LkYtDSGA3o8SJFTfZIJxPjBI7191jhnA+M0r0/G5kh2l5MfkYM4gtJLCLUeL1 ekO4jiWd/WAJNgFNidcfvzCB2CICyhLP9h0Gs5kFdCXOvF8HtltYwFpi/qc9YDaLgKrEiunL WUBsXgEriZ3XTzJCLJOXWL3hANhMTqD6A49ugt0qITCdXWL/mZVQRS4S7zatZ4GwhSVeHd8C damUxMv+NqiGZkaJHZs3Qjk9jBIPfnRDg8Be4lzTM9YuRg6g8zQl1u/ShwjLSkw9tQ7qaj6J 3t9PmCDivBI75sHYKhIbVnXCLft4bCEzhO0h0XHrEjQg+xglFu3bxzyBUW4WwooFjIyrGCVT C4pz01OLTQuM8lLL9YoTc4tL89L1kvNzNzGC41nLawfjwwcf9A4xMnEwHmKU4GBWEuFVKfqa IMSbklhZlVqUH19UmpNafIhRmoNFSZyXPR4oJZCeWJKanZpakFoEk2Xi4JRqYNrZmcivvWGl GWOrzqFfF9i+sH2rF8k16wlv4ojyuHcqMt/8hqWM6jtPvqAPGm8+PtUsn3fg6hYjsb6dPnOm 8Vn6zcvefGy3tMrGJRLregR4jebZTHSQ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1nx2u6Ai2ikxjWP04YYq/Qt6/q7W7fv6rXPflZpQSS3FGoqEWc1FxIgBcm/0ehQIAAA== X-CMS-MailID: 20210722055009epcas5p25e4997aa7e53cb2a6e3780fdb7301785 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055009epcas5p25e4997aa7e53cb2a6e3780fdb7301785 References: <20210722054951.8291-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This will allow to set the LE PHY preferences for a connected device. Reviewed-by: Anupam Roy --- doc/device-api.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/device-api.txt b/doc/device-api.txt index 4e824d2de..d0e108f74 100644 --- a/doc/device-api.txt +++ b/doc/device-api.txt @@ -272,3 +272,25 @@ Properties string Address [readonly] Example: 0x26 0x01 0x01... + + array{string} Phy [readwrite, optional] + + PHY Preferences for a connected device. + + Note: The controller might not be able to make the + change because of reasons like peer not supporting + the requested PHY or it couldnot schedule due to + other activites. + + This is only available for LE capable controllers. + It will return Not Supported Otherwise. + + Possible values: + "LE1MTX" + "LE1MRX" + "LE2MTX" + "LE2MRX" + "LECODEDTX" + "LECODEDRX" + "LECODEDS2" + "LECODEDS8" From patchwork Thu Jul 22 05:49:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393151 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 A1AD4C6377D for ; Thu, 22 Jul 2021 06:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89AD461279 for ; Thu, 22 Jul 2021 06:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbhGVFUX (ORCPT ); Thu, 22 Jul 2021 01:20:23 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:19484 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbhGVFUW (ORCPT ); Thu, 22 Jul 2021 01:20:22 -0400 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210722060057epoutp02a421aaf98fad0ef58c912b083e5fddae~UB4qZcEF01764317643epoutp02I for ; Thu, 22 Jul 2021 06:00:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210722060057epoutp02a421aaf98fad0ef58c912b083e5fddae~UB4qZcEF01764317643epoutp02I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933657; bh=pAi250CDFGbNfpdLR4WHLR17XIUus+005tpHnZhisVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qsUcVVb3BemxLb0rLwoPVtGvBJSPXeZ47NIi/ZDcjRr+wFrIqjHiU5D56nqvwSOwD mnDciYjGAHLE/+YlPC3pedLgnngeiT9ktuVpTgz5PQGiCyXd2kSSKJC4L4Mev8XuCQ LUWLA/i4jyEvGIfbmZQmnk62AVzAx0SnLVDChWgM= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20210722060047epcas5p1aed4914c7362aebdc596b7b67e934f02~UB4hcv_T72576525765epcas5p1V; Thu, 22 Jul 2021 06:00:47 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 0F.03.55882.D8909F06; Thu, 22 Jul 2021 15:00:45 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210722055010epcas5p45a16ff704c37d108a9df0d6c0a1942a8~UBvQAq-iO2535725357epcas5p4G; Thu, 22 Jul 2021 05:50:10 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722055010epsmtrp1ce7e23b831485f35ef28327a459700e3~UBvP-taDv3087030870epsmtrp1X; Thu, 22 Jul 2021 05:50:10 +0000 (GMT) X-AuditID: b6c32a49-f65ff7000001da4a-b7-60f9098ddf3e Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 09.6B.08289.21709F06; Thu, 22 Jul 2021 14:50:10 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055009epsmtip1524cc0293ebfce1a1f9d8d23e70f0772~UBvPQey2n1099710997epsmtip1e; Thu, 22 Jul 2021 05:50:09 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 2/8] doc/mgmt-api: Add support for LE PHY Update Complete event Date: Thu, 22 Jul 2021 11:19:45 +0530 Message-Id: <20210722054951.8291-3-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7bCmlm4v588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xg9Pm+SC2CK4rJJSc3JLEst0rdL4Mp4f3QDY8Eczor9nTfYGhjnsncxcnJI CJhI3Gr5CGRzcQgJ7GCU2PnkI3MXIwdQQkri8TIdiBphiZX/nkPVfGCUOH9nGhtIgk1AU+L1 xy9MILaIgLLEs32HwWxmAX2JpxeuM4LYwgKhEp9nPGQCmckioCoxcV4aSJhXwEriT8MqJoj5 8hKrNxxgBrE5BawlDjy6CXabEFDNvddbmCcw8i1gZFjFKJlaUJybnltsWGCUl1quV5yYW1ya l66XnJ+7iREcKlpaOxj3rPqgd4iRiYPxEKMEB7OSCK9K0dcEId6UxMqq1KL8+KLSnNTiQ4zS HCxK4rwXuk7GCwmkJ5akZqemFqQWwWSZODilGpi8CzUVf1dfj9I79VaP4YiP+iL1JLe3s3c8 jv527M7S0MyZVefvSlTVRpvLmmRe0ZmZb5K+bGJMbsID5a3X9u88oPGTq74tzn91WMNPIeez pdPXRE/mibvz53y1qvbJ1JoJfWvuSi/h3y8gt3R1gmbpTvEfK2oPMWXLLTuzSaG34l94XvWF qWl7nap+zTuuoSUexZkpK/mUc41C6SuXpcd25N6wM7zSfzQqIMX8WDPv64w1S69m7+kSLdhR G2Ry/UfaUeG9Tzdw2Cx5sP/n5+/fXhz4J7I+fMeSef0OJy5O2XAg6H2Q9s/Hvx/KHSzUfKUv l3Pr78NnIh7bcye5ii069K5+t4OpuvjbjxLlBp1eSizFGYmGWsxFxYkABIjs1oQCAAA= X-CMS-MailID: 20210722055010epcas5p45a16ff704c37d108a9df0d6c0a1942a8 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055010epcas5p45a16ff704c37d108a9df0d6c0a1942a8 References: <20210722054951.8291-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Reviewed-by: Anupam Roy --- doc/mgmt-api.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt index 5355fedb0..f7379fcd9 100644 --- a/doc/mgmt-api.txt +++ b/doc/mgmt-api.txt @@ -4910,3 +4910,32 @@ Controller Resume Event Address_Type. Otherwise, Address and Address_Type will both be zero. This event will be sent to all management sockets. + + +LE PHY Update Complete Event +=============================== + + Event Code: 0x002f + Controller Index: + Event Parameters: Address (6 Octets) + Address_Type (1 Octet) + Status (1 Octet) + PHYs (4 Octets) + + This event indicates that LE PHYs have been changed for this + connected device. + + The PHYs parameters are a bitmask with currently the + following available bits: + + 9 LE 1M TX + 10 LE 1M RX + 11 LE 2M TX + 12 LE 2M RX + 13 LE Coded TX + 14 LE Coded RX + + This event will be used in case of autonomous PHY update made + by the controller or HCI_LE_SET_PHY command succeeded. + + This event will be sent to all management sockets. From patchwork Thu Jul 22 05:49:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393147 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 C0C5BC6377D for ; Thu, 22 Jul 2021 06:00:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A624C61283 for ; Thu, 22 Jul 2021 06:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbhGVFUT (ORCPT ); Thu, 22 Jul 2021 01:20:19 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:49426 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbhGVFUS (ORCPT ); Thu, 22 Jul 2021 01:20:18 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210722060053epoutp01cea9b5e15ddac7cf04aa5073b1c2dc23~UB4m3AULM1956619566epoutp01F for ; Thu, 22 Jul 2021 06:00:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210722060053epoutp01cea9b5e15ddac7cf04aa5073b1c2dc23~UB4m3AULM1956619566epoutp01F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933653; bh=+bXCDXMPBYaySU8ZeO2ssuv752TOfXMu8pPFE7teVSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZW6qmZz/hrIY7PkidUQFnUUPx60wKey+txTyYTInDkcEXbUP5/PhDkd9Q5RxXS8ET 2m5X8sHeeT6F4oEn96+rbSauR1RUfnruPKmq5tNNnM9j7yjmyR4uMiBsYeTQa4Ro57 QJnEZUSX0CJa9RVoT9gnhhfPTcI3doi7oFw50miw= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20210722060048epcas5p1e782dfef9f2df6439e509b1508d32f3c~UB4iY0efb2845628456epcas5p1T; Thu, 22 Jul 2021 06:00:48 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 63.13.55882.F8909F06; Thu, 22 Jul 2021 15:00:47 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20210722055011epcas5p15299bfe8f8b8dd58e1354364071608e3~UBvRPlD9b1427914279epcas5p1A; Thu, 22 Jul 2021 05:50:11 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210722055011epsmtrp2d6032a963bdec05754de1312b722d9b8~UBvRPF0gE1175011750epsmtrp26; Thu, 22 Jul 2021 05:50:11 +0000 (GMT) X-AuditID: b6c32a49-f65ff7000001da4a-c3-60f9098fea23 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 72.14.08394.31709F06; Thu, 22 Jul 2021 14:50:11 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055010epsmtip1a7fe1e5b4d68aa21b5c4301eccf2831c~UBvQLqhZT1275612756epsmtip1C; Thu, 22 Jul 2021 05:50:10 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 3/8] btio: Add BT_IO_PHY option to set le phy options Date: Thu, 22 Jul 2021 11:19:46 +0530 Message-Id: <20210722054951.8291-4-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7bCmhm4/588Eg1uT5CzurLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4MqYci+p4LdExZyb/9gbGF8IdzFyckgI mEjMWDOdpYuRi0NIYDejxI2dHxghnE+MEmdut7BDON8YJXb9esgG09J+8QBUYi+jxPkJe1jg WnrXbmUFqWIT0JR4/fELE4gtIqAs8WzfYTCbWUBX4sz7dUCTODiEBbwlVvaBhVkEVCVunnnE DmLzClhJ/Fj5lgVimbzE6g0HmEFsT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XnJhbXJqX rpecn7uJERwoWpo7GLev+qB3iJGJg/EQowQHs5IIr0rR1wQh3pTEyqrUovz4otKc1OJDjNIc LErivBe6TsYLCaQnlqRmp6YWpBbBZJk4OKUamFofbBCTXbJGYpODtg2nqsg3o6Pzf/lkzp/U sf/4/E08Mc+93t55srwxru7N7kN6HS7HpL1n+k5dJC6iECcSVP72luuu66lz/vn6Tb7+MdJV 9tP8OmHNBffKXk5PEPr1LKl2RwdP7w136cdTrcwWrj7vwOGxfK2/Zt2jI3qBae8vcjTb7pFf s7aUT+/nNqV/1zV+OSwU2KGUsWtD2xV+/QeLZgexir2Ta7x+92hJHOfq3VZRO19X/ClU+8NR 2Ka5Len3j8avCYcNFZa5cS3NSdWsvNF6oqvp4c5MQ2ttnl27O5fLZexQ3dZwT4Bv84bT3hP2 PHTcUcsR2rhWf8N6e6VXrfdOPeYMMJ4lXv1zdpMSS3FGoqEWc1FxIgA0wTy1gwIAAA== X-CMS-MailID: 20210722055011epcas5p15299bfe8f8b8dd58e1354364071608e3 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055011epcas5p15299bfe8f8b8dd58e1354364071608e3 References: <20210722054951.8291-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds support for the BT_IO_PHY socket option through BtIO. This can be used to set preference for LE TX & RX PHYs for a particular connection. Reviewed-by: Anupam Roy --- btio/btio.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/btio/btio.c b/btio/btio.c index 1f1c374bc..6805ac438 100644 --- a/btio/btio.c +++ b/btio/btio.c @@ -66,6 +66,7 @@ struct set_opts { int flushable; uint32_t priority; uint16_t voice; + uint32_t phy; }; struct connect { @@ -569,6 +570,14 @@ static int set_priority(int sock, uint32_t prio) return 0; } +static int l2cap_set_le_phy(int sock, uint32_t phy) +{ + if (setsockopt(sock, SOL_BLUETOOTH, BT_PHY, &phy, sizeof(phy)) < 0) + return -errno; + + return 0; +} + static gboolean get_key_size(int sock, int *size, GError **err) { struct bt_security sec; @@ -657,7 +666,7 @@ static gboolean set_le_mode(int sock, uint8_t mode, GError **err) static gboolean l2cap_set(int sock, uint8_t src_type, int sec_level, uint16_t imtu, uint16_t omtu, uint8_t mode, int master, int flushable, uint32_t priority, - GError **err) + uint32_t phy, GError **err) { if (imtu || omtu || mode) { gboolean ret = FALSE; @@ -694,6 +703,11 @@ static gboolean l2cap_set(int sock, uint8_t src_type, int sec_level, if (sec_level && !set_sec_level(sock, BT_IO_L2CAP, sec_level, err)) return FALSE; + if (phy > 0 && l2cap_set_le_phy(sock, phy) < 0) { + ERROR_FAILED(err, "l2cap_set_le_phy", errno); + return FALSE; + } + return TRUE; } @@ -834,6 +848,7 @@ static gboolean parse_set_opts(struct set_opts *opts, GError **err, opts->priority = 0; opts->src_type = BDADDR_BREDR; opts->dst_type = BDADDR_BREDR; + opts->phy = 0; while (opt != BT_IO_OPT_INVALID) { switch (opt) { @@ -904,13 +919,15 @@ static gboolean parse_set_opts(struct set_opts *opts, GError **err, case BT_IO_OPT_VOICE: opts->voice = va_arg(args, int); break; + case BT_IO_OPT_PHY: + opts->phy = va_arg(args, int); + break; case BT_IO_OPT_INVALID: case BT_IO_OPT_KEY_SIZE: case BT_IO_OPT_SOURCE_CHANNEL: case BT_IO_OPT_DEST_CHANNEL: case BT_IO_OPT_HANDLE: case BT_IO_OPT_CLASS: - case BT_IO_OPT_PHY: default: g_set_error(err, BT_IO_ERROR, EINVAL, "Unknown option %d", opt); @@ -1579,7 +1596,7 @@ gboolean bt_io_set(GIOChannel *io, GError **err, BtIOOption opt1, ...) case BT_IO_L2CAP: return l2cap_set(sock, opts.src_type, opts.sec_level, opts.imtu, opts.omtu, opts.mode, opts.master, - opts.flushable, opts.priority, err); + opts.flushable, opts.priority, opts.phy, err); case BT_IO_RFCOMM: return rfcomm_set(sock, opts.sec_level, opts.master, err); case BT_IO_SCO: @@ -1629,7 +1646,7 @@ static GIOChannel *create_io(gboolean server, struct set_opts *opts, if (!l2cap_set(sock, opts->src_type, opts->sec_level, opts->imtu, opts->omtu, opts->mode, opts->master, opts->flushable, opts->priority, - err)) + opts->phy, err)) goto failed; break; case BT_IO_RFCOMM: From patchwork Thu Jul 22 05:49:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393153 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 A2207C63793 for ; Thu, 22 Jul 2021 06:01:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 878716127C for ; Thu, 22 Jul 2021 06:01:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230371AbhGVFU3 (ORCPT ); Thu, 22 Jul 2021 01:20:29 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:19594 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbhGVFU2 (ORCPT ); Thu, 22 Jul 2021 01:20:28 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210722060103epoutp02e393e7df816488f17375a565431903f5~UB4v8CWk41764317643epoutp02M for ; Thu, 22 Jul 2021 06:01:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210722060103epoutp02e393e7df816488f17375a565431903f5~UB4v8CWk41764317643epoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933663; bh=GgWyk2DnZQ4LcpuBfoNND2z6/+1ylic5BsNXwwY1Fqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UXsV9xhslWgBtH2+FYaBklAQeaOtzzyZrXHhLOijCDuFFI8PpmpchRPO27S+jM/KD VgaXSEBZ+dtxm98cUoj9LL1NVyrHtdaA898PQd154uDFnnCkqf5AdxpVVVb1kbQlhG c7Blj/E5UutQmJfDGmK529RofA/rMkAZ1KhPhq2E= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20210722060053epcas5p3e32e5f4f09d84d8875391a9df6aa82eb~UB4nVnA300434204342epcas5p3S; Thu, 22 Jul 2021 06:00:53 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id BC.7B.11627.59909F06; Thu, 22 Jul 2021 15:00:53 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20210722055012epcas5p1bb92b3e31233da03906c4f562b22b4fc~UBvSRZr6w1933919339epcas5p1q; Thu, 22 Jul 2021 05:50:12 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722055012epsmtrp135c35128e087c34e213c420cd6cf438d~UBvSQOwNJ3087030870epsmtrp1e; Thu, 22 Jul 2021 05:50:12 +0000 (GMT) X-AuditID: b6c32a4b-acdff70000022d6b-4c-60f90995b469 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B3.14.08394.41709F06; Thu, 22 Jul 2021 14:50:12 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055011epsmtip19d0dda9537b3b9bb20424af634788ccb~UBvRXX1Go1099710997epsmtip1h; Thu, 22 Jul 2021 05:50:11 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 4/8] device: Add support for get/set PHY property Date: Thu, 22 Jul 2021 11:19:47 +0530 Message-Id: <20210722054951.8291-5-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7bCmlu5Uzp8JBv9bRSzurLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4MpoWdvAXtDjUvH8+Ur2BsY+8y5GTg4J AROJmU/2M3YxcnEICexmlJg0/w4TSEJI4BOjxMU7FhCJb4wS+/dPZYLp6NjyhRkisZdR4smJ JcxwHd9OKYPYbAKaEq8/fgFrEBFQlni27zCYzSygK3Hm/To2EFtYwF1iyqPJYDaLgKrEue7J YDW8AlYSq2ZcYIdYJi+xesMBsPmcAtYSBx7dZAdZLCEwmV1iUcsFZogiF4nd814wQtjCEq+O b4FqlpJ42d8G1dDMKLFj80Yop4dR4sGPbjaIKnuJc03PWLsYOYDO05RYv0sfIiwrMfXUOqir +SR6fz+Bep9XYsc8GFtFYsOqTrhlH48tZAYZIyHgIfF9UQQkhPoYJVY9+csygVFuFsKGBYyM qxglUwuKc9NTi00LjPNSy/WKE3OLS/PS9ZLzczcxgmNZy3sH46MHH/QOMTJxMB5ilOBgVhLh VSn6miDEm5JYWZValB9fVJqTWnyIUZqDRUmcl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JSsbgzq/qG 3PxELfVqq6dLp8/f8f0uy9J3VzSqZwTMFOkP2sSwOf6KZIHZ77+rdRZ/2HpEX+LlqxelR5N5 rJiu35DOUn3rPqumRlr37xNB30PFuybsfcS9tDzgsvXzcL4/C86ui1ii3yog+jJVeH4Hq/9a mU9vjvNcuP93q8pSeRm2d1ouP8LsVN+Izzz251qzEktxRqKhFnNRcSIA3gHaVYUCAAA= X-CMS-MailID: 20210722055012epcas5p1bb92b3e31233da03906c4f562b22b4fc X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055012epcas5p1bb92b3e31233da03906c4f562b22b4fc References: <20210722054951.8291-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change introduces a new device property which will enable user to get PHYs of the current LE Connection. It will also allow to set preferred PHYs for a particular LE connection. Reviewed-by: Anupam Roy --- lib/bluetooth.h | 9 ++ src/adapter.c | 8 ++ src/adapter.h | 1 + src/device.c | 220 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 238 insertions(+) diff --git a/lib/bluetooth.h b/lib/bluetooth.h index 9ab033ec4..a6afaa753 100644 --- a/lib/bluetooth.h +++ b/lib/bluetooth.h @@ -127,6 +127,15 @@ struct bt_voice { #define BT_PHY_LE_2M_RX 0x00001000 #define BT_PHY_LE_CODED_TX 0x00002000 #define BT_PHY_LE_CODED_RX 0x00004000 +#define BT_PHY_LE_CODED_S2 0x00008000 +#define BT_PHY_LE_CODED_S8 0x00010000 + +#define BT_PHY_LE_MASK (BT_PHY_LE_1M_TX | BT_PHY_LE_1M_RX | \ + BT_PHY_LE_2M_TX | BT_PHY_LE_2M_RX | \ + BT_PHY_LE_CODED_TX | BT_PHY_LE_CODED_RX) + +#define BT_PHY_LE_CODED_MASK (BT_PHY_LE_CODED_TX | \ + BT_PHY_LE_CODED_RX) #define BT_MODE 15 diff --git a/src/adapter.c b/src/adapter.c index 3861ade8a..5de92a570 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -6661,6 +6661,14 @@ const char *adapter_get_path(struct btd_adapter *adapter) return adapter->path; } +uint32_t adapter_get_supported_phys(struct btd_adapter *adapter) +{ + if (!adapter) + return 0; + + return adapter->supported_phys; +} + const bdaddr_t *btd_adapter_get_address(struct btd_adapter *adapter) { return &adapter->bdaddr; diff --git a/src/adapter.h b/src/adapter.h index 60b5e3bcc..21046ceaa 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -87,6 +87,7 @@ struct btd_device *btd_adapter_find_device_by_path(struct btd_adapter *adapter, const char *path); const char *adapter_get_path(struct btd_adapter *adapter); +uint32_t adapter_get_supported_phys(struct btd_adapter *adapter); const bdaddr_t *btd_adapter_get_address(struct btd_adapter *adapter); uint8_t btd_adapter_get_address_type(struct btd_adapter *adapter); const char *btd_adapter_get_storage_dir(struct btd_adapter *adapter); diff --git a/src/device.c b/src/device.c index b29aa195d..6f74989c7 100644 --- a/src/device.c +++ b/src/device.c @@ -272,6 +272,9 @@ struct btd_device { GIOChannel *att_io; guint store_id; + + uint32_t phys; + bool pending_phys; }; static const uint16_t uuid_list[] = { @@ -1470,6 +1473,212 @@ static gboolean dev_property_wake_allowed_exist( return device_get_wake_support(device); } +static struct phys_config { + uint32_t flag; + const char *name; +} phys_str[] = { + { BT_PHY_LE_1M_TX, "LE1MTX" }, + { BT_PHY_LE_1M_RX, "LE1MRX" }, + { BT_PHY_LE_2M_TX, "LE2MTX" }, + { BT_PHY_LE_2M_RX, "LE2MRX" }, + { BT_PHY_LE_CODED_TX, "LECODEDTX" }, + { BT_PHY_LE_CODED_RX, "LECODEDRX" }, + { BT_PHY_LE_CODED_S2, "LECODEDS2" }, + { BT_PHY_LE_CODED_S8, "LECODEDS8" } +}; + +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 device_set_phy(struct btd_device *device, uint32_t phys) +{ + if (!device) + return; + + DBG("Device PHYs %u", phys); + + device->phys = phys; + + g_dbus_emit_property_changed(dbus_conn, device->path, + DEVICE_INTERFACE, "Phy"); + +} + +static int set_preferred_phy(struct btd_device *device, uint32_t phys) +{ + GIOChannel *io; + GError *gerr = NULL; + uint32_t supported_phys = 0; + int ret; + + if (!device || !phys) { + error("Invalid arguments in method call"); + return -EINVAL; + } + + if (!device->le) { + error("Operation is not supported"); + return -ENOTSUP; + } + + if (!device->le_state.connected || !device->attrib) { + error("Device Not Connected"); + return -ENOTCONN; + } + + io = g_attrib_get_channel(device->attrib); + + if (!io) { + error("Device Not Connected"); + return -ENOTCONN; + } + + supported_phys = adapter_get_supported_phys(device->adapter) & + BT_PHY_LE_MASK; + + if (supported_phys & BT_PHY_LE_CODED_MASK) { + supported_phys |= BT_PHY_LE_CODED_S2; + supported_phys |= BT_PHY_LE_CODED_S8; + } + + if (phys & ~supported_phys) { + error("Supplied phy(s) are not supported"); + return -EINVAL; + } + + if (device->pending_phys) { + error("Operation already in progress"); + return -EINPROGRESS; + } + + device->pending_phys = true; + + if (device->phys == phys) { + device->pending_phys = false; + return 0; + } + + bt_io_set(io, &gerr, BT_IO_OPT_PHY, phys, BT_IO_OPT_INVALID); + + if (gerr) { + error("bt_io_set: %s", gerr->message); + device->pending_phys = false; + ret = gerr->code; + g_error_free(gerr); + return ret; + } + + return 0; +} + +static gboolean dev_property_get_phy(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct btd_device *device = data; + DBusMessageIter array; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "s", &array); + + append_phys_str(&array, device->phys); + + dbus_message_iter_close_container(iter, &array); + + return TRUE; +} + +static void dev_property_set_phy(const GDBusPropertyTable *property, + DBusMessageIter *value, + GDBusPendingPropertySet id, void *data) +{ + struct btd_device *device = data; + DBusMessageIter array; + uint32_t phys; + int ret; + + if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_ARRAY) { + ret = -EINVAL; + goto failed; + } + + dbus_message_iter_recurse(value, &array); + + if (!parse_phys_str(&array, &phys)) { + ret = -EINVAL; + goto failed; + } + + ret = set_preferred_phy(device, phys); + + if (ret >= 0) { + g_dbus_pending_property_success(id); + 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 ENOTCONN: + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".NotConnected", + "Device Not Connected"); + break; + case EINPROGRESS: + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".InProgress", + "Operation already in progress"); + break; + default: + g_dbus_pending_property_error(id, ERROR_INTERFACE ".Failed", + strerror(-ret)); + break; + } + +} + static bool disconnect_all(gpointer user_data) { struct btd_device *device = user_data; @@ -2950,6 +3159,7 @@ static const GDBusPropertyTable device_properties[] = { { "WakeAllowed", "b", dev_property_get_wake_allowed, dev_property_set_wake_allowed, dev_property_wake_allowed_exist }, + { "Phy", "as", dev_property_get_phy, dev_property_set_phy }, { } }; @@ -3017,6 +3227,12 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type) state->connected = false; device->general_connect = FALSE; + /* Reset PHYs if LE connection is disconnected */ + if (bdaddr_type != BDADDR_BREDR) { + device->pending_phys = false; + device_set_phy(device, 0); + } + device_set_svc_refreshed(device, false); if (device->disconn_timer > 0) { @@ -5305,10 +5521,12 @@ bool device_attach_att(struct btd_device *dev, GIOChannel *io) struct btd_gatt_database *database; const bdaddr_t *dst; char dstaddr[18]; + uint32_t phys; bt_io_get(io, &gerr, BT_IO_OPT_SEC_LEVEL, &sec_level, BT_IO_OPT_IMTU, &mtu, BT_IO_OPT_CID, &cid, + BT_IO_OPT_PHY, &phys, BT_IO_OPT_INVALID); if (gerr) { @@ -5358,6 +5576,8 @@ bool device_attach_att(struct btd_device *dev, GIOChannel *io) dev->attrib = attrib; dev->att = g_attrib_get_att(attrib); + device_set_phy(dev, phys); + bt_att_ref(dev->att); bt_att_set_debug(dev->att, BT_ATT_DEBUG, gatt_debug, NULL, NULL); From patchwork Thu Jul 22 05:49:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393155 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 914DBC63793 for ; Thu, 22 Jul 2021 06:01:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B4C661279 for ; Thu, 22 Jul 2021 06:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbhGVFUc (ORCPT ); Thu, 22 Jul 2021 01:20:32 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:41843 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbhGVFUb (ORCPT ); Thu, 22 Jul 2021 01:20:31 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210722060105epoutp03b651546b1f34baa3e79c505d0165dca9~UB4yf3_he1006110061epoutp03p for ; Thu, 22 Jul 2021 06:01:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210722060105epoutp03b651546b1f34baa3e79c505d0165dca9~UB4yf3_he1006110061epoutp03p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933665; bh=TOVJeRLqrpM2C6gWzVfH/5BMx07AEgbwpq9e1f615Lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uazDXwTsk+2fXmDVqOkIhtlwRrs0uRRawQaH4e7/bH8gvvkILc/LXwYJ576io8VSn Dl7ngB+T2VanqfVVsmHf7rO7P4vLI2gqW8IIeNpQ8X0dikWWYqLwRqcx3XMsPlFHNx 3ACX3rQEzpYetimdAyUm/Sp68ryf0oxTxCnXVkug= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20210722060102epcas5p3a7ca0b4255a7d2531303f5408a429273~UB4u2r8PW0665006650epcas5p3d; Thu, 22 Jul 2021 06:01:02 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id E8.1B.09595.D9909F06; Thu, 22 Jul 2021 15:01:01 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20210722055013epcas5p350d88f402bbe4c55f1f868dbb2decbaf~UBvTSavM-2138821388epcas5p39; Thu, 22 Jul 2021 05:50:13 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722055013epsmtrp159358437877ed17d100b1907ef0594e6~UBvTR9EZX3119631196epsmtrp1r; Thu, 22 Jul 2021 05:50:13 +0000 (GMT) X-AuditID: b6c32a4a-eebff7000000257b-c6-60f9099d7883 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 05.14.08394.51709F06; Thu, 22 Jul 2021 14:50:13 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055013epsmtip1b1230acbd100318b1de6b85a398f0808~UBvSaq0qa1155311553epsmtip1A; Thu, 22 Jul 2021 05:50:12 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 5/8] adapter: Add support for LE PHY Update Complete event Date: Thu, 22 Jul 2021 11:19:48 +0530 Message-Id: <20210722054951.8291-6-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7bCmlu5czp8JBqunK1rcWW1tMedaH7PF tnXtzA7MHn1bVjF6fN4kF8AUxWWTkpqTWZZapG+XwJXx7OtT9oLFchU/t55lb2C8KdHFyMkh IWAisfH1ArYuRi4OIYHdjBI9yw8xQTifGCXe9d1nhXC+MUpcXvmFpYuRA6xl3SJNiPheRon9 T9sY4ToO3F/PBDKXTUBT4vXHL2C2iICyxLN9h8FsZgFdiTPv17GB2MICQRJHbhxmBbFZBFQl rp38yAJi8wpYSWz5fYQF4j55idUbDjCD2JwC1hIHHt1kB1kmITCZXWLN+bfsEBe5SGw5r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GJk4GA8xSnAwK4nwqhR9TRDiTUmsrEotyo8vKs1JLT7E KM3BoiTOe6HrZLyQQHpiSWp2ampBahFMlomDU6qByfBnkoe6zdGkeQdc5/50/qC7wHHjVJl2 wc3XdHml1x1UZ3seyvJX+t2TmJkib3QUZYMDnwiy1X05x/O9OJQ1Svr5quvzzb6pO65eFMKo ePTV3IuOVRWyGWueh6uJlPHYnj/44wunWkwV770FiQ8FNS317ixP9bNSLKytKlf2bAlJefVJ 324CX53mf66jfG7fM2ckq2/MdJwsVcfrfCd650v9ztUGotN0vvoYsKrezX4syDfT2JWXjclP d3M0u85Zk+A4iyXa81zd5CYH7Ll0TuuzRCfLoRnHKnMOn3VNaD11n/ngAtVKrq5H+7rNnJ3X FFzIzp9gfG+qxlNbbaOJ7Nm7qv5Evln++sGlldJKLMUZiYZazEXFiQBgyM4vhAIAAA== X-CMS-MailID: 20210722055013epcas5p350d88f402bbe4c55f1f868dbb2decbaf X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055013epcas5p350d88f402bbe4c55f1f868dbb2decbaf References: <20210722054951.8291-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change will subscribe the MGMT LE PHY Update Complete event. This event will come whenever the particular PHYs changed either autonomously or as a response of set PHY property. Upon receiving the event, it will notify the user by emitting "Phy" property changed event. Reviewed-by: Anupam Roy --- lib/mgmt.h | 8 ++++++++ src/adapter.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/device.c | 7 +++++++ src/device.h | 2 ++ 4 files changed, 57 insertions(+) diff --git a/lib/mgmt.h b/lib/mgmt.h index 0a6349321..4d2acb778 100644 --- a/lib/mgmt.h +++ b/lib/mgmt.h @@ -1014,6 +1014,13 @@ struct mgmt_ev_controller_resume { uint8_t wake_reason; } __packed; +#define MGMT_EV_LE_PHY_UPDATE_COMPLETE 0x002f +struct mgmt_ev_le_phy_update_complete { + struct mgmt_addr_info addr; + uint8_t status; + uint32_t phys; +} __packed; + static const char *mgmt_op[] = { "<0x0000>", "Read Version", @@ -1152,6 +1159,7 @@ static const char *mgmt_ev[] = { "Advertisement Monitor Removed", "Controller Suspend", "Controller Resume", + "LE PHY Update Complete", /* 0x002f */ }; static const char *mgmt_status[] = { diff --git a/src/adapter.c b/src/adapter.c index 5de92a570..f616879fd 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -9740,6 +9740,41 @@ static void phy_configuration_changed_callback(uint16_t index, ADAPTER_INTERFACE, "PhyConfiguration"); } +static void le_phy_update_complete_callback(uint16_t index, + uint16_t length, const void *param, + void *user_data) +{ + const struct mgmt_ev_le_phy_update_complete *ev = param; + struct btd_adapter *adapter = user_data; + struct btd_device *device; + char addr[18]; + + if (length < sizeof(*ev)) { + btd_error(adapter->dev_id, "Too small le phy update complete event"); + return; + } + + if (ev->status != MGMT_STATUS_SUCCESS) { + btd_error(adapter->dev_id, "Failed to set le phy: %s (0x%02x)", + mgmt_errstr(ev->status), ev->status); + return; + } + + ba2str(&ev->addr.bdaddr, addr); + + DBG("hci%u device %s PHYs updated %u", index, addr, ev->phys); + + device = btd_adapter_get_device(adapter, &ev->addr.bdaddr, + ev->addr.type); + if (!device) { + btd_error(adapter->dev_id, + "Unable to get device object for %s", addr); + return; + } + + device_le_phy_updated(device, ev->phys); +} + static void read_info_complete(uint8_t status, uint16_t length, const void *param, void *user_data) { @@ -9980,6 +10015,11 @@ static void read_info_complete(uint8_t status, uint16_t length, phy_configuration_changed_callback, adapter, NULL); + mgmt_register(adapter->mgmt, MGMT_EV_LE_PHY_UPDATE_COMPLETE, + adapter->dev_id, + le_phy_update_complete_callback, + adapter, NULL); + set_dev_class(adapter); set_name(adapter, btd_adapter_get_name(adapter)); diff --git a/src/device.c b/src/device.c index 6f74989c7..4b11772b8 100644 --- a/src/device.c +++ b/src/device.c @@ -5684,6 +5684,13 @@ done: } } +void device_le_phy_updated(struct btd_device *dev, uint32_t phy) +{ + dev->pending_phys = false; + + device_set_phy(dev, phy); +} + int device_connect_le(struct btd_device *dev) { struct btd_adapter *adapter = dev->adapter; diff --git a/src/device.h b/src/device.h index 4ae9abe0d..b3b32b231 100644 --- a/src/device.h +++ b/src/device.h @@ -154,6 +154,8 @@ int device_unblock(struct btd_device *device, gboolean silent, void btd_device_set_pnpid(struct btd_device *device, uint16_t source, uint16_t vendor, uint16_t product, uint16_t version); +void device_le_phy_updated(struct btd_device *dev, uint32_t phy); + int device_connect_le(struct btd_device *dev); typedef void (*device_svc_cb_t) (struct btd_device *dev, int err, From patchwork Thu Jul 22 05:49:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393159 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 7AA09C63793 for ; Thu, 22 Jul 2021 06:01:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64BD161287 for ; Thu, 22 Jul 2021 06:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230404AbhGVFUl (ORCPT ); Thu, 22 Jul 2021 01:20:41 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:45799 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbhGVFUj (ORCPT ); Thu, 22 Jul 2021 01:20:39 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210722060111epoutp04237ac041883adb6ca3bdb999c36df179~UB43TmS9i0789207892epoutp04B for ; Thu, 22 Jul 2021 06:01:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210722060111epoutp04237ac041883adb6ca3bdb999c36df179~UB43TmS9i0789207892epoutp04B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933671; bh=mUwTXKrcEYy5ptthGIZBEt/suYaU5Fcxf0wxeN6gvVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hhRLCduBOUtbYWpVScnxl/wT3jMVESyn+9GsjNz1quZSqBtBDaoWml90vD6wrvtcR U9z9CGYRXNA/WW8G6k/v2CErV46Ap7wg1gXoahG8xfEynSzf+066jjxijfArLShxDc /qIey/q7Z/lhE0Rmxnm7bOlPke9ScvQy0QajIhf4= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20210722060110epcas5p19bbd51bce3a0074159772f4faa018e33~UB42SyHT42847228472epcas5p1g; Thu, 22 Jul 2021 06:01:10 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id C8.9B.11627.4A909F06; Thu, 22 Jul 2021 15:01:08 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210722055015epcas5p4db389aa15f16f1577a74ba5ce446919b~UBvUZk_xC2757927579epcas5p4F; Thu, 22 Jul 2021 05:50:15 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722055015epsmtrp19b3b498bfac8771fc53b7707533c4ecc~UBvUYaHEb3133731337epsmtrp1C; Thu, 22 Jul 2021 05:50:15 +0000 (GMT) X-AuditID: b6c32a4b-acdff70000022d6b-94-60f909a4042f Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id EF.6B.08289.61709F06; Thu, 22 Jul 2021 14:50:14 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055014epsmtip180ff11a70d4b5665b05179845d9c0856~UBvTdfJtV1278012780epsmtip1D; Thu, 22 Jul 2021 05:50:13 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 6/8] client: Add support for LE get/set device PHY in bluetoothctl Date: Thu, 22 Jul 2021 11:19:49 +0530 Message-Id: <20210722054951.8291-7-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7bCmpu4Szp8JBuc/y1vcWW1tMedaH7PF tnXtzA7MHn1bVjF6fN4kF8AUxWWTkpqTWZZapG+XwJWx7udFpoK/whU3N61kbWDcJ9DFyMkh IWAicf7lFKYuRi4OIYHdjBKTtkxmh3A+MUq83bUfyvnMKLFoXgMzTMvOj3ehErsYJbYsvMAE 1/J5/xJWkCo2AU2J1x+/MIHYIgLKEs/2HQazmQV0Jc68X8cGYgsLREksOPuZEcRmEVCVWHrx E5jNK2AlseJXNxPENnmJ1RsOgG3mFLCWOPDoJthmCYHJ7BL/3r9ngShykTj19hOULSzx6vgW dghbSuJlfxtUQzOjxI7NG6GcHkaJBz+62SCq7CXONT0DOpsD6DxNifW79CHCshJTT62DuppP ovf3E6iLeCV2zIOxVSQ2rOqEW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erpV56NcUr XqonvHg868BrP1Gx8HOGMzaGtl3flsQu62x0jFd5em3WzLwSheM/yjacri7p7XeecKz9dLHF nnUbfacHfSpcfqyu5kpy5aQw80Pm7M47FutzRTH6XjmZd8fswAtp52Pvf938J7N6VbznUXGu eFZpreSjUZsPr69es8VrlXm87otFPE0LNXU+3tiToNUl4fSin/3qxR1uJ9c/buxzPOZg3bzX q2+fzsSJKZ6CoeUr2bczB3KLibOfnPFdRndj04kFFTpxxo9Lv67aYeKRPeNuvAnv7v/xWjIX fZSiP75eNn/rb9eUVMEoT6utV2Kb55XP9uxXPXtbiaU4I9FQi7moOBEAsonInYUCAAA= X-CMS-MailID: 20210722055015epcas5p4db389aa15f16f1577a74ba5ce446919b X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055015epcas5p4db389aa15f16f1577a74ba5ce446919b References: <20210722054951.8291-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 ============================================== [S20] phy 45:18:F8:CF:23:7E Selected phys: LE1MTX Selected phys: LE1MRX [S20] phy 45:18:F8:CF:23:7E LE2MTX LE2MRX [S20] Changing PHY succeeded Device 45:18:F8:CF:23:7E Phy: LE2MTX Device 45:18:F8:CF:23:7E Phy: LE2MRX Reviewed-by: Anupam Roy --- client/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/client/main.c b/client/main.c index ab925769b..e7146ab6f 100644 --- a/client/main.c +++ b/client/main.c @@ -1705,6 +1705,7 @@ static void cmd_info(int argc, char *argv[]) print_property(proxy, "TxPower"); print_property(proxy, "AdvertisingFlags"); print_property(proxy, "AdvertisingData"); + print_property(proxy, "Phy"); battery_proxy = find_battery_by_path(battery_proxies, g_dbus_proxy_get_path(proxy)); @@ -2071,6 +2072,47 @@ static void cmd_phy_configuration(int argc, char *argv[]) g_strfreev(phys); } +static void get_phy(GDBusProxy *proxy) +{ + print_property_with_label(proxy, "Phy", + "Selected phys"); +} + +static void cmd_phy(int argc, char *argv[]) +{ + GDBusProxy *proxy; + 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])) { + bt_shell_printf("Device address not given as input\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + proxy = find_proxy_by_address(default_ctrl->devices, argv[1]); + if (!proxy) { + bt_shell_printf("Device %s not available\n", argv[1]); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (argc == 2) + return get_phy(proxy); + + phys = g_strdupv(&argv[2]); + phys_len = g_strv_length(phys); + + g_dbus_proxy_set_property_array(proxy, + "Phy", DBUS_TYPE_STRING, phys, + phys_len, generic_callback, "PHY", + NULL); + + g_strfreev(phys); +} + + static void cmd_list_attributes(int argc, char *argv[]) { GDBusProxy *proxy; @@ -3072,6 +3114,9 @@ static const struct bt_shell_menu main_menu = { "[EDR2M1SLOT] [EDR2M3SLOT] [EDR2M5SLOT] " "[EDR3M1SLOT] [EDR3M3SLOT] [EDR3M5SLOT]", cmd_phy_configuration, "Get/Set PHY Configuration" }, + { "phy", " [LE1MTX] [LE1MRX] [LE2MTX] [LE2MRX] " + "[LECODEDTX] [LECODEDRX] [LECODEDS2] [LECODEDS8]", + cmd_phy, "Get/Set LE PHY preferences for a connected device" }, { } }, }; From patchwork Thu Jul 22 05:49:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393157 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 1439AC6377D for ; Thu, 22 Jul 2021 06:01:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE17961283 for ; Thu, 22 Jul 2021 06:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230402AbhGVFUk (ORCPT ); Thu, 22 Jul 2021 01:20:40 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:41977 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhGVFUi (ORCPT ); Thu, 22 Jul 2021 01:20:38 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210722060110epoutp0314506dee29e79bcb56a87f8b8c5613fe~UB42v7wcZ1006110061epoutp03y for ; Thu, 22 Jul 2021 06:01:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210722060110epoutp0314506dee29e79bcb56a87f8b8c5613fe~UB42v7wcZ1006110061epoutp03y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933670; bh=vZJ5YsLRm+TaNStqvt11eEi1/zcqwQc1xxbOq52U9+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QfheJMdME89Eg3BOe0CYwXue2BgqpxcICjGcr1gV4AWsQxtsO0v6WrnvTajWlS6YZ U2MSfmm+U7YLUM/jNKQLUA9erI6kfU1x3GcRHSoms3yz2ughTlBv8IMODVh94BvRwP 102E9Vs0r5zqxToAFh8aJ0mvNWQeSwadPiCqfbLY= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20210722060108epcas5p207518e1eb91d02a89dedfee61ccf463c~UB40eoSgS0861908619epcas5p2l; Thu, 22 Jul 2021 06:01:08 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 4D.1B.09595.2A909F06; Thu, 22 Jul 2021 15:01:06 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20210722055016epcas5p267b70f0da3b5c1991d29ca47d685ab6d~UBvVeUvLe0519705197epcas5p2c; Thu, 22 Jul 2021 05:50:16 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722055016epsmtrp1d68eb3d80bba2ae437539030db7fe39b~UBvVdAcGv3119631196epsmtrp11; Thu, 22 Jul 2021 05:50:16 +0000 (GMT) X-AuditID: b6c32a4a-eebff7000000257b-de-60f909a2980e Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 62.7B.08289.81709F06; Thu, 22 Jul 2021 14:50:16 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055015epsmtip1de5ecd70dbb90deed93f8dcfe63ee946~UBvUlmjzS1278412784epsmtip1B; Thu, 22 Jul 2021 05:50:15 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 7/8] device: Save device PHY in storage and read it at init Date: Thu, 22 Jul 2021 11:19:50 +0530 Message-Id: <20210722054951.8291-8-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951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tracker: H4sIAAAAAAAAA+NgFvrIJMWRmVeSWpSXmKPExsWy7bCSnK4E+88Egx9XuS3urLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4Mq4cPgna8Fxvoo7jXuZGxjvcHcxcnBI CJhI7F3M1sXIxSEksINRYtnDD2wQcSmJx8t0uhg5gUxhiZX/nrND1HxglNi35TUTSIJNQFPi 9ccvYLaIgLLEs32HwWxmAX2JpxeuM4LYwgKBEpvXHQGLswioSmz7cYINxOYVsJJo6PjICrFA XmL1hgPMIDangLXEgUc32UFsIaCae6+3ME9g5FvAyLCKUTK1oDg3PbfYsMAoL7Vcrzgxt7g0 L10vOT93EyM4VLS0djDuWfVB7xAjEwfjIUYJDmYlEV6Voq8JQrwpiZVVqUX58UWlOanFhxil OViUxHkvdJ2MFxJITyxJzU5NLUgtgskycXBKNTApBk00evzk91MbW77vx3YZblr4c+aGgKOH ts5e4u321b9jpeFV7sIlEkuO3zo9o//PFZXUMyfkraTZHh0J/R2y5vSHHzZ1DYZ2B65Jyc+y 2xHmaLniznGzbNn6/QE7b0+65rXK2dvpSo3QhCkWpm0vNVxeLOQUSvu59EqDS7JK8LP6tSwz 9+urKn7q3vKnI9GfOS+xY90x/axzh07us35SXXt68pvVx89nvPqSc9hCJeppdltfatKFJxHS xzzqorK4+8++iDK7b3H8kcal12lM9+r+/WpmvxiuyLhy8bGbS+4cF/L+7vpqIedhhgUuPQVn bvFGfeJa+1zQQufE6qiXZ/j4pi6Nj+qZe7jm/CzZ50osxRmJhlrMRcWJAILGE/CEAgAA X-CMS-MailID: 20210722055016epcas5p267b70f0da3b5c1991d29ca47d685ab6d X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055016epcas5p267b70f0da3b5c1991d29ca47d685ab6d References: <20210722054951.8291-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change will save the current LE connection PHY in the storage when LE PHY Updated Event is received. It will also load and set the last stored LE PHY when that device is re-connected. Reviewed-by: Anupam Roy --- src/device.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/device.c b/src/device.c index 4b11772b8..b708fc822 100644 --- a/src/device.c +++ b/src/device.c @@ -275,6 +275,7 @@ struct btd_device { uint32_t phys; bool pending_phys; + uint32_t stored_phys; }; static const uint16_t uuid_list[] = { @@ -448,6 +449,12 @@ static gboolean store_device_info_cb(gpointer user_data) g_key_file_remove_key(key_file, "General", "Services", NULL); } + if (device->stored_phys) + g_key_file_set_integer(key_file, "General", "Phy", + device->stored_phys); + else + g_key_file_remove_key(key_file, "General", "Phy", NULL); + if (device->vendor_src) { g_key_file_set_integer(key_file, "DeviceID", "Source", device->vendor_src); @@ -3576,6 +3583,14 @@ next: gerr = NULL; } + /* Get PHY */ + device->stored_phys = g_key_file_get_integer(key_file, + "General", "Phy", &gerr); + if (gerr) { + g_error_free(gerr); + gerr = NULL; + } + if (store_needed) store_device_info(device); } @@ -5578,6 +5593,9 @@ bool device_attach_att(struct btd_device *dev, GIOChannel *io) device_set_phy(dev, phys); + if (dev->stored_phys) + set_preferred_phy(dev, dev->stored_phys); + bt_att_ref(dev->att); bt_att_set_debug(dev->att, BT_ATT_DEBUG, gatt_debug, NULL, NULL); @@ -5688,6 +5706,9 @@ void device_le_phy_updated(struct btd_device *dev, uint32_t phy) { dev->pending_phys = false; + dev->stored_phys = phy; + store_device_info(dev); + device_set_phy(dev, phy); } From patchwork Thu Jul 22 05:49:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Garg X-Patchwork-Id: 12393161 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=-17.4 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, UNWANTED_LANGUAGE_BODY,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 D7AA8C63797 for ; Thu, 22 Jul 2021 06:01:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C520861283 for ; Thu, 22 Jul 2021 06:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbhGVFUl (ORCPT ); Thu, 22 Jul 2021 01:20:41 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:19892 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbhGVFUj (ORCPT ); Thu, 22 Jul 2021 01:20:39 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210722060114epoutp02317fdbed6fd289a92af616a85635f2b4~UB46Pe8_i1764317643epoutp02T for ; Thu, 22 Jul 2021 06:01:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210722060114epoutp02317fdbed6fd289a92af616a85635f2b4~UB46Pe8_i1764317643epoutp02T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626933674; bh=SAwXS1k1o4yo5Auivr4AhoDjySgx+LKBBteqHFADDks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpXj7ozycHsJhwjD2qLWkYFxlnQsc2ac+mDld4jbPFqB1nNsaIzRUQjYUZ+Zrt+VJ WFIrkADo9Se4CxlYzXZZGJtsOdbZdW9iS1buygpuVslMb/JpK61rfkuGqv/aurhBEj Nkoy89VXsCRtfeuym5STlh+5QqF82KJ+wpAFrm3c= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20210722060113epcas5p21054d9e9332a933e3c46fa4d2bf43cb6~UB45TZ7kI0861508615epcas5p20; Thu, 22 Jul 2021 06:01:13 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 2D.33.55882.8A909F06; Thu, 22 Jul 2021 15:01:12 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210722055017epcas5p4da91b311c34a5fb869148b369338ed07~UBvWmN6NT2536725367epcas5p4S; Thu, 22 Jul 2021 05:50:17 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210722055017epsmtrp10a46a9e16cd5e37f85eb9d3904f6ceba~UBvWk--v63119631196epsmtrp16; Thu, 22 Jul 2021 05:50:17 +0000 (GMT) X-AuditID: b6c32a49-f4fff7000001da4a-41-60f909a8d3aa Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 68.14.08394.91709F06; Thu, 22 Jul 2021 14:50:17 +0900 (KST) Received: from ayush.garg-20-10-15 (unknown [107.109.98.149]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210722055016epsmtip13f66d616a4cb9a62b862955bf6e75a91~UBvVoxwtG1278812788epsmtip1C; Thu, 22 Jul 2021 05:50:16 +0000 (GMT) From: Ayush Garg To: linux-bluetooth@vger.kernel.org Cc: anupam.r@samsung.com, nitin.j@samsung.com Subject: [PATCH BlueZ 8/8] monitor: Add support for LE PHY Update event Date: Thu, 22 Jul 2021 11:19:51 +0530 Message-Id: <20210722054951.8291-9-ayush.garg@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722054951.8291-1-ayush.garg@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7bCmlu4Kzp8JBvPmmFvcWW1tMedaH7PF tnXtzA7MHn1bVjF6fN4kF8AUxWWTkpqTWZZapG+XwJWxa+E61oJrPBX/Ppo2MM7h6mLk5JAQ MJHYsWsdUxcjF4eQwG5GiVNNN6GcT4wS87e8YINwvjFKNNxcxQLT8v77SVYQW0hgL6PErCdp cB1HX14AS7AJaEq8/viFCcQWEVCWeLbvMJjNLKArceb9OjYQW1jAXeL5xPdg9SwCqhKfjk4A W8ArYCVx9u0DZohl8hKrNxwAszkFrCUOPLrJDrJMQmAyu8SBT/fYIYpcJGZOmg1lC0u8Or4F ypaSeNnfBtXQzCixY/NGKKeHUeLBj242iCp7iXNNz4DO4AA6T1Ni/S59iLCsxNRT66Cu5pPo /f2ECSLOK7FjHoytIrFhVSfcso/HFkJd7SHxZ+FxaED2MUpMev+WeQKj3CyEFQsYGVcxSqYW FOempxabFhjmpZbrFSfmFpfmpesl5+duYgRHs5bnDsa7Dz7oHWJk4mA8xCjBwawkwqtS9DVB iDclsbIqtSg/vqg0J7X4EKM0B4uSOC97PFBKID2xJDU7NbUgtQgmy8TBKdXA5JZ4Q+e+lpLr p+46k2bXhpM7ikK45F04qn9PPHo8ffve3r2lM81tP16cseDo8+nsDdq8F9lbQiekLN28b+v2 ORkdcjVX56sFPr7kuaBnxTTRx4nG5zZOXtf/Ipxx3R2vOy6vW1qrHoVz5M19XubMXZpa1TN/ dlx2drbCnFeS5gsZ3pY//vDaNzfuYLrWWcPCBbPDOw5xu5xkEPnno77iXYfxiTklfw83nJx9 tYNxYeOEB3/mq33dNvHcftHaqe80gz6Vrnu3+4f4xQ8b/ddkzJF8c+Nx+EGuSbwh5fbzPJb6 5xnNOrUjhidp+okzStumpalM6E1mzH0uJMf35dz3LcZXL02w0Fm7bEHfSz+jjCVKLMUZiYZa zEXFiQC1CQwYVQMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIJMWRmVeSWpSXmKPExsWy7bCSnK4k+88Eg7+fBCzurLa2mHOtj9li 27p2Zgdmj74tqxg9Pm+SC2CK4rJJSc3JLEst0rdL4MrYtXAda8E1nop/H00bGOdwdTFyckgI mEi8/36StYuRi0NIYDejxMrfE4AcDqCElMTjZToQNcISK/89Z4eo+cAo8eXtPXaQBJuApsTr j1+YQGwRAWWJZ/sOg9nMAvoSTy9cZwSxhQXcJZ5PfM8KYrMIqEp8OjqBBcTmFbCSOPv2ATPE AnmJ1RsOgNmcAtYSBx7dBJsvBFRz7/UW5gmMfAsYGVYxSqYWFOem5xYbFhjmpZbrFSfmFpfm pesl5+duYgSHipbmDsbtqz7oHWJk4mA8xCjBwawkwqtS9DVBiDclsbIqtSg/vqg0J7X4EKM0 B4uSOO+FrpPxQgLpiSWp2ampBalFMFkmDk6pBqYE51358Tqnz64I8boVty7u3+KsahGJWeda 463uHjINc1HV/LPDZPFnDYvg1X5pEmuYZZ43Riate2e0qOW8UVXi5/oqa8cZ9utLwo5ev6Le 9d516l3mFq/2p++O3Q1+lGzwN2xJmPi22S+SfovEF3a/8G2/IfNnsfei6E+fjGU5jn76w8Cx y9u28N5VgTVmanO1/02wev/phcmpk5GvCn4p9F4OOWJz/ImwuRL/w3MzZW7/dN8/8d2WJ733 Hwcn/xJR05X8V+7v9+PKq4+n/srlWTdFWFociF9+hK/t1MdH09dZlm+W+Huonu3JwWkOGw5O Olk05+BH9eIuntL+so0rryRvre2qPKi5deaUOVn+SizFGYmGWsxFxYkAf5wGU4QCAAA= X-CMS-MailID: 20210722055017epcas5p4da91b311c34a5fb869148b369338ed07 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210722055017epcas5p4da91b311c34a5fb869148b369338ed07 References: <20210722054951.8291-1-ayush.garg@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Verification logs: ========================================= > HCI Event: LE Meta Event (0x3e) plen 6 LE PHY Update Complete (0x0c) Status: Success (0x00) Handle: 0 TX PHY: LE 2M (0x02) RX PHY: LE 2M (0x02) @ MGMT Event: LE PHY Update Complete (0x002f) plen 12 LE Address: 45:18:F8:CF:23:7E (Resolvable) Status: Success (0x00) Updated PHYs: 0x1800 LE 2M TX LE 2M RX Reviewed-by: Anupam Roy --- monitor/packet.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/monitor/packet.c b/monitor/packet.c index 52d22ab21..eaa3070de 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -14304,6 +14304,18 @@ static void mgmt_controller_resume_evt(const void *data, uint16_t size) mgmt_print_address(data, addr_type); } +static void mgmt_le_phy_update_complete_evt(const void *data, + uint16_t size) +{ + uint8_t address_type = get_u8(data + 6); + uint8_t status = get_u8(data + 7); + uint32_t selected_phys = get_le32(data + 8); + + mgmt_print_address(data, address_type); + mgmt_print_status(status); + mgmt_print_phys("Updated PHYs", selected_phys); +} + static const struct mgmt_data mgmt_event_table[] = { { 0x0001, "Command Complete", mgmt_command_complete_evt, 3, false }, @@ -14393,6 +14405,8 @@ static const struct mgmt_data mgmt_event_table[] = { mgmt_controller_suspend_evt, 1, true }, { 0x002e, "Controller Resumed", mgmt_controller_resume_evt, 8, true }, + { 0x002f, "LE PHY Update Complete", + mgmt_le_phy_update_complete_evt, 12, true }, { } };