summaryrefslogtreecommitdiff
path: root/README.md
blob: c7b82e8c824e5d2dffdfeb8003aaf71ec9c65561 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
uhubctl
=======

uhubctl is utility to control USB power per-port on smart USB hubs.
Smart hub is defined as one that implements per-port power switching.

Original idea for this code was inspired by hub-ctrl.c by Niibe Yutaka:
http://www.gniibe.org/development/ac-power-control-by-USB-hub


Compatible USB hubs
===================

Note that very few hubs actually 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                                                   | VID  | PID  |
|:------------------- |:--------------------------------------------------------- | ----:| ----:|
| AmazonBasics        | HU3770V1, 7 Port USB 3.0 Hub with 12V/3A Power Adapter    |`2109`|`2811`|
| Anker               | AK-A7518111                                               |      |      |
| Apple               | Thunderbolt Display 27" (internal USB hub)                |      |      |
| Apple               | USB Keyboard With Numeric Pad (internal USB hub)          |      |      |
| Asus                | Z87-PLUS Motherboard (onboard USB hubs)                   |      |      |
| B&B Electronics     | UHR204                                                    |      |      |
| Belkin              | F5U701-BLK                                                |      |      |
| Circuitco           | Beagleboard-xM (internal USB hub)                         |`0424`|`9514`|
| D-Link              | DUB-H7 (Silver edition only!)                             |`2001`|`F103`|
| Elecom              | U2H-G4S                                                   |      |      |
| Hawking Technology  | UH214                                                     |      |      |
| Lenovo              | ThinkPad EU Ultra Dockingstation (40A20090EU)             |`17EF`|`100F`|
| Linksys             | USB2HUB4                                                  |      |      |
| Plugable            | USB2-HUB10S                                               |      |      |
| Rosewill            | RHUB-210                                                  |`0409`|`005A`|
| Sanwa Supply        | USB-HUB14GPH                                              |      |      |
| Targus              | PAUH212                                                   |      |      |

This table is by no means complete.
If your hub works with uhubctl, but is not listed above, please report it
by opening new issue at https://github.com/mvp/uhubctl/issues,
so we can add it to supported table.

Some modern motherboards have built-in root hubs that do support
this feature, but you need to use option `-i` to enable it.


Compiling
=========

This utility was tested to compile and work on Linux
(Ubuntu, Redhat/Fedora/CentOS), FreeBSD and Mac OS X.
It should be possible to compile it for Windows as well -
please report if you succeed in doing that.

First, you need to install library libusb-1.0 (version 1.0.12 or later):

* 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`
* FreeBSD: libusb is included by default
* Windows: TBD?

To compile, simply run `make` - this will generate `uhubctl` binary.

Usage
=====

You can control the power on a USB port(s) like this:

    uhubctl -a off -p 235

This means operate on default smart hub and turn power off (`-a off`, or `-a 0`)
on ports 2,3,5 (`-p 235`). Supported actions are `off`/`on`/`cycle` (or `0`/`1`/`2`).
`cycle` means turn power off, wait some delay (configurable with `-d`) and turn it back on.

On Linux, you may need to run it with `sudo`, or to configure `udev` USB permissions.

If you have more than one smart USB hub connected, you should choose
specific hub to control using `-l` (location) parameter.


Copyright
=========

Copyright (C) 2009-2017 Vadim Mikhailov

This file can be distributed under the terms and conditions of the
GNU General Public License version 2.