{"id":13574849,"url":"https://github.com/mvp/uhubctl","last_synced_at":"2025-05-14T03:08:06.023Z","repository":{"id":25510199,"uuid":"28941753","full_name":"mvp/uhubctl","owner":"mvp","description":"uhubctl - USB hub per-port power control","archived":false,"fork":false,"pushed_at":"2024-10-16T04:51:00.000Z","size":357,"stargazers_count":2209,"open_issues_count":7,"forks_count":230,"subscribers_count":49,"default_branch":"master","last_synced_at":"2024-10-29T15:34:12.129Z","etag":null,"topics":["c","control","disable","hub","libusb","off","port","power","ppps","switching","toggle","usb","utility"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"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":"2015-01-08T00:56:39.000Z","updated_at":"2024-10-27T13:17:53.000Z","dependencies_parsed_at":"2023-09-23T20:11:03.673Z","dependency_job_id":"61ae44cd-653e-496c-a007-4f3a2fb68af5","html_url":"https://github.com/mvp/uhubctl","commit_stats":{"total_commits":330,"total_committers":32,"mean_commits":10.3125,"dds":0.1454545454545455,"last_synced_commit":"2dbc6ce2d9ab7f00f3cc9cd21807d7982a838288"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvp%2Fuhubctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvp%2Fuhubctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvp%2Fuhubctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvp%2Fuhubctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvp","download_url":"https://codeload.github.com/mvp/uhubctl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288351,"owners_count":21078903,"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":["c","control","disable","hub","libusb","off","port","power","ppps","switching","toggle","usb","utility"],"created_at":"2024-08-01T15:00:55.185Z","updated_at":"2025-05-14T03:08:06.009Z","avatar_url":"https://github.com/mvp.png","language":"C","readme":"uhubctl\n=======\n\n`uhubctl` is utility to control USB power per-port on smart USB hubs.\nSmart hub is defined as one that implements per-port power switching.\n\nOriginal idea for this code was inspired by hub-ctrl.c by Niibe Yutaka:\nhttps://www.gniibe.org/development/ac-power-control-by-USB-hub\n\n\nCompatible USB hubs\n===================\n\nNote that not many USB hubs correctly support per-port power switching.\nSome of them are no longer manufactured and can be hard to find.\n\nThis is list of known compatible USB hubs:\n\n| Manufacturer       | Product                                              | Ports | USB | VID:PID   | Release | EOL  |\n|:-------------------|:-----------------------------------------------------|:------|:----|:----------|:--------|:-----|\n| Acer               | BE270U monitor ([see](https://tinyurl.com/acer550))  | 4     | 3.0 |`2109:2811`| 2016    |      |\n| AmazonBasics       | HU3641V1 ([RPi issue](https://goo.gl/CLt46M))        | 4     | 3.0 |`2109:2811`| 2013    |      |\n| AmazonBasics       | HU3770V1 ([RPi issue](https://goo.gl/CLt46M))        | 7     | 3.0 |`2109:2811`| 2013    |      |\n| AmazonBasics       | HU9003V1EBL, HUC9003V1EBL                            | 7     | 3.1 |`2109:2817`| 2018    |      |\n| AmazonBasics       | HU9002V1SBL, HU9002V1EBL, HU9002V1ESL ([note](https://tinyurl.com/HU9002)) | 10    | 3.1 |`2109:2817`| 2018    |      |\n| AmazonBasics       | HUC9002V1SBL, HUC9002V1EBL, HUC9002V1ESL             | 10    | 3.1 |`2109:2817`| 2018    |      |\n| AmazonBasics       | U3-7HUB (only works for 1 charge port)               | 7     | 3.0 |`2109:2813`| 2020    |      |\n| Anker              | AK-68ANHUB-BV7A-0004 ([note](https://git.io/JLnZb))  | 7     | 3.0 |`2109:0812`| 2014    |      |\n| Apple              | Mac Mini M4 (2 front ports only)                     | 2     | 3.2 |`05AC:800B`| 2024    |      |\n| Apple              | Pro Display XDR MWPE2LL/A (internal USB hub)         | 4     | 2.0 |`05AC:9139`| 2019    |      |\n| Apple              | Thunderbolt Display 27\" (internal USB hub)           | 6     | 2.0 |           | 2011    | 2016 |\n| Apple              | USB Keyboard With Numeric Pad (internal USB hub)     | 3     | 2.0 |           | 2011    |      |\n| Asus               | Z77 Sabertooth Motherboard (onboard USB hub)         | 6     | 2.0 |           | 2012    |      |\n| Asus               | Z87-PLUS Motherboard (onboard USB hub)               | 4     | 3.0 |           | 2013    | 2016 |\n| Aukey              | CB-C59                                               | 4     | 3.0 |`2109:2813`| 2017    |      |\n| B+B SmartWorx      | UHR204                                               | 4     | 2.0 |`0856:DB00`| 2013    |      |\n| B+B SmartWorx      | USH304                                               | 4     | 3.0 |`04B4:6506`| 2017    | 2019 |\n| Basler             | 2000036234                                           | 4     | 3.0 |`0451:8046`| 2016    |      |\n| Belkin             | F5U101                                               | 4     | 2.0 |`0451:2046`| 2005    | 2010 |\n| Belkin             | F5U238UKCRL-MOB                                      | 4     | 2.0 |`0409:0059`| 2004    | 2010 |\n| BenQ               | PD2700U 4K Monitor (works only in USB2 mode)         | 4     | 3.0 |`05E3:0610`| 2018    |      |\n| BenQ               | PD3220U                                              | 4     | 3.1 |`05E3:0610`| 2019    |      |\n| Bytecc             | BT-UH340 ([warning](https://tinyurl.com/BT-UH340-1)) | 4     | 3.0 |`2109:8110`| 2010    |      |\n| Centech            | CT-USB4HUB ReTRY HUB                                 | 4     | 3.0 |`0424:2744`| 2017    |      |\n| Circuitco          | Beagleboard-xM (internal USB hub)                    | 4     | 2.0 |`0424:9514`| 2010    |      |\n| Club3D             | CSV-3242HD Dual Display Docking Station              | 4     | 3.0 |`2109:2811`| 2015    |      |\n| Coolgear           | USBG-12U2ML                                          | 12    | 2.0 |`05e3:0607`| 2015    |      |\n| Cypress            | CY4608 HX2VL ([note](https://tinyurl.com/CY4608-1))  | 4     | 2.0 |`04B4:6570`| 2012    |      |\n| D-Link             | DUB-H4 rev D,E (black). Note: rev A,C,F not supported| 4     | 2.0 |`05E3:0608`| 2012    |      |\n| D-Link             | DUB-H7 rev A (silver)                                | 7     | 2.0 |`2001:F103`| 2005    | 2010 |\n| D-Link             | DUB-H7 rev D,E (black). Rev B,C,F,G not supported    | 7     | 2.0 |`05E3:0608`| 2012    |      |\n| Dell               | P2416D 24\" QHD Monitor ([note](https://git.io/JUAu8))| 4     | 2.0 |           | 2017    |      |\n| Dell               | S2719DGF 27\" WQHD Gaming-Monitor                     | 5     | 3.0 |`0424:5734`| 2018    |      |\n| Dell               | UltraSharp 1704FPT 17\" LCD Monitor                   | 4     | 2.0 |`0424:A700`| 2005    | 2015 |\n| Dell               | UltraSharp U2415 24\" LCD Monitor                     | 5     | 3.0 |           | 2014    |      |\n| Dell               | UltraSharp U3419W 34\" Curved Monitor                 | 6     | 3.0 |           | 2020    |      |\n| Dell               | Wyse 3040 ([-f required](https://tinyurl.com/wyse3k))| 6     | 3.0 |           | 2017    |      |\n| Delock             | 62537                                                | 4     | 3.0 |           | 2017    | 2021 |\n| Delock             | 87445 ([note](https://git.io/Jsuz5))                 | 4     | 2.0 |`05E3:0608`| 2009    | 2013 |\n| Elecom             | U2H-G4S                                              | 4     | 2.0 |           | 2006    | 2011 |\n| Gigabyte           | G27Q monitor ([see](http://tinyurl.com/G27Q551))     | 4     | 3.0 |`2109:0817`| 2020    |      |\n| GlobalScale        | ESPRESSObin SBUD102 V5                               | 1     | 3.0 |`1D6B:0003`| 2017    |      |\n| Hardkernel         | ODROID-C4 ([note](https://git.io/JG0mP))             | 4     | 3.0 |           | 2020    |      |\n| Hawking Technology | UH214                                                | 4     | 2.0 |           | 2003    | 2008 |\n| Hewlett Packard    | USB-C Dock G5 5TW10AA                                | 5     | 3.0 |`03F0:076B`| 2019    |      |\n| Hewlett Packard    | P5Q58UT                                              | 3     | 3.0 |           | 2019    |      |\n| Inateck            | HB2025A ([USB2 only](https://tinyurl.com/HB2025A-1)) | 4     | 3.1 |`2109:2822`| 2021    |      |\n| IOI                | U3H415E1                                             | 4     | 3.0 |           | 2012    |      |\n| j5create           | JUH377 ([note](https://tinyurl.com/JUH377))          | 7     | 3.0 |           | 2016    |      |\n| j5create           | JUH470 ([note](https://tinyurl.com/JUH470))          | 3     | 3.0 |`05E3:0610`| 2014    |      |\n| Juiced Systems     | 6HUB-01                                              | 7     | 3.0 |`0BDA:0411`| 2014    | 2018 |\n| KUNBUS GmbH        | RevPi Connect (+) / S / SE                           | 2     | 2.0 |`0424:9514`| 2018    |      |\n| KUNBUS GmbH        | RevPi Connect 4                                      | 2     | 3.0 |           | 2022    |      |\n| KUNBUS GmbH        | RevPi Core 3 / S / SE                                | 2     | 2.0 |`0424:9514`| 2017    |      |\n| LG Electronics     | 27MD5KL-B monitor                                    | 4     | 3.0 |`043E:9A60`| 2019    |      |\n| LG Electronics     | 27GL850-B monitor                                    | 4     | 3.0 |`0451:8142`| 2019    |      |\n| LG Electronics     | 27UK850-W monitor                                    | 2     | 3.0 |           | 2018    |      |\n| LG Electronics     | 27UN83A-W monitor                                    | 2     | 3.0 |`0451:8142`| 2020    |      |\n| LG Electronics     | 38WK95C-W monitor                                    | 4     | 3.0 |`0451:8142`| 2018    |      |\n| Lenovo             | ThinkPad Ultra Docking Station (40A20090EU)          | 6     | 2.0 |`17EF:100F`| 2015    |      |\n| Lenovo             | ThinkPad Ultra Docking Station (40AJ0135EU)          | 7     | 3.1 |`17EF:3070`| 2018    |      |\n| Lenovo             | ThinkPad X200 Ultrabase 42X4963                      | 3     | 2.0 |`17EF:1005`| 2008    | 2011 |\n| Lenovo             | ThinkPad X6 Ultrabase 42W3107                        | 4     | 2.0 |`17EF:1000`| 2006    | 2009 |\n| Lenovo             | ThinkPlus 4-in-1 USB-C hub 4X90W86497                | 3     | 3.0 |           | 2021    |      |\n| Lenovo             | ThinkVision T24i-10 Monitor                          | 4     | 2.0 |`17EF:0610`| 2018    |      |\n| Lenovo             | USB-C to 4 Port USB-A Hub                            | 4     | 2.0 |`17EF:103A`| 2020    |      |\n| Lindy              | USB serial converter 4 port                          | 4     | 1.1 |`058F:9254`| 2008    |      |\n| Linksys            | USB2HUB4 ([note](https://git.io/JYiDZ))              | 4     | 2.0 |           | 2004    | 2010 |\n| Maplin             | A08CQ                                                | 7     | 2.0 |`0409:0059`| 2008    | 2011 |\n| Metadot            | Das Keyboard 4                                       | 2     | 3.0 |           | 2014    |      |\n| Microchip          | EVB9512                                              | 2     | 2.0 |           | 2009    |      |\n| Microchip          | EVB-USB2517                                          | 7     | 2.0 |           | 2008    |      |\n| Microchip          | EVB-USB2534BC                                        | 4     | 2.0 |           | 2013    |      |\n| Microchip          | EVB-USB5807                                          | 7     | 3.0 |           | 2016    |      |\n| Moxa               | Uport-407                                            | 7     | 2.0 |`110A:0407`| 2009    |      |\n| NVidia             | Jetson Nano B01 ([details](https://git.io/JJaFR))    | 4     | 3.0 |           | 2019    |      |\n| NVidia             | Jetson Xavier NX ([details](https://tinyurl.com/Xavier-NX)) | 4     | 3.0 |           | 2020    |      |\n| Phidgets           | HUB0003_0                                            | 7     | 2.0 |`1A40:0201`| 2017    |      |\n| Philips            | 346B1C UltraWide 34\" Curved Monitor                  | 4     | 3.0 |`05E3:0610`| 2019    |      |\n| Plugable           | USB3-HUB7BC                                          | 7     | 3.0 |`2109:0813`| 2015    |      |\n| Plugable           | USB3-HUB7C (only works for 2 charge ports)           | 7     | 3.0 |`2109:0813`| 2015    |      |\n| Plugable           | USBC-HUB7BC (works for 6/7 ports, not the rightmost) | 7     | 3.0 |`2109:0817`| 2021    |      |\n| Plugable           | USB3-HUB10-C2 (only works for 2 charge ports)        | 10    | 3.0 |           | 2014    |      |\n| Port Inc           | NWUSB01                                              | 4     | 1.1 |`0451:1446`| 1999    | 2003 |\n| Raspberry Pi       | B+, 2B, 3B ([see below](#raspberry-pi-b2b3b))        | 4     | 2.0 |           | 2011    |      |\n| Raspberry Pi       | 3B+        ([see below](#raspberry-pi-3b))           | 4     | 2.0 |`0424:2514`| 2018    |      |\n| Raspberry Pi       | 4B         ([see below](#raspberry-pi-4b))           | 4     | 3.0 |`2109:3431`| 2019    |      |\n| Raspberry Pi       | 5          ([see below](#raspberry-pi-5))            | 4     | 3.0 |`1d6b:0002`| 2023    |      |\n| Renesas            | uPD720202 PCIe USB 3.0 host controller               | 2     | 3.0 |           | 2013    |      |\n| Rosewill           | RHUB-210                                             | 4     | 2.0 |`0409:005A`| 2011    | 2014 |\n| Rosonway           | RSH-518C ([note](https://tinyurl.com/RSH518))        | 7     | 3.0 |`2109:0817`| 2021    |      |\n| Rosonway           | RSH-A10 ([see](https://tinyurl.com/2ppyyaj8))        | 10    | 3.0 |`0bda:0411`| 2020    |      |\n| Rosonway           | RSH-A13 ([warning](https://tinyurl.com/RSH-A13))     | 13    | 3.1 |`2109:2822`| 2021    |      |\n| Rosonway           | RSH-A16 ([note](https://git.io/JTawg), [warning](https://tinyurl.com/RSH-A16)) | 16    | 3.0 |`0bda:0411`| 2020    |      |\n| Rosonway           | RSH-A37S                                             | 7     | 3.0 |`2109:2822`| 2021    |      |\n| Rosonway           | RSH-A104 ([USB2 only](https://tinyurl.com/RSH-A104)) | 4     | 3.1 |`2109:2822`| 2022    |      |\n| Rosonway           | RSH-ST07C ([only 4](https://tinyurl.com/4pjnujrn))   | 7     | 3.0 |`2109:2822`| 2023    |      |\n| Sanwa Supply       | USB-HUB14GPH                                         | 4     | 1.1 |           | 2001    | 2003 |\n| Seagate            | Backup Plus Hub STEL8000100                          | 2     | 3.0 |`0BC2:AB44`| 2016    |      |\n| Seeed Studio       | reTerminal CM4104032                                 | 2     | 2.0 |`0424:2514`| 2021    |      |\n| StarTech           | DKT30CSDHPD3 USB-C Travel Dock                       | 3     | 3.0 |`2109:2817`| 2018    |      |\n| StarTech           | HB30A4AIB ([warning](https://tinyurl.com/ycxravwk))  | 4     | 3.0 |`2109:2817`| 2018    |      |\n| StarTech           | HB31C2A2CB ([note](https://github.com/mvp/uhubctl/issues/601)) | 5 | 3.0 |`14B0:013D`| 2020    |      |\n| Sunix              | SHB4200MA                                            | 4     | 2.0 |`0409:0058`| 2006    | 2009 |\n| System Talks       | Sugoi USB2-HUB4X                                     | 4     | 2.0 |           | 2007    |      |\n| Targus             | PA095UZ                                              | 2     | 2.0 |           | 2004    |      |\n| Targus             | PAUH212/PAUH212U                                     | 7     | 2.0 |           | 2004    | 2009 |\n| Texas Instruments  | TUSB4041PAPEVM                                       | 4     | 2.1 |`0451:8142`| 2015    |      |\n| UUGear             | MEGA4 (for Raspberry Pi 4B)                          | 4     | 3.0 |`2109:0817`| 2021    |      |\n| VirtualHere        | USB3 4-port hub ([note](https://tinyurl.com/vhusb))  | 4     | 3.0 |           | 2024    |      |\n\nThis table is by no means complete.\nIf your hub works with `uhubctl`, but is not listed above, please report it\nby opening new issue at https://github.com/mvp/uhubctl/issues,\nso we can add it to supported table. In your report, please provide\nexact product model and add output from `uhubctl`\nand please test VBUS off support as described below in FAQ.\n\nNote that quite a few modern motherboards have built-in root hubs that\ndo support this feature - you may not even need to buy any external hub.\n\n\nUSB 3.0 duality note\n====================\nIf you have USB 3.0 hub connected to USB3 upstream port, it will be detected\nas 2 independent virtual hubs: USB2 and USB3, and your USB devices will be connected\nto USB2 or USB3 virtual hub depending on their capabilities and connection speed.\nTo control power for such hubs, it is necessary to turn off/on power on **both** USB2 and USB3\nvirtual hubs for power off/on changes to take effect. `uhubctl` will try to do this automatically\n(unless you disable this behavior with option `-e`).\n\nUnfortunately, while most hubs will cut off data USB connection, some may still not cut off VBUS to port,\nwhich means connected phone may still continue to charge from port that is powered off by `uhubctl`.\n\nInstalling\n==========\n\nFor Linux and MacOS uhubctl is available in standard package managers\nand can be installed with following commands:\n\n* MacOS: `brew install uhubctl` or `sudo port install uhubctl`\n* Ubuntu/Debian/Raspbian: `sudo apt install uhubctl`\n* Redhat/EPEL/Fedora/CentOS: `sudo yum install uhubctl`\n* OpenSUSE: `sudo zypper install uhubctl`\n\nHowever, uhubctl installed from standard package manager may not\nnecessarily be latest version, or even severely lag behind current version.\nIf [latest published](https://github.com/mvp/uhubctl/releases) uhubctl version\nis newer than what your package manager offers, you may need to compile and install\nfrom source as described below.\n\nCompiling\n=========\n\nThis utility was tested to compile and work on Linux (Ubuntu/Debian/Raspbian,\nRedhat/EPEL/Fedora/CentOS, Arch Linux, Gentoo, openSUSE, Buildroot),\nFreeBSD, NetBSD, SunOS and MacOS.\n\nWhile `uhubctl` compiles on Windows, USB power switching does not work on Windows because `libusb`\nis using `winusb.sys` driver, which according to Microsoft does not support\n[necessary USB control requests](https://web.archive.org/web/20210225235523/https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f680b63f-ca4f-4e52-baa9-9e64f8eee101/how-to-send-an-quotusb-control-requestquot-to-an-usbhub?forum=wdk).\nThis may be fixed if `libusb` starts supporting different driver on Windows.\n\nNote that it is highly recommended to have utility `pkgconf` (or `pkg-config`) installed\n(often it is installed by default).\n\nFirst, you need to install library libusb-1.0 (version 1.0.13 or later is required,\n1.0.23 or later is recommended):\n\n* Ubuntu: `sudo apt-get install libusb-1.0-0-dev pkgconf`\n* Redhat: `sudo yum install libusb1-devel pkgconf`\n* OpenSUSE: `sudo zypper install libusb-1_0-devel pkgconf`\n* MacOS: `brew install libusb pkgconf`, or `sudo port install libusb-devel pkgconf`\n* FreeBSD: `pkg install gmake pkgconf` (libusb is included by default)\n* NetBSD: `sudo pkgin install libusb1 gmake pkgconf`\n* Windows: TBD?\n\nTo fetch uhubctl source and compile it:\n\n    git clone https://github.com/mvp/uhubctl\n    cd uhubctl\n    make\n\nThis should generate `uhubctl` binary.\nYou can install it in your system as `/usr/sbin/uhubctl` using:\n\n    sudo make install\n\nNote that on some OS (e.g. FreeBSD/NetBSD) you need to use `gmake` instead to build.\n\nUsage\n=====\n\n\u003e :warning: On Linux, use `sudo` or configure USB permissions as described below!\n\nTo list all supported hubs:\n\n    uhubctl\n\nYou can control the power on a USB port(s) like this:\n\n    uhubctl -a off -p 2\n\nThis means operate on default smart hub and turn power off (`-a off`, or `-a 0`)\non port 2 (`-p 2`). Supported actions are `off`/`on`/`cycle`/`toggle` (or `0`/`1`/`2`/`3`).\n`cycle` means turn power off, wait some delay (configurable with `-d`) and turn it back on.\nPorts can be comma separated list, and may use `-` for ranges e.g. `2`, or `2,4`, or `2-5`, or `1-2,5-8`.\n\n\u003e :warning: Turning off built-in USB ports may cut off your keyboard or mouse,\nso be careful which ports you are turning off!\n\nIf you have more than one smart USB hub connected, you should choose\nspecific hub to control using `-l` (location) parameter.\nTo find hub locations, simply run `uhubctl` without any parameters.\nHub locations look like `b-x.y.z`, where `b` is USB bus number, and `x`, `y`, `z`...\nare port numbers for all hubs in chain, starting from root hub for a given USB bus.\nThis address is semi-stable - it will not change if you unplug/replug (or turn off/on)\nUSB device into the same physical USB port (this method is also used in Linux kernel).\n\n\nLinux USB permissions\n=====================\n\nOn Linux, you should configure `udev` USB permissions (otherwise you will have to run it as root using `sudo uhubctl`).\n\nStarting with Linux Kernel 6.0 there is a standard interface to turn USB hub ports on or off,\nand `uhubctl` will try to use it (instead of `libusb`) to set the port status.\nThis is why there are additional rules for 6.0+ kernels.\nThere is no harm in having these rules on systems running older kernel versions.\n\nTo fix USB permissions, first run `sudo uhubctl` and note all `vid:pid` for hubs you need to control.\nThen, add udev rules like below to file `/etc/udev/rules.d/52-usb.rules`\n(replace `2001` with your hub vendor id, or completely remove `ATTR{idVendor}` filter to allow any USB hub access):\n\n    SUBSYSTEM==\"usb\", DRIVER==\"usb\", MODE=\"0666\", ATTR{idVendor}==\"2001\"\n    # Linux 6.0 or later (its ok to have this block present for older Linux kernels):\n    SUBSYSTEM==\"usb\", DRIVER==\"usb\", \\\n      RUN=\"/bin/sh -c \\\"chmod -f 666 $sys$devpath/*port*/disable || true\\\"\"\n\nNote that for USB3 hubs, some hubs use different vendor ID for USB2 vs USB3 components of the same chip,\nand both need permissions to make uhubctl work properly.\nE.g. for Raspberry Pi 4B, you need to add these 2 lines (or remove idVendor filter):\n\n    SUBSYSTEM==\"usb\", DRIVER==\"usb\", MODE=\"0666\", ATTR{idVendor}==\"2109\"\n    SUBSYSTEM==\"usb\", DRIVER==\"usb\", MODE=\"0666\", ATTR{idVendor}==\"1d6b\"\n\nIf you don't like wide open mode `0666`, you can restrict access by group like this:\n\n    SUBSYSTEM==\"usb\", DRIVER==\"usb\", MODE=\"0664\", GROUP=\"dialout\"\n    # Linux 6.0 or later (its ok to have this block present for older Linux kernels):\n    SUBSYSTEM==\"usb\", DRIVER==\"usb\", \\\n      RUN+=\"/bin/sh -c \\\"chown -f root:dialout $sys$devpath/*port*/disable || true\\\"\" \\\n      RUN+=\"/bin/sh -c \\\"chmod -f 660 $sys$devpath/*port*/disable || true\\\"\"\n\nand then add permitted users to `dialout` group:\n\n    sudo usermod -a -G dialout $USER\n\nFor your `udev` rule changes to take effect, reboot or run:\n\n    sudo udevadm trigger --attr-match=subsystem=usb\n\nFor your convenience, ready to use udev rule is provided [here](https://github.com/mvp/uhubctl/blob/master/udev/rules.d/52-usb.rules).\n\n\nFAQ\n===\n\n#### _What is USB per-port power switching?_\n\nAccording to USB 2.0 specification, USB hubs can advertise no power switching,\nganged (all ports at once) power switching or per-port (individual) power switching.\nNote that by default `uhubctl` will only detect USB hubs which support per-port power switching\n(but you can force it to try operating on unsupported hubs with option `-f`).\nYou can find what kind of power switching your hardware supports by using `sudo lsusb -v`:\n\nNo power switching:\n\n    wHubCharacteristic 0x000a\n      No power switching (usb 1.0)\n      Per-port overcurrent protection\n\nGanged power switching:\n\n    wHubCharacteristic 0x0008\n      Ganged power switching\n      Per-port overcurrent protection\n\nPer-port power switching:\n\n    wHubCharacteristic 0x0009\n      Per-port power switching\n      Per-port overcurrent protection\n\n\n#### _How do I check if my USB hub is supported by `uhubctl`?_\n\n1. Run `sudo uhubctl`. If your hub is not listed, it is not supported.\n   Alternatively, you can run `sudo lsusb -v` and check for\n   `Per-port power switching` -  if you cannot see such line in lsusb output,\n   hub is not supported.\n2. Check for VBUS (voltage) off support: plug a phone, USB light\n    or USB fan into USB port of your hub.\n   Try using `uhubctl` to turn power off on that port, and check\n   that phone stops charging, USB light stops shining or USB fan stops spinning.\n   If VBUS doesn't turn off, your hub manufacturer did not include circuitry\n   to actually cut power off. Such hub would still work\n   to cut off USB data connection, but it cannot turn off power,\n   and we do not consider this supported device.\n3. If tests above were successful, please report your hub\n   by opening new issue at https://github.com/mvp/uhubctl/issues,\n   so we can add it to list of supported devices.\n   Please do not report unsupported hubs, unless it is different\n   hardware revision of some already listed supported model.\n\n\n#### _USB devices are not removed after port power down on Linux_\n\nAfter powering down USB port, udev does not get any event, so it keeps the device files around.\nHowever, trying to access the device files will lead to an IO error.\n\nThis is Linux kernel [issue](https://tinyurl.com/ym7yvuzw) and is [fixed](https://github.com/mvp/uhubctl/pull/450)\nsince uhubctl 2.5.0 for systems with Linux kernel 6.0 or later.\n\nIf you are still using Linux 5.x or older, you can use this workaround for this issue:\n\n    sudo uhubctl -a off -l ${location} -p ${port}\n    sudo udevadm trigger --action=remove /sys/bus/usb/devices/${location}.${port}/\n\nDevice file will be removed by udev, but USB device will be still visible in `lsusb`.\nNote that path `/sys/bus/usb/devices/${location}.${port}` will only exist if device was detected on that port.\nWhen you turn power back on, device should re-enumerate properly (no need to call `udevadm` again).\n\n#### _Power comes back on after few seconds on Linux_\n\nSome device drivers in kernel are surprised by USB device being turned off and automatically try to power it back on.\n\nThis is Linux kernel [issue](https://tinyurl.com/ym7yvuzw) and is [fixed](https://github.com/mvp/uhubctl/pull/450)\nsince uhubctl 2.5.0 for systems with Linux kernel 6.0 or later.\n\nIf you are still using Linux 5.x or older:\n\nYou can use option `-r N`, where N is some number from 10 to 1000 to fix this -\n`uhubctl` will try to turn power off many times in quick succession, and it should suppress that.\n\nDisabling USB authorization for device in question before turning power off with `uhubctl` should help:\n\n    echo 0 \u003e sudo tee /sys/bus/usb/devices/${location}.${port}/authorized\n\nIf your device is USB mass storage, invoking `udisksctl` before calling `uhubctl` should help too:\n\n    sudo udisksctl power-off --block-device /dev/disk/...`\n    sudo uhubctl -a off ...\n\n\n#### _Multiple 4-port hubs are detected, but I only have one 7-port hub connected_\n\nMany hub manufacturers build their USB hubs using basic 4 port USB chips.\nE.g. to make 7 port hub, they daisy-chain two 4 port hubs - 1 port is lost to daisy-chaining,\nso it makes it 4+4-1=7 port hub. Similarly, 10 port hub could be built as 3 4-port hubs\ndaisy-chained together, which gives 4+4+4-2=10 usable ports.\n\nNote that you should never try to change power state for ports used to daisy-chain internal hubs together.\nDoing so will confuse internal hub circuitry and will cause unpredictable behavior.\n\n\n#### _Raspberry Pi turns power off on all ports, not just the one I specified_\n\nThis is the limitation of Raspberry Pi hardware design.\nAs a workaround, you can buy any external USB hub from supported list above,\nattach it to any USB port of Raspberry Pi, and control power on its ports independently.\nAlso, there are supported hubs designed specifically for Raspberry Pi, e.g. UUGear MEGA4.\n\nFor reference, supported Raspberry Pi models have following internal USB topology:\n\n##### Raspberry Pi B+,2B,3B\n\n  * Single hub `1-1`, ports 2-5 ganged, all controlled by port `2`:\n\n        uhubctl -l 1-1 -p 2 -a 0\n\n    Trying to control ports `3`,`4`,`5` will not do anything.\n    Port `1` controls power for Ethernet+WiFi.\n\n##### Raspberry Pi 3B+\n\n  * Main hub `1-1`, all 4 ports ganged, all controlled by port `2` (turns off secondary hub ports as well).\n    Port `1` connects hub `1-1.1` below, ports `2` and `3` are wired outside, port `4` not wired.\n\n        uhubctl -l 1-1 -p 2 -a 0\n\n  * Secondary hub `1-1.1` (daisy-chained to main): 3 ports,\n    port `1` is used for Ethernet+WiFi, and ports `2` and `3` are wired outside.\n\n\n##### Raspberry Pi 4B\n\n \u003e :warning: If your VL805 firmware is older than `00137ad` (check with `sudo rpi-eeprom-update`),\nyou have to [update firmware](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#rpi-eeprom-update)\nto make power switching work on RPi 4B.\n\n  * USB2 hub `1`, 1 port, only connects hub `1-1` below.\n\n  * USB2 hub `1-1`, 4 ports ganged, dual to USB3 hub `2` below:\n\n        uhubctl -l 1-1 -a 0\n\n  * USB3 hub `2`, 4 ports ganged, dual to USB2 hub `1-1` above:\n\n        uhubctl -l 2 -a 0\n\n  * USB2 hub `3`, 1 port, OTG controller. Power switching is [not supported](https://git.io/JUc5Q).\n\n##### Raspberry Pi 5\n\n  Raspberry Pi 5 has two USB2 ports and two USB3 ports (total 4).\nThese ports are connected to 4 distinct USB hubs `1`,`2`,`3`,`4` in really weird configuration\n(but depending on OS and HW revision hubs of interest can be `2`,`3`,`4`,`5`).\nIf USB3 device is connected to blue socket, it will be detected on USB3 hub `2` or `4`.\nIf USB2 device is connected to any socket or USB3 device connected to black socket,\nit will be detected on USB2 hub `1` or `3`.\nRegardless of USB2/USB3 connection type, blue sockets are always port `1`,\nand black sockets are always port `2`.\n\n  Each of 4 USB onboard hubs advertises as supporting per-port power switching, but this is not true.\nIn reality, Raspberry Pi 5 all 4 ports are ganged together in one group,\ndespite belonging to 4 different logical USB hubs.\n\nTo turn off VBUS power it has to be disabled across all onboard hubs and ports with:\n\n   ```\n   uhubctl -l 2 -a 0\n   uhubctl -l 4 -a 0\n   ```\n\nTo turn it back on:\n\n   ```\n   uhubctl -l 2 -a 1\n   uhubctl -l 4 -a 1\n   ```\n\nNote that VBUS power goes down only if all ports are off -\nenabling any single port enables VBUS back for all 4 ports.\n\nNotable projects using uhubctl\n==============================\n| Project                                                  | Description                                             |\n|:---------------------------------------------------------|:--------------------------------------------------------|\n| [Morse code USB light](https://git.io/fj1F4)             | Flash a message in Morse code with USB light            |\n| [Webcam USB light](https://git.io/fj1FB)                 | Turn on/off LED when webcam is turned on/off            |\n| [Cinema Lightbox](https://goo.gl/fjCvkz)                 | Turn on/off Cinema Lightbox from iOS Home app           |\n| [Build Status Light](https://goo.gl/3GA82o)              | Create a build status light in under 10 minutes         |\n| [Buildenlights](https://git.io/fj1FC)                    | GitLab/GitHub project build status as green/red light   |\n| [Weather Station](https://goo.gl/3b1FzC)                 | Reset Weather Station when it freezes                   |\n| [sysmoQMOD](https://tinyurl.com/sysmoQMOD)               | Reset cellular modems when necessary                    |\n| [Smog Sensor](https://tinyurl.com/smogsensor)            | Raspberry Pi based smog sensor power reset              |\n| [Terrible Cluster](https://goo.gl/XjiXFu)                | Power on/off Raspberry Pi cluster nodes as needed       |\n| [Ideal Music Server](https://tinyurl.com/ideal-m-srv)    | Turn off unused USB ports to improve audio quality      |\n| [USB drives with no phantom load](https://goo.gl/qfrmGK) | Power USB drives only when needed to save power         |\n| [USB drive data recovery](https://goo.gl/4MddLr)         | Recover data from failing USB hard drive                |\n| [Control power to 3D printer](https://git.io/fh5Tr)      | OctoPrint web plugin for USB power control              |\n| [USB fan for Raspberry Pi](https://tinyurl.com/fan-rpi)  | Control USB fan to avoid Raspberry Pi overheating       |\n| [Raspberry Pi Reboot Router](https://tinyurl.com/rpi-rtr)| Automatically reboot router if internet isn't working   |\n| [Control USB Lamp With Voice](https://tinyurl.com/usblmp)| Voice Control of USB Lamp using Siri and Raspberry Pi   |\n| [Control USB LED Strip](https://tinyurl.com/usbleds)     | Controlling USB powered LED Light Strip                 |\n| [Brew beer with Raspberry Pi](https://git.io/JtbLd)      | Automated beer brewing system using Raspberry Pi        |\n| [Webcam On-Air Sign](https://tinyurl.com/uonair)         | Automatically light up a sign when webcam is in use     |\n| [Do it yourself PPPS](https://git.io/J3lHs)              | Solder wires in your USB hub to support uhubctl         |\n| [Open source PPPS hub](https://tinyurl.com/yckhystt)     | Open source hardware project for uhubctl compatible hub |\n| [Python Wrapper for uhubctl](https://github.com/nbuchwitz/python3-uhubctl) | Module to use uhubctl with Python     |\n| [labgrid](https://github.com/labgrid-project/labgrid)    | Framework for testing embedded Linux on hardware        |\n| [Thermal Camera](https://tinyurl.com/5asne8hw)           | Turn on/off robot's thermal camera when necessary       |\n\n\nCopyright\n=========\n\nCopyright (C) 2009-2025 Vadim Mikhailov\n\nThis file can be distributed under the terms and conditions of the\nGNU General Public License version 2.\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvp%2Fuhubctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvp%2Fuhubctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvp%2Fuhubctl/lists"}