Skip to content

Commit

Permalink
fix: handle missing hci devices when enumerating adapters (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Apr 30, 2024
1 parent e0014e7 commit 95759e7
Showing 1 changed file with 17 additions and 10 deletions.
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

0 comments on commit 95759e7

Please sign in to comment.