Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1570399pxa; Fri, 28 Aug 2020 17:08:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxz4FSBJtJnX/Lb/INxeJ7ANZYCi6i2De4dJdfTj0uYEui6gipg5AUSKXl1yTaBbdRdScEr X-Received: by 2002:a17:906:f996:: with SMTP id li22mr1307709ejb.540.1598659735763; Fri, 28 Aug 2020 17:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598659735; cv=none; d=google.com; s=arc-20160816; b=gMwaxP0YNprF9bXINunPd5m7+rFzsMWATXJxeKLQt/Kx0Io6uTECFoixcpT2ayCWGK LfksfvYGSRMzrvs5Vm5jZs48hMkaMv9KHQt/xr05jJ2onZ7ZVYFHLacoXLSQgxGYLJ1L 8cLVwwzBfm7BNiBMbs07rQlGfdhYYjZlTB3W5C6v9V598h1aQH1F5EKbxTAowOTVEWM4 BVQwwjst4Y7c3Vt34qv8UNc0C+XUzqjo7Vs5V08yt6HMn2eGDqK0AJjFHWG6nP/6UtRH agJRaSq1xSUe5egPwncN+/wEzY2WAFPXohkb1zcMGLeOUxXQ6ySaZEL69iVNRRpgX25w 2BJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=dgX8MvNfWRo/FSN0M2j5wWuGqUOGeMHRDlLU1VAQCyA=; b=x2epSMJxOJYL53dLC8E1O9XVum/jI1OhvB+NQwd/V82n3G75G/t3maRgBePgXBn+Kz ISrWXPqKhDcIwezyrsj85x9VyHAbgtyu3MLpLuwwwIFb7FTCVagAD21QYZy8gbBkyZrW 6+Dp8R5HtWlJy6+csmsrSdVYzPKG13e/KgrCgoZwx95DjbSYf5VnQWVykyFFoRNvXPww xcd+hVtYFKwhif6bAADXHlSRKj3DBAv03Kp+oMEafZGp2EWceMkgrZ99gmetZD5Hjq2d MSrzxSU1IQCOYSib/D8DoPRp1qtzonhQVxpdFyzZQ3yR9NZaPCj41neFAp0ovMI8XEEv 7hpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si556478edx.134.2020.08.28.17.08.18; Fri, 28 Aug 2020 17:08:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbgH2AIN (ORCPT + 99 others); Fri, 28 Aug 2020 20:08:13 -0400 Received: from mga12.intel.com ([192.55.52.136]:10238 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbgH2AIN (ORCPT ); Fri, 28 Aug 2020 20:08:13 -0400 IronPort-SDR: +3AiurOMES0StYhdXY92G4lc45OSGPiyFlOK7ZOPVjDIbTdSlyP4IccTrjoAdhC/57STOHu9GO y3VfdCLkLZzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9727"; a="136305340" X-IronPort-AV: E=Sophos;i="5.76,365,1592895600"; d="scan'208";a="136305340" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 17:08:10 -0700 IronPort-SDR: u3ZMtn9vWPBh2CQBL+QGtO5w2pQBE3pydhi65ie1KoeleRTLAatETACP2uI1N6ZJv4EBvCwMr6 6tZ79QYECgvg== X-IronPort-AV: E=Sophos;i="5.76,365,1592895600"; d="scan'208";a="324213880" Received: from asmit14x-mobl1.amr.corp.intel.com (HELO han1-mobl3.jf.intel.com) ([10.254.83.187]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 17:08:10 -0700 From: tedd.an@intel.com To: linux-bluetooth@vger.kernel.org Cc: Tedd Ho-Jeong An Subject: [V3 3/3] btpclient: Fix gap reset not sending response Date: Fri, 28 Aug 2020 17:08:03 -0700 Message-Id: <20200829000803.20286-3-tedd.an@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200829000803.20286-1-tedd.an@intel.com> References: <20200829000803.20286-1-tedd.an@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An This patch fixes the GAP reset command to response the default settings after resetting the stack. --- tools/btpclient.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/tools/btpclient.c b/tools/btpclient.c index f9c693056..38e326670 100644 --- a/tools/btpclient.c +++ b/tools/btpclient.c @@ -521,6 +521,19 @@ static void reset_unreg_agent_reply(struct l_dbus_proxy *proxy, ag.registered = false; } +static void update_current_settings(struct btp_adapter *adapter, + uint32_t new_settings) +{ + struct btp_new_settings_ev ev; + + adapter->current_settings = new_settings; + + ev.current_settings = L_CPU_TO_LE32(adapter->current_settings); + + btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_NEW_SETTINGS, adapter->index, + sizeof(ev), &ev); +} + static void btp_gap_reset(uint8_t index, const void *param, uint16_t length, void *user_data) { @@ -528,6 +541,7 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length, const struct l_queue_entry *entry; uint8_t status; bool prop; + uint32_t default_settings; if (!adapter) { status = BTP_ERROR_INVALID_INDEX; @@ -570,10 +584,13 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length, goto failed; } - adapter->current_settings = adapter->default_settings; + default_settings = adapter->default_settings; + + update_current_settings(adapter, default_settings); /* TODO for we assume all went well */ - btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_RESET, index, 0, NULL); + btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_RESET, index, + sizeof(default_settings), &default_settings); return; failed: @@ -644,19 +661,6 @@ failed: btp_send_error(btp, BTP_GAP_SERVICE, index, status); } -static void update_current_settings(struct btp_adapter *adapter, - uint32_t new_settings) -{ - struct btp_new_settings_ev ev; - - adapter->current_settings = new_settings; - - ev.current_settings = L_CPU_TO_LE32(adapter->current_settings); - - btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_NEW_SETTINGS, adapter->index, - sizeof(ev), &ev); -} - static void btp_gap_set_connectable(uint8_t index, const void *param, uint16_t length, void *user_data) { -- 2.25.4