Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions checkbox-support/checkbox_support/scripts/eddystone_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
BeaconScanner,
EddystoneURLFrame,
)
from checkbox_support.vendor.beacontools.const import (
BluetoothAddressType,
ScanFilter,
ScanType,
)
from checkbox_support.helpers.timeout import timeout
from checkbox_support.helpers.retry import retry
from checkbox_support.interactive_cmd import InteractiveCommand
Expand All @@ -37,11 +42,6 @@ def init_bluetooth():
with InteractiveCommand("bluetoothctl") as btctl:
btctl.writeline("power on")
time.sleep(3)
# workaround for some intel bluetooth controller
# if we don't enable scan on via bluetoothctl first,
# the hci 'advertising scan enable' command would failed
btctl.writeline("scan on")
time.sleep(3)
btctl.writeline("exit")
btctl.kill()

Expand All @@ -65,6 +65,13 @@ def callback(sub_event, bt_addr, rssi, packet, additional_info):
callback,
bt_device_id=hci_device,
packet_filter=EddystoneURLFrame,
scan_parameters={
"scan_type": ScanType.ACTIVE,
"interval_ms": 10,
"window_ms": 10,
"address_type": BluetoothAddressType.PUBLIC,
"filter_type": ScanFilter.ALL,
},
debug=debug,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,5 @@ def test_initial_scripts(self, mock_command, mock_sleep):
eddystone_scanner.init_bluetooth()
mock_command.assert_called_with("bluetoothctl")
mock_btctl.writeline.assert_any_call("power on")
mock_btctl.writeline.assert_any_call("scan on")
mock_btctl.writeline.assert_any_call("exit")
self.assertEqual(mock_sleep.call_count, 2)
self.assertEqual(mock_sleep.call_count, 1)
Loading