Skip to content

Commit 184b801

Browse files
Add a vendor ID and product ID property to controllers.
1 parent 42f0fbd commit 184b801

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

examples/list_controllers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@
99
# Get a list of all the available devices
1010
devices = usbbluetooth.list_controllers()
1111
for dev in devices:
12-
print(dev)
12+
print("Controller found:")
13+
print(f"- Device: {dev}")
14+
print(f"- VID: 0x{dev.vendor_id:04x}")
15+
print(f"- PID: 0x{dev.product_id:04x}")

src/usbbluetooth/controller.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ def __init__(self, usb_device):
2121
self._ep_acl_out = None
2222
self.is_open = False
2323

24+
@property
25+
def vendor_id(self):
26+
return self._dev.idVendor
27+
28+
@property
29+
def product_id(self):
30+
return self._dev.idProduct
31+
2432
def open(self):
2533
# Check if there is a kernel driver controlling the device
2634
try:

0 commit comments

Comments
 (0)