Syntax
Global Options
Arguments
Commands
cycle options
Usage
List USB Nets
When invoked without a net name, lists all USB nets on the box:Control USB Port Power
Power cycle a device
cycle cuts power, waits, and restores it. Then it waits up to 5 seconds for the
device to come back:
cycle exits 1 when the device did not come back. The other three results exit 0.
An empty port and an unreadable topology confirm nothing about a device. A
script that needs the device must check the output text for those two results.
A box too old to report whether the device came back makes cycle exit 0 for
all four results.
How cycle decides that the device came back depends on the hub:
- Acroname and YKUSH hubs: the box reads the kernel USB topology before the power cut and again while the port is off. A device that left the bus must return to it.
- Plugable docks: the box watches the connect status that the hub reports for the port.
On a Plugable dock,
cycle returns as soon as the hub reports the device
reconnecting, which is a few hundred milliseconds. Linux does not finish
re-enumerating at that instant. A device node or /dev/ttyUSB* can still be
absent, and a /sys read taken immediately still shows the pre-cycle values. On
Acroname and YKUSH hubs, cycle returns when the device is back in the kernel
USB topology. On every hub, wait for the device node before the next step opens
the device. A return from cycle does not mean that the device is ready.disable/sleep/enable, for these reasons:
- It restores power on every failure path, so a command that dies partway through cannot strand a port.
- It reports whether the device actually came back, so you do not have to guess.
- On a Plugable dock, it holds the hub for the whole sequence, so nothing else can switch the port while it is dark. On Acroname and YKUSH hubs, it opens the hub twice. Another process can switch the port during the off time.
--off-time defaults to 1 second, comfortably above the slowest cold boot
measured on real hardware. Too short an off time is the failure that
matters: the device’s rails do not fully discharge. The device then
warm-starts, but it looks like a device that was reset. Raise the off time for a
device with large bulk capacitance. A value below 0.5s or above 10s is refused.
Recover a port left unpowered
If a command was interrupted between powering a port down and back up,recover
restores power:
recover re-powers every port on it. You usually reach for recover because
something is off and it is not obvious what.
Read port state (read-only)
state reports whether a port is currently enabled or disabled without
changing it. The value is read live from the hub hardware, so it always
reflects the real port state — nothing is cached or stored:
toggle: use state to check a port,
toggle to flip it (which also reports the resulting state).
toggle reports the resulting state so you can tell which way it flipped:enable and disable confirm the action explicitly (USB port 'USB1' enabled).Examples
Supported Hardware
See Supported Instruments for
which ports on a Plugable dock switch power and which do not.
Notes
- Net names (e.g.,
USB1,CAM_USB) refer to USB ports configured on your testbed - Commands are case-sensitive. Type them in lowercase (
enable, notENABLE) - Useful for power cycling USB devices during testing
- USB hubs must be connected to the box and configured as instruments
- Default net can be set with
lager defaults add --usb-net - Create USB nets with
lager nets add <name> usb <channel> <address>

