Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp371500ybv; Wed, 19 Feb 2020 23:35:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyrWvf+cmuusbUqvV2NdGJuIZ4ekGl6AXDMTfdJwcSNDHeeimn+aSg9vxIooUeFzcVtPCkT X-Received: by 2002:a9d:7dc9:: with SMTP id k9mr22314220otn.117.1582184110086; Wed, 19 Feb 2020 23:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582184110; cv=none; d=google.com; s=arc-20160816; b=0hT3yO7WJtVNToMOt+SDKYlG3CNJi7ig6JelRtj2ggX98LnMo4OO7n7AzBySpIZx55 r5dRvbhA8Hw+y5/R0/XCjMLp7xCxLz4qYaBuBxx81xrxazfD7NkvC6/p2SQr1KfRusYN iAfLUFNXNDA+ld5b6QCKrY7vJB8uMGRxIvM6TiXJjC9gRmAMQcgsNN6jN25g2aqueUln gK+vVx7NgivDEoUcYZ33dY/HGb5gD1CCZ/Fe1acncCnzoq9X1YLduY6vxaiJgDLy7cDX 9HTjITPP5Ml1rn8WKLbYrVntJH55omD/w8HuuuxWwRC4+lL4hn5BHsjmZc2YD/JtCl3V zRJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=b5beHDY5wVSdB4dkvQDOUS2J0cu47iUhVIQbE5GJ8ks=; b=oaWkaDcdu3raYVw9t152CyVFoG9Ic0Uo5H7ak/puF35Ddd9xWQGyhO1KnEqNcdCGGk KewYztIxaDu5u5rTBBPKVgKIzPODhR5nl57nS+D1jtSaxqHXS9SWL1bfNqCseSRpC5df NaRF3P5eKR0+xR6UMGdJPPmLyLF7hMLBD+nBQa39GrOcV8WnqG4C1ZfJyQR3CplU23bM C0/wNeV7x+eDDmGjjlyAWBWONbYb3DNhDgasJU5wkvyzYPAsQmAPS7O0nhyHeLHaEWW8 Rf6dhE2U2ntNCJPKu5VkqC6T2iOkB1Fj/WzB/3ua5s6H+ajMN6KrohshZ9xm7W+bWTMj L92w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si11175734oic.140.2020.02.19.23.34.56; Wed, 19 Feb 2020 23:35:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgBTHey convert rfc822-to-8bit (ORCPT + 99 others); Thu, 20 Feb 2020 02:34:54 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:44311 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbgBTHey (ORCPT ); Thu, 20 Feb 2020 02:34:54 -0500 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id AE3FCCECDC; Thu, 20 Feb 2020 08:44:17 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: [PATCH] Bluetooth: Fix - During le_conn_timeout disable EXT_ADV From: Marcel Holtmann In-Reply-To: Date: Thu, 20 Feb 2020 08:34:52 +0100 Cc: Bluez mailing list , Sathish Narsimman Content-Transfer-Encoding: 8BIT Message-Id: <8A9D15AB-0A69-4BCA-A673-33F3A616C31E@holtmann.org> References: <20200218123747.3006-1-sathish.narasimman@intel.com> <072E9094-BA5F-47CB-9740-B04A6DC5384D@holtmann.org> To: Sathish Narasimman X-Mailer: Apple Mail (2.3608.60.0.2.5) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sathish, >>>> Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command >>>> disallowed . This patch fixes that issue and disables EXT_ADV if >>>> enabled. >>>> >>>> Signed-off-by: Sathish Narsimman >>>> --- >>>> net/bluetooth/hci_conn.c | 16 +++++++++++++--- >>>> 1 file changed, 13 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c >>>> index a582c676e584..a8d8a876363c 100644 >>>> --- a/net/bluetooth/hci_conn.c >>>> +++ b/net/bluetooth/hci_conn.c >>>> @@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work) >>>> * (which doesn't have a timeout of its own). >>>> */ >>>> if (conn->role == HCI_ROLE_SLAVE) { >>>> - u8 enable = 0x00; >>>> - hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), >>>> - &enable); >>>> + if (ext_adv_capable(hdev)) { >>>> + struct hci_cp_le_set_ext_adv_enable cp; >>>> + >>>> + cp.enable = 0x00; >>>> + cp.num_of_sets = 0x00; >>>> + >>>> + hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, >>>> + sizeof(cp), &cp); >>>> + } else { >>>> + u8 enable = 0x00; >>>> + hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, >>>> + sizeof(enable), &enable); >>>> + } >>> >>> hmmm, I wonder if it is better to create a helper function for this. >>> >>> Regards >>> >>> Marcel >>> >> >> let me verify and submit patch with __hci_req_disable_advertising >> >> Regards >> Sathish N > > calling __hci_req_disable_advertising is not working. the command is > not getting executed > I hope the below method is fine? where it works > > +static void le_disable_advertising(struct hci_dev *hdev) > +{ > + if (ext_adv_capable(hdev)) { > + struct hci_cp_le_set_ext_adv_enable cp; > + cp.enable = 0x00; > + cp.num_of_sets = 0x00; > + > + hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, sizeof(cp), > + &cp); > + } else { > + u8 enable = 0x00; > + hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, > + sizeof(enable), &enable); > + } > + > +} at first glance this looks fine. Regards Marcel