From patchwork Tue Feb 27 16:44:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 776345 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD91C2C6A4 for ; Tue, 27 Feb 2024 16:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709052249; cv=none; b=dK9otPIZPf/uf9xTiPVpMPAquMqXnoORfJXnvkxjzmb64tt+Os6lyCYQqIKkl/FNhbqYHhosdpzRNHwC6F9kiNo1WryjLInGZZeYsDwkDP0fUYP8ccUC8IdUb06NsHSg00qQMNyKJn0IOITrrbo8iCcV2siIUUcVnIw/Yt5wtQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709052249; c=relaxed/simple; bh=wFD/0e+zYEhk/i6GEa+vOAGTQEiwvHmSoOygd75kFiM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=R1DJznCjPx3OxAZyMJkqNSpFlDPElPe3ucfejP7iksLxqMchR3DmC/wGC+PvXveMzVKsgZ9JeOfejWmHMbosd2KsWmIAVwVAy0Pl7E5Ui8B1hm/HnZ+8/Mga7unWe52952uOJDYkDEUhYS35vabWUkagEPFJPtoIfFSlxqz/BE0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=drf7Oubd; arc=none smtp.client-ip=209.85.217.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="drf7Oubd" Received: by mail-vs1-f53.google.com with SMTP id ada2fe7eead31-470446f19cfso674336137.0 for ; Tue, 27 Feb 2024 08:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709052245; x=1709657045; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=oSV8qVBZIYT8/RnPIXC7e6ul1BVe73ZSzmIdXj0MKiI=; b=drf7OubdC8lrRNHYcEpMqIwUeLXd0bkv/dIx8NGuofvPNQ9yVWCjcErUzh60ph9mmJ Gp8mn32pvVpY9dfzeAl/Pd/KQrONdKEEmOZqsoUYKy4xn88JCIxYc7wSzaomfBbSdet/ z1+cIwiwade4jss1I2Ra0RD08IUKxz3L7YcM/rWlchVT3YCBz/26Atn+M9Mqzjdukscr RrAAIn/hYiI96NO2b4WrrWPiOPTqA4+vQnBxBIhwy81x4tO+LFGXvHWGPj7XwdSPpEg/ klTNcSQJlfjyHPn1NMr0EgQ0ntSg3h/mBRQrt7yBQe3fP1ayBCl7jBQcnUyLryQ6Esx1 RfDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709052245; x=1709657045; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oSV8qVBZIYT8/RnPIXC7e6ul1BVe73ZSzmIdXj0MKiI=; b=Q3y0j1aCfbRdMU72sJ/kJnofHFyz8qNyrToZAJyoCa6GE7haFm8QX5V7Ckn5/6p2FO j423p2h17JVqSQSlU/Z2Q4pZTfMAN4+BcqGIENglOip/nORhd33hIv1g30wZYMm6CYTA JOW+obROK0FyzvCIB2d1TSy8RIF2vGq2OofkwHLInMwDphWw9N1cetXrMx73u3b3ftfC kpLu/3UoQpjjtr7uj6sYzmgTj4DmEfC3XdIzbK2YprkjMcOLfDS4gTnzJO5Nf1ky7xWP +wAZ6ixNA8BZ9SXxBPH3skV/pKKE46q7Nd3nJF9XGYP/HeZLtbbXb7fTFVEza94/Mu98 TN3g== X-Gm-Message-State: AOJu0YxsSAqf/XOHWSnSrMhI63vPUMZPdfwfsg0qM8t6061vpTRsuby3 kj4LFMfHANKqXR5W3JnCmVXO0gyUfH9ZqWHTxMYetbiaalTaHEGwF/RsNkjJ X-Google-Smtp-Source: AGHT+IHB7sdlbJ/1VRFIthQGuaj2lrnKY3iq0BUbScJ10RpdsI0wJ7bvvEFjOn2KwYJm0VALQxpWIQ== X-Received: by 2002:a67:fe4b:0:b0:470:5373:2389 with SMTP id m11-20020a67fe4b000000b0047053732389mr6583237vsr.0.1709052244897; Tue, 27 Feb 2024 08:44:04 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id j30-20020a0561023e1e00b0046d28239032sm1378126vsv.5.2024.02.27.08.44.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 08:44:04 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 1/2] btdev: Fix not resetting big_handle on HCI_Reset Date: Tue, 27 Feb 2024 11:44:02 -0500 Message-ID: <20240227164403.1904213-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz 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; From patchwork Tue Feb 27 16:44:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 776655 Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED95F2C69D for ; Tue, 27 Feb 2024 16:44:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709052250; cv=none; b=NQN0ZtnUrGWPdRkBN7r/GpNIJc4Nyf1D+n9FX1uyvKNJgzF9Ihnzmb8Qucr7vGkqTwDQ3MtkoKEjcYk7HA+qvM+TW1y5dxQR0nztFiMUbr78robZFjyiN+/sd0iJvi0S9ZDz8itaPljMExA3xN7KCDDxYSW8fwfAp6vDc8sdZJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709052250; c=relaxed/simple; bh=ubKQJPV5hCvqV4OpR8OcKERTXKdBFJBog/T2TFvYut4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L6CIDphPEwtDBe6DoEzG+ORN/D33m8MRIExobHb3Cv6+E7nbVKtiBD+vZ5fTUzikV+ngjZLV4BZO0Qu9y60nS1uo6Z5wsR0wP1eiq80Z6qgkQTSP05VdMUiz6vWfWYl/mxP4TLXIbUJvtg4/Jm0EO88hUMbT/4/pB9tfIq86hMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ff4XqUJw; arc=none smtp.client-ip=209.85.217.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ff4XqUJw" Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-47048ea1b17so543324137.0 for ; Tue, 27 Feb 2024 08:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709052246; x=1709657046; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2vLhphde7KiKM567H6JdrwgApp0exKrb3Gp/hXUliMc=; b=ff4XqUJwgolJeEaiDQWn8jGHqhT7cygOVK//UpLfuh8AOzs5D31iNWMQGK1hCzyz4b 1NJ1ZQQulefWJXxDcxWmG+i1HFgybsrcuLlgegPhQBvTRki2XPMcNxaPZVXm/a90kkC6 NCnHWRPtx6vbJ4SGpXfNB6ZbmWbNVwQurkPctJ4SIWRc6f0bT3yLltbtykP1rI9Rus54 jHXP9k9eiUZwciyxm/hGroPx0SfmQ5c+pLU9h4iqugMQCnjlLaMonTLnqwOjmV4LN2tX j9op+EF4djUatJZrhfjRPyTIUiftw/F3RUgoYdLKSD3wZBj/UxWcPN7KMtG9mX2CIzjX uiyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709052246; x=1709657046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2vLhphde7KiKM567H6JdrwgApp0exKrb3Gp/hXUliMc=; b=TcDfFS1q2Uuxoz6B58YKKow9r345EQfX9zN+K9+GqliQIA7JEf21Qc3YdiHIdJbpHv Wd9fzPqf2TO2wumdZLROIg7dClNFwqHvbhrGEDPfO5gnjZjleV+FJNxjYIKxBUT61rvz 1XCikN9+QSdU6imZOQRAVmUU2JCy8YWkrMoZrNt20DQDReAZAMZrPss5Fl9mWiW9IrBD JUj4gmoQu+8fqzWMepaO9Ugh945mjTXDMxeyuO3enXSeLKtidQV+UJ6SS7wHwY8PFZTs f/TcRuEUhLpGBIPEWHbiD3Vg1F1A9TtdTzRUuZcI3jER1/Qfscj+7mPlrc05ccQJz+2t nY4Q== X-Gm-Message-State: AOJu0Yz/s70s0G/nJ+DOu2IVLBoMn/VwNmX03oWwdzbVMRari7NvSp4H jlY6grezdqWsGAaQfOh7qGoN4eBcZCI7JbSB73l1PwR1DAfPrqerwrWFNBoR X-Google-Smtp-Source: AGHT+IHkZKuWXlMeR81/QvRhvhDc5YarUFfZoE29KHcnqjKq10VEQdyWtcnoi/DglgGW/L/bMPenIg== X-Received: by 2002:a05:6102:55aa:b0:470:4a5f:684d with SMTP id dc42-20020a05610255aa00b004704a5f684dmr10516771vsb.29.1709052245898; Tue, 27 Feb 2024 08:44:05 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id j30-20020a0561023e1e00b0046d28239032sm1378126vsv.5.2024.02.27.08.44.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 08:44:05 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 2/2] device: Consider service state on device_is_connected Date: Tue, 27 Feb 2024 11:44:03 -0500 Message-ID: <20240227164403.1904213-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240227164403.1904213-1-luiz.dentz@gmail.com> References: <20240227164403.1904213-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz 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. */