From 819810e52abc33737ddd401f798787cd0058e915 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 23 Jan 2021 13:36:01 -0600 Subject: [PATCH] add workaround for bluez notification issue https://crbug.com/1170085 --- src/sagas/lwp3-bootloader-ble.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sagas/lwp3-bootloader-ble.ts b/src/sagas/lwp3-bootloader-ble.ts index 0fbcbe60..8fe9fbc7 100644 --- a/src/sagas/lwp3-bootloader-ble.ts +++ b/src/sagas/lwp3-bootloader-ble.ts @@ -132,6 +132,14 @@ function* connect(_action: BootloaderConnectionAction): Generator { }); try { + try { + yield call([characteristic, 'stopNotifications']); + } catch { + // HACK: Chromium on Linux (BlueZ) will not receive notifications + // if a device disconnects while notifications are enabled and then + // reconnects. So we have to call stopNotifications() first to get + // back to a known state. https://crbug.com/1170085 + } yield call([characteristic, 'startNotifications']); } catch (err) { notificationChannel.close();