> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lagerdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# USB

> Control USB hub port power

Control programmable USB hub ports through the Lager CLI for power management and device connectivity.

## Syntax

```bash theme={null}
lager usb [OPTIONS] [NET_NAME] [COMMAND]
```

## Global Options

| Option       | Description                 |
| ------------ | --------------------------- |
| `--box TEXT` | Lagerbox name or IP address |
| `--help`     | Show help message and exit  |

## Arguments

| Argument   | Description                                     |
| ---------- | ----------------------------------------------- |
| `NET_NAME` | USB net name (optional - lists nets if omitted) |
| `COMMAND`  | Power command: `enable`, `disable`, or `toggle` |

## Commands

| Command   | Description                      |
| --------- | -------------------------------- |
| `enable`  | Enable (power on) the USB port   |
| `disable` | Disable (power off) the USB port |
| `toggle`  | Toggle the current power state   |

***

## Usage

### List USB Nets

When invoked without a net name, lists all USB nets on the box:

```bash theme={null}
lager usb --box my-lager-box
```

**Output:**

```
Name    Net Type  Instrument    Channel  Address
USB1    usb       Acroname_Hub  0        USB::123456
USB2    usb       Acroname_Hub  1        USB::123456
CAM_USB usb       YKUSH         0        USB::789012
```

### Control USB Port Power

```bash theme={null}
lager usb NET_NAME COMMAND [--box BOX]
```

**Examples:**

```bash theme={null}
# Enable USB port
lager usb USB1 enable --box my-lager-box

# Disable USB port
lager usb USB1 disable --box my-lager-box

# Toggle USB port state
lager usb USB1 toggle --box my-lager-box
```

***

## Examples

```bash theme={null}
# List all USB nets
lager usb --box my-lager-box

# Power on a USB port for a camera
lager usb CAM_USB enable --box my-lager-box

# Power off USB port to reset a device
lager usb USB1 disable --box my-lager-box

# Toggle power state (useful for power cycling)
lager usb USB1 toggle --box my-lager-box

# Power cycle a device (disable then enable)
lager usb USB1 disable --box my-lager-box
sleep 2
lager usb USB1 enable --box my-lager-box
```

***

## Supported Hardware

| Manufacturer | Model     | Description              |
| ------------ | --------- | ------------------------ |
| Acroname     | USBHub3+  | Programmable USB 3.0 hub |
| Acroname     | USBHub2x4 | 4-port programmable hub  |
| YKUSH        | YKUSH3    | USB switchable hub       |

***

## Notes

* Net names (e.g., `USB1`, `CAM_USB`) refer to USB ports configured on your testbed
* Commands are case-insensitive (`enable`, `ENABLE`, and `Enable` all work)
* 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 create <name> usb <channel> <address>`
