---
name: "struct_usb_device"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/struct_usb_device"
---

# struct\_usb\_device(9)

kernel's representation of a USB device

## NAME

struct\_usb\_device - kernel's representation of a USB device

## SYNOPSIS

```
struct usb_device {
  int devnum;
  char devpath[16];
  u32 route;
  enum usb_device_state state;
  enum usb_device_speed speed;
  struct usb_tt * tt;
  int ttport;
  unsigned int toggle[2];
  struct usb_device * parent;
  struct usb_bus * bus;
  struct usb_host_endpoint ep0;
  struct device dev;
  struct usb_device_descriptor descriptor;
  struct usb_host_bos * bos;
  struct usb_host_config * config;
  struct usb_host_config * actconfig;
  struct usb_host_endpoint * ep_in[16];
  struct usb_host_endpoint * ep_out[16];
  char ** rawdescriptors;
  unsigned short bus_mA;
  u8 portnum;
  u8 level;
  unsigned can_submit:1;
  unsigned persist_enabled:1;
  unsigned have_langid:1;
  unsigned authorized:1;
  unsigned authenticated:1;
  unsigned wusb:1;
  unsigned lpm_capable:1;
  unsigned usb2_hw_lpm_capable:1;
  unsigned usb2_hw_lpm_besl_capable:1;
  unsigned usb2_hw_lpm_enabled:1;
  unsigned usb2_hw_lpm_allowed:1;
  unsigned usb3_lpm_u1_enabled:1;
  unsigned usb3_lpm_u2_enabled:1;
  int string_langid;
  char * product;
  char * manufacturer;
  char * serial;
  struct list_head filelist;
  int maxchild;
  u32 quirks;
  atomic_t urbnum;
  unsigned long active_duration;
#ifdef CONFIG_PM
  unsigned long connect_time;
  unsigned do_remote_wakeup:1;
  unsigned reset_resume:1;
  unsigned port_is_suspended:1;
#endif
  struct wusb_dev * wusb_dev;
  int slot_id;
  enum usb_device_removable removable;
  struct usb2_lpm_parameters l1_params;
  struct usb3_lpm_parameters u1_params;
  struct usb3_lpm_parameters u2_params;
  unsigned lpm_disable_count;
};
```

## MEMBERS

devnum

device number; address on a USB bus

devpath\[16\]

device ID string for use in messages (e.g., /port/...)

route

tree topology hex string for use with xHCI

state

device state: configured, not attached, etc.

speed

device speed: high/full/low (or error)

tt

Transaction Translator info; used with low/full speed dev, highspeed hub

ttport

device port on that tt hub

toggle\[2\]

one bit for each endpoint, with (\[0\] = IN, \[1\] = OUT) endpoints

parent

our hub, unless we're the root

bus

bus we're part of

ep0

endpoint 0 data (default control pipe)

dev

generic device interface

descriptor

USB device descriptor

bos

USB device BOS descriptor set

config

all of the device's configs

actconfig

the active configuration

ep\_in\[16\]

array of IN endpoints

ep\_out\[16\]

array of OUT endpoints

rawdescriptors

raw descriptors for each config

bus\_mA

Current available from the bus

portnum

parent port number (origin 1)

level

number of USB hub ancestors

can\_submit

URBs may be submitted

persist\_enabled

USB\_PERSIST enabled for this device

have\_langid

whether string\_langid is valid

authorized

policy has said we can use it; (user space) policy determines if we authorize this device to be used or not. By default, wired USB devices are authorized. WUSB devices are not, until we authorize them from user space. FIXME -- complete doc

authenticated

Crypto authentication passed

wusb

device is Wireless USB

lpm\_capable

device supports LPM

usb2\_hw\_lpm\_capable

device can perform USB2 hardware LPM

usb2\_hw\_lpm\_besl\_capable

device can perform USB2 hardware BESL LPM

usb2\_hw\_lpm\_enabled

USB2 hardware LPM is enabled

usb2\_hw\_lpm\_allowed

Userspace allows USB 2.0 LPM to be enabled

usb3\_lpm\_u1\_enabled

USB3 hardware U1 LPM enabled

usb3\_lpm\_u2\_enabled

USB3 hardware U2 LPM enabled

string\_langid

language ID for strings

product

iProduct string, if present (static)

manufacturer

iManufacturer string, if present (static)

serial

iSerialNumber string, if present (static)

filelist

usbfs files that are open to this device

maxchild

number of ports if hub

quirks

quirks of the whole device

urbnum

number of URBs submitted for the whole device

active\_duration

total time device is not suspended

connect\_time

time device was first connected

do\_remote\_wakeup

remote wakeup should be enabled

reset\_resume

needs reset instead of resume

port\_is\_suspended

the upstream port is suspended (L2 or U3)

wusb\_dev

if this is a Wireless USB device, link to the WUSB specific data for the device.

slot\_id

Slot ID assigned by xHCI

removable

Device can be physically removed from this port

l1\_params

best effor service latency for USB2 L1 LPM state, and L1 timeout.

u1\_params

exit latencies for USB3 U1 LPM state, and hub-initiated timeout.

u2\_params

exit latencies for USB3 U2 LPM state, and hub-initiated timeout.

lpm\_disable\_count

Ref count used by **usb\_disable\_lpm** and **usb\_enable\_lpm** to keep track of the number of functions that require USB 3.0 Link Power Management to be disabled for this usb\_device. This count should only be manipulated by those functions, with the bandwidth\_mutex is held.

## NOTES

Usbcore drivers should not set usbdev-\>state directly. Instead use **usb\_set\_device\_state**.

## COPYRIGHT
