* [PATCH BlueZ] device: Add connectable flag to bearer state
@ 2022-06-13 23:34 Luiz Augusto von Dentz
2022-06-13 23:34 ` [PATCH BlueZ] monitor/att: Fix decoding for notifications Luiz Augusto von Dentz
2022-06-14 0:43 ` [BlueZ] device: Add connectable flag to bearer state bluez.test.bot
0 siblings, 2 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-06-13 23:34 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds connectable flag to state so it can be used to detect which is
the last seen connectable bearer.
---
src/adapter.c | 6 +++---
src/device.c | 41 +++++++++++++++++++++++------------------
src/device.h | 3 ++-
3 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index a75dd61bf..aeef6b7a8 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3484,7 +3484,7 @@ static void device_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
/* continue with service discovery and connection */
btd_device_set_temporary(device, false);
- device_update_last_seen(device, data->dst_type);
+ device_update_last_seen(device, data->dst_type, true);
if (data->dst_type != BDADDR_BREDR){
g_io_channel_set_close_on_unref(io, FALSE);
@@ -6994,7 +6994,7 @@ void btd_adapter_update_found_device(struct btd_adapter *adapter,
return;
}
- device_update_last_seen(dev, bdaddr_type);
+ device_update_last_seen(dev, bdaddr_type, !not_connectable);
/*
* FIXME: We need to check for non-zero flags first because
@@ -7006,7 +7006,7 @@ void btd_adapter_update_found_device(struct btd_adapter *adapter,
!(eir_data.flags & EIR_BREDR_UNSUP)) {
device_set_bredr_support(dev);
/* Update last seen for BR/EDR in case its flag is set */
- device_update_last_seen(dev, BDADDR_BREDR);
+ device_update_last_seen(dev, BDADDR_BREDR, !not_connectable);
}
if (eir_data.name != NULL && eir_data.name_complete)
diff --git a/src/device.c b/src/device.c
index 3da09578f..7b451e458 100644
--- a/src/device.c
+++ b/src/device.c
@@ -155,6 +155,8 @@ struct bearer_state {
bool connected;
bool svc_resolved;
bool initiator;
+ bool connectable;
+ time_t last_seen;
};
struct csrk_info {
@@ -255,9 +257,6 @@ struct btd_device {
sdp_list_t *tmp_records;
- time_t bredr_seen;
- time_t le_seen;
-
gboolean trusted;
gboolean blocked;
gboolean auto_connect;
@@ -2273,14 +2272,14 @@ static uint8_t select_conn_bearer(struct btd_device *dev)
if (dev->bdaddr_type == BDADDR_LE_RANDOM)
return dev->bdaddr_type;
- if (dev->bredr_seen) {
- bredr_last = current - dev->bredr_seen;
+ if (dev->bredr_state.last_seen) {
+ bredr_last = current - dev->bredr_state.last_seen;
if (bredr_last > SEEN_TRESHHOLD)
bredr_last = NVAL_TIME;
}
- if (dev->le_seen) {
- le_last = current - dev->le_seen;
+ if (dev->le_state.last_seen) {
+ le_last = current - dev->le_state.last_seen;
if (le_last > SEEN_TRESHHOLD)
le_last = NVAL_TIME;
}
@@ -3022,7 +3021,7 @@ void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type)
{
struct bearer_state *state = get_state(dev, bdaddr_type);
- device_update_last_seen(dev, bdaddr_type);
+ device_update_last_seen(dev, bdaddr_type, true);
if (state->connected) {
char addr[18];
@@ -3151,7 +3150,7 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
if (device->bredr_state.connected || device->le_state.connected)
return;
- device_update_last_seen(device, bdaddr_type);
+ device_update_last_seen(device, bdaddr_type, true);
g_slist_free_full(device->eir_uuids, g_free);
device->eir_uuids = NULL;
@@ -4168,7 +4167,7 @@ void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
void device_set_bredr_support(struct btd_device *device)
{
- if (device->bredr)
+ if (btd_opts.mode == BT_MODE_LE || device->bredr)
return;
device->bredr = true;
@@ -4177,7 +4176,7 @@ void device_set_bredr_support(struct btd_device *device)
void device_set_le_support(struct btd_device *device, uint8_t bdaddr_type)
{
- if (device->le)
+ if (btd_opts.mode == BT_MODE_BREDR || device->le)
return;
device->le = true;
@@ -4186,12 +4185,15 @@ void device_set_le_support(struct btd_device *device, uint8_t bdaddr_type)
store_device_info(device);
}
-void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type)
+void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type,
+ bool connectable)
{
- if (bdaddr_type == BDADDR_BREDR)
- device->bredr_seen = time(NULL);
- else
- device->le_seen = time(NULL);
+ struct bearer_state *state;
+
+ state = get_state(device, bdaddr_type);
+
+ state->last_seen = time(NULL);
+ state->connectable = connectable;
if (!device_is_temporary(device))
return;
@@ -5902,14 +5904,17 @@ void device_set_flags(struct btd_device *device, uint8_t flags)
bool device_is_connectable(struct btd_device *device)
{
+ struct bearer_state *state;
+
if (!device)
return false;
if (device->bredr)
return true;
- /* Check if either Limited or General discoverable are set */
- return (device->ad_flags[0] & 0x03);
+ state = get_state(device, device->bdaddr_type);
+
+ return state->connectable;
}
static bool start_discovery(gpointer user_data)
diff --git a/src/device.h b/src/device.h
index 5e8d1c3e1..1bf7b3989 100644
--- a/src/device.h
+++ b/src/device.h
@@ -33,7 +33,8 @@ void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
uint8_t bdaddr_type);
void device_set_bredr_support(struct btd_device *device);
void device_set_le_support(struct btd_device *device, uint8_t bdaddr_type);
-void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type);
+void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type,
+ bool last_seen);
void device_merge_duplicate(struct btd_device *dev, struct btd_device *dup);
uint32_t btd_device_get_class(struct btd_device *device);
uint16_t btd_device_get_vendor(struct btd_device *device);
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ] monitor/att: Fix decoding for notifications
2022-06-13 23:34 [PATCH BlueZ] device: Add connectable flag to bearer state Luiz Augusto von Dentz
@ 2022-06-13 23:34 ` Luiz Augusto von Dentz
2022-06-14 0:39 ` [BlueZ] " bluez.test.bot
2022-06-14 20:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
2022-06-14 0:43 ` [BlueZ] device: Add connectable flag to bearer state bluez.test.bot
1 sibling, 2 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-06-13 23:34 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
monitor/att.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/monitor/att.c b/monitor/att.c
index 00db8ddaa..de70a9dc4 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -1547,7 +1547,7 @@ static void print_notify(const struct l2cap_frame *frame, uint16_t handle,
return;
}
- attr = get_attribute(frame, handle, false);
+ attr = get_attribute(frame, handle, true);
if (!attr)
return;
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [BlueZ] monitor/att: Fix decoding for notifications
2022-06-13 23:34 ` [PATCH BlueZ] monitor/att: Fix decoding for notifications Luiz Augusto von Dentz
@ 2022-06-14 0:39 ` bluez.test.bot
2022-06-14 20:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-06-14 0:39 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 995 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=650006
---Test result---
Test Summary:
CheckPatch PASS 1.10 seconds
GitLint PASS 0.70 seconds
Prep - Setup ELL PASS 37.88 seconds
Build - Prep PASS 0.57 seconds
Build - Configure PASS 7.42 seconds
Build - Make PASS 1338.88 seconds
Make Check PASS 11.80 seconds
Make Check w/Valgrind PASS 398.51 seconds
Make Distcheck PASS 212.71 seconds
Build w/ext ELL - Configure PASS 7.30 seconds
Build w/ext ELL - Make PASS 1275.21 seconds
Incremental Build with patchesPASS 0.00 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [BlueZ] device: Add connectable flag to bearer state
2022-06-13 23:34 [PATCH BlueZ] device: Add connectable flag to bearer state Luiz Augusto von Dentz
2022-06-13 23:34 ` [PATCH BlueZ] monitor/att: Fix decoding for notifications Luiz Augusto von Dentz
@ 2022-06-14 0:43 ` bluez.test.bot
1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-06-14 0:43 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 995 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=650005
---Test result---
Test Summary:
CheckPatch PASS 1.43 seconds
GitLint PASS 0.97 seconds
Prep - Setup ELL PASS 42.60 seconds
Build - Prep PASS 0.66 seconds
Build - Configure PASS 8.47 seconds
Build - Make PASS 1391.45 seconds
Make Check PASS 11.87 seconds
Make Check w/Valgrind PASS 445.83 seconds
Make Distcheck PASS 231.66 seconds
Build w/ext ELL - Configure PASS 8.62 seconds
Build w/ext ELL - Make PASS 1383.55 seconds
Incremental Build with patchesPASS 0.00 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ] monitor/att: Fix decoding for notifications
2022-06-13 23:34 ` [PATCH BlueZ] monitor/att: Fix decoding for notifications Luiz Augusto von Dentz
2022-06-14 0:39 ` [BlueZ] " bluez.test.bot
@ 2022-06-14 20:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-06-14 20:50 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 13 Jun 2022 16:34:19 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> ---
> monitor/att.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [BlueZ] monitor/att: Fix decoding for notifications
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ef14e6eaa7e6
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] 5+ messages in thread
end of thread, other threads:[~2022-06-14 20:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-13 23:34 [PATCH BlueZ] device: Add connectable flag to bearer state Luiz Augusto von Dentz
2022-06-13 23:34 ` [PATCH BlueZ] monitor/att: Fix decoding for notifications Luiz Augusto von Dentz
2022-06-14 0:39 ` [BlueZ] " bluez.test.bot
2022-06-14 20:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
2022-06-14 0:43 ` [BlueZ] device: Add connectable flag to bearer state bluez.test.bot
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).