196 Commits

Author SHA1 Message Date
Vadim Mikhailov
4b2c4c211f Add IBM SK-8815 keyboard as compatible device
Closes #647.
2026-01-16 12:47:18 -08:00
Vadim Mikhailov
da8a260538 Remove Dell Wyse 5070 - does not support vbus off
Closes #646, originally added in #642.
2026-01-16 12:36:50 -08:00
Vadim Mikhailov
a9cd307a4a Add Sipolar A-173 as compatible device
Closes #645.
2026-01-16 12:32:05 -08:00
Vadim Mikhailov
f45034e0d0 Add DLink DUB-2332 as compatible device 2025-12-19 16:50:14 -08:00
Vadim Mikhailov
74ac3e6bc3 Add Dell Wyse 5070 as compatible device 2025-12-19 16:48:52 -08:00
Vadim Mikhailov
1117cc7ce2 Add a note how to install uhubctl from FreeBSD ports
uhubctl is now available in FreeBSD ports collection.
Soon it should be available as a package too,
which will make install even simpler (`pkg install uhubctl`).

Closes #640.
2025-11-10 18:15:15 -08:00
Vadim Mikhailov
65e3b74e60 Add MacBook Air 2010 as compatible device
Closes #638.
2025-11-10 18:01:05 -08:00
Vadim Mikhailov
ceadf4c13a Add a warning for Sugoi USB2-HUB4X
New hw revision of Sugoi USB2-HUB4X does not support per-port power control,
but seems to work with ganged power switching (requires -f).

Closes #636.
2025-10-04 11:54:44 -07:00
Vadim Mikhailov
ad94660713 Add a note for Maplin A08CQ
Only older model with red plastic in USB ports is working correctly.
Per report in issue #635, there are different samples
with white plastic in USB ports which do not support PPPS
and should be avoided.

Closes #635.
2025-09-19 13:14:31 -07:00
Vadim Mikhailov
ca7610ab01 Add Lenovo ThinkPad Mini Dock Series 3 as compatible device
Closes #628.
2025-09-19 13:05:56 -07:00
Vadim Mikhailov
c9edaf3da8 Add a note how to make uhubctl work on MacOS 26 Tahoe
Closes #623.
2025-09-18 10:03:05 -07:00
Shun Hasegawa
9a6e6d3a6d Add note to ReTRY HUB (#631) 2025-09-18 09:39:09 -07:00
Vadim Mikhailov
1af4949ce8 Lenovo USB-C to 4 Port USB-A Hub only works in USB2 mode
This hub only works in USB2 mode, and ports are ganged in a weird way.
Added a note in device table.

Closes #625.
2025-06-13 08:58:25 -07:00
Vadim Mikhailov
5dda8a874b Add hub|usb udev recipe to README as well
Related to #618.
2025-06-06 22:40:54 -07:00
Vadim Mikhailov
786dcb2277 Improve Linux udev rules to support more systems
Some Linux systems detect USB hubs with driver as `hub`, and some as `usb`.
Improve udev permission rules to match both options.

Closes #618.
2025-06-05 21:32:31 -07:00
Vadim Mikhailov
fab805bc12 Add Targus ACH155 as compatible device
Per submitter, Targus ACH155 port 3 turns on/off power on all four ports.

Closes #620.
2025-06-04 23:09:40 -07:00
Vadim Mikhailov
a05a250644 Add Rosonway RSH-ST10C-6 as compatible device
Closes #616.
2025-05-30 23:54:36 -07:00
Vadim Mikhailov
b3fa9e7e63 Improve computer model detection when device tree is not available
Closes #614.
2025-05-30 23:23:04 -07:00
Vadim Mikhailov
fbe812bd83 Add an option to search/limit hub by description
Adding new option to limit hub by description.
Existing -s option limits by attached device description,
and new feature -H limits by hub instead.
Thanks to @pendragonsound for submitting patch!

Closes #611.
2025-04-19 10:35:44 -07:00
Vadim Mikhailov
d96308569c uhubctl is in homebrew core now - remove obsolete files, update readme
* remove custom homebrew tap - uhubctl is included in homebrew core now.
* remove bitbake recipe - it does not seem to be used for years now,
  and it should not have been committed in first place.
* add `installing` paragraph to readme. since most relevant OS include uhubctl
  in standard package managers now, most people don't want to compile it,
  but instead know how to install it quickly.
* update short links to not use bit.ly as it became very spammy now.
* update few expired links to point to archive.org cache.
* add `all` target to Makefile (FreeBSD ports want `all` target to always exist).
2025-04-18 23:13:56 -07:00
Vadim Mikhailov
d85f100c98 homebrew audit: livecheck must be before depends_on 2025-04-17 13:51:05 -07:00
Vadim Mikhailov
65f6d48cd1 homebrew audit one more fix 2025-04-17 13:44:56 -07:00
Vadim Mikhailov
14852054e2 making homebrew audit happy 2025-04-17 13:42:33 -07:00
Vadim Mikhailov
d00a167ab4 homebrew audit insists on checksum before head 2025-04-17 13:35:31 -07:00
Vadim Mikhailov
16001b090d minor fixes to homebrew formula so it passes strict audit checks 2025-04-17 13:28:19 -07:00
Vadim Mikhailov
42cdfb0b82 Fix udev rules to support Linux kernels 6.8+
Linux kernels before had devpath containing `usbN-portM`.
Newer kernels just use `port` symlink instead, which breaks our udev rules.
Changing glob from `*-port*` to `*port*` makes it work for both old and new kernels.

Closes issues #608, #609.
2025-02-23 12:51:49 -08:00
Vadim Mikhailov
c74755be42 Fix FreeBSD build, update docs regarding pkg-config 2025-01-21 19:45:22 -08:00
Vadim Mikhailov
07abf4cbea Fix warnings when compiled in C++ mode
Fixed all warnings when compiling with `c++ -std=c++11 ...`:
* bzero() appears to be deprecated, replaced with memset()
* fixed few const warnings
* suppressed zero array warnings (emitted by libusb headers)
2025-01-21 19:25:50 -08:00
Vadim Mikhailov
d483981f95 Add thermal camera control as notable project
Described in #594.
2025-01-18 14:59:52 -08:00
Vadim Mikhailov
2ca14eb3dd Add Mac Mini M4 as compatible device
Closes #606.
2025-01-18 14:44:59 -08:00
Vadim Mikhailov
40f10578cb Remove Rosonway RSH-A107 (and ikuai A107) from supported list
There are multiple reports that RSH-A107 does not turn off VBUS:
While it is possible that some hardware revisions which are working,
looks like most don't. It is better to remove it from the list.

Closes #604.
2025-01-18 14:32:56 -08:00
Vadim Mikhailov
7604f84c95 Add StarTech HB31C2A2CB as compatible device
Closes #601.
2025-01-18 14:24:32 -08:00
Vadim Mikhailov
f4b0d2ad31 Add RSH-A37S as compatible device
Closes #598.
2025-01-18 14:15:35 -08:00
Vadim Mikhailov
a7df8f8367 Cleanup ifdef usage
* No need to check for both __gnu_linux__ and __linux__, latter is enough.
* Require libusb 1.0.13 to build - this makes LIBUSB_API_VERSION always defined.
* Include `<libusb.h>` not `<libusb-1.0/libusb.h>` - this will always work
  if `pkg-config` is detected. For backwards compatibility still try building
  without `pkg-config` present, but it is much less reliable and will not work on Mac.
* Bump copyright year.
2025-01-18 14:04:34 -08:00
Tormod Volden
a957b21815 Add --sysdev/-y option for direct device node access (#600)
* Add --sysdev/-u option for direct device node access

Only the device specified by the given device path will be accessed,
instead of scanning the USB bus.

Most useful if you use udev rules to create stable device node aliases for hubs,
independent of bus topology.

For instance, if your matching udev rules include SYMLINK+="MYSMARTHUB1"
you can call uhubctl with --sysdev /dev/MYSMARTHUB1 instead of using -l
and a non-stable bus location to specify it.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2025-01-18 11:50:25 -08:00
Vadim Mikhailov
2dbc6ce2d9 Add recipe for compiling on OpenSUSE
Closes #592.
2024-10-15 21:49:00 -07:00
mvp
302b3c0c77 always include <fcntl.h>
4a233824c4 fixed issue for Raspberry Pi on Linux, but broke compilation on Mac.
Fixing it by always including <fcntl.h>.
2024-10-13 13:10:22 -07:00
Vadim Mikhailov
4a233824c4 Add StarTech DKT30CSDHPD3 as compatible device
Closes #588.
2024-09-17 18:09:57 -07:00
Vadim Mikhailov
e0d1c34eed Improve support for Raspberry Pi 4B and 5:
* Detect if we are running on Raspberry 4B or 5
* Add RPi 4B and 5 conditionals for RPi hacks
* Relax some conditions which may vary depending on RPi hardware and/or OS
  (in particular Ubuntu hub numbering differs from Raspbian).
* For RPi5, changed README to suggest using busses 2 and 4 instead of 1 and 3.
  This makes the same recipe work on both Raspbian and Ubuntu.

This fixes #587.
2024-09-16 20:23:33 -07:00
mvp
153c5da267 Fixed snprintf override which breaks on old MacOS
`snprintf` is available in Mac/FreeBSD headers only if _XOPEN_SOURCE is 600 or higher.
This closes #586.
2024-09-12 10:42:23 -07:00
mvp
bfc11e6b05 Remove Buffalo BSH4A05U3BK from supported list
Buffalo BSH4A05U3BK does not seem to support VBUS off, removing from the list.

Closes #584.
2024-08-31 22:29:58 -07:00
mvp
c9abed425c Release version 2.6.0 as stable brew tap 2024-08-31 16:57:18 -07:00
mvp
352f5878e9 Release version 2.6.0 2024-08-31 16:30:35 -07:00
mvp
169842ae97 Improve Linux detection
__gnu_linux__ is not always present on all Linux platforms -
add checking for __linux__ too.
2024-08-31 16:19:59 -07:00
mvp
8de8c9487f Add Philips 346B1C as compatible device
Closes #582.
2024-08-31 16:01:38 -07:00
mvp
3dbc1d9e41 Add Rosonway RSH-A107 (aka ikuai A107) as compatible device
Closes #572.
2024-08-31 15:52:12 -07:00
Misha Bunte
83ce372810 Fix flag to turn on and off 2024-08-16 14:05:14 -07:00
Misha Bunte
f22541cf64 Add flash (inverted cycle) option - turn on and off (#580)
* Add flash (inverted cycle) option - to turn port on then off with a delay
2024-08-13 13:24:09 -07:00
Christian Svensson
2df4681826 Construct root USB device sysfs path
Fixes #578. See issue for discussion.

Signed-off-by: Christian Svensson <blue@cmd.nu>
2024-08-05 12:32:33 -07:00
mvp
359d887927 Fix typo for driver name
Closes #574.
2024-08-04 20:51:41 -07:00
Christian Svensson
1f920f6b15 Fix endian conversions to work for big-endian
Before:
```
Current status for hub 3 [6b1d:0200 Linux 6.1.98 xhci-hcd xHCI Host Controller 0000:01:00.0, USB 0.02, 2 ports, ppps]
  Port 1: 0305 power lowspeed suspend connect [9911:c068 Sierra Wireless, Incorporated MC7304-CP]
  Port 2: 0301 power lowspeed connect [0304:0160 FTDI FT232R USB UART A10OEDEW]
```

After:

```
Current status for hub 1 [1d6b:0002 Linux 6.1.98 ehci_hcd EHCI Host Controller 16f0000000000.ehci, USB 2.00, 2 ports, nops]
  Port 1: 0503 power highspeed enable connect [0424:2240 Generic Ultra Fast Media 000000225001]
  Port 2: 0100 power
Current status for hub 3 [1d6b:0002 Linux 6.1.98 xhci-hcd xHCI Host Controller 0000:01:00.0, USB 2.00, 2 ports, ppps]
  Port 1: 0503 power highspeed enable connect [1199:68c0 Sierra Wireless, Incorporated MC7304-CP]
  Port 2: 0103 power enable connect [0403:6001 FTDI FT232R USB UART A10OEDEW]
```

Tested on both x86-64 and MIPS64.

Signed-off-by: Christian Svensson <blue@cmd.nu>
2024-08-04 19:59:56 -07:00
mvp
746891d888 Add VirtualHere USB3 4-port hub as compatible device
Closes #571.
2024-06-05 16:26:20 -07:00
mvp
83f624f3b5 Removed Plugable USB3-HUB7-81X from supported list
Closes #559.
2024-05-21 11:14:23 -07:00
Hans Märki
61fd83ff10 Add Rosonway A10, and ST07C as compatible device (#567) 2024-05-21 11:06:36 -07:00
Jan Lübbe
cd99f0de34 Add labgrid to README as project using uhubctl (#566)
labgrid uses uhubctl in the USBPowerDriver to control power for boards
connected on switchable USB hubs [1].

[1] https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/powerdriver.py
2024-05-06 00:57:57 -07:00
Vadim Mikhailov
3d804c1ab7 Add support for Raspberry Pi 5
Added hack to support Raspberry Pi 5.
Updated README with recipe how to control power on RPi5.

Closes #547.
2024-04-19 16:08:19 -07:00
Vadim Mikhailov
3e86729800 Add Lenovo USB-C to 4 Port USB-A Hub as compatible device
Closes #561.
2024-04-19 16:06:29 -07:00
Vadim Mikhailov
d556081fbb Add LG 27GL850-B as compatible device
Closes #560.
2024-04-19 16:02:47 -07:00
Vadim Mikhailov
1199b9ddbc Add Targus PA095UZ as compatible device
Closes #558.
2024-04-19 15:59:46 -07:00
Vadim Mikhailov
f70c2ced96 Fix build on Mac
Recent libusb seems to have removed extra symlink `libusb-1.0/libusb.h`,
which breaks build on Mac.

TODO: consider always using `<libusb.h>`, but that would
put hard dependency on `pkg-config` usage.
2024-04-19 15:49:19 -07:00
Vadim Mikhailov
4deae1731c Update README, bump copyright year
* Remove mention of MacOS bug only applicable to old MacOS 12.4 x86
* Simplify docs related to Linux kernel 6.0 fixes
* Bump copyright year
2024-02-20 22:40:28 -08:00
Vadim Mikhailov
5cc9f154e1 Remove Cyberpower CP-H420P from supported list
Removing CP-H420P because it does not seem to support Vbus control.

Closes #557.
2024-02-20 22:08:08 -08:00
mvp
7a0fbd266f Update README.md (#553)
Fix devices sorting order
2024-01-24 11:48:24 -08:00
Nicolai
e18434cd2e Add Revolution Pi to list of supported devices (#552)
Revolution Pi Core and Connect family implement per port power switching
for all USB ports.

Signed-off-by: Nicolai Buchwitz <nb+github@tipi-net.de>
2024-01-24 11:42:36 -08:00
mvp
a34319a6d4 Add Gigabyte G27Q as compatible device
Closes #551.
2024-01-21 17:34:39 -08:00
mvp
d18db0d2be Add Acer BE270U as compatible device
Closes #550.
2024-01-21 17:29:02 -08:00
mvp
f37dcb5cbf Update EOL dates for some hubs
Updated EOL date for B+B SmartWorx USH304 to 2019.
https://www.mouser.com/PCN/Advantech_Corporation_EOL_BB_USH304.pdf.
Updated EOL date for Delock 62537, last available date seems to be 2021.

Closes #528.
2023-10-07 12:53:45 -07:00
mvp
5bb7197f51 Remove Anker AK-A83650A1 from supported list
There are multiple reports in #361 that Anker PowerExpand 6-in-1 USB-C hub
does not support vbus off - removing it from supported list.
2023-09-23 10:36:18 -07:00
mvp
5b2c40db83 Add Sugoi USB2-HUB4X as compatible device
Closes #525.
2023-09-21 20:25:07 -07:00
mvp
0d28753bcf Add Das Keyboard 4 as compatible device
Closes #522.
2023-09-21 20:12:35 -07:00
mvp
54ab9e72d4 Add Dell Wyse 3040 as compatible device
Dell Wyse 3040 is odd - it has 6 ports advertised on USB2 and 7 ports on USB3,
and both USB2+USB3 do not advertise power switching support.
However, using -f it seems that power switching does work.
I assume it needs separate control for USB2+USB3 using -e as well.

Closes #512.
2023-07-30 16:26:33 -07:00
mvp
b16ba1b36d Add Coolgear USBG-12U2ML as compatible device
Closes #514.
2023-07-17 22:40:50 -07:00
mvp
30372ce59f Add open source hardware hub design based on CH335F to notable projects
Closes #516.
2023-07-17 21:13:50 -07:00
Vadim Mikhailov
a9f2e7832d Use another URL shortener, GFM relative links do not seem to work correctly 2023-05-23 13:58:27 -07:00
Vadim Mikhailov
cec0435144 Use different issue linking method 2023-05-23 13:54:09 -07:00
Vadim Mikhailov
586b424557 Fix issue relative link 2023-05-23 13:50:24 -07:00
Vadim Mikhailov
1d3b841429 Add a warning link for StarTech HB30A4AIB different batch
Add a warning link for StarTech HB30A4AIB - new hardware is using
different USB chipset and different USB vid:pid,
which does not support power switching correctly.

Closes #509.
2023-05-23 13:39:04 -07:00
Vadim Mikhailov
2f45ac6138 Add Microchip EVB9512 as compatible device
Closes #505.
2023-05-02 11:55:33 -07:00
Vadim Mikhailov
4c235868eb Remove ExSys EX-1113HMS from supported list
ExSys EX-1113HMS was tested to not support turning VBUS off.
Remove from supported list.

Closes #502.
2023-04-05 22:46:29 -07:00
Vadim Mikhailov
33f1ecb2dd Add explicit void prototypes to make modern compilers happy 2023-03-31 14:44:54 -07:00
Vadim Mikhailov
8f355837b7 Add StarTech HB30A4AIB as compatible device
Closes #497.
2023-03-31 14:37:43 -07:00
Vadim Mikhailov
f2d97a3aad Add Belkin F5U238UKCRL-MOB as compatible device
Closes #492.
2023-02-13 21:31:06 -08:00
Vadim Mikhailov
e847dc461d Revert "Fixed brew sha256 for v2.5.0.tar.gz"
This reverts commit 61fd84b0ad.

It should fix issue #490.
2023-01-31 16:08:06 -08:00
Vadim Mikhailov
61fd84b0ad Fixed brew sha256 for v2.5.0.tar.gz
This used to work fine, perhaps something has changed in how Github
creates archives so archive checksum does not match anymore?
Confirmed that actual file content at https://github.com/mvp/uhubctl/archive/v2.5.0.tar.gz
is exactly the same as content for `git checkout v2.5.0`.
Updated checksum to expected value so `brew install uhubctl` should pass.
Closes #489.
2023-01-30 14:53:36 -08:00
Vadim Mikhailov
a54835e0ea Add Asus Z77 Sabertooth motherboard as compatible device
Closes #486.
2023-01-27 11:26:29 -08:00
Vadim Mikhailov
41e1bacf41 Bump copyright year 2023-01-27 11:23:08 -08:00
mvp
2be4125977 Add LG Electronics 27UN83A-W monitor as compatible device
Closes #482.
2023-01-04 20:48:47 -08:00
mvp
2ef5f0eb0b Fixed udev rule example to use DRIVER="usb"
It seems that DRIVER="hub" almost never works,
but DRIVER="hub" always does.
2023-01-04 20:37:58 -08:00
mvp
19dfdad7f6 Fix device table specs for some hubs incorrectly listed as USB 3.1
This is additional fix for #447.

We use old convention for USB versions in device table:

USB 3.2 spec version | Max speed | Old style USB version
---------------------+-----------+----------------------
USB 3.2 Gen 1	     |  5 gbps   | USB 3.0
USB 3.2 Gen 2        | 10 gbps   | USB 3.1
USB 3.2 Gen 2x2      | 20 gbps   | USB 3.2

All affected hubs were USB 3.2 Gen 1, which corresponds to original USB 3.0.
2022-11-02 20:24:10 -07:00
mvp
ce2fd9a419 Release version 2.5.0 as stable brew tap 2022-11-01 20:49:11 -07:00
mvp
20276ad5ce Release version 2.5.0 2022-11-01 20:26:08 -07:00
mvp
914060b4b5 Add simpler way to configure udev rules and ready to use udev rule file
It turns out that we can allow udev access to any USB hub using DRIVER=="hub"
udev filter, this should make it easier for linux ditros to add proper udev rules.

This change adds more documentation to README, and also adds ready to use udev rule
that should work for any USB hub and any Linux kernel version.
2022-11-01 20:19:00 -07:00
gfrancesco
5a46019e15 ADD: BenQ PD3220U monitor to compatibility list (#464) 2022-10-26 22:55:09 -07:00
Vadim Mikhailov
b6189d1409 Consistently use only C style comments 2022-10-05 12:04:56 -07:00
Vadim Mikhailov
554a5c7eb3 Note that PR #450 has fixed few annoyances listed in FAQ 2022-09-22 16:22:09 -07:00
Vadim Mikhailov
732ad2d90e Fix crash on non-Linux if -S is used
Also move short options near long options table so it is easier to maintain.
2022-09-22 11:24:32 -07:00
Vadim Mikhailov
dd5ff8f79d Fix unused variable compilation warning on non Linux platforms 2022-09-22 11:09:24 -07:00
mvp
a802fa75aa Merge pull request #450 from hnez/linux-sysfs
Use sysfs interface on recent Linux kernels
2022-09-22 11:05:23 -07:00
Leonard Göhrs
24e1540006 Add udev rules for Linux sysfs power switching to README.md
The udev rules for the sysfs case are a bit more complex than those for the
libusb based interface, as udev has built-in support for changing permissions
on device files but not for sysfs attributes.
Instead we have to use chmod / chown to set permissions and owners.

You may notice the " || true" parts in the RUN part of the rules in addition
to the -f parameters. These are there to make sure that no error is logged by
udev even if the disable attribute does not exist. chmod/chown still return
an error exit code even with -f if the requested path does not exist.
" || true" makes sure this error is not propagated to udev.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
2022-09-22 11:40:03 +02:00
Leonard Göhrs
aa7fc0a126 Add support for Linux sysfs based power switching
Starting with Linux kernel 6.0[1] there will be a sysfs interface to power USB
ports off/on from userspace.
Try to use this interface before falling back to the usual libusb based
power switching (e.g. when running on a kernel <6.0 or if file permissions do
not allow using the sysfs interface).

The main benefit of using the sysfs interface is that the kernel does not get
confused about the state of a port, so retrying should no longer be required.

[1]: https://lore.kernel.org/all/20220607114522.3359148-1-m.grzeschik@pengutronix.de/

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
2022-09-22 11:40:03 +02:00
Vadim Mikhailov
7099809b24 Add Apple Pro Display XDR as compatible device
Closes #453.
2022-09-06 18:03:10 -07:00
mvp
a1bc86824b Add Inateck HB2025A as compatible device
This works only if connected via USB2.

Closes #451.
2022-09-05 10:46:29 -07:00
Leonard Göhrs
9d66811175 Split out port status setting logic into separate function
Split out current libusb based power on/off logic into a separate function
in anticipation of a other power switching implementations.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
2022-09-02 12:28:04 +02:00
Vadim Mikhailov
9171fc6bad Fix description for j5create JUH470 quirks 2022-09-01 22:35:15 -07:00
Vadim Mikhailov
d75b10d696 Fixed USB version for few supported devices to match their spec
Per USB 3.2 spec, any USB 3.x device can claim itself as USB 3.2 per following table:

| Old style USB version | USB 3.2 specification | Speed, gbps |
|-----------------------|-----------------------|-------------|
| USB 3.0               | USB 3.2 Gen 1         | 5           |
| USB 3.1               | USB 3.2 Gen 2         | 10          |
| USB 3.2               | USB 3.2 Gen 2x2       | 20          |

https://www.usb.org/sites/default/files/usb_3_2_language_product_and_packaging_guidelines_final.pdf

And this is what happens - some devices claim themselves to be USB 3.2 despite only supporting 5 or 10 gbps -
and unfortunately this is correct per USB 3.2 spec. But it is very confusing for people shopping for better product.

Not ideal solution, but a workaround is to use old style USB version designators in our compatibility table
so people do not choose USB 3.2 device listed if it cannot support speeds higher than 5 gbps.

Closes #447.
2022-08-31 15:58:13 -07:00
Tim Ruffing
88e5641fe1 Make sure option strings are null-terminated 2022-08-24 15:59:01 -07:00
Nicolai
b51b5addee Add python3-uhubctl to project list
Add python3-uhubctl to project list
2022-08-24 12:04:15 -07:00
Vadim Mikhailov
a76f45f377 Remove D-Link DUB-H4 rev B from the list
D-Link DUB-H4 rev B does not seem to support VBUS off, remove from supported list.
Closes #440.
2022-08-24 12:02:24 -07:00
mvp
941e356c24 Add HP USB-C Dock G5 as compatible device
Closes #441.
2022-08-22 14:58:56 -07:00
Vadim Mikhailov
e1e4d45066 Add Rosonway RSH-A13 as compatible device
This works only if connected via USB2.

Closes #434.
2022-08-05 11:03:34 -07:00
Vadim Mikhailov
9263ab266e Add Dell U3419W as compatible device
Closes #435.
2022-08-02 09:38:58 -07:00
Vadim Mikhailov
54248b8f29 Note that issue #419 is fixed in MacOS 12.5
Closes #419.
2022-07-20 16:47:09 -07:00
Vadim Mikhailov
06e7240db6 Add Seeed Studio reTerminal CM4104032 as compatible device
Closes #429.
2022-07-12 15:57:28 -07:00
Vadim Mikhailov
e1709c7b62 Add a note for AmazonBasics HU9002V1EBL
Closes #428.
2022-07-12 15:51:48 -07:00
Vadim Mikhailov
38ff03200d Add Rosonway RSH-A13 as compatible device (with some caveats)
Closes #423.
2022-07-01 17:17:45 -07:00
Vadim Mikhailov
24e3680c4b Add a warning that libusb (and uhubctl) are broken on MacOS 12.4 and later
Highlight issue #419 and https://github.com/libusb/libusb/issues/1156.
2022-06-20 11:56:44 -07:00
Vadim Mikhailov
5418edf9d1 Add a warning link that RSHTech RSH-A16 may not work
Rosonway RSH-A16 works, while RSHTech RSH-A16 may not.
Closes #417.
2022-06-17 17:55:52 -07:00
Vadim Mikhailov
a6159d68e7 Add NVidia Jetson Xavier NX as compatible device
Closes #420.
2022-05-27 13:24:16 -07:00
Vadim Mikhailov
ee98e43a43 Update copyright year 2022-05-10 18:13:08 -07:00
Vadim Mikhailov
4f38fde9da Add LG Electronics 27UK850-W monitor as compatible device
Closes #414.
2022-05-10 18:11:25 -07:00
Vadim Mikhailov
a022e60112 Add Lenovo ThinkPlus 4X90W86497 as compatible device
Closes #414.
2022-05-10 18:04:25 -07:00
Vadim Mikhailov
a0f8c87e08 Add Rosonway RSH-518C as compatible device
Closes #407.
2022-05-10 16:25:22 -07:00
Vadim Mikhailov
6f1c71d5a5 Add j5create JUH377 as compatible device
Closes #406.
2022-03-07 10:25:19 -08:00
Vadim Mikhailov
7496d53f87 Add a note for Cypress CY4608 HX2VL
Closes #404.
2022-03-07 10:10:33 -08:00
Vadim Mikhailov
56ea37fc46 Add a warning that some revisions of Bytecc BT-UH340 may not work
Closes #401.
2022-02-28 15:41:08 -08:00
Vadim Mikhailov
ed27158c11 Add Lenovo T24i-10 as compatible device
Closes #384.
2022-02-02 20:22:07 -08:00
Vadim Mikhailov
53fd1f39ce Remove StarTech ST4300USB3 from compatible list, does not seem to properly support VBUS off
Closes #390.
2022-02-01 17:16:22 -08:00
Vadim Mikhailov
950fce2325 Add Centech CT-USB4HUB as compatible device
Closes #393.
2022-02-01 17:13:50 -08:00
Mark Furland
61187d755c Add pluggable USB3-HUB7BC; note USB3-HUB7-81x is 2 port only
Closes #378.
2021-12-17 13:10:32 -08:00
Vadim Mikhailov
610e85ff2d Add StarTech ST4300USB3 as compatible device
Closes #376.
2021-11-29 11:22:47 -08:00
Vadim Mikhailov
5779054ccc Add a note about D-Link DUB-H7 rev. G not supported
Closes #377.
2021-11-29 11:16:41 -08:00
Vadim Mikhailov
f8cb89f4be Add option --nodesc to skip querying device string descriptors
Sometimes target devices may become unresponsive for control messages to read string descriptors.
Option --nodesc (-N) allows to still reset such devices.

Also, as preventative measure, check if libusb_get_string_descriptor_ascii returns any error,
then stop querying any other string descriptor from the same device.
2021-10-29 11:49:59 -07:00
Vadim Mikhailov
1a7d34780f Add Microchip EVB-USB5807 as compatible device
Closes #369.
2021-10-20 16:56:31 -07:00
Vadim Mikhailov
f6e99bc35d Add HP P5Q58UT and LG 27MD5KL-B as compatible devices
Adding two devices reported by @alanzchen in #366.
2021-10-18 22:20:00 -07:00
Vadim Mikhailov
db3ae900d8 Add BenQ PD2700U as compatible device
Closes #362.
2021-09-28 19:15:13 -07:00
Vadim Mikhailov
75b1f668f9 Add Anker AK-A83650A1 as compatible device
Closes #361.
2021-09-28 19:15:08 -07:00
Vadim Mikhailov
37f494ff31 Update UUGear MEGA4 info 2021-08-12 13:33:05 -07:00
Vadim Mikhailov
bc80baa9e9 Add UUGear MEGA4 as compatible device
Add UUGear MEGA4 USB 3.1 PPPS hub for Raspberry PI 4B to supported list,
it was specifically designed to support uhubctl in #316.
https://www.uugear.com/news/new-product-mega4-usb-3-1-ppps-hub-for-raspberry-pi-4
2021-08-09 09:57:41 -07:00
Vadim Mikhailov
6cd357e150 Remove UNITEK Y-3098ABK from supported list
Too many reports in #352 stating it is not supporting VBUS.
2021-08-09 09:32:34 -07:00
Vadim Mikhailov
5ba647ee27 Add Unitek Y-3098ABK as compatible device
Closes #352.
2021-07-07 13:26:55 -07:00
Vadim Mikhailov
69c444b75d Add Hardkernel ODROID-C4 as compatible device
Closes #348.
2021-05-31 20:31:10 -07:00
Vadim Mikhailov
f20007e25e Add Delock 62537 as compatible device
Closes #346.
2021-05-17 22:08:47 -07:00
Vadim Mikhailov
46d0de4331 Re-add Delock 87445 to supported list
It seems to work after all (originally reported in #107, then removed in #123).
It looks like there are different hardware revisions, some work well, some are not detected - added a note.
2021-05-17 22:04:11 -07:00
Vadim Mikhailov
23c15ffcf8 Add diyppps to notable projects
Closes #343.
2021-05-01 22:13:32 -07:00
Vadim Mikhailov
16f7a6dd23 Add AmazonBasics HUC9002V1ESL as compatible device
AmazonBasics HUC900xxx models seem to be identical to HU900xxx except for included USB-C cable.
2021-05-01 22:05:42 -07:00
Vadim Mikhailov
7bafc7ffb3 Add a note for Linksys USB2HUB4
Closes #331.
2021-04-02 14:27:53 -07:00
Vadim Mikhailov
0a42b91382 Add Webcam On-Air Sign to notable projects 2021-04-01 09:42:04 -07:00
Vadim Mikhailov
2820f9fa27 DLink DUB-H4 rev B4 does not work
Closes #328.
2021-03-29 15:48:24 -07:00
Vadim Mikhailov
fb85325629 Add AmazonBasics U3-7HUB as supported device
AmazonBasics U3-7HUB power switching works, but only on 1 charge port with lightning symbol.
This should also work for similar AmazonBasics hubs U3-4HUB and U3-10HUB.

Closes #325.
2021-03-18 17:02:38 -07:00
Vadim Mikhailov
e5ae7b9906 Add Plugable USB3-HUB10-C2 as supported device
Plugable USB3-HUB10-C2 power switching works, but only on 2 charge ports.
This is also true for USB3-HUB7C, updated note accordingly.

Closes #322.
2021-03-05 12:55:00 -08:00
Vadim Mikhailov
bf3971423a Add Autobrew to list of notable projects 2021-03-05 12:46:04 -08:00
Vadim Mikhailov
7757db54ac Release version 2.4.0 as stable brew tap 2021-02-13 16:48:24 -08:00
Vadim Mikhailov
014b55ac5d Release version 2.4.0 2021-02-13 16:21:16 -08:00
Vadim Mikhailov
92736a8604 Honor PKG_CONFIG variable if exists
Some build systems want to pass location for pkg-config.

Closes #315.
2021-02-11 17:48:11 -08:00
Vadim Mikhailov
9f1de74523 Clarify that we do not maintain list of unsupported hubs
Closes #312.
2021-02-05 15:40:21 -08:00
Vadim Mikhailov
9b73c8e314 Note that PAUH212 is also supported
Closes #311.
2021-02-05 15:32:05 -08:00
Vadim Mikhailov
fa449eac0b Add a note that D-Link DUB-H4 rev B7+ is not supported
Closes #307.
2021-01-21 13:16:46 -08:00
Vadim Mikhailov
9b5efa0ec0 Simplify code that powers on/off
* Simplified code that powers on/off.
* Fixed minor bug for repeat counter (always once to power off, and opt_repeat times to power on).
* Only warn about USB permissions if no compatible hubs are detected.
  Old behavior would always warn, even if permissions were missing for any hub (even unsupported ones).
2021-01-17 14:34:11 -08:00
comzine
b99a0805bb Added feature toggle mode (#305)
Added feature toggle mode

Co-authored-by: Tobias Weber <comzine@gmail.com>
2021-01-17 11:28:44 -08:00
Vadim Mikhailov
6ac502a07a Add ExSys EX-1113HMS as compatible device
Closes #303.
2021-01-15 09:28:02 -08:00
Vadim Mikhailov
f76dc98653 Refactor README section for Raspberry Pi
Move workaround closer to the question context.
2020-12-16 09:04:26 -08:00
Vadim Mikhailov
592d60b9ab Add a note to Anker AK-68ANHUB-BV7A-0004
Closes #300.
2020-12-16 08:49:30 -08:00
Vadim Mikhailov
4b663f3d15 Add Aukey CB-C59 as compatible device
Closes #299.
2020-12-15 11:43:05 -08:00
Vadim Mikhailov
6a43ea9c5c Add Controlling USB LED Strip to notable projects 2020-12-14 11:30:39 -08:00
Vadim Mikhailov
6f136f17fe Add Port NWUSB01 as compatible device
Closes #298.
2020-12-14 11:23:29 -08:00
Vadim Mikhailov
8d8b66c5c6 Release version 2.3.0 as stable brew tap 2020-12-13 14:56:43 -08:00
Vadim Mikhailov
1b52efddbd Release version 2.3.0 2020-12-13 14:31:05 -08:00
Vadim Mikhailov
71a4274615 Print uhubctl version as last item in --help output 2020-12-13 13:08:32 -08:00
Vadim Mikhailov
d98e6deb6e README clarifications
* Clarify how to build and install
* Clarify USB permissions
* Mention force flag -f
2020-12-13 12:53:28 -08:00
Vadim Mikhailov
ac5a704449 Fix homebrew formula
* Document installing from stable version by default.
* Automatically install pkg-config which benefits getting proper CFLAGS/LDFLAGS.
* Specify license field.
2020-12-11 00:53:40 -08:00
Vadim Mikhailov
1e65ff9b05 Remove MacOS libusb workaround
Now that libusb-1.0.24 is released https://github.com/libusb/libusb/issues/618,
workaround is no longer needed.

Also, replace MacOS X references to just MacOS (since it works on MacOS 11 Big Sur too).

This finally fixes issue #227.
2020-12-10 15:32:44 -08:00
Vadim Mikhailov
77aeb7f30b Implement searching by device description
Add switch --search (-s) to limit hubs by attached device description.
It is recommended to specify search string that is as unique as possible, e.g. device serial number.
It should work for "off" and "cycle" actions, but not for "on" because device would not be visible on USB.

Closes #209.
2020-12-08 18:40:13 -08:00
Vadim Mikhailov
e65d077712 Do not allow just commit id to be used as version
Homebrew is forcing `--no-tags` for cloned repos.
Because we used `git describe --always` brew was choosing raw commit id as version, which is quite bad.
By removing `--always` we will use contents of VERSION file as a backup.
2020-12-08 15:24:41 -08:00
Vadim Mikhailov
0cc09299fe Add a switch to allow operation on unsupported hubs
Show power switching type supported by a hub:

* ppps   - per-port power switching
* ganged - ganged power switching
* nops   - no power switching

Add --force (-f) switch to allow operation on non-ppps hubs.
Use `-f` at your own risk, this most likely will not work to actually switch power.

For ganged hubs, you may need to turn power off for all hub ports to get any effect.
For nops hubs, it is not likely to work at all, but might be useful for informational purposes.

Also, instead of printing recipe on how to fix USB permissions on Linux,
forward user to web page with detailed explanations.

Closes #260, #280.
2020-12-07 18:43:22 -08:00
Vadim Mikhailov
44f963d00f Improve USB2/3 duality matching
Use priority based duality matching.

* Support Raspberry Pi 4B better (as it has USB2 hub one level deeper than its USB3 counterpart).
* Support M1 Macs (as they seem to place all USB devices to bus 2).
* Support Apple mini-dock (it advertises 2 USB2 ports but only 1 USB3 port).
* Should support multiple identical hubs (with the same container id) on Linux.
2020-12-07 11:32:29 -08:00
Vadim Mikhailov
d3a79ace46 Use pkg-config when available
Remove custom handling for different platforms for CFLAGS and LDFLAGS
and prefer using pkg-config when available.
However, this is tested to still build ok on Linux on Mac howebrew
even if pkg-config is not available.

Closes #292, should also simplify issues raised by #142, #147, #289 and 5db248771e.
2020-12-05 21:24:17 -08:00
Vadim Mikhailov
0e733b6901 Add a note that D-Link DUB-H7 rev F is not supported
Closes #291.
2020-12-01 11:37:07 -08:00
Vadim Mikhailov
50d5501d91 Clarify how to configure udev permissions for USB3 hubs 2020-11-27 11:07:36 -08:00
Jim Klimov
9183aef17e Makefile: add support for "SunOS" (e.g. with modern illumos) 2020-11-26 14:56:16 -08:00
Vadim Mikhailov
4b10fdbd24 Add Anker AK-68ANHUB-BV7A-0004 as supported device
Closes #287.
2020-11-25 09:12:04 -08:00
Julius Henke
3cc17baae1 Add Dell S2719DGF to compatible hubs list 2020-11-24 12:09:22 -08:00
Vadim Mikhailov
db8c4a59f3 Document another workaround for getting working libusb on MacOS
Previous workaround of getting working `libusb` on MacOS is no longer supported by Homebrew,
so now recommended fix is to install `libusb` from HEAD.

This workaround will be removed once libusb 1.0.24 is released and is provided by Homebrew by default.
2020-11-11 12:35:59 -08:00
Vadim Mikhailov
77d8851c34 Add Microchip EVB-USB2534BC as supported device
Closes #277.
2020-11-01 10:39:34 -08:00
Vadim Mikhailov
dcb1e611f7 Add Rosonway RSH-16 as compatible device
This hub is built from 5 * 4-port USB chips in daisy chain. Unfortunately, it advertises
identical bos container IDs for all 5 hubs of them, which will cause issues controlling power in USB3 mode -
one would have to call uhubctl twice with `-e` to turn off both USB2 and USB3 hub pair ports properly.

Rosonway also sells this hub under RSHTECH brand in some markets.

Closes #276.
2020-10-23 10:44:06 -07:00
Vadim Mikhailov
a7b5f6b362 Add a note about USB authorization on Linux 2020-10-06 10:54:08 -07:00
Vadim Mikhailov
2a4df4ee6c Warn about possible incompatibility for Dell P2416D 2020-10-06 10:53:57 -07:00
Vadim Mikhailov
f610598227 Fixed accidentally dropped AmazonBasics HUC9002V1ESL
Also split HU900* and HUC900* items to two separate lines to avoid table becoming too wide.
2020-09-14 23:35:18 -07:00
Vadim Mikhailov
3bc22e3cd7 Clarify RPi4B support for USB-C OTG port
Closes #266.
2020-09-09 12:10:17 -07:00
Vadim Mikhailov
0f6218dfb8 Add AmazonBasics HUC9003V1EBL 7-port USB 3.1 hub as supported device
Closes #261.
2020-08-11 20:48:36 -07:00
Vadim Mikhailov
91035987e4 Mention that D-Link DUB-H4 rev F is not supported
Closes #259.
2020-08-05 15:22:25 -07:00
Vadim Mikhailov
c6927085ec Add NVidia Jetson Nano B01 as supported device
Closes #258.
2020-08-01 01:24:40 -07:00
Vadim Mikhailov
5b1ae79b05 Clarify RPi4B firmware requirement and checking current version
Firmware VL805 00137ac was an alpha verson that was never released.
Change firmware requirement to stable version VL805 00137ad,
and provide easy way to check if it is compliant.
2020-07-25 13:34:43 -07:00
Vadim Mikhailov
b8a1b808e7 Remove StarTech ST4200USBM from supported table
There are multiple reports that VBUS off is not supported by ST4200USBM.
Closes #254.
2020-07-06 11:07:26 -07:00
Vadim Mikhailov
f75bda6896 Removed Belkin F5U701-BLK from supported devices list
Unfortunately, F5U701-BLK does not support per-port power switching, as reported in #252.
2020-06-29 18:15:17 -07:00
Vadim Mikhailov
e171813596 Update device table for AmazonBasics 10 port hub HU[C]9002V1{SBL,ESL}
Apparently all following hubs: HU9002V1SBL, HU9002V1ESL, HUC9002V1SBL, HUC9002V1EBL
are almost the same, with C models including USB-C cable.
Update device table to reflect this.

Closes #246.
2020-06-25 13:25:48 -07:00
Vadim Mikhailov
5257d8567d Add D-Link DUB-H7 rev E as supported device
Closes #244.
2020-06-17 16:34:57 -07:00
9 changed files with 845 additions and 301 deletions

7
.gitignore vendored
View File

@@ -6,3 +6,10 @@ uhubctl
# Mac symbols
*.dSYM
# Patches
*.patch
*.diff
# IDE config dirs
.*/

View File

@@ -1,16 +0,0 @@
class Uhubctl < Formula
desc "control USB hubs powering per-port"
homepage "https://github.com/mvp/uhubctl"
head "https://github.com/mvp/uhubctl.git"
depends_on "libusb"
def install
system "make"
bin.install "uhubctl"
end
test do
system "#{bin}/uhubctl", "-v"
end
end

View File

@@ -1,6 +1,6 @@
uhubctl USB hub per-port power control.
Copyright (c) 2009-2020, Vadim Mikhailov
Copyright (c) 2009-2025, Vadim Mikhailov
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -10,40 +10,38 @@ INSTALL := install
INSTALL_DIR := $(INSTALL) -m 755 -d
INSTALL_PROGRAM := $(INSTALL) -m 755
RM := rm -rf
PKG_CONFIG ?= pkg-config
CC ?= gcc
CFLAGS ?= -g -O0
CFLAGS += -Wall -Wextra -std=c99 -pedantic
GIT_VERSION := $(shell git describe --match "v[0-9]*" --abbrev=8 --dirty --always --tags | cut -c2-)
CFLAGS += -Wall -Wextra -Wno-zero-length-array -std=c99 -pedantic
GIT_VERSION := $(shell git describe --match "v[0-9]*" --abbrev=8 --dirty --tags | cut -c2-)
ifeq ($(GIT_VERSION),)
GIT_VERSION := $(shell cat VERSION)
GIT_VERSION := $(shell cat VERSION)
endif
CFLAGS += -DPROGRAM_VERSION=\"$(GIT_VERSION)\"
# Use hardening options on Linux
ifeq ($(UNAME_S),Linux)
LDFLAGS += -Wl,-zrelro,-znow -lusb-1.0
LDFLAGS += -Wl,-zrelro,-znow
endif
ifeq ($(UNAME_S),Darwin)
ifneq ($(wildcard /opt/local/include),)
# MacPorts
CFLAGS += -I/opt/local/include
LDFLAGS += -L/opt/local/lib
endif
# Use pkg-config if available
ifneq (,$(shell which $(PKG_CONFIG)))
CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libusb-1.0)
else
# But it should still build even if pkg-config is not available
CFLAGS += -I/usr/include/libusb-1.0
LDFLAGS += -lusb-1.0
endif
ifeq ($(UNAME_S),FreeBSD)
LDFLAGS += -lusb
endif
ifeq ($(UNAME_S),NetBSD)
CFLAGS += $(shell pkg-config --cflags libusb-1.0)
LDFLAGS += $(shell pkg-config --libs libusb-1.0)
endif
PROGRAM = uhubctl
.PHONY: all install clean
all: $(PROGRAM)
$(PROGRAM): $(PROGRAM).c
$(CC) $(CPPFLAGS) $(CFLAGS) $@.c -o $@ $(LDFLAGS)

324
README.md
View File

@@ -11,69 +11,130 @@ https://www.gniibe.org/development/ac-power-control-by-USB-hub
Compatible USB hubs
===================
Note that very few hubs actually support per-port power switching.
Note that not many USB hubs correctly support per-port power switching.
Some of them are no longer manufactured and can be hard to find.
This is list of known compatible USB hubs:
| Manufacturer | Product | Ports | USB | VID:PID | Release | EOL |
|:-------------------|:-----------------------------------------------------|:------|:----|:----------|:--------|:-----|
| Acer | BE270U monitor ([see](https://tinyurl.com/acer550)) | 4 | 3.0 |`2109:2811`| 2016 | |
| AmazonBasics | HU3641V1 ([RPi issue](https://goo.gl/CLt46M)) | 4 | 3.0 |`2109:2811`| 2013 | |
| AmazonBasics | HU3770V1 ([RPi issue](https://goo.gl/CLt46M)) | 7 | 3.0 |`2109:2811`| 2013 | |
| AmazonBasics | HU9002V1SBL ([RPi issue](https://goo.gl/CLt46M)) | 10 | 3.1 |`2109:2817`| 2018 | |
| AmazonBasics | HUC9002V1ESL ([RPi issue](https://goo.gl/CLt46M)) | 10 | 3.1 |`2109:2817`| 2018 | |
| AmazonBasics | HU9003V1EBL, HUC9003V1EBL | 7 | 3.1 |`2109:2817`| 2018 | |
| AmazonBasics | HU9002V1SBL, HU9002V1EBL, HU9002V1ESL ([note](https://tinyurl.com/HU9002)) | 10 | 3.1 |`2109:2817`| 2018 | |
| AmazonBasics | HUC9002V1SBL, HUC9002V1EBL, HUC9002V1ESL | 10 | 3.1 |`2109:2817`| 2018 | |
| AmazonBasics | U3-7HUB (only works for 1 charge port) | 7 | 3.0 |`2109:2813`| 2020 | |
| Anker | AK-68ANHUB-BV7A-0004 ([note](https://git.io/JLnZb)) | 7 | 3.0 |`2109:0812`| 2014 | |
| Apple | Mac Mini M4 (2 front ports only) | 2 | 3.2 |`05AC:800B`| 2024 | |
| Apple | MacBook Air (Late 2010) | 2 | 2.0 |`1D6B:0002`| 2010 | 2020 |
| Apple | Pro Display XDR MWPE2LL/A (internal USB hub) | 4 | 2.0 |`05AC:9139`| 2019 | |
| Apple | Thunderbolt Display 27" (internal USB hub) | 6 | 2.0 | | 2011 | 2016 |
| Apple | USB Keyboard With Numeric Pad (internal USB hub) | 3 | 2.0 | | 2011 | |
| Asus | Z77 Sabertooth Motherboard (onboard USB hub) | 6 | 2.0 | | 2012 | |
| Asus | Z87-PLUS Motherboard (onboard USB hub) | 4 | 3.0 | | 2013 | 2016 |
| Aukey | CB-C59 | 4 | 3.0 |`2109:2813`| 2017 | |
| B+B SmartWorx | UHR204 | 4 | 2.0 |`0856:DB00`| 2013 | |
| B+B SmartWorx | USH304 | 4 | 3.0 |`04B4:6506`| 2017 | |
| B+B SmartWorx | USH304 | 4 | 3.0 |`04B4:6506`| 2017 | 2019 |
| Basler | 2000036234 | 4 | 3.0 |`0451:8046`| 2016 | |
| Belkin | F5U101 | 4 | 2.0 |`0451:2046`| 2005 | 2010 |
| Belkin | F5U701-BLK | 7 | 2.0 | | 2008 | 2012 |
| Buffalo | BSH4A05U3BK | 4 | 3.0 |`05E3:0610`| 2015 | |
| Bytecc | BT-UH340 | 4 | 3.0 |`2109:8110`| 2010 | |
| Belkin | F5U238UKCRL-MOB | 4 | 2.0 |`0409:0059`| 2004 | 2010 |
| BenQ | PD2700U 4K Monitor (works only in USB2 mode) | 4 | 3.0 |`05E3:0610`| 2018 | |
| BenQ | PD3220U | 4 | 3.1 |`05E3:0610`| 2019 | |
| Bytecc | BT-UH340 ([warning](https://tinyurl.com/BT-UH340-1)) | 4 | 3.0 |`2109:8110`| 2010 | |
| Centech | CT-USB4HUB ReTRY HUB ([note](https://github.com/mvp/uhubctl/issues/630)) | 4 | 3.0 |`0424:2744`| 2017 | |
| Circuitco | Beagleboard-xM (internal USB hub) | 4 | 2.0 |`0424:9514`| 2010 | |
| Club3D | CSV-3242HD Dual Display Docking Station | 4 | 3.0 |`2109:2811`| 2015 | |
| CyberPower | CP-H420P | 4 | 2.0 |`0409:0059`| 2004 | |
| Cypress | CY4608 HX2VL development kit | 4 | 2.0 |`04B4:6570`| 2012 | |
| D-Link | DUB-H4 rev B (silver) | 4 | 2.0 |`05E3:0605`| 2005 | 2010 |
| D-Link | DUB-H4 rev D,E (black). Note: rev A,C not supported | 4 | 2.0 |`05E3:0608`| 2012 | |
| Coolgear | USBG-12U2ML | 12 | 2.0 |`05e3:0607`| 2015 | |
| Cypress | CY4608 HX2VL ([note](https://tinyurl.com/CY4608-1)) | 4 | 2.0 |`04B4:6570`| 2012 | |
| D-Link | DUB-2332 rev A1 | 3 | 3.0 | | 2022 | |
| D-Link | DUB-H4 rev D,E (black). Note: rev A,C,F not supported| 4 | 2.0 |`05E3:0608`| 2012 | |
| D-Link | DUB-H7 rev A (silver) | 7 | 2.0 |`2001:F103`| 2005 | 2010 |
| D-Link | DUB-H7 rev D (black). Note: rev B,C not supported | 7 | 2.0 |`05E3:0608`| 2012 | |
| Dell | P2416D 24" QHD Monitor | 4 | 2.0 | | 2017 | |
| D-Link | DUB-H7 rev D,E (black). Rev B,C,F,G not supported | 7 | 2.0 |`05E3:0608`| 2012 | |
| Dell | P2416D 24" QHD Monitor ([note](https://git.io/JUAu8))| 4 | 2.0 | | 2017 | |
| Dell | S2719DGF 27" WQHD Gaming-Monitor | 5 | 3.0 |`0424:5734`| 2018 | |
| Dell | UltraSharp 1704FPT 17" LCD Monitor | 4 | 2.0 |`0424:A700`| 2005 | 2015 |
| Dell | UltraSharp U2415 24" LCD Monitor | 5 | 3.0 | | 2014 | |
| Dell | UltraSharp U3419W 34" Curved Monitor | 6 | 3.0 | | 2020 | |
| Dell | Wyse 3040 ([-f required](https://tinyurl.com/wyse3k))| 6 | 3.0 | | 2017 | |
| Delock | 62537 | 4 | 3.0 | | 2017 | 2021 |
| Delock | 87445 ([note](https://git.io/Jsuz5)) | 4 | 2.0 |`05E3:0608`| 2009 | 2013 |
| Elecom | U2H-G4S | 4 | 2.0 | | 2006 | 2011 |
| Gigabyte | G27Q monitor ([see](http://tinyurl.com/G27Q551)) | 4 | 3.0 |`2109:0817`| 2020 | |
| GlobalScale | ESPRESSObin SBUD102 V5 | 1 | 3.0 |`1D6B:0003`| 2017 | |
| Hardkernel | ODROID-C4 ([note](https://git.io/JG0mP)) | 4 | 3.0 | | 2020 | |
| Hawking Technology | UH214 | 4 | 2.0 | | 2003 | 2008 |
| Hewlett Packard | USB-C Dock G5 5TW10AA | 5 | 3.0 |`03F0:076B`| 2019 | |
| Hewlett Packard | P5Q58UT | 3 | 3.0 | | 2019 | |
| IBM | SK-8815 USB Keyboard | 3 | 1.1 |`04B3:301A`| 2004 | |
| Inateck | HB2025A ([USB2 only](https://tinyurl.com/HB2025A-1)) | 4 | 3.1 |`2109:2822`| 2021 | |
| IOI | U3H415E1 | 4 | 3.0 | | 2012 | |
| j5create | JUH470 (works only in USB2 mode) | 3 | 3.0 |`05E3:0610`| 2014 | |
| j5create | JUH377 ([note](https://tinyurl.com/JUH377)) | 7 | 3.0 | | 2016 | |
| j5create | JUH470 ([note](https://tinyurl.com/JUH470)) | 3 | 3.0 |`05E3:0610`| 2014 | |
| Juiced Systems | 6HUB-01 | 7 | 3.0 |`0BDA:0411`| 2014 | 2018 |
| KUNBUS GmbH | RevPi Connect (+) / S / SE | 2 | 2.0 |`0424:9514`| 2018 | |
| KUNBUS GmbH | RevPi Connect 4 | 2 | 3.0 | | 2022 | |
| KUNBUS GmbH | RevPi Core 3 / S / SE | 2 | 2.0 |`0424:9514`| 2017 | |
| LG Electronics | 27MD5KL-B monitor | 4 | 3.0 |`043E:9A60`| 2019 | |
| LG Electronics | 27GL850-B monitor | 4 | 3.0 |`0451:8142`| 2019 | |
| LG Electronics | 27UK850-W monitor | 2 | 3.0 | | 2018 | |
| LG Electronics | 27UN83A-W monitor | 2 | 3.0 |`0451:8142`| 2020 | |
| LG Electronics | 38WK95C-W monitor | 4 | 3.0 |`0451:8142`| 2018 | |
| Lenovo | ThinkPad Mini Dock Series 3 (433710U) | 6 | 2.0 |`17EF:100A`| 2016 | |
| Lenovo | ThinkPad Ultra Docking Station (40A20090EU) | 6 | 2.0 |`17EF:100F`| 2015 | |
| Lenovo | ThinkPad Ultra Docking Station (40AJ0135EU) | 7 | 3.1 |`17EF:3070`| 2018 | |
| Lenovo | ThinkPad X200 Ultrabase 42X4963 | 3 | 2.0 |`17EF:1005`| 2008 | 2011 |
| Lenovo | ThinkPad X6 Ultrabase 42W3107 | 4 | 2.0 |`17EF:1000`| 2006 | 2009 |
| Lenovo | ThinkPlus 4-in-1 USB-C hub 4X90W86497 | 3 | 3.0 | | 2021 | |
| Lenovo | ThinkVision T24i-10 Monitor | 4 | 2.0 |`17EF:0610`| 2018 | |
| Lenovo | USB-C to 4 Port USB-A Hub ([USB2 only](https://github.com/mvp/uhubctl/issues/625)) | 4 | 2.0 |`17EF:103A`| 2020 | |
| Lindy | USB serial converter 4 port | 4 | 1.1 |`058F:9254`| 2008 | |
| Linksys | USB2HUB4 | 4 | 2.0 | | 2004 | 2010 |
| Maplin | A08CQ | 7 | 2.0 |`0409:0059`| 2008 | 2011 |
| Linksys | USB2HUB4 ([note](https://git.io/JYiDZ)) | 4 | 2.0 | | 2004 | 2010 |
| Maplin | A08CQ ([red ports only](https://tinyurl.com/gh635)) | 7 | 2.0 |`0409:0059`| 2008 | 2011 |
| Metadot | Das Keyboard 4 | 2 | 3.0 | | 2014 | |
| Microchip | EVB9512 | 2 | 2.0 | | 2009 | |
| Microchip | EVB-USB2517 | 7 | 2.0 | | 2008 | |
| Microchip | EVB-USB2534BC | 4 | 2.0 | | 2013 | |
| Microchip | EVB-USB5807 | 7 | 3.0 | | 2016 | |
| Moxa | Uport-407 | 7 | 2.0 |`110A:0407`| 2009 | |
| NVidia | Jetson Nano B01 ([details](https://git.io/JJaFR)) | 4 | 3.0 | | 2019 | |
| NVidia | Jetson Xavier NX ([details](https://tinyurl.com/Xavier-NX)) | 4 | 3.0 | | 2020 | |
| Phidgets | HUB0003_0 | 7 | 2.0 |`1A40:0201`| 2017 | |
| Philips | 346B1C UltraWide 34" Curved Monitor | 4 | 3.0 |`05E3:0610`| 2019 | |
| Plugable | USB3-HUB7BC | 7 | 3.0 |`2109:0813`| 2015 | |
| Plugable | USB3-HUB7C | 7 | 3.0 |`2109:0813`| 2015 | |
| Plugable | USB3-HUB7-81X | 7 | 3.0 |`2109:0813`| 2012 | |
| Plugable | USB3-HUB7C (only works for 2 charge ports) | 7 | 3.0 |`2109:0813`| 2015 | |
| Plugable | USBC-HUB7BC (works for 6/7 ports, not the rightmost) | 7 | 3.0 |`2109:0817`| 2021 | |
| Plugable | USB3-HUB10-C2 (only works for 2 charge ports) | 10 | 3.0 | | 2014 | |
| Port Inc | NWUSB01 | 4 | 1.1 |`0451:1446`| 1999 | 2003 |
| Raspberry Pi | B+, 2B, 3B ([see below](#raspberry-pi-b2b3b)) | 4 | 2.0 | | 2011 | |
| Raspberry Pi | 3B+ ([see below](#raspberry-pi-3b)) | 4 | 2.0 |`0424:2514`| 2018 | |
| Raspberry Pi | 4B ([see below](#raspberry-pi-4b)) | 4 | 3.0 |`2109:3431`| 2019 | |
| Raspberry Pi | 5 ([see below](#raspberry-pi-5)) | 4 | 3.0 |`1d6b:0002`| 2023 | |
| Renesas | uPD720202 PCIe USB 3.0 host controller | 2 | 3.0 | | 2013 | |
| Rosewill | RHUB-210 | 4 | 2.0 |`0409:005A`| 2011 | 2014 |
| Rosonway | RSH-518C ([note](https://tinyurl.com/RSH518)) | 7 | 3.0 |`2109:0817`| 2021 | |
| Rosonway | RSH-A10 ([see](https://tinyurl.com/2ppyyaj8)) | 10 | 3.0 |`0bda:0411`| 2020 | |
| Rosonway | RSH-A13 ([warning](https://tinyurl.com/RSH-A13)) | 13 | 3.1 |`2109:2822`| 2021 | |
| Rosonway | RSH-A16 ([note](https://git.io/JTawg), [warning](https://tinyurl.com/RSH-A16)) | 16 | 3.0 |`0bda:0411`| 2020 | |
| Rosonway | RSH-A37S | 7 | 3.0 |`2109:2822`| 2021 | |
| Rosonway | RSH-A104 ([USB2 only](https://tinyurl.com/RSH-A104)) | 4 | 3.1 |`2109:2822`| 2022 | |
| Rosonway | RSH-ST07C ([only 4](https://tinyurl.com/4pjnujrn)) | 7 | 3.0 |`2109:2822`| 2023 | |
| Rosonway | RSH-ST10C-6 ([note](https://tinyurl.com/428vpa2f)) | 10 | 3.1 | | 2024 | |
| Sanwa Supply | USB-HUB14GPH | 4 | 1.1 | | 2001 | 2003 |
| Seagate | Backup Plus Hub STEL8000100 | 2 | 3.0 |`0BC2:AB44`| 2016 | |
| StarTech | ST4200USBM | 4 | 2.0 |`0409:005A`| 2004 | |
| Seeed Studio | reTerminal CM4104032 | 2 | 2.0 |`0424:2514`| 2021 | |
| Sipolar | A-173 | 7 | 3.0 |`0BDA:0411`| 2016 | |
| StarTech | DKT30CSDHPD3 USB-C Travel Dock | 3 | 3.0 |`2109:2817`| 2018 | |
| StarTech | HB30A4AIB ([warning](https://tinyurl.com/ycxravwk)) | 4 | 3.0 |`2109:2817`| 2018 | |
| StarTech | HB31C2A2CB ([note](https://github.com/mvp/uhubctl/issues/601)) | 5 | 3.0 |`14B0:013D`| 2020 | |
| Sunix | SHB4200MA | 4 | 2.0 |`0409:0058`| 2006 | 2009 |
| Targus | PAUH212U | 7 | 2.0 | | 2004 | 2009 |
| System Talks | Sugoi USB2-HUB4X ([warning](https://github.com/mvp/uhubctl/issues/636))|4|2.0| | 2007 | |
| Targus | ACH155 (port 3 controls all ports) | 4 | 3.0 | | 2022 | |
| Targus | PA095UZ | 2 | 2.0 | | 2004 | |
| Targus | PAUH212/PAUH212U | 7 | 2.0 | | 2004 | 2009 |
| Texas Instruments | TUSB4041PAPEVM | 4 | 2.1 |`0451:8142`| 2015 | |
| UUGear | MEGA4 (for Raspberry Pi 4B) | 4 | 3.0 |`2109:0817`| 2021 | |
| VirtualHere | USB3 4-port hub ([note](https://tinyurl.com/vhusb)) | 4 | 3.0 | | 2024 | |
This table is by no means complete.
If your hub works with `uhubctl`, but is not listed above, please report it
@@ -98,57 +159,83 @@ virtual hubs for power off/on changes to take effect. `uhubctl` will try to do t
Unfortunately, while most hubs will cut off data USB connection, some may still not cut off VBUS to port,
which means connected phone may still continue to charge from port that is powered off by `uhubctl`.
Installing
==========
For Linux and MacOS uhubctl is available in standard package managers
and can be installed with following commands:
* MacOS: `brew install uhubctl` or `sudo port install uhubctl`
- :warning: MacOS 26+ requires [fix](https://github.com/libusb/libusb/pull/1700).
Until libusb version 1.0.30 with this fix is released, install libusb from master:
brew uninstall libusb --ignore-dependencies
brew install libusb --head
* Ubuntu/Debian/Raspbian: `sudo apt install uhubctl`
* Redhat/EPEL/Fedora/CentOS: `sudo yum install uhubctl`
* OpenSUSE: `sudo zypper install uhubctl`
* FreeBSD: `cd /usr/ports/sysutils/uhubctl && sudo make install`
However, uhubctl installed from standard package manager may not
necessarily be latest version, or even severely lag behind current version.
If [latest published](https://github.com/mvp/uhubctl/releases) uhubctl version
is newer than what your package manager offers, you may need to compile and install
from source as described below.
Compiling
=========
This utility was tested to compile and work on Linux
(Ubuntu/Debian, Redhat/Fedora/CentOS, Arch Linux, Gentoo, openSUSE, Buildroot), FreeBSD, NetBSD and Mac OS X.
This utility was tested to compile and work on Linux (Ubuntu/Debian/Raspbian,
Redhat/EPEL/Fedora/CentOS, Arch Linux, Gentoo, openSUSE, Buildroot),
FreeBSD, NetBSD, SunOS and MacOS.
While `uhubctl` compiles on Windows, USB power switching does not work on Windows because `libusb`
is using `winusb.sys` driver, which according to Microsoft does not support
[necessary USB control requests](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f680b63f-ca4f-4e52-baa9-9e64f8eee101).
[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).
This may be fixed if `libusb` starts supporting different driver on Windows.
First, you need to install library libusb-1.0 (version 1.0.12 or later, 1.0.16 or later is recommended):
Note that it is highly recommended to have utility `pkgconf` (or `pkg-config`) installed
(often it is installed by default).
* Ubuntu: `sudo apt-get install libusb-1.0-0-dev`
* Redhat: `sudo yum install libusb1-devel`
* MacOSX: `brew install libusb`, or `sudo port install libusb-devel`
> :warning: `libusb-1.0.23` is [broken](https://github.com/libusb/libusb/issues/707) on MacOS Catalina!
You have to install `libusb-1.0.22` until [libusb issue 707](https://github.com/libusb/libusb/issues/707) is fixed,
or use this workaround to force use of older Mojave build:
First, you need to install library libusb-1.0 (version 1.0.13 or later is required,
1.0.23 or later is recommended):
brew uninstall --ignore-dependencies libusb
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/5314f1d/Formula/libusb.rb
* FreeBSD: libusb is included by default
* NetBSD: `sudo pkgin install libusb1 gmake pkg-config`
* Ubuntu: `sudo apt-get install libusb-1.0-0-dev pkgconf`
* Redhat: `sudo yum install libusb1-devel pkgconf`
* OpenSUSE: `sudo zypper install libusb-1_0-devel pkgconf`
* MacOS: `brew install libusb pkgconf`, or `sudo port install libusb-devel pkgconf`
* FreeBSD: `pkg install gmake pkgconf` (libusb is included by default)
* NetBSD: `sudo pkgin install libusb1 gmake pkgconf`
* Windows: TBD?
To fetch uhubctl source:
To fetch uhubctl source and compile it:
git clone https://github.com/mvp/uhubctl
cd uhubctl
make
This should generate `uhubctl` binary.
You can install it in your system as `/usr/sbin/uhubctl` using:
sudo make install
To compile, simply run `make` - this will generate `uhubctl` binary.
Note that on some OS (e.g. FreeBSD/NetBSD) you need to use `gmake` instead to build.
Also, for Mac OS X you can install `uhubctl` with Homebrew custom tap:
```
brew tap mvp/uhubctl https://github.com/mvp/uhubctl
brew install --HEAD uhubctl
```
Usage
=====
> :warning: On Linux, use `sudo` or configure USB permissions as described below!
To list all supported hubs:
uhubctl
You can control the power on a USB port(s) like this:
uhubctl -a off -p 2
This means operate on default smart hub and turn power off (`-a off`, or `-a 0`)
on port 2 (`-p 2`). Supported actions are `off`/`on`/`cycle` (or `0`/`1`/`2`).
on port 2 (`-p 2`). Supported actions are `off`/`on`/`cycle`/`toggle` (or `0`/`1`/`2`/`3`).
`cycle` means turn power off, wait some delay (configurable with `-d`) and turn it back on.
Ports can be comma separated list, and may use `-` for ranges e.g. `2`, or `2,4`, or `2-5`, or `1-2,5-8`.
@@ -168,14 +255,35 @@ Linux USB permissions
=====================
On Linux, you should configure `udev` USB permissions (otherwise you will have to run it as root using `sudo uhubctl`).
To fix USB permissions, first run `sudo uhubctl` and note all `vid:pid` for hubs you need to control.
Then, add one or more udev rules like below to file `/etc/udev/rules.d/52-usb.rules` (replace with your vendor id):
SUBSYSTEM=="usb", ATTR{idVendor}=="2001", MODE="0666"
Starting with Linux Kernel 6.0 there is a standard interface to turn USB hub ports on or off,
and `uhubctl` will try to use it (instead of `libusb`) to set the port status.
This is why there are additional rules for 6.0+ kernels.
There is no harm in having these rules on systems running older kernel versions.
To fix USB permissions, first run `sudo uhubctl` and note all `vid:pid` for hubs you need to control.
Then, add udev rules like below to file `/etc/udev/rules.d/52-usb.rules`
(replace `2001` with your hub vendor id, or completely remove `ATTR{idVendor}` filter to allow any USB hub access):
SUBSYSTEM=="usb", DRIVER=="hub|usb", MODE="0666", ATTR{idVendor}=="2001"
# Linux 6.0 or later (its ok to have this block present for older Linux kernels):
SUBSYSTEM=="usb", DRIVER=="hub|usb", \
RUN="/bin/sh -c \"chmod -f 666 $sys$devpath/*port*/disable || true\""
Note that for USB3 hubs, some hubs use different vendor ID for USB2 vs USB3 components of the same chip,
and both need permissions to make uhubctl work properly.
E.g. for Raspberry Pi 4B, you need to add these 2 lines (or remove idVendor filter):
SUBSYSTEM=="usb", DRIVER=="hub|usb", MODE="0666", ATTR{idVendor}=="2109"
SUBSYSTEM=="usb", DRIVER=="hub|usb", MODE="0666", ATTR{idVendor}=="1d6b"
If you don't like wide open mode `0666`, you can restrict access by group like this:
SUBSYSTEM=="usb", ATTR{idVendor}=="2001", MODE="0664", GROUP="dialout"
SUBSYSTEM=="usb", DRIVER=="hub|usb", MODE="0664", GROUP="dialout"
# Linux 6.0 or later (its ok to have this block present for older Linux kernels):
SUBSYSTEM=="usb", DRIVER=="hub|usb", \
RUN+="/bin/sh -c \"chown -f root:dialout $sys$devpath/*port*/disable || true\"" \
RUN+="/bin/sh -c \"chmod -f 660 $sys$devpath/*port*/disable || true\""
and then add permitted users to `dialout` group:
@@ -185,6 +293,7 @@ For your `udev` rule changes to take effect, reboot or run:
sudo udevadm trigger --attr-match=subsystem=usb
For your convenience, ready to use udev rule is provided [here](https://github.com/mvp/uhubctl/blob/master/udev/rules.d/52-usb.rules).
FAQ
@@ -194,7 +303,8 @@ FAQ
According to USB 2.0 specification, USB hubs can advertise no power switching,
ganged (all ports at once) power switching or per-port (individual) power switching.
Note that `uhubctl` will only detect USB hubs which support per-port power switching.
Note that by default `uhubctl` will only detect USB hubs which support per-port power switching
(but you can force it to try operating on unsupported hubs with option `-f`).
You can find what kind of power switching your hardware supports by using `sudo lsusb -v`:
No power switching:
@@ -233,6 +343,8 @@ Per-port power switching:
3. If tests above were successful, please report your hub
by opening new issue at https://github.com/mvp/uhubctl/issues,
so we can add it to list of supported devices.
Please do not report unsupported hubs, unless it is different
hardware revision of some already listed supported model.
#### _USB devices are not removed after port power down on Linux_
@@ -240,11 +352,10 @@ Per-port power switching:
After powering down USB port, udev does not get any event, so it keeps the device files around.
However, trying to access the device files will lead to an IO error.
This is Linux kernel issue. It may be eventually fixed in kernel, see more discussion [here](https://bit.ly/2JzczjZ).
Basically what happens here is that kernel USB driver knows about power off,
but doesn't send notification about it to udev.
This is Linux kernel [issue](https://tinyurl.com/ym7yvuzw) and is [fixed](https://github.com/mvp/uhubctl/pull/450)
since uhubctl 2.5.0 for systems with Linux kernel 6.0 or later.
You can use this workaround for this issue:
If you are still using Linux 5.x or older, you can use this workaround for this issue:
sudo uhubctl -a off -l ${location} -p ${port}
sudo udevadm trigger --action=remove /sys/bus/usb/devices/${location}.${port}/
@@ -257,12 +368,19 @@ When you turn power back on, device should re-enumerate properly (no need to cal
Some device drivers in kernel are surprised by USB device being turned off and automatically try to power it back on.
You can use option `-r N` where N is some number from 10 to 1000 to fix this -
`uhubctl` will try to turn power off many times in quick succession, and it should suppress that.
This may be eventually fixed in kernel, see more discussion [here](https://bit.ly/2JzczjZ).
This is Linux kernel [issue](https://tinyurl.com/ym7yvuzw) and is [fixed](https://github.com/mvp/uhubctl/pull/450)
since uhubctl 2.5.0 for systems with Linux kernel 6.0 or later.
If your device is USB mass storage, invoking `udisksctl` before calling `uhubctl`
might help to mitigate this issue:
If you are still using Linux 5.x or older:
You can use option `-r N`, where N is some number from 10 to 1000 to fix this -
`uhubctl` will try to turn power off many times in quick succession, and it should suppress that.
Disabling USB authorization for device in question before turning power off with `uhubctl` should help:
echo 0 > sudo tee /sys/bus/usb/devices/${location}.${port}/authorized
If your device is USB mass storage, invoking `udisksctl` before calling `uhubctl` should help too:
sudo udisksctl power-off --block-device /dev/disk/...`
sudo uhubctl -a off ...
@@ -281,7 +399,10 @@ Doing so will confuse internal hub circuitry and will cause unpredictable behavi
#### _Raspberry Pi turns power off on all ports, not just the one I specified_
This is limitation of Raspberry Pi hardware design.
This is the limitation of Raspberry Pi hardware design.
As a workaround, you can buy any external USB hub from supported list above,
attach it to any USB port of Raspberry Pi, and control power on its ports independently.
Also, there are supported hubs designed specifically for Raspberry Pi, e.g. UUGear MEGA4.
For reference, supported Raspberry Pi models have following internal USB topology:
@@ -307,8 +428,9 @@ For reference, supported Raspberry Pi models have following internal USB topolog
##### Raspberry Pi 4B
> :warning: You may need to [update firmware](https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md)
to vl805 00137ac or later to make power switching work on RPi 4B.
> :warning: If your VL805 firmware is older than `00137ad` (check with `sudo rpi-eeprom-update`),
you have to [update firmware](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#rpi-eeprom-update)
to make power switching work on RPi 4B.
* USB2 hub `1`, 1 port, only connects hub `1-1` below.
@@ -320,42 +442,74 @@ to vl805 00137ac or later to make power switching work on RPi 4B.
uhubctl -l 2 -a 0
* USB2 hub `3`, 1 port, OTG controller:
* USB2 hub `3`, 1 port, OTG controller. Power switching is [not supported](https://git.io/JUc5Q).
uhubctl -l 3 -p 1 -a 0
##### Raspberry Pi 5
Raspberry Pi 5 has two USB2 ports and two USB3 ports (total 4).
These ports are connected to 4 distinct USB hubs `1`,`2`,`3`,`4` in really weird configuration
(but depending on OS and HW revision hubs of interest can be `2`,`3`,`4`,`5`).
If USB3 device is connected to blue socket, it will be detected on USB3 hub `2` or `4`.
If USB2 device is connected to any socket or USB3 device connected to black socket,
it will be detected on USB2 hub `1` or `3`.
Regardless of USB2/USB3 connection type, blue sockets are always port `1`,
and black sockets are always port `2`.
As a workaround, you can buy any external USB hub from supported list,
attach it to any USB port of Raspberry Pi, and control power on its ports independently.
Each of 4 USB onboard hubs advertises as supporting per-port power switching, but this is not true.
In reality, Raspberry Pi 5 all 4 ports are ganged together in one group,
despite belonging to 4 different logical USB hubs.
To turn off VBUS power it has to be disabled across all onboard hubs and ports with:
```
uhubctl -l 2 -a 0
uhubctl -l 4 -a 0
```
To turn it back on:
```
uhubctl -l 2 -a 1
uhubctl -l 4 -a 1
```
Note that VBUS power goes down only if all ports are off -
enabling any single port enables VBUS back for all 4 ports.
Notable projects using uhubctl
==============================
| Project | Description |
|:---------------------------------------------------------|:------------------------------------------------------|
| [Morse code USB light](https://git.io/fj1F4) | Flash a message in Morse code with USB light |
| [Webcam USB light](https://git.io/fj1FB) | Turn on/off LED when webcam is turned on/off |
| [Cinema Lightbox](https://goo.gl/fjCvkz) | Turn on/off Cinema Lightbox from iOS Home app |
| [Build Status Light](https://goo.gl/3GA82o) | Create a build status light in under 10 minutes |
| [Buildenlights](https://git.io/fj1FC) | GitLab/GitHub project build status as green/red light |
| [Weather Station](https://goo.gl/3b1FzC) | Reset Weather Station when it freezes |
| [sysmoQMOD](https://bit.ly/2VtWrVt) | Reset cellular modems when necessary |
| [Smog Sensor](https://bit.ly/2EMwgCk) | Raspberry Pi based smog sensor power reset |
| [Terrible Cluster](https://goo.gl/XjiXFu) | Power on/off Raspberry Pi cluster nodes as needed |
| [Ideal Music Server](https://bit.ly/39MeVFQ) | Turn off unused USB ports to improve audio quality |
| [USB drives with no phantom load](https://goo.gl/qfrmGK) | Power USB drives only when needed to save power |
| [USB drive data recovery](https://goo.gl/4MddLr) | Recover data from failing USB hard drive |
| [Control power to 3D printer](https://git.io/fh5Tr) | OctoPrint web plugin for USB power control |
| [USB fan for Raspberry Pi](https://bit.ly/2TRV6sM) | Control USB fan to avoid Raspberry Pi overheating |
| [Raspberry Pi Reboot Router](https://bit.ly/3aNbQqs) | Automatically reboot router if internet isn't working |
| [Control USB Lamp With Voice](https://bit.ly/2VtW2SX) | Voice Control of USB Lamp using Siri and Raspberry Pi |
| Project | Description |
|:---------------------------------------------------------|:--------------------------------------------------------|
| [Morse code USB light](https://git.io/fj1F4) | Flash a message in Morse code with USB light |
| [Webcam USB light](https://git.io/fj1FB) | Turn on/off LED when webcam is turned on/off |
| [Cinema Lightbox](https://goo.gl/fjCvkz) | Turn on/off Cinema Lightbox from iOS Home app |
| [Build Status Light](https://goo.gl/3GA82o) | Create a build status light in under 10 minutes |
| [Buildenlights](https://git.io/fj1FC) | GitLab/GitHub project build status as green/red light |
| [Weather Station](https://goo.gl/3b1FzC) | Reset Weather Station when it freezes |
| [sysmoQMOD](https://tinyurl.com/sysmoQMOD) | Reset cellular modems when necessary |
| [Smog Sensor](https://tinyurl.com/smogsensor) | Raspberry Pi based smog sensor power reset |
| [Terrible Cluster](https://goo.gl/XjiXFu) | Power on/off Raspberry Pi cluster nodes as needed |
| [Ideal Music Server](https://tinyurl.com/ideal-m-srv) | Turn off unused USB ports to improve audio quality |
| [USB drives with no phantom load](https://goo.gl/qfrmGK) | Power USB drives only when needed to save power |
| [USB drive data recovery](https://goo.gl/4MddLr) | Recover data from failing USB hard drive |
| [Control power to 3D printer](https://git.io/fh5Tr) | OctoPrint web plugin for USB power control |
| [USB fan for Raspberry Pi](https://tinyurl.com/fan-rpi) | Control USB fan to avoid Raspberry Pi overheating |
| [Raspberry Pi Reboot Router](https://tinyurl.com/rpi-rtr)| Automatically reboot router if internet isn't working |
| [Control USB Lamp With Voice](https://tinyurl.com/usblmp)| Voice Control of USB Lamp using Siri and Raspberry Pi |
| [Control USB LED Strip](https://tinyurl.com/usbleds) | Controlling USB powered LED Light Strip |
| [Brew beer with Raspberry Pi](https://git.io/JtbLd) | Automated beer brewing system using Raspberry Pi |
| [Webcam On-Air Sign](https://tinyurl.com/uonair) | Automatically light up a sign when webcam is in use |
| [Do it yourself PPPS](https://git.io/J3lHs) | Solder wires in your USB hub to support uhubctl |
| [Open source PPPS hub](https://tinyurl.com/yckhystt) | Open source hardware project for uhubctl compatible hub |
| [Python Wrapper for uhubctl](https://github.com/nbuchwitz/python3-uhubctl) | Module to use uhubctl with Python |
| [labgrid](https://github.com/labgrid-project/labgrid) | Framework for testing embedded Linux on hardware |
| [Thermal Camera](https://tinyurl.com/5asne8hw) | Turn on/off robot's thermal camera when necessary |
Copyright
=========
Copyright (C) 2009-2020 Vadim Mikhailov
Copyright (C) 2009-2025 Vadim Mikhailov
This file can be distributed under the terms and conditions of the
GNU General Public License version 2.

View File

@@ -1 +1 @@
v2.2.0-dev
2.6.0

24
udev/rules.d/52-usb.rules Normal file
View File

@@ -0,0 +1,24 @@
# uhubctl USB hub per-port power control https://github.com/mvp/uhubctl
#
# Copyright (c) 2009-2025, Vadim Mikhailov
#
# This file can be distributed under the terms and conditions of the
# GNU General Public License version 2.
# uhubctl udev rules for rootless operation on Linux for users in group `dialout`.
#
# Copy this file to /etc/udev/rules.d, then reboot or run:
#
# sudo udevadm trigger --attr-match=subsystem=usb
#
# To add yourself to this permission group, run:
#
# sudo usermod -a -G dialout $USER
# This is for Linux before 6.0:
SUBSYSTEM=="usb", DRIVER=="hub|usb", MODE="0664", GROUP="dialout"
# This is for Linux 6.0 or later (ok to keep this block present for older Linux kernels):
SUBSYSTEM=="usb", DRIVER=="hub|usb", \
RUN+="/bin/sh -c \"chown -f root:dialout $sys$devpath/*port*/disable || true\"" \
RUN+="/bin/sh -c \"chmod -f 660 $sys$devpath/*port*/disable || true\""

715
uhubctl.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +0,0 @@
DESCRIPTION = "uhubctl - USB hub per-port power control"
HOMEPAGE = "https://github.com/mvp/uhubctl"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://LICENSE;md5=a79e6a142b69522fe7757fe7313895eb"
DEPENDS = "libusb1"
RDEPENDS_${PN} = "libusb1"
SRC_URI = "git://github.com/mvp/uhubctl.git"
SRCREV = "${AUTOREV}"
PV = "git"
S = "${WORKDIR}/git"
do_install_append () {
install -d ${D}${bindir}
install -Dm 0755 ${S}/uhubctl ${D}${bindir}/
}
FILES_${PN} += "${bindir}/*"