mvp / uhubctl

uhubctl - USB hub per-port power control
Other
2.23k stars 232 forks source link

Please add examples #448

Closed socketpair closed 2 years ago

socketpair commented 2 years ago
Options [defaults in brackets]:
--action,   -a - action to off/on/cycle/toggle (0/1/2/3) for affected ports.
--ports,    -p - ports to operate on    [all hub ports].
--location, -l - limit hub by location  [all smart hubs].
--level     -L - limit hub by location level (e.g. a-b.c is level 3).
--vendor,   -n - limit hub by vendor id [any] (partial ok).
--search,   -s - limit hub by attached device description.
--delay,    -d - delay for cycle action [2 sec].
--repeat,   -r - repeat power off count [1] (some devices need it to turn off).
--exact,    -e - exact location (no USB3 duality handling).
--force,    -f - force operation even on unsupported hubs.
--reset,    -R - reset hub after each power-on action, causing all devices to reassociate.
--wait,     -w - wait before repeat power off [20 ms].
--version,  -v - print program version.
--help,     -h - print this text.
  1. what should I use -a cycle or -a 2 ?
  2. ports ? how to specify many?
  3. location? what is it ? what syntax ?
  4. level ? what is level ?
  5. vendor - numeric code or string ?
  6. search - what is the type of the arguement ?
  7. what is exact location ? USB3 duality ? what does it mean ?

Sorry, I tried. But could not make it work. Just don't know what to pass as arguments.

mvp commented 2 years ago

Most of these questions can be answered if you simply read README.md. But fair point, --help output should include more of this or at least offer a link to README.

what should I use -a cycle or -a 2 ?

Both will work

ports ? how to specify many?

https://github.com/mvp/uhubctl#usage

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/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, or1-2,5-8.

location? what is it ? what syntax ?

Again, from README:

If you have more than one smart USB hub connected, you should choose specific hub to control using -l (location) parameter. To find hub locations, simply run uhubctl without any parameters. Hub locations look like b-x.y.z, where b is USB bus number, and x, y, z... are port numbers for all hubs in chain, starting from root hub for a given USB bus. This address is semi-stable - it will not change if you unplug/replug (or turn off/on) USB device into the same physical USB port (this method is also used in Linux kernel).

level ? what is level ?

level is limiting hub location to certain length in elements. E.g. 1-4 is level 2, 1-4.2 is level 3.

vendor - numeric code or string ?

Hex vid:pid like a123e:de1c, can be shortened to any length and would still match e.g. a123e:de, a123e.

search - what is the type of the arguement ?

It limits ports to operate on by connected device description string.

what is exact location ? USB3 duality ? what does it mean ?

Again, read README regarding USB3 duality.