device: Fix not removing connected device
PATCH 1/1 device: Fix not removing connected device
[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
UUID: Audio Sink
UUID: A/V Remote Control Target
UUID: A/V Remote Control
UUID: Handsfree
UUID: Phonebook Access Server
--- src/adapter.c | 11 ++++++++++- src/device.c | 4 ++-- src/device.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-)
src/adapter.c +10 -1
@@ -7171,6 +7171,8 @@ static void adapter_remove_connection(struct btd_adapter *adapter,struct btd_device *device, uint8_t bdaddr_type) { + bool remove_device = false; +DBG ("" );if (!g_slist_find (adapter->connections, device)) {
@@ -7178,7 +7180,7 @@ static void adapter_remove_connection(struct btd_adapter *adapter,return ; } -device_remove_connection (device, bdaddr_type); +device_remove_connection (device, bdaddr_type, &remove_device);if (device_is_authenticating (device))device_cancel_authentication (device, TRUE);
@@ -7188,6 +7190,13 @@ static void adapter_remove_connection(struct btd_adapter *adapter,return ; adapter->connections =g_slist_remove (adapter->connections, device); + +if (remove_device) { +const char *path =device_get_path (device); + +DBG ("Removing temporary device %s" , path); +btd_adapter_remove_device (adapter, device); + } }static void adapter_stop (struct btd_adapter *adapter)
src/device.c +2 -2
@@ -3073,7 +3073,7 @@ static void set_temporary_timer(struct btd_device *dev, unsigned int timeout) dev, NULL); } -void device_remove_connection (struct btd_device *device,uint8_t bdaddr_type) +void device_remove_connection (struct btd_device *device,uint8_t bdaddr_type,bool *remove) {struct bearer_state *state =get_state (device, bdaddr_type);DBusMessage *reply;
@@ -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 ); + *remove = remove_device; } guint device_add_disconnect_watch(struct btd_device *device,
src/device.h +1 -1
@@ -123,7 +123,7 @@ int device_notify_pincode(struct btd_device *device, gboolean secure,void device_cancel_authentication (struct btd_device *device,gboolean aborted);gboolean device_is_authenticating (struct btd_device *device);void device_add_connection (struct btd_device *dev,uint8_t bdaddr_type); -void device_remove_connection (struct btd_device *device,uint8_t bdaddr_type); +void device_remove_connection (struct btd_device *device,uint8_t bdaddr_type,bool *remove);void device_request_disconnect (struct btd_device *device,DBusMessage *msg);bool device_is_disconnecting (struct btd_device *device);void device_set_ltk_enc_size (struct btd_device *device,uint8_t enc_size);
Signature · 1 line
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=652986
---Test result---
Test Summary:
CheckPatch FAIL 1.08 seconds GitLint PASS 0.70 seconds Prep - Setup ELL PASS 41.48 seconds Build - Prep PASS 0.56 seconds Build - Configure PASS 8.20 seconds Build - Make PASS 1255.26 seconds Make Check PASS 11.29 seconds Make Check w/Valgrind PASS 422.87 seconds Make Distcheck PASS 222.72 seconds Build w/ext ELL - Configure PASS 8.27 seconds Build w/ext ELL - Make PASS 1244.67 seconds Incremental Build with patchesPASS 0.00 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
device: Fix not removing connected device
WARNING:LONG_LINE: line length of 91 exceeds 80 columns
#131: FILE: src/device.c:3076:
+void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type, bool *remove)
WARNING:LONG_LINE: line length of 92 exceeds 80 columns
#153: FILE: src/device.h:126:
+void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type, bool *remove);
/github/workspace/src/12891622.patch total: 0 errors, 2 warnings, 53 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/12891622.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
---
Regards,
Linux Bluetooth