-
Notifications
You must be signed in to change notification settings - Fork 46
Add --hci-id argument to python_ble_proxy #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
acf2fc0
793dbc3
00537d9
a4eac26
b5dea1f
2265b45
156838f
9221cba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,12 @@ def _parse_args(argv: list[str] | None) -> argparse.Namespace: | |
| default="ws://localhost:5580/ble", | ||
| help="matter-server BLE proxy URL (default: %(default)s)", | ||
| ) | ||
| parser.add_argument( | ||
| "--hci-id", | ||
| default=None, | ||
| type=int, | ||
| help="Bluetooth adapter HCI ID (e.g., 0 for hci0). Use only on Linux with BlueZ.", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the adapter pin currently only affects scanning (see main comment re: the address-fallback connect path), consider hinting at that here, e.g. |
||
| ) | ||
|
Apollon77 marked this conversation as resolved.
Apollon77 marked this conversation as resolved.
|
||
| parser.add_argument( | ||
| "--log-level", | ||
| default="INFO", | ||
|
|
@@ -46,8 +52,8 @@ def _parse_args(argv: list[str] | None) -> argparse.Namespace: | |
| return parser.parse_args(argv) | ||
|
|
||
|
|
||
| async def _run(server_url: str) -> int: | ||
| scan_source = BleakScanSource() | ||
| async def _run(server_url: str, hci_id: int | None) -> int: | ||
| scan_source = BleakScanSource(hci_device=hci_id) | ||
| device_resolver = BleakDeviceResolver(scan_source) | ||
| proxy = MatterBleProxy(server_url, scan_source, device_resolver) | ||
|
|
||
|
|
@@ -96,7 +102,7 @@ def main(argv: list[str] | None = None) -> int: | |
| datefmt="%H:%M:%S", | ||
| ) | ||
| try: | ||
| return asyncio.run(_run(args.server)) | ||
| return asyncio.run(_run(args.server, args.hci_id)) | ||
|
Comment on lines
104
to
+105
|
||
| except KeyboardInterrupt: | ||
| return 0 | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the flag is
--hci-idand the argparse dest ishci_id, but this parameter ishci_device. Renaming it tohci_idwould keep one name end-to-end (BleakScanSource(hci_id=args.hci_id)).