linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 1/2] btdev: Fix not resetting big_handle on HCI_Reset
@ 2024-02-27 16:44 Luiz Augusto von Dentz
  2024-02-27 16:44 ` [PATCH BlueZ v1 2/2] device: Consider service state on device_is_connected Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-02-27 16:44 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

HCI_Reset shall cleanup BIG state including if the handle has been set.
---
 emulator/btdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 3224b73bfc31..0ad6b2793c06 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -577,6 +577,7 @@ static void btdev_reset(struct btdev *btdev)
 	btdev->le_adv_enable		= 0x00;
 	btdev->le_pa_enable		= 0x00;
 	btdev->le_pa_sync_handle	= 0x0000;
+	btdev->big_handle		= 0xff;
 
 	al_clear(btdev);
 	rl_clear(btdev);
@@ -6483,6 +6484,9 @@ static int cmd_big_term_sync(struct btdev *dev, const void *data, uint8_t len)
 	}
 
 done:
+	if (rsp.status == BT_HCI_ERR_SUCCESS)
+		dev->big_handle = 0xff;
+
 	cmd_complete(dev, BT_HCI_CMD_LE_BIG_TERM_SYNC, &rsp, sizeof(rsp));
 
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ v1 2/2] device: Consider service state on device_is_connected
  2024-02-27 16:44 [PATCH BlueZ v1 1/2] btdev: Fix not resetting big_handle on HCI_Reset Luiz Augusto von Dentz
@ 2024-02-27 16:44 ` Luiz Augusto von Dentz
  2024-02-27 18:21 ` [BlueZ,v1,1/2] btdev: Fix not resetting big_handle on HCI_Reset bluez.test.bot
  2024-02-29 14:30 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-02-27 16:44 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This checks if there is any service connected on device_is_connected
since some profiles maybe probed using advertising data which doesn't
require a connection.
---
 src/device.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index 1db96d9a672c..e5191cabe81a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3225,7 +3225,11 @@ uint8_t btd_device_get_bdaddr_type(struct btd_device *dev)
 
 bool btd_device_is_connected(struct btd_device *dev)
 {
-	return dev->bredr_state.connected || dev->le_state.connected;
+	if (dev->bredr_state.connected || dev->le_state.connected)
+		return true;
+
+	return find_service_with_state(dev->services,
+						BTD_SERVICE_STATE_CONNECTED);
 }
 
 static void clear_temporary_timer(struct btd_device *dev)
@@ -3276,6 +3280,13 @@ static bool device_disappeared(gpointer user_data)
 {
 	struct btd_device *dev = user_data;
 
+	if (btd_device_is_connected(dev)) {
+		char addr[18];
+		ba2str(&dev->bdaddr, addr);
+		DBG("Device %s is marked as connected", dev->path);
+		return TRUE;
+	}
+
 	/* If there are services connecting restart the timer to give more time
 	 * for the service to either complete the connection or disconnect.
 	 */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,v1,1/2] btdev: Fix not resetting big_handle on HCI_Reset
  2024-02-27 16:44 [PATCH BlueZ v1 1/2] btdev: Fix not resetting big_handle on HCI_Reset Luiz Augusto von Dentz
  2024-02-27 16:44 ` [PATCH BlueZ v1 2/2] device: Consider service state on device_is_connected Luiz Augusto von Dentz
@ 2024-02-27 18:21 ` bluez.test.bot
  2024-02-29 14:30 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-02-27 18:21 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 2865 bytes --]

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=830344

---Test result---

Test Summary:
CheckPatch                    FAIL      0.85 seconds
GitLint                       PASS      0.42 seconds
BuildEll                      PASS      24.00 seconds
BluezMake                     PASS      730.29 seconds
MakeCheck                     PASS      11.79 seconds
MakeDistcheck                 PASS      169.51 seconds
CheckValgrind                 PASS      232.43 seconds
CheckSmatch                   WARNING   338.75 seconds
bluezmakeextell               PASS      110.48 seconds
IncrementalBuild              PASS      1377.67 seconds
ScanBuild                     WARNING   989.44 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v1,2/2] device: Consider service state on device_is_connected
WARNING:LINE_SPACING: Missing a blank line after declarations
#127: FILE: src/device.c:3285:
+		char addr[18];
+		ba2str(&dev->bdaddr, addr);

/github/workspace/src/src/13574121.patch total: 0 errors, 1 warnings, 25 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/src/13574121.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.


##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:434:29: warning: Variable length array is used.
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
emulator/btdev.c:1099:10: warning: Although the value stored to 'conn' is used in the enclosing expression, the value is never actually read from 'conn'
        while ((conn = queue_find(dev->conns, match_handle,
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
emulator/btdev.c:1386:24: warning: Access to field 'link' results in a dereference of a null pointer (loaded from variable 'conn')
        pending_conn_del(dev, conn->link->dev);
                              ^~~~~~~~~~
emulator/btdev.c:1508:13: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'conn')
        send_event(conn->dev, BT_HCI_EVT_AUTH_COMPLETE, &ev, sizeof(ev));
                   ^~~~~~~~~
3 warnings generated.



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ v1 1/2] btdev: Fix not resetting big_handle on HCI_Reset
  2024-02-27 16:44 [PATCH BlueZ v1 1/2] btdev: Fix not resetting big_handle on HCI_Reset Luiz Augusto von Dentz
  2024-02-27 16:44 ` [PATCH BlueZ v1 2/2] device: Consider service state on device_is_connected Luiz Augusto von Dentz
  2024-02-27 18:21 ` [BlueZ,v1,1/2] btdev: Fix not resetting big_handle on HCI_Reset bluez.test.bot
@ 2024-02-29 14:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-02-29 14:30 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 27 Feb 2024 11:44:02 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> HCI_Reset shall cleanup BIG state including if the handle has been set.
> ---
>  emulator/btdev.c | 4 ++++
>  1 file changed, 4 insertions(+)

Here is the summary with links:
  - [BlueZ,v1,1/2] btdev: Fix not resetting big_handle on HCI_Reset
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ade2b97597e1
  - [BlueZ,v1,2/2] device: Consider service state on device_is_connected
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=44d3f67277f8

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-29 14:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 16:44 [PATCH BlueZ v1 1/2] btdev: Fix not resetting big_handle on HCI_Reset Luiz Augusto von Dentz
2024-02-27 16:44 ` [PATCH BlueZ v1 2/2] device: Consider service state on device_is_connected Luiz Augusto von Dentz
2024-02-27 18:21 ` [BlueZ,v1,1/2] btdev: Fix not resetting big_handle on HCI_Reset bluez.test.bot
2024-02-29 14:30 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).