Skip to content
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

fix: handle missing hci devices when enumerating adapters #129

Merged
merged 3 commits into from
Apr 30, 2024
Merged
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
27 changes: 17 additions & 10 deletions src/bluetooth_adapters/systems/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,27 @@ def adapters(self) -> dict[str, AdapterDetails]:
or usb_device.manufacturer == "Unknown"
):
manufacturer = aiooui.get_vendor(mac_address)
else:
elif usb_device is not None:
manufacturer = usb_device.manufacturer
product = usb_device.product
vendor_id = usb_device.vendor_id
product_id = usb_device.product_id
if usb_device is not None:
product = usb_device.product
vendor_id = usb_device.vendor_id
product_id = usb_device.product_id
elif isinstance(device, UARTBluetoothDevice):
uart_device = device.uart_device
if mac_address == EMPTY_MAC_ADDRESS:
manufacturer = uart_device.manufacturer
if uart_device is None:
if mac_address != EMPTY_MAC_ADDRESS:
manufacturer = aiooui.get_vendor(mac_address)
else:
manufacturer = (
aiooui.get_vendor(mac_address) or uart_device.manufacturer
)
product = uart_device.product
product = uart_device.product

if mac_address == EMPTY_MAC_ADDRESS:
manufacturer = uart_device.manufacturer
else:
manufacturer = (
aiooui.get_vendor(mac_address)
or uart_device.manufacturer
)

adapters[adapter] = AdapterDetails(
address=mac_address,
Expand Down
Loading