libnx  v4.2.2
Data Structures | Macros | Enumerations
usb.h File Reference

Common USB (usb:*) service IPC header. More...

#include "../types.h"

Go to the source code of this file.

Data Structures

struct  usb_endpoint_descriptor
 Imported from libusb, with some adjustments. More...
 
struct  usb_interface_descriptor
 Imported from libusb, with some adjustments. More...
 
struct  usb_device_descriptor
 Imported from libusb, with some adjustments. More...
 
struct  usb_config_descriptor
 Imported from libusb, with some adjustments. More...
 
struct  usb_ss_endpoint_companion_descriptor
 Imported from libusb, with some adjustments. More...
 
struct  usb_string_descriptor
 Imported from libusb, with some adjustments. More...
 

Macros

#define USB_DT_INTERFACE_SIZE   9
 Names starting with "libusb" were changed to "usb" to avoid collision with actual libusb if it's ever used. More...
 
#define USB_DT_ENDPOINT_SIZE   7
 
#define USB_DT_DEVICE_SIZE   0x12
 
#define USB_DT_SS_ENDPOINT_COMPANION_SIZE   6
 
#define USB_ENDPOINT_ADDRESS_MASK   0x0f /* in bEndpointAddress */
 
#define USB_ENDPOINT_DIR_MASK   0x80
 
#define USB_TRANSFER_TYPE_MASK   0x03 /* in bmAttributes */
 

Enumerations

enum  usb_class_code {
  USB_CLASS_PER_INTERFACE = 0,
  USB_CLASS_AUDIO = 1,
  USB_CLASS_COMM = 2,
  USB_CLASS_HID = 3,
  USB_CLASS_PHYSICAL = 5,
  USB_CLASS_PRINTER = 7,
  USB_CLASS_PTP = 6,
  USB_CLASS_IMAGE = 6,
  USB_CLASS_MASS_STORAGE = 8,
  USB_CLASS_HUB = 9,
  USB_CLASS_DATA = 10,
  USB_CLASS_SMART_CARD = 0x0b,
  USB_CLASS_CONTENT_SECURITY = 0x0d,
  USB_CLASS_VIDEO = 0x0e,
  USB_CLASS_PERSONAL_HEALTHCARE = 0x0f,
  USB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
  USB_CLASS_WIRELESS = 0xe0,
  USB_CLASS_APPLICATION = 0xfe,
  USB_CLASS_VENDOR_SPEC = 0xff
}
 Imported from libusb, with changed names.
 
enum  usb_descriptor_type {
  USB_DT_DEVICE = 0x01,
  USB_DT_CONFIG = 0x02,
  USB_DT_STRING = 0x03,
  USB_DT_INTERFACE = 0x04,
  USB_DT_ENDPOINT = 0x05,
  USB_DT_BOS = 0x0f,
  USB_DT_DEVICE_CAPABILITY = 0x10,
  USB_DT_HID = 0x21,
  USB_DT_REPORT = 0x22,
  USB_DT_PHYSICAL = 0x23,
  USB_DT_HUB = 0x29,
  USB_DT_SUPERSPEED_HUB = 0x2a,
  USB_DT_SS_ENDPOINT_COMPANION = 0x30
}
 Imported from libusb, with changed names.
 
enum  usb_endpoint_direction {
  USB_ENDPOINT_IN = 0x80,
  USB_ENDPOINT_OUT = 0x00
}
 Imported from libusb, with changed names.
 
enum  usb_transfer_type {
  USB_TRANSFER_TYPE_CONTROL = 0,
  USB_TRANSFER_TYPE_ISOCHRONOUS = 1,
  USB_TRANSFER_TYPE_BULK = 2,
  USB_TRANSFER_TYPE_INTERRUPT = 3,
  USB_TRANSFER_TYPE_BULK_STREAM = 4
}
 Imported from libusb, with changed names.
 
enum  usb_standard_request {
  USB_REQUEST_GET_STATUS = 0x00,
  USB_REQUEST_CLEAR_FEATURE = 0x01,
  USB_REQUEST_SET_FEATURE = 0x03,
  USB_REQUEST_SET_ADDRESS = 0x05,
  USB_REQUEST_GET_DESCRIPTOR = 0x06,
  USB_REQUEST_SET_DESCRIPTOR = 0x07,
  USB_REQUEST_GET_CONFIGURATION = 0x08,
  USB_REQUEST_SET_CONFIGURATION = 0x09,
  USB_REQUEST_GET_INTERFACE = 0x0A,
  USB_REQUEST_SET_INTERFACE = 0x0B,
  USB_REQUEST_SYNCH_FRAME = 0x0C,
  USB_REQUEST_SET_SEL = 0x30,
  USB_SET_ISOCH_DELAY = 0x31
}
 Imported from libusb, with changed names. More...
 
enum  usb_iso_sync_type {
  USB_ISO_SYNC_TYPE_NONE = 0,
  USB_ISO_SYNC_TYPE_ASYNC = 1,
  USB_ISO_SYNC_TYPE_ADAPTIVE = 2,
  USB_ISO_SYNC_TYPE_SYNC = 3
}
 Imported from libusb, with changed names.
 
enum  usb_iso_usage_type {
  USB_ISO_USAGE_TYPE_DATA = 0,
  USB_ISO_USAGE_TYPE_FEEDBACK = 1,
  USB_ISO_USAGE_TYPE_IMPLICIT = 2
}
 Imported from libusb, with changed names.
 
enum  UsbState {
  UsbState_Detached = 0,
  UsbState_Attached = 1,
  UsbState_Powered = 2,
  UsbState_Default = 3,
  UsbState_Address = 4,
  UsbState_Configured = 5,
  UsbState_Suspended = 6
}
 USB Device States, per USB 2.0 spec. More...
 

Detailed Description

Common USB (usb:*) service IPC header.

Author
SciresM, yellows8

Macro Definition Documentation

◆ USB_DT_INTERFACE_SIZE

#define USB_DT_INTERFACE_SIZE   9

Names starting with "libusb" were changed to "usb" to avoid collision with actual libusb if it's ever used.

Imported from libusb with changed names.

Enumeration Type Documentation

◆ usb_standard_request

Imported from libusb, with changed names.

Enumerator
USB_REQUEST_GET_STATUS 

Request status of the specific recipient.

USB_REQUEST_CLEAR_FEATURE 

Clear or disable a specific feature.

USB_REQUEST_SET_FEATURE 

Set or enable a specific feature.

USB_REQUEST_SET_ADDRESS 

Set device address for all future accesses.

USB_REQUEST_GET_DESCRIPTOR 

Get the specified descriptor.

USB_REQUEST_SET_DESCRIPTOR 

Used to update existing descriptors or add new descriptors.

USB_REQUEST_GET_CONFIGURATION 

Get the current device configuration value.

USB_REQUEST_SET_CONFIGURATION 

Set device configuration.

USB_REQUEST_GET_INTERFACE 

Return the selected alternate setting for the specified interface.

USB_REQUEST_SET_INTERFACE 

Select an alternate interface for the specified interface.

USB_REQUEST_SYNCH_FRAME 

Set then report an endpoint's synchronization frame.

USB_REQUEST_SET_SEL 

Sets both the U1 and U2 Exit Latency.

USB_SET_ISOCH_DELAY 

Delay from the time a host transmits a packet to the time it is received by the device.

◆ UsbState

enum UsbState

USB Device States, per USB 2.0 spec.

Enumerator
UsbState_Detached 

Device is not attached to USB.

UsbState_Attached 

Device is attached, but is not powered.

UsbState_Powered 

Device is attached and powered, but has not been reset.

UsbState_Default 

Device is attached, powered, and has been reset, but does not have an address.

UsbState_Address 

Device is attached, powered, has been reset, has an address, but is not configured.

UsbState_Configured 

Device is attached, powered, has been reset, has an address, configured, and may be used.

UsbState_Suspended 

Device is attached and powered, but has not seen bus activity for 3ms. Device is suspended and cannot be used.