Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5159784iog; Wed, 22 Jun 2022 13:22:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vSPFBCoj0mh3Kexm4ZdU2AOTRa8okkB/ZnRp0H7ZTFMxZYWBzYbi3CY9MWY0bcsg/3nJF+ X-Received: by 2002:a17:906:74c2:b0:722:a7e9:6f82 with SMTP id z2-20020a17090674c200b00722a7e96f82mr4869783ejl.3.1655929375494; Wed, 22 Jun 2022 13:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655929375; cv=none; d=google.com; s=arc-20160816; b=0YeXF9ds4LMAecHt3PAB0Q0HYpyW8HSBrnD+wjMl9d0/GxE3uAjFns87/DxA8UGjLB lOyu6Ug/Nu93YhK+u01Kl8zTV3qtJ6j7AV65GLHeHAdFBJPyUbSO/sOD3tbxc6YTHfTt g9abqqYtY8swy8OPFK9K8GE2MnAGhLO+IvhPANqr3rHU2GCe9bGf7JF2nnPzfg95p7xP el0E/UMRHSAnqGWh5fONnoR8O6Ra0DKY58otEZ9haegqRQVPENpx52zqj3iOZi/kJqWe b8KP7TKnfvaC/LjAHOWWnNAhdzwxbS8/0QaoEaEBk5tChQGDwg2O5LueWyxGHLUl1oav nRzg== 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=ZMTRNKyoIFjrGLh5LZl280W6Caedspq3IyF/8bZep8w=; b=sjgeD1V5uf1No9IiiEiUET9cdJRuwXBpb5Z9hrNT3YE/ZcE+j4dzm0DUxRnAw0au09 iv4QSRpRYwb9XNTeaE3PiZ7W5zvYSVSeJM4goqW0ddMIb3KmAd1PtTnxUXeSvlwF9RUG I5KLxbump60KQXj4p6UyO/+OaW2bte5w8JdHbTM5ORcZqXyGyFIDKb5XTczDXbV3Ccbf X3GcJ0jTzA6KETpdtBpALVpeCpqQnAYbHGWlrG8oZPqRdOub2bKB2WntFMXyrxi2t2+N tBrFfnqdrrRiW6ZdR0IePh95kWmYDfqHreioNnDmAMC81vy4Ka1S1v6QfPbPFZrLg4OR mgCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HP68uulh; 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 hs7-20020a1709073e8700b007084cb35e5esi25168374ejc.442.2022.06.22.13.22.12; Wed, 22 Jun 2022 13:22:55 -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=HP68uulh; 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 S1377107AbiFVUIO (ORCPT + 99 others); Wed, 22 Jun 2022 16:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377053AbiFVUIL (ORCPT ); Wed, 22 Jun 2022 16:08:11 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 474E92FE7B for ; Wed, 22 Jun 2022 13:08:09 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id g4so17247808lfv.9 for ; Wed, 22 Jun 2022 13:08:09 -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=ZMTRNKyoIFjrGLh5LZl280W6Caedspq3IyF/8bZep8w=; b=HP68uulhGEjF1++TYNaHFVg/8H+d4aDqf+Oeruyx7lrE35bvzjW63sYatJNOdLb5Ss 7xmCLxvINg8b01A3n1v0iMnO2ZVMEZEAvmE8qouUEWxTur84cS2RgQuNAFFzd2ZyjneM uW7hzSjQdFtRpHGoxZ08zstgHsej8ZUEv//N7ufoC/iEtuccvxKf5WuS4vS+ObTA3qzX CqgLb4I/wCXuzQk3gDb/Sy9FdQ9mw1oUIvLmP3nlkmE6Pt9WJN8zhtIxV4i8QPbEjxB2 rh+UOzR34EuQLPHu1jBmx8XWS6agRFDjVZnWRj6Ua1Gp/WOVcfpVdZ54MWUiii1Go/AY FY0Q== 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=ZMTRNKyoIFjrGLh5LZl280W6Caedspq3IyF/8bZep8w=; b=Cw28/yA9a1paNDirtc67BCmu+UFPvQj4P4L10JW6UwioouCIuFv31my9lTZpXJ6Smq utnefD677ceUZAWtJ6jmxudMJEM2Cnvq2Q6o7i4EB0gznZNwkLG+z08MZqBo5TsXvCvS yX1PhUn7oJxTf1nmbjY+lkBNXSeGWpDAfzTc2LoK7+WIk2O6zkfKJOWt4/1bBWWYeViC 1CyBV2sdp5gsoiivtJFLujAIpL8DvGZ8/tZ6zDqWwEY8jtNZJS0HwdetObgoxh1R1AOr fY9+0L1s4DITgcy2OWpxNXJ6I6NVLiuBZfVI7cvwvo05JhOxZendEaYF0Yy0lPAqEHxw AxjA== X-Gm-Message-State: AJIora9OlObU91x/hMaRfLLst7tfaUcHr0qxdjzQyXKR5KarmC28NiB6 HlbVDSuBM8aJh+/lmY6muB2l3ZULZGN0531pqFaQJHwg59N4/g== X-Received: by 2002:a05:6512:11c8:b0:47f:9e6d:6050 with SMTP id h8-20020a05651211c800b0047f9e6d6050mr1818162lfr.251.1655928487381; Wed, 22 Jun 2022 13:08:07 -0700 (PDT) MIME-Version: 1.0 References: <20220621134818.11515-1-wangyouwan@uniontech.com> In-Reply-To: From: Luiz Augusto von Dentz Date: Wed, 22 Jun 2022 13:07:55 -0700 Message-ID: Subject: Re: [PATCH] device: Fix timeout=1 to remove the device immediately To: =?UTF-8?B?546L5pyJ5LiH?= 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, On Tue, Jun 21, 2022 at 6:38 PM =E7=8E=8B=E6=9C=89=E4=B8=87 wrote: > > thank you! > This modification is consistent with my code > https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=3D5ebc2b5a3= e48dbe67a2d315979b096a1b4d1eb99 > > Here are my steps, I found that it takes two times to remove the connecte= d device > When removing for the first time btd_adapter_remove_device(dev->adapter, = dev) func will not be called > > [bluetooth]# connect 40:EF:4C:0C:11:F0 > Attempting to connect to 40:EF:4C:0C:11:F0 > [CHG] Device 40:EF:4C:0C:11:F0 Connected: yes > Connection successful > [CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: yes > [UFO]# remove 40:EF:4C:0C:11:F0 > [CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: no > Device has been removed > [CHG] Device 40:EF:4C:0C:11:F0 Connected: no > [bluetooth]# info 40:EF:4C:0C:11:F0 > Device 40:EF:4C:0C:11:F0 (public) > Name: UFO > Alias: UFO > Class: 0x00240418 > Icon: audio-headphones > Paired: yes > Trusted: no > Blocked: no > Connected: no > LegacyPairing: no > UUID: Headset (00001108-0000-1000-8000-00805f9b= 34fb) > UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b= 34fb) > UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b= 34fb) > UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b= 34fb) > UUID: Handsfree (0000111e-0000-1000-8000-00805f9b= 34fb) > UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b= 34fb) > [bluetooth]# > > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/device.c:btd_device_= set_temporary() temporary 1 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a84200: device 40:EF:4C:0C:11:F0 profile avrcp-controller stat= e changed: connected -> disconnecting (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avrcp.c:a= vrcp_disconnect() path /org/bluez/hci0/dev_40_EF_4C_0C_11_F0 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37aaeac0: device 40:EF:4C:0C:11:F0 profile audio-avrcp-target st= ate changed: connected -> disconnected (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a84200: device 40:EF:4C:0C:11:F0 profile avrcp-controller stat= e changed: disconnecting -> disconnected (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avrcp.c:c= ontroller_destroy() 0x558c37a4e600 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avrcp.c:t= arget_destroy() 0x558c37a47e20 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avctp.c:a= vctp_set_state() AVCTP Disconnected > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avctp.c:a= vctp_disconnected() AVCTP: closing uinput for 40:EF:4C:0C:11:F0 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37aaeb30: device 40:EF:4C:0C:11:F0 profile a2dp-sink state chang= ed: connected -> disconnecting (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:a2= dp_sink_disconnect() path /org/bluez/hci0/dev_40_EF_4C_0C_11_F0 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a80790: device 40:EF:4C:0C:11:F0 profile Hands-Free Voice gate= way state changed: connected -> disconnecting (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a869e0: device 40:EF:4C:0C:11:F0 profile Phone Book Access sta= te changed: connected -> disconnecting (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/adapter.c:remove_acc= ept_list_complete() 40:EF:4C:0C:11:F0 removed from kernel accept list > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a869e0: device 40:EF:4C:0C:11:F0 profile Phone Book Access sta= te changed: disconnecting -> disconnected (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37a869e0: ref=3D1 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a80790: device 40:EF:4C:0C:11:F0 profile Hands-Free Voice gate= way state changed: disconnecting -> disconnected (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37a80790: ref=3D2 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:s= ession_cb() > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_parse_resp() CLOSE request succeeded > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_sep_set_state() stream state changed: STREAMING -> CLOSING > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:cl= ose_cfm() Source 0x558c37a73050: Close_Cfm > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_sep_set_state() stream state changed: CLOSING -> IDLE > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/transport= .c:media_transport_remove_owner() Transport /org/bluez/hci0/dev_40_EF_4C_0C= _11_F0/sep1/fd10 Owner :1.1779 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/transport= .c:media_owner_free() Owner :1.1779 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/transport= .c:transport_set_state() State changed /org/bluez/hci0/dev_40_EF_4C_0C_11_F= 0/sep1/fd10: TRANSPORT_STATE_ACTIVE -> TRANSPORT_STATE_IDLE > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:a2= dp_sep_unlock() SEP 0x558c37a73050 unlocked > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_unref() 0x558c37a61720: ref=3D1 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37aaeb30: device 40:EF:4C:0C:11:F0 profile a2dp-sink state chang= ed: disconnecting -> disconnected (0) > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_unref() 0x558c37a61720: ref=3D0 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_ref() 0x558c37a61720: ref=3D1 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:s= et_disconnect_timer() timeout 0 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_ref() 0x558c37a61720: ref=3D2 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:c= onnection_lost() Disconnected from 40:EF:4C:0C:11:F0 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/sink.c:si= nk_set_state() State changed /org/bluez/hci0/dev_40_EF_4C_0C_11_F0: SINK_ST= ATE_PLAYING -> SINK_STATE_DISCONNECTED > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:ch= annel_remove() chan 0x558c37a4e530 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_unref() 0x558c37a61720: ref=3D1 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_unref() 0x558c37a61720: ref=3D0 > 6=E6=9C=88 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:a= vdtp_free() 0x558c37a61720 > 6=E6=9C=88 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:dev_discon= nected() Device 40:EF:4C:0C:11:F0 disconnected, reason 2 > 6=E6=9C=88 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:adapter_re= move_connection() > 6=E6=9C=88 20 15:05:44 uos-PC bluetoothd[10094]: plugins/policy.c:disconn= ect_cb() reason 2 > 6=E6=9C=88 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:bonding_at= tempt_complete() hci0 bdaddr 40:EF:4C:0C:11:F0 type 0 status 0xe > 6=E6=9C=88 20 15:05:44 uos-PC bluetoothd[10094]: src/device.c:device_bond= ing_complete() bonding (nil) status 0x0e > 6=E6=9C=88 20 15:05:44 uos-PC bluetoothd[10094]: src/device.c:device_bond= ing_failed() status 14 > 6=E6=9C=88 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:resume_dis= covery() > > > [bluetooth]#=E3=80=80remove 40:EF:4C:0C:11:F0 > > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/device.c:device_remo= ve() Removing device /org/bluez/hci0/dev_40_EF_4C_0C_11_F0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a84200: device 40:EF:4C:0C:11:F0 profile avrcp-controller stat= e changed: disconnected -> unavailable (0) > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: profiles/audio/control.c= :path_unregister() Unregistered interface org.bluez.MediaControl1 on path /= org/bluez/hci0/dev_40_EF_4C_0C_11_F0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37aaeac0: ref=3D1 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37a84200: ref=3D1 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37a84200: ref=3D0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37aaeac0: device 40:EF:4C:0C:11:F0 profile audio-avrcp-target st= ate changed: disconnected -> unavailable (0) > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37aaeac0: ref=3D0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37aaeb30: device 40:EF:4C:0C:11:F0 profile a2dp-sink state chang= ed: disconnected -> unavailable (0) > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37aaeb30: ref=3D2 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: profiles/audio/sink.c:si= nk_unregister() /org/bluez/hci0/dev_40_EF_4C_0C_11_F0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37aaeb30: ref=3D1 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37aaeb30: ref=3D0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a80790: device 40:EF:4C:0C:11:F0 profile Hands-Free Voice gate= way state changed: disconnected -> unavailable (0) > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37a80790: ref=3D1 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/profile.c:ext_device= _remove() Hands-Free Voice gateway > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37a80790: ref=3D0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_sta= te() 0x558c37a869e0: device 40:EF:4C:0C:11:F0 profile Phone Book Access sta= te changed: disconnected -> unavailable (0) > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/profile.c:ext_device= _remove() Phone Book Access > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_servic= e_unref() 0x558c37a869e0: ref=3D0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/device.c:btd_device_= unref() Freeing device /org/bluez/hci0/dev_40_EF_4C_0C_11_F0 > 6=E6=9C=88 20 15:08:32 uos-PC bluetoothd[10094]: src/device.c:device_free= () 0x558c37a93860 How about the following fix: https://patchwork.kernel.org/project/bluetooth/patch/20220622190053.2605233= -1-luiz.dentz@gmail.com/ > ------------------ Original ------------------ > From: "Luiz Augusto von Dentz"; > Date: Wed, Jun 22, 2022 02:39 AM > To: "Youwan Wang"; > Cc: "linux-bluetooth@vger.kernel.org"; > Subject: Re: [PATCH] device: Fix timeout=3D1 to remove the device immedi= ately > > Hi Youwan, > > On Tue, Jun 21, 2022 at 6:55 AM Youwan Wang wr= ote: > > > > =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 *= device, uint8_t bdaddr_type) > > DEVICE_INTERFACE, "Conn= ected"); > > > > 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=3D5ebc2b5a3= e48dbe67a2d315979b096a1b4d1eb99 > > > guint device_add_disconnect_watch(struct btd_device *device, > > -- > > 2.20.1 > > > > > > > > > -- > Luiz Augusto von Dentz --=20 Luiz Augusto von Dentz