base: ignore anything not from the known vendor IDs

We don't want to accidentally start talking to a device and brick it.
pull/147/head
Peter Hutterer 2019-07-17 10:07:11 +10:00
parent deb2c3ad2f
commit e1a3675439
1 changed files with 5 additions and 7 deletions

View File

@ -333,9 +333,6 @@ class Tuhi(GObject.Object):
@classmethod
def _device_in_register_mode(cls, bluez_device):
if bluez_device.vendor_id not in WACOM_COMPANY_IDS:
return False
# When the device is in register mode (blue light blinking), the
# manufacturer is merely 4 bytes. This will reset to 7 bytes even
# when the device simply times out and does not register fully.
@ -368,16 +365,17 @@ class Tuhi(GObject.Object):
stage.
'''
uuid = None
# We have a reverse-engineered protocol. Let's not talk to anyone
# who doesn't look like we know them to avoid potentially bricking a
# device.
if bluez_device.vendor_id not in WACOM_COMPANY_IDS:
return
# check if the device is already known to us
try:
config = self.config.devices[bluez_device.address]
uuid = config['uuid']
except KeyError:
pass
if uuid is None and bluez_device.vendor_id not in WACOM_COMPANY_IDS:
return
# if we got here from a currently live BlueZ device,