Removed address masking and SDP cleaning
This commit is contained in:
parent
abb966d438
commit
5221236868
2 changed files with 3 additions and 30 deletions
|
|
@ -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.
|
||||
|
|
|
|||
27
nxbt/nxbt.py
27
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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue