Skip to content

Commit b51e4ee

Browse files
committed
doc: Example for port description, VID and PID
1 parent 052c557 commit b51e4ee

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,27 @@ print("Get port 1-1.1 status")
6060
print(port.status)
6161
```
6262

63+
## Device details
64+
65+
```python
66+
import uhubctl
67+
68+
hubs = uhubctl.discover_hubs()
69+
70+
for hub in hubs:
71+
print(f"Found hub: {hub}")
72+
73+
for port in hub.ports:
74+
print(f" Found port: {port}")
75+
76+
# You can use the optional argument `cached_results=False` for each of
77+
# these 3 methods in order to invalidate the internal cache,
78+
# which is used for performance reasons
79+
print(f" Description: {port.description()}")
80+
print(f" Vendor ID: {port.vendor_id()}")
81+
print(f" Product ID: {port.product_id()}")
82+
```
83+
6384
# FAQ
6485

6586
### How can I specify the path to ´uhubctl´

0 commit comments

Comments
 (0)