<a id="devices-usb"></a>

# Type: `usb`


            <p class="youtube_link">
              <a href="https://www.youtube.com/watch?v=SAord28VS4g" target="_blank">
                <span title="LXD USB devices" class="play_icon">▶</span>
                <span title="LXD USB devices">Watch on YouTube</span>
              </a>
            </p>
        
#### NOTE
The `usb` device type is supported for both containers and VMs.
It supports hotplugging for both containers and VMs.

USB devices make the specified USB device appear in the instance.
For performance issues, avoid using devices that require high throughput or low latency.

For containers, only `libusb` devices (at `/dev/bus/usb`) are passed to the instance.
This method works for devices that have user-space drivers.
For devices that require dedicated kernel drivers, use a [`unix-char` device](https://canonical.com/lxd/docs/default/reference/devices_unix_char/index.html.md#devices-unix-char) or a [`unix-hotplug` device](https://canonical.com/lxd/docs/default/reference/devices_unix_hotplug/index.html.md#devices-unix-hotplug) instead.

For virtual machines, the entire USB device is passed through, so any USB device is supported.
When a device is passed to the instance, it vanishes from the host.

## Device options

`usb` devices have the following device options:

<!-- Include content from [../metadata.txt](../metadata.txt) -->

<a id="device-unix-usb-device-conf:busnum"></a>
`busnum`

The bus number of which the USB device is attached

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:busnum)

| **Key:**    | `busnum`   |
|-------------|------------|
| **Type:**   | int        |

<a id="device-unix-usb-device-conf:devnum"></a>
`devnum`

The device number of the USB device

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:devnum)

| **Key:**    | `devnum`   |
|-------------|------------|
| **Type:**   | int        |

<a id="device-unix-usb-device-conf:gid"></a>
`gid`

GID of the device owner in the instance

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:gid)

| **Key:**       | `gid`     |
|----------------|-----------|
| **Type:**      | integer   |
| **Default:**   | `0`       |
| **Condition:** | container |

<a id="device-unix-usb-device-conf:mode"></a>
`mode`

Mode of the device in the instance

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:mode)

| **Key:**       | `mode`    |
|----------------|-----------|
| **Type:**      | integer   |
| **Default:**   | `0660`    |
| **Condition:** | container |

<a id="device-unix-usb-device-conf:productid"></a>
`productid`

Product ID of the USB device

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:productid)

| **Key:**    | `productid`   |
|-------------|---------------|
| **Type:**   | string        |

<a id="device-unix-usb-device-conf:required"></a>
`required`

Whether this device is required to start the instance

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:required)

| **Key:**     | `required`   |
|--------------|--------------|
| **Type:**    | bool         |
| **Default:** | `false`      |

The default is `false`, which means that all devices can be hotplugged.

<a id="device-unix-usb-device-conf:serial"></a>
`serial`

The serial number of the USB device

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:serial)

| **Key:**    | `serial`   |
|-------------|------------|
| **Type:**   | string     |

<a id="device-unix-usb-device-conf:uid"></a>
`uid`

UID of the device owner in the instance

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:uid)

| **Key:**       | `uid`     |
|----------------|-----------|
| **Type:**      | integer   |
| **Default:**   | `0`       |
| **Condition:** | container |

<a id="device-unix-usb-device-conf:vendorid"></a>
`vendorid`

Vendor ID of the USB device

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-usb-device-conf:vendorid)

| **Key:**    | `vendorid`   |
|-------------|--------------|
| **Type:**   | string       |

## Configuration examples

Add a `usb` device to an instance by specifying its vendor ID and product ID:

```none
lxc config device add <instance_name> <device_name> usb vendorid=<vendor_ID> productid=<product_ID>
```

To determine the vendor ID and product ID, you can use **lsusb**, for example.

See [Configure devices](https://canonical.com/lxd/docs/default/howto/instances_configure/index.html.md#instances-configure-devices) for more information.
