Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp431538pxa; Fri, 21 Aug 2020 10:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG4cGLPeMu/nOSj7Uwpsd6LWhe+qN2RIpBZ7kxY/BN74+nKcGJeLCVK1EVJLrfX8o2Kjl/ X-Received: by 2002:a50:e611:: with SMTP id y17mr3821912edm.376.1598032515006; Fri, 21 Aug 2020 10:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598032514; cv=none; d=google.com; s=arc-20160816; b=aATMOhGzjc6DSS9XHR68OylB5KX8QxAp3wazv+KnjlBRJrjS5Pt4h6qDoIdx3o/xMs GUKYEycyuSdBsOJjSYcPm1ns124zlDq7epJz6mQ7UOQ1T8Xpg0nW61bESkq2Orwk93ut y5dv7az/dSXxsXMPGenfFFACvTGsB0r4zTCjuLpqVc+p16n4NU7xcbtpIOLl9gxBxR/Q Gvbt2W8ryvzO7ohWwWAmCkm43Vz2sXVj18+uYbU4pzwvpiyFS6yz2Z9vHkxbTUUmI9u9 Nd4/d9+blxGCzhYwJtCZQoZ1mzsfjlNN2O/TGMoKuVOPVOxjaj5CvmAKXjA/vTswlu2n HGqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xNQFwJoi1mS8yo9UsU4ab+XF9HC8xWBiEbryZG9ORqs=; b=nzI1tMrJTkKVD0KIjF3/cadTiOmiS/wU9BS5U1xfkhYQhVfz0BZiLKWnoLy5xNEAf4 VG9zn97ngUvgXyqnn4cF2J33875C3ihEWx85hiLbykbS3jc29ebXfB1tiY/fSzhZIQVl DY3KLdOrtQi0VGXDxl0MaJ4a4oed5sFU6SqJw2NYMSd5StJM6uhlNa7va+4pq/yXiQ7Z bXRvR8Vl2Iely3I/edEK7P8II4VG7oPzit6KuAuOkIkamnYOSpvuw23esbVgd7aOIOAC tigB2887wOG6NB8QYW/e8jXr1JvTtg6EMKX9b7NQF37zaPiChT5TUWFRiC0iuz1d4GVu cJvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iRSUkdbk; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si1912326edi.194.2020.08.21.10.54.48; Fri, 21 Aug 2020 10:55:14 -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=@gmail.com header.s=20161025 header.b=iRSUkdbk; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726876AbgHURyh (ORCPT + 99 others); Fri, 21 Aug 2020 13:54:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbgHURyh (ORCPT ); Fri, 21 Aug 2020 13:54:37 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6BB8C061573 for ; Fri, 21 Aug 2020 10:54:36 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id l84so2212922oig.10 for ; Fri, 21 Aug 2020 10:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xNQFwJoi1mS8yo9UsU4ab+XF9HC8xWBiEbryZG9ORqs=; b=iRSUkdbklz8z2Py0ri2l9eZzqU3NNI7cYqntpEHUSiQiZJryrD09mDi+fCdzy6koz+ 81w+ZXnVk4TtVOMNEWv4SwsvmcFgDpQw34y64oHSDBSJM0rXXqeABEDVMEFnaPDJd0wL unJYmBIAWYIhhJiQr+lgrNXT20faMrefeOMBAjdEPw2N1iUEL8PL11pvG5UEb4Okbg3H r7pgkNXq9XLGXZK/rQTv/t4GOtqSUtmzP5vmTOfLy8jMM8i6atVOzAaGp52UT6BZMjA0 wbZ4K1Rr+RUsFUVT+1oifdYAgRwiIb9MGDcctRseUEDA47hn+sN0hs+NXGCJcn1nSxWU 2tBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xNQFwJoi1mS8yo9UsU4ab+XF9HC8xWBiEbryZG9ORqs=; b=eDakLXHVo/hg4vnSRg+/0hhE73VuRwFGoGvz7MX4WDfgV1mhgtoS5QE5i46uEY6CyI h+H3dTfBG71tKaolA1+9rUpCq7S8HPF2JYPrGNp1w1l+pkI6i4sWTkAOTzgKFvmyB1dj 3UFdqnjdkgbmWdiRGHgzD9TynW/dzW8rPH/PdbCh+lVKYNm+GKcHP7wlBvBCIrlL+sGO z5ELkQY7fQsopKtLdu3DAFfZCnjVKgMtWR6MEON4NdA1wsSEIeiUl64JI2pmiMeQ5lVw vFSTo68kjQtvRCaj5AU+LepLXjTmeETdnRjDaRtbC9gRrt2lfjiHzdeUCtMuzgJekQh3 48wQ== X-Gm-Message-State: AOAM530e9xsthOY0SuICjtkkPe/A8iWOVOesVisMCfWzothozDzk5jlq PUiHMWWpcvDHjrOdSaD30RV1ic8tbWruEsSmGRczeSRx X-Received: by 2002:aca:5703:: with SMTP id l3mr2378460oib.48.1598032476208; Fri, 21 Aug 2020 10:54:36 -0700 (PDT) MIME-Version: 1.0 References: <20200821072812.19131-1-sonnysasaka@chromium.org> In-Reply-To: <20200821072812.19131-1-sonnysasaka@chromium.org> From: Luiz Augusto von Dentz Date: Fri, 21 Aug 2020 10:54:25 -0700 Message-ID: Subject: Re: [PATCH BlueZ] client: Add cancel-pairing command To: Sonny Sasaka Cc: "linux-bluetooth@vger.kernel.org" , Miao-chen Chou Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sonny, On Fri, Aug 21, 2020 at 12:30 AM Sonny Sasaka wrote: > > From: Miao-chen Chou > > This adds cancel-pairing command which can be used to cancel the ongoing > pairing. > > Reviewed-by: Sonny Sasaka > > --- > client/main.c | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/client/main.c b/client/main.c > index 9abada69f..da877b546 100644 > --- a/client/main.c > +++ b/client/main.c > @@ -1742,6 +1742,39 @@ static void cmd_pair(int argc, char *argv[]) > bt_shell_printf("Attempting to pair with %s\n", proxy_address(proxy)); > } > > +static void cancel_pairing_reply(DBusMessage *message, void *user_data) > +{ > + DBusError error; > + > + dbus_error_init(&error); > + > + if (dbus_set_error_from_message(&error, message) == TRUE) { > + bt_shell_printf("Failed to cancel pairing: %s\n", error.name); > + dbus_error_free(&error); > + return; > + } > + > + bt_shell_printf("Cancel pairing successful\n"); > +} > + > +static void cmd_cancel_pairing(int argc, char *argv[]) > +{ > + GDBusProxy *proxy; > + > + proxy = find_device(argc, argv); > + if (!proxy) > + return; > + > + if (g_dbus_proxy_method_call(proxy, "CancelPairing", NULL, > + cancel_pairing_reply, NULL, NULL) == FALSE) { > + bt_shell_printf("Failed to cancel pairing\n"); > + return; > + } > + > + bt_shell_printf("Attempting to cancel pairing with %s\n", > + proxy_address(proxy)); > +} > + > static void cmd_trust(int argc, char *argv[]) > { > GDBusProxy *proxy; > @@ -2816,6 +2849,8 @@ static const struct bt_shell_menu main_menu = { > dev_generator }, > { "pair", "[dev]", cmd_pair, "Pair with device", > dev_generator }, > + { "cancel-pairing", "[dev]", cmd_cancel_pairing, > + "Cancel pairing with device", dev_generator }, > { "trust", "[dev]", cmd_trust, "Trust device", > dev_generator }, > { "untrust", "[dev]", cmd_untrust, "Untrust device", > -- > 2.26.2 Applied, thanks. -- Luiz Augusto von Dentz