Skip to content

Commit ffbf5bc

Browse files
Fix: hid.py BLEHID (#1108)
* Fix: hid.py BLEHID
1 parent 5c404ff commit ffbf5bc

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

kmk/hid.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,20 @@ def devices(self):
349349
def ble_monitor(self):
350350
if self.ble_connected != self.connected:
351351
self.ble_connected = self.connected
352-
if self.connected:
353-
if debug.enabled:
352+
if debug.enabled:
353+
if self.connected:
354354
debug('BLE connected')
355-
else:
356-
# Security-wise this is not right. While you're away someone turns
357-
# on your keyboard and they can pair with it nice and clean and then
358-
# listen to keystrokes.
359-
# On the other hand we don't have LESC so it's like shouting your
360-
# keystrokes in the air
361-
self.start_advertising()
362-
if debug.enabled:
355+
else:
363356
debug('BLE disconnected')
364357

358+
if not self.connected:
359+
# Security-wise this is not right. While you're away someone turns
360+
# on your keyboard and they can pair with it nice and clean and then
361+
# listen to keystrokes.
362+
# On the other hand we don't have LESC so it's like shouting your
363+
# keystrokes in the air
364+
self.start_advertising()
365+
365366
def clear_bonds(self):
366367
import _bleio
367368

0 commit comments

Comments
 (0)