Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4090692iog; Tue, 21 Jun 2022 11:48:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1utFRLIIc+jG8lz9W6pnY4ITtefG41U1vEeJFgA+ia4SRH1Qha5XOG8XarkYPlBa+anMsUi X-Received: by 2002:a05:6402:4246:b0:42f:3a4b:cc71 with SMTP id g6-20020a056402424600b0042f3a4bcc71mr36613475edb.107.1655837337842; Tue, 21 Jun 2022 11:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655837337; cv=none; d=google.com; s=arc-20160816; b=Jm6p2NZYSfHKYEO+AbAvdNPa7Ojvp7UCjDSl+ioi5bc22yXdQWfDv7GQzY3d5vPYLu NkIZu8tDxzuF08pFUSpn7QIRnR5HTYNf9TbjwEOj405MqJMci3+qojnd9GUCM7ecE6aN M1NvxJ/QIJwjG93lYVwoo/efR5q/3oG7SuV90cRTHD9rw6FaW3MxolA0C0dfoBd+C9y2 XB/bHMNQHdpdHcYY1oxGh8j2sS3KGmcmu0kjFYy+lHh4HwGW9Syz/D8EdQU+8HK9JyDz Ws9YyRmxvvvfcFSvppsVroag+4aSIUz4xt3TcITGiifkArJkMxgll3WtfGZChLQD/rlu SJmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=viRAp4gMMQ0ZqzyDeDXgEXnmd89yZs/6hCJtvDrTTsM=; b=g+e4BgyxikA2SXdeLXPgHoPQmZC6WTe2LTxtq19BC5HlZYROlk3JQbt0IMH9XDRAEL 0wkixAz0USicCYTGSo2nmnjN3JvsyQuUt5VFBOKxfcY03ZClxGsWgSzclbQ23qP30m+F ZSWKvbo8XAK7PmYOGsapaMG38C8h8n4c4pRPQBCgQSXbiQKoqN+F2JUylo+IKyu4SopZ BNRuEWJoYKM49BZd+9+vqx0L6GU5TQQVoKV+M9GbVbcdw/ZvgC1ErC8hp/AXYpDqi3d2 0wz+aPayqrzgZzIynrLzYa+W1W+u4IqPYp6jS+Ja5xtmPQ+hq516C3wjSNgUt/Swd+Vp a8IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HbJQhz4D; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc18-20020a1709078a1200b007120a60b38asi2378530ejc.1001.2022.06.21.11.48.28; Tue, 21 Jun 2022 11:48:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HbJQhz4D; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230063AbiFUSji (ORCPT + 99 others); Tue, 21 Jun 2022 14:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229869AbiFUSji (ORCPT ); Tue, 21 Jun 2022 14:39:38 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F7A10FDF for ; Tue, 21 Jun 2022 11:39:36 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id j21so10739361lfe.1 for ; Tue, 21 Jun 2022 11:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=viRAp4gMMQ0ZqzyDeDXgEXnmd89yZs/6hCJtvDrTTsM=; b=HbJQhz4DnPBt+sEVwEj1YW8LvUHTA4/pU6qUx1k1ipuirP8B5WwFTZbyV8UDcMg8+5 7FyClkllZuC5uGuih1GHG8nCJB2rJ6lFRuTur6lsn7BWLDhSUhbPbQIBvcWv81WttrRh a1hWsI82wVATXcxULlRrwoBvFwxey/7CD2/IuTPXzLRGeX+X7lXjCgkDQ2Rb7FfkkMX3 EJgaYeuQMaOSaUhdYya1WK0fJydSg86zxHS7fTAG9ccFhg3CcL/4OQn6zPv1e35i40fY ZD7PwMMOe03oK7RjMCYyI4fqKIhAhHzqekJTl5202xlxni2VESrte7XvrZpkzBYxjPY2 OZ+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=viRAp4gMMQ0ZqzyDeDXgEXnmd89yZs/6hCJtvDrTTsM=; b=3g1bJO1dgOrqz7y/c9ripRRZ279Z4mA327FC31gUUrZJ5bSoSKEtxQHAZYi3vgkCva 3+XJK/ocxmu44CmF6YccS2T0T/nGQPt6beQsOWyQ20nPBhfJ+LxNSrnvVMjCSTJXep3k GfBs/iX1j+JPO7fKgGRTgnrKLbshaRn7RrYf/RB3DFDt/gFwvdco8LzMuoGmhdkWTo/I OAQ4sZZEhkQkLfCEh5lAgkXnU5txHK+LK12Aqp1JyTiweOBPn99wkf7YDALDQCXBdsvX WajhHa+Klyc1HQqfgajjdhhr7yWndtMOvC04nKDXgzHGl2eJqa/Umzgb3OdgpL7PM/Ea 6Hyw== X-Gm-Message-State: AJIora+aGP41DlndYjfwfp5SQorOtIcaBtriWxEL3g45uUUmLAPTy4rC RROna1Jf55UV53yxACkUiKGqsNQhDD9MuKCtAx9jNIiEW8dh5Q== X-Received: by 2002:a05:6512:3ca4:b0:47f:6e53:fb4 with SMTP id h36-20020a0565123ca400b0047f6e530fb4mr7423883lfv.57.1655836774638; Tue, 21 Jun 2022 11:39:34 -0700 (PDT) MIME-Version: 1.0 References: <20220621134818.11515-1-wangyouwan@uniontech.com> In-Reply-To: <20220621134818.11515-1-wangyouwan@uniontech.com> From: Luiz Augusto von Dentz Date: Tue, 21 Jun 2022 11:39:23 -0700 Message-ID: Subject: Re: [PATCH] device: Fix timeout=1 to remove the device immediately To: Youwan Wang Cc: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Youwan, On Tue, Jun 21, 2022 at 6:55 AM Youwan Wang wrot= e: > > =E3=80=80When I use bluetoothctl to remove a device, > =E3=80=80I find that the device has not been deleted. > > =E3=80=80static void set_temporary_timer(device, 0) > =E3=80=80{ > ...... > if (!timeout) > return; > =E3=80=80=E3=80=80 ...... > =E3=80=80 } > > =E3=80=80=E3=80=80Now I want to delete the connected device > when call remove. > =E3=80=80=E3=80=80I don't know whether this modification is > feasible, please give me some suggestions. > --- > src/device.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/device.c b/src/device.c > index 7b451e458..d38ad74fc 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -3159,7 +3159,7 @@ void device_remove_connection(struct btd_device *de= vice, uint8_t bdaddr_type) > DEVICE_INTERFACE, "Connec= ted"); > > if (remove_device) > - set_temporary_timer(device, 0); > + set_temporary_timer(device, 1); > } Don't think this is right, in fact the original code could have been clearer since all we want is to call clear_temporary_timeout thus why we passed 0, perhaps you are after the following fix: https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=3D5ebc2b5a3e4= 8dbe67a2d315979b096a1b4d1eb99 > guint device_add_disconnect_watch(struct btd_device *device, > -- > 2.20.1 > > > --=20 Luiz Augusto von Dentz