Message ID | 20210618171301.2285511-1-luiz.dentz@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Luiz Von Dentz |
Headers | show |
Series | [BlueZ] device: Fix enabling temporary timer when TemporaryTimeout=0 | expand |
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=503457 ---Test result--- Test Summary: CheckPatch PASS 0.37 seconds GitLint PASS 0.15 seconds Prep - Setup ELL PASS 50.72 seconds Build - Prep PASS 0.11 seconds Build - Configure PASS 8.80 seconds Build - Make PASS 219.47 seconds Make Check PASS 9.61 seconds Make Distcheck PASS 263.52 seconds Build w/ext ELL - Configure PASS 8.77 seconds Build w/ext ELL - Make PASS 204.11 seconds Details ############################## Test: CheckPatch - PASS Desc: Run checkpatch.pl script with rule in .checkpatch.conf ############################## Test: GitLint - PASS Desc: Run gitlint with rule in .gitlint ############################## Test: Prep - Setup ELL - PASS Desc: Clone, build, and install ELL ############################## Test: Build - Prep - PASS Desc: Prepare environment for build ############################## Test: Build - Configure - PASS Desc: Configure the BlueZ source tree ############################## Test: Build - Make - PASS Desc: Build the BlueZ source tree ############################## Test: Make Check - PASS Desc: Run 'make check' ############################## Test: Make Distcheck - PASS Desc: Run distcheck to check the distribution ############################## Test: Build w/ext ELL - Configure - PASS Desc: Configure BlueZ source with '--enable-external-ell' configuration ############################## Test: Build w/ext ELL - Make - PASS Desc: Build BlueZ source with '--enable-external-ell' configuration --- Regards, Linux Bluetooth
Hi, On Fri, Jun 18, 2021 at 10:52 AM <bluez.test.bot@gmail.com> wrote: > > 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=503457 > > ---Test result--- > > Test Summary: > CheckPatch PASS 0.37 seconds > GitLint PASS 0.15 seconds > Prep - Setup ELL PASS 50.72 seconds > Build - Prep PASS 0.11 seconds > Build - Configure PASS 8.80 seconds > Build - Make PASS 219.47 seconds > Make Check PASS 9.61 seconds > Make Distcheck PASS 263.52 seconds > Build w/ext ELL - Configure PASS 8.77 seconds > Build w/ext ELL - Make PASS 204.11 seconds > > Details > ############################## > Test: CheckPatch - PASS > Desc: Run checkpatch.pl script with rule in .checkpatch.conf > > ############################## > Test: GitLint - PASS > Desc: Run gitlint with rule in .gitlint > > ############################## > Test: Prep - Setup ELL - PASS > Desc: Clone, build, and install ELL > > ############################## > Test: Build - Prep - PASS > Desc: Prepare environment for build > > ############################## > Test: Build - Configure - PASS > Desc: Configure the BlueZ source tree > > ############################## > Test: Build - Make - PASS > Desc: Build the BlueZ source tree > > ############################## > Test: Make Check - PASS > Desc: Run 'make check' > > ############################## > Test: Make Distcheck - PASS > Desc: Run distcheck to check the distribution > > ############################## > Test: Build w/ext ELL - Configure - PASS > Desc: Configure BlueZ source with '--enable-external-ell' configuration > > ############################## > Test: Build w/ext ELL - Make - PASS > Desc: Build BlueZ source with '--enable-external-ell' configuration > > > > --- > Regards, > Linux Bluetooth Pushed.
diff --git a/src/device.c b/src/device.c index 65838f59f..faf07ba22 100644 --- a/src/device.c +++ b/src/device.c @@ -2963,6 +2963,14 @@ bool btd_device_is_connected(struct btd_device *dev) return dev->bredr_state.connected || dev->le_state.connected; } +static void clear_temporary_timer(struct btd_device *dev) +{ + if (dev->temporary_timer) { + timeout_remove(dev->temporary_timer); + dev->temporary_timer = 0; + } +} + void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type) { struct bearer_state *state = get_state(dev, bdaddr_type); @@ -2991,10 +2999,7 @@ void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type) return; /* Remove temporary timer while connected */ - if (dev->temporary_timer) { - timeout_remove(dev->temporary_timer); - dev->temporary_timer = 0; - } + clear_temporary_timer(dev); g_dbus_emit_property_changed(dbus_conn, dev->path, DEVICE_INTERFACE, "Connected"); @@ -4280,6 +4285,17 @@ static bool device_disappeared(gpointer user_data) return FALSE; } +static void set_temporary_timer(struct btd_device *dev, unsigned int timeout) +{ + clear_temporary_timer(dev); + + if (!timeout) + return; + + dev->temporary_timer = timeout_add_seconds(timeout, device_disappeared, + dev, NULL); +} + void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type) { if (bdaddr_type == BDADDR_BREDR) @@ -4291,12 +4307,7 @@ void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type) return; /* Restart temporary timer */ - if (device->temporary_timer) - timeout_remove(device->temporary_timer); - - device->temporary_timer = timeout_add_seconds(btd_opts.tmpto, - device_disappeared, - device, NULL); + set_temporary_timer(device, btd_opts.tmpto); } /* It is possible that we have two device objects for the same device in @@ -4487,10 +4498,7 @@ void device_remove(struct btd_device *device, gboolean remove_stored) disconnect_all(device); } - if (device->temporary_timer > 0) { - timeout_remove(device->temporary_timer); - device->temporary_timer = 0; - } + clear_temporary_timer(device); if (device->store_id > 0) { g_source_remove(device->store_id); @@ -5701,11 +5709,6 @@ void btd_device_set_temporary(struct btd_device *device, bool temporary) device->temporary = temporary; - if (device->temporary_timer) { - timeout_remove(device->temporary_timer); - device->temporary_timer = 0; - } - if (temporary) { if (device->bredr) adapter_whitelist_remove(device->adapter, device); @@ -5714,11 +5717,10 @@ void btd_device_set_temporary(struct btd_device *device, bool temporary) device->disable_auto_connect = TRUE; device_set_auto_connect(device, FALSE); } - device->temporary_timer = timeout_add_seconds(btd_opts.tmpto, - device_disappeared, - device, NULL); + set_temporary_timer(device, btd_opts.tmpto); return; - } + } else + clear_temporary_timer(device); if (device->bredr) adapter_whitelist_add(device->adapter, device);
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> When TemporaryTimeout is set to 0 it is supposed to disable the temporary timeout so devices never desappear. Fixes: https://github.com/bluez/bluez/issues/146 --- src/device.c | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-)