Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nbuchwitz/action-playground
https://github.com/nbuchwitz/action-playground
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nbuchwitz/action-playground
- Owner: nbuchwitz
- License: mit
- Created: 2022-08-12T11:10:16.000Z (over 2 years ago)
- Default Branch: feat/ci-cd
- Last Pushed: 2022-08-12T12:21:10.000Z (over 2 years ago)
- Last Synced: 2023-02-26T22:06:34.617Z (almost 2 years ago)
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python wrapper for uhubctl
This is a simple Python wrapper for [uhubctl](https://github.com/mvp/uhubctl)
# Examples
## Discover all usable USB hubs
```python
import uhubctlhubs = uhubctl.discover_hubs()
for hub in hubs:
print(f"Found hub: {hub}")for port in hub.ports:
print(f" Found port: {port}")
```## Create hub and enumerate attached ports
```python
import uhubctlhub = Hub("1-1", enumerate=True)
# Iterate all ports
for port in hub.ports:
print(f"Found port: {port}")# Get port by port number
port_2 = hub.find_port(2)
print(f"The status of port 2 is {port_2.status}")
```## Manually specify hub and port
```python
from uhubctl import Hub, Porthub = Hub("1-1")
hub.add_port(1)
```## Control ports
```python
from uhubctl import Hub, Porthub = Hub("1-1")
port = hub.add_port(1)print("Switch port 1-1.1 off")
port.status = Falseprint("Switch port 1-1.1 on")
port.status = Trueprint("Get port 1-1.1 status")
print(port.status)
```# FAQ
### How can I specify the path to ´uhubctl´
```python
import uhubctluhubctl.UHUBCTL_BINARY = "sudo /usr/local/bin/uhubctl"
```