Skip to main content
Control the power state of USB devices and ports on your testbed using USB hubs with per-port power control.

Import

Methods

Exception Classes

Method Reference

Net.get(name, type=NetType.Usb)

Get a USB net by name.
Parameters: Returns: USB Net instance

enable()

Enable (power on) the USB port.

disable()

Disable (power off) the USB port.

toggle()

Toggle the power state of the USB port. Returns the resulting state (True if now enabled, False if now disabled).

state()

Read the current power state of the USB port without changing it. Returns True if the port is currently enabled (powered on), False if disabled. The value is read live from the hub, so it always reflects the real port state.

Examples

Basic Power Control

Power Cycle Device

Error Handling

Automated Test Setup

USB Device Reset

Toggle for Quick State Change

Supported Hardware

Notes

  • USB nets must be configured on the Lager Box with hub serial number and port mapping
  • Power state changes take effect immediately
  • Allow time for USB enumeration after powering on (~1-3 seconds)
  • Power cycling can be useful for device reset/recovery
  • The toggle() function is useful for quick state changes
  • Use exception handling for robust error recovery