From 5221236868bdcd02856ca20e94448658addbab06 Mon Sep 17 00:00:00 2001 From: Brikwerk Date: Fri, 23 Apr 2021 13:39:59 -0700 Subject: [PATCH] Removed address masking and SDP cleaning --- nxbt/bluez.py | 6 +++--- nxbt/nxbt.py | 27 --------------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/nxbt/bluez.py b/nxbt/bluez.py index 1198bb1..5df1d86 100644 --- a/nxbt/bluez.py +++ b/nxbt/bluez.py @@ -144,9 +144,6 @@ def toggle_clean_bluez(toggle): # Kill a bit of time here to ensure all services have restarted time.sleep(0.5) - # Only clean out SDP records if we're toggling ON - if toggle: - clean_sdp_records() def clean_sdp_records(): """Cleans all SDP Records from BlueZ with sdptool @@ -723,6 +720,8 @@ class BlueZ(): devices = self.get_discovered_devices() # Start discovering new devices and loop + self.set_powered(True) + self.set_pairable(True) self.adapter.StartDiscovery() try: for i in range(0, timeout): @@ -737,6 +736,7 @@ class BlueZ(): callback(devices) finally: self.adapter.StopDiscovery() + time.sleep(1) # Filter out paired devices or devices that don't # match a specified alias. diff --git a/nxbt/nxbt.py b/nxbt/nxbt.py index 91a9588..993986c 100644 --- a/nxbt/nxbt.py +++ b/nxbt/nxbt.py @@ -176,30 +176,6 @@ class Nxbt(): self._adapters_in_use = {} self._controller_adapter_lookup = {} - # Save all MAC addresses for existing adapters and replace - # with Controller MAC addresses - self.cached_adapters = self.get_available_adapters() - self.old_addresses = [] - self.masked_addresses = [] - for adapter in self.cached_adapters: - bt = BlueZ(adapter_path=adapter) - - # Saving old address - self.old_addresses.append(bt.address) - - # Creating/saving a Switch-compliant masked address - address = bt.address.split(":") - address[0] = "7C" - address[1] = "BB" - address[2] = "8A" - address = ":".join(address) - self.masked_addresses.append(address) - - bt.bus.close() - # Replace the old MAC addresses with the Switch-compliant - # masked ones - replace_mac_addresses(self.cached_adapters, self.masked_addresses) - # Disable the BlueZ input plugin so we can use the # HID control/interrupt Bluetooth ports toggle_clean_bluez(True) @@ -231,9 +207,6 @@ class Nxbt(): self.resource_manager.shutdown() - # Reset Bluetooth MAC addresses - replace_mac_addresses(self.cached_adapters, self.old_addresses) - # Re-enable the BlueZ plugins, if we have permission toggle_clean_bluez(False)