Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2871977pxb; Mon, 19 Apr 2021 16:39:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa4h4kb5i9XOR28S9oFXWwbbqNdQJ7FP/zUApuknuF2WLiUSZVUaQRdgHwHggu9JvF/ttr X-Received: by 2002:a63:1214:: with SMTP id h20mr400035pgl.207.1618875547418; Mon, 19 Apr 2021 16:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618875547; cv=none; d=google.com; s=arc-20160816; b=IbDzGdNo1ozGD2sJht+K4FElhWKDmzQgBm33DEUXtYRRLImd5OE2HDrBn6XEf0RIvY N+C56iv9RunyBd0MImoPbNM7aoClbFdV0ST7fZhWGgrqdYiqbta0jSVAJqMsd25hLpZQ UT8JIoZ6zrC76FL8UrVeqssMLAv9uPxcPVALTMcB4Hg2x0Ebl6lzRHUZ3VrvCF2HfiYh gL9Z8t11w3rafs2oJfkql5qY11NhOW4sKw6R9rktmi16UhTi7O0D3+Ewlbtnxj9XqoAd d5sqK7rFxYQCKJpCYsOPr6wOoJTubN6e0B0nGY5hwA/lZFC7ZukSmeM8YZ1yPSf2kxU4 U68A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wLLNnqiqcs/lATj65OpNjSTqcU7M8vh3ILTJJ7yqOQ0=; b=Q03q1kY+0vx8Rh/26h7CawMK2uLSlQxgSSSfdVFsqS8CXFDnzVeI+aHck5HN+8YqJi lhLAgSVhVTmme0oGVXSZp91MjmyOHFJblO5kktw0YzhO+iDaz7vZdviM5bD9ocDZiEGs qv+EcrZNLMQLefdawrgDqIJQg1QvatyUhwPRWbCjcvxo+pOAJSFyyc/lNzE/8Ni4EBZ5 mpjwp8yl07Nw3O/626uKHNvg1LN7BjadxFs+sb4lT/8u0pTfSzgjrfMHSGh/t4586bb1 JF0adH6VtHj9+M6+Cta10G61Ra01QLGkBlXhcGzbrMKgO9zQlghAEaW1NAiusxJjmFn8 q0AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PYiHX7SM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si17207650pfu.219.2021.04.19.16.38.36; Mon, 19 Apr 2021 16:39:07 -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; dkim=pass header.i=@chromium.org header.s=google header.b=PYiHX7SM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232184AbhDSXgt (ORCPT + 99 others); Mon, 19 Apr 2021 19:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231572AbhDSXgs (ORCPT ); Mon, 19 Apr 2021 19:36:48 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38FDBC06174A for ; Mon, 19 Apr 2021 16:36:16 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id h15so6584166pfv.2 for ; Mon, 19 Apr 2021 16:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wLLNnqiqcs/lATj65OpNjSTqcU7M8vh3ILTJJ7yqOQ0=; b=PYiHX7SMVxnQjsxJCv125H9lnAq8Q7JKSM0S6xy4AAp0b4tTEr++oEWy0D2k2j5m4Z HwuOxb18z4FqyxrxSclX8xhYJkhlsRNs/quVJjSlHyDr9S9/HcqjjqziFZ7pukFUhB50 7I6OG45AvdfAhzbUzDBiqADQixHbyJLvZoj0E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wLLNnqiqcs/lATj65OpNjSTqcU7M8vh3ILTJJ7yqOQ0=; b=OAxCfoEGu0Ihur0aGNyysBeaWMF/Z/SqXN1Zda/BQN+biDEjcqbKnpMPbz5t0OIl/6 sNwQ+a7UFUIw6T+jjPh+/20SM7pe27uHaevzKgBm8klAADliuHID5sjWnjZR+hkWy2Ee vMbb+ySI4O4zWTw9KITJcRS+H8Zhmr//C5hFaGBD77JX9/U39OSG7DtETFzIZZJZ90mC lF7RbD/8FkW/N7cbKMF2enxxHQeusvEj0lCJQUqcIBW8uPF+aDj6fxmGMpu9vWF3ZXzi n2KTxCmcDKlk2y0UP4X+iU9aWBNrWksVRFfqR5OSUW1Mdx39DQTzjk12AabnqvJZklqZ 7aGw== X-Gm-Message-State: AOAM532z5TgcS5XBAvh7MosJ4ZsV/hJAJ1d/Y123D7kdMdvIEtPK3AvH 6N0hvlRn25JNKFY+Zdr2qrSTIHPouVGJCw== X-Received: by 2002:a65:620d:: with SMTP id d13mr14059811pgv.85.1618875375497; Mon, 19 Apr 2021 16:36:15 -0700 (PDT) Received: from localhost ([2620:15c:202:201:7527:8700:7408:d424]) by smtp.gmail.com with UTF8SMTPSA id oa9sm440043pjb.44.2021.04.19.16.36.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Apr 2021 16:36:15 -0700 (PDT) From: Miao-chen Chou To: Bluetooth Kernel Mailing List Cc: Alain Michaud , Sonny Sasaka , Marcel Holtmann , Luiz Augusto von Dentz , Miao-chen Chou Subject: [BlueZ PATCH v1] device: Reply to connect request if SDP search failed Date: Mon, 19 Apr 2021 16:36:02 -0700 Message-Id: <20210419163518.BlueZ.v1.1.Id327043128b54d359c7ad4bf44ec21179c7d3213@changeid> X-Mailer: git-send-email 2.31.1.368.gbe11c130af-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org SDP request can be initiated during BR/EDR connection. This fixes a missing reply to the method call to prevent generic error message for no reply. The following test steps were performed: (1) Put Bose QC35 into pairing mode, start scanning on bluetoothctl (2) Turn off the headphones and connect to the headphones (3) Verify that error should returns immediately to bluetoothctl --- src/device.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/device.c b/src/device.c index df440ce09..516ffe2e7 100644 --- a/src/device.c +++ b/src/device.c @@ -4966,6 +4966,7 @@ static void search_cb(sdp_list_t *recs, int err, gpointer user_data) { struct browse_req *req = user_data; struct btd_device *device = req->device; + DBusMessage *reply; GSList *primaries; char addr[18]; @@ -5009,6 +5010,18 @@ static void search_cb(sdp_list_t *recs, int err, gpointer user_data) DEVICE_INTERFACE, "UUIDs"); send_reply: + /* If SDP search failed during an ongoing connection request, we should + * reply to D-Bus method call. + */ + if (err < 0 && device->connect) { + DBG("SDP failed during connection"); + reply = btd_error_failed(device->connect, + strerror(-err)); + g_dbus_send_message(dbus_conn, reply); + dbus_message_unref(device->connect); + device->connect = NULL; + } + device_svc_resolved(device, BROWSE_SDP, BDADDR_BREDR, err); } -- 2.31.1.368.gbe11c130af-goog