{"id":23151606,"url":"https://github.com/nbuchwitz/python3-uhubctl","last_synced_at":"2025-08-17T20:32:02.861Z","repository":{"id":56717991,"uuid":"523820538","full_name":"nbuchwitz/python3-uhubctl","owner":"nbuchwitz","description":"Simple uhubctl wrapper for Python 3","archived":false,"fork":false,"pushed_at":"2024-05-21T20:26:59.000Z","size":37,"stargazers_count":15,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-22T20:05:38.378Z","etag":null,"topics":["automation","hub","python","testing","usb"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nbuchwitz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-11T17:59:09.000Z","updated_at":"2024-05-21T20:21:37.000Z","dependencies_parsed_at":"2024-05-21T20:02:28.980Z","dependency_job_id":"97021561-be87-4962-a4ac-71df37a276a4","html_url":"https://github.com/nbuchwitz/python3-uhubctl","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuchwitz%2Fpython3-uhubctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuchwitz%2Fpython3-uhubctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuchwitz%2Fpython3-uhubctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbuchwitz%2Fpython3-uhubctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nbuchwitz","download_url":"https://codeload.github.com/nbuchwitz/python3-uhubctl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230163670,"owners_count":18183263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","hub","python","testing","usb"],"created_at":"2024-12-17T18:35:02.427Z","updated_at":"2024-12-17T18:35:03.086Z","avatar_url":"https://github.com/nbuchwitz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python wrapper for uhubctl\n\nThis is a simple Python wrapper for [uhubctl](https://github.com/mvp/uhubctl)\n\n# Examples\n\n## Discover all usable USB hubs\n\n```python\nimport uhubctl\n\nhubs = uhubctl.discover_hubs()\n\nfor hub in hubs:\n    print(f\"Found hub: {hub}\")\n\n    for port in hub.ports:\n        print(f\"   Found port: {port}\")\n```\n\n## Create hub and enumerate attached ports\n```python\nimport uhubctl\n\nhub = Hub(\"1-1\", enumerate_ports=True)\n\n# Iterate all ports\nfor port in hub.ports:\n    print(f\"Found port: {port}\")\n\n# Get port by port number\nport_2 = hub.find_port(2)\nprint(f\"The status of port 2 is {port_2.status}\")\n```\n\n## Manually specify hub and port\n\n```python\nfrom uhubctl import Hub, Port\n\nhub = Hub(\"1-1\")\nhub.add_port(1)\n```\n\n## Control ports\n\n```python\nfrom uhubctl import Hub, Port\n\nhub = Hub(\"1-1\")\nport = hub.add_port(1)\n\nprint(\"Switch port 1-1.1 off\")\nport.status = False\n\nprint(\"Switch port 1-1.1 on\")\nport.status = True\n\nprint(\"Get port 1-1.1 status\")\nprint(port.status)\n```\n\n## Device details\n\n```python\nimport uhubctl\n\nhubs = uhubctl.discover_hubs()\n\nfor hub in hubs:\n    print(f\"Found hub: {hub}\")\n\n    for port in hub.ports:\n        print(f\"   Found port: {port}\")\n        \n        # You can use the optional argument `cached_results=False` for each of \n        # these 3 methods in order to invalidate the internal cache,\n        # which is used for performance reasons\n        print(f\"      Description: {port.description()}\")\n        print(f\"      Vendor ID: {port.vendor_id()}\")\n        print(f\"      Product ID: {port.product_id()}\")\n```\n\n# FAQ\n\n### How can I specify the path to ´uhubctl´\n\n```python\nimport uhubctl\n\nuhubctl.utils.UHUBCTL_BINARY = \"sudo /usr/local/bin/uhubctl\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbuchwitz%2Fpython3-uhubctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbuchwitz%2Fpython3-uhubctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbuchwitz%2Fpython3-uhubctl/lists"}