When I use bluetoothctl to remove a device,
I find that the device has not been deleted.
static void set_temporary_timer(device, 0)
{
......
if (!timeout)
return;
......
}
Now I want to delete the connected device
when call remove.
I 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, "Connected");
if (remove_device)
- set_temporary_timer(device, 0);
+ set_temporary_timer(device, 1);
}
guint device_add_disconnect_watch(struct btd_device *device,
--
2.20.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=652390
---Test result---
Test Summary:
CheckPatch PASS 1.46 seconds
GitLint FAIL 0.99 seconds
Prep - Setup ELL PASS 39.86 seconds
Build - Prep PASS 0.65 seconds
Build - Configure PASS 7.75 seconds
Build - Make PASS 1297.39 seconds
Make Check PASS 11.36 seconds
Make Check w/Valgrind PASS 403.84 seconds
Make Distcheck PASS 216.05 seconds
Build w/ext ELL - Configure PASS 8.26 seconds
Build w/ext ELL - Make PASS 1309.01 seconds
Incremental Build with patchesPASS 0.00 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint
Output:
device: Fix timeout=1 to remove the device immediately
9: B3 Line contains hard tab characters (\t): " if (!timeout)"
10: B3 Line contains hard tab characters (\t): " return;"
13: B2 Line has trailing whitespace: " "
---
Regards,
Linux Bluetooth
Hi Youwan,
On Tue, Jun 21, 2022 at 6:55 AM Youwan Wang <[email protected]> wrote:
>
> When I use bluetoothctl to remove a device,
> I find that the device has not been deleted.
>
> static void set_temporary_timer(device, 0)
> {
> ......
> if (!timeout)
> return;
> ......
> }
>
> Now I want to delete the connected device
> when call remove.
> I 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, "Connected");
>
> 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=5ebc2b5a3e48dbe67a2d315979b096a1b4d1eb99
> guint device_add_disconnect_watch(struct btd_device *device,
> --
> 2.20.1
>
>
>
--
Luiz Augusto von Dentz
Hi,
On Tue, Jun 21, 2022 at 6:38 PM 王有万 <[email protected]> wrote:
>
> thank you!
> This modification is consistent with my code
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=5ebc2b5a3e48dbe67a2d315979b096a1b4d1eb99
>
> Here are my steps, I found that it takes two times to remove the connected 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-00805f9b34fb)
> UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
> UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
> UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
> UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
> UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
> [bluetooth]#
>
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/device.c:btd_device_set_temporary() temporary 1
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a84200: device 40:EF:4C:0C:11:F0 profile avrcp-controller state changed: connected -> disconnecting (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avrcp.c:avrcp_disconnect() path /org/bluez/hci0/dev_40_EF_4C_0C_11_F0
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37aaeac0: device 40:EF:4C:0C:11:F0 profile audio-avrcp-target state changed: connected -> disconnected (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a84200: device 40:EF:4C:0C:11:F0 profile avrcp-controller state changed: disconnecting -> disconnected (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avrcp.c:controller_destroy() 0x558c37a4e600
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avrcp.c:target_destroy() 0x558c37a47e20
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avctp.c:avctp_set_state() AVCTP Disconnected
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avctp.c:avctp_disconnected() AVCTP: closing uinput for 40:EF:4C:0C:11:F0
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37aaeb30: device 40:EF:4C:0C:11:F0 profile a2dp-sink state changed: connected -> disconnecting (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:a2dp_sink_disconnect() path /org/bluez/hci0/dev_40_EF_4C_0C_11_F0
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a80790: device 40:EF:4C:0C:11:F0 profile Hands-Free Voice gateway state changed: connected -> disconnecting (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a869e0: device 40:EF:4C:0C:11:F0 profile Phone Book Access state changed: connected -> disconnecting (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/adapter.c:remove_accept_list_complete() 40:EF:4C:0C:11:F0 removed from kernel accept list
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a869e0: device 40:EF:4C:0C:11:F0 profile Phone Book Access state changed: disconnecting -> disconnected (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37a869e0: ref=1
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a80790: device 40:EF:4C:0C:11:F0 profile Hands-Free Voice gateway state changed: disconnecting -> disconnected (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37a80790: ref=2
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:session_cb()
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_parse_resp() CLOSE request succeeded
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_sep_set_state() stream state changed: STREAMING -> CLOSING
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:close_cfm() Source 0x558c37a73050: Close_Cfm
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_sep_set_state() stream state changed: CLOSING -> IDLE
> 6月 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月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/transport.c:media_owner_free() Owner :1.1779
> 6月 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_F0/sep1/fd10: TRANSPORT_STATE_ACTIVE -> TRANSPORT_STATE_IDLE
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:a2dp_sep_unlock() SEP 0x558c37a73050 unlocked
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_unref() 0x558c37a61720: ref=1
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37aaeb30: device 40:EF:4C:0C:11:F0 profile a2dp-sink state changed: disconnecting -> disconnected (0)
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_unref() 0x558c37a61720: ref=0
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_ref() 0x558c37a61720: ref=1
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:set_disconnect_timer() timeout 0
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_ref() 0x558c37a61720: ref=2
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:connection_lost() Disconnected from 40:EF:4C:0C:11:F0
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/sink.c:sink_set_state() State changed /org/bluez/hci0/dev_40_EF_4C_0C_11_F0: SINK_STATE_PLAYING -> SINK_STATE_DISCONNECTED
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/a2dp.c:channel_remove() chan 0x558c37a4e530
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_unref() 0x558c37a61720: ref=1
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_unref() 0x558c37a61720: ref=0
> 6月 20 15:05:41 uos-PC bluetoothd[10094]: profiles/audio/avdtp.c:avdtp_free() 0x558c37a61720
> 6月 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:dev_disconnected() Device 40:EF:4C:0C:11:F0 disconnected, reason 2
> 6月 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:adapter_remove_connection()
> 6月 20 15:05:44 uos-PC bluetoothd[10094]: plugins/policy.c:disconnect_cb() reason 2
> 6月 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 40:EF:4C:0C:11:F0 type 0 status 0xe
> 6月 20 15:05:44 uos-PC bluetoothd[10094]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
> 6月 20 15:05:44 uos-PC bluetoothd[10094]: src/device.c:device_bonding_failed() status 14
> 6月 20 15:05:44 uos-PC bluetoothd[10094]: src/adapter.c:resume_discovery()
>
>
> [bluetooth]# remove 40:EF:4C:0C:11:F0
>
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/device.c:device_remove() Removing device /org/bluez/hci0/dev_40_EF_4C_0C_11_F0
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a84200: device 40:EF:4C:0C:11:F0 profile avrcp-controller state changed: disconnected -> unavailable (0)
> 6月 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月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37aaeac0: ref=1
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37a84200: ref=1
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37a84200: ref=0
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37aaeac0: device 40:EF:4C:0C:11:F0 profile audio-avrcp-target state changed: disconnected -> unavailable (0)
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37aaeac0: ref=0
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37aaeb30: device 40:EF:4C:0C:11:F0 profile a2dp-sink state changed: disconnected -> unavailable (0)
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37aaeb30: ref=2
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: profiles/audio/sink.c:sink_unregister() /org/bluez/hci0/dev_40_EF_4C_0C_11_F0
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37aaeb30: ref=1
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37aaeb30: ref=0
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a80790: device 40:EF:4C:0C:11:F0 profile Hands-Free Voice gateway state changed: disconnected -> unavailable (0)
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37a80790: ref=1
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/profile.c:ext_device_remove() Hands-Free Voice gateway
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37a80790: ref=0
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:change_state() 0x558c37a869e0: device 40:EF:4C:0C:11:F0 profile Phone Book Access state changed: disconnected -> unavailable (0)
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/profile.c:ext_device_remove() Phone Book Access
> 6月 20 15:08:32 uos-PC bluetoothd[10094]: src/service.c:btd_service_unref() 0x558c37a869e0: ref=0
> 6月 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月 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/[email protected]/
> ------------------ Original ------------------
> From: "Luiz Augusto von Dentz"<[email protected]>;
> Date: Wed, Jun 22, 2022 02:39 AM
> To: "Youwan Wang"<[email protected]>;
> Cc: "[email protected]"<[email protected]>;
> Subject: Re: [PATCH] device: Fix timeout=1 to remove the device immediately
>
> Hi Youwan,
>
> On Tue, Jun 21, 2022 at 6:55 AM Youwan Wang <[email protected]> wrote:
> >
> > When I use bluetoothctl to remove a device,
> > I find that the device has not been deleted.
> >
> > static void set_temporary_timer(device, 0)
> > {
> > ......
> > if (!timeout)
> > return;
> > ......
> > }
> >
> > Now I want to delete the connected device
> > when call remove.
> > I 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, "Connected");
> >
> > 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=5ebc2b5a3e48dbe67a2d315979b096a1b4d1eb99
>
> > guint device_add_disconnect_watch(struct btd_device *device,
> > --
> > 2.20.1
> >
> >
> >
>
>
> --
> Luiz Augusto von Dentz
--
Luiz Augusto von Dentz