libnx  v4.2.0
Data Structures | Macros | Enumerations | Functions
usbds.h File Reference

USB (usb:ds) service IPC wrapper. More...

#include "../types.h"
#include "../sf/service.h"
#include "../services/usb.h"
#include "../kernel/event.h"

Go to the source code of this file.

Data Structures

struct  UsbDsInterface
 
struct  UsbDsEndpoint
 
struct  UsbDsDeviceInfo
 
struct  UsbDsReportEntry
 
struct  UsbDsReportData
 

Macros

#define USBDS_DEFAULT_InterfaceNumber   0x4
 

Enumerations

enum  UsbComplexId { UsbComplexId_Default = 0x2 }
 
enum  UsbDeviceSpeed {
  UsbDeviceSpeed_Full = 0x2,
  UsbDeviceSpeed_High = 0x3,
  UsbDeviceSpeed_Super = 0x4
}
 

Functions

Result usbDsInitialize (void)
 Opens a session with usb:ds.
 
void usbDsExit (void)
 Closes the usb:ds session. Any interfaces/endpoints which are left open are automatically closed, since otherwise usb-sysmodule won't fully reset usb:ds to defaults.
 
ServiceusbDsGetServiceSession (void)
 Gets the Service object for the actual usb:ds service session.
 
Result usbDsWaitReady (u64 timeout)
 Helper func.
 
Result usbDsParseReportData (UsbDsReportData *reportdata, u32 urbId, u32 *requestedSize, u32 *transferredSize)
 Helper func.
 
IDsService
EventusbDsGetStateChangeEvent (void)
 
Result usbDsGetState (UsbState *out)
 Gets the device state. See UsbState.
 
Result usbDsGetDsInterface (UsbDsInterface **out, struct usb_interface_descriptor *descriptor, const char *interface_name)
 Removed in [5.0.0+].
 
Result usbDsSetVidPidBcd (const UsbDsDeviceInfo *deviceinfo)
 Removed in [5.0.0+].
 
Result usbDsRegisterInterface (UsbDsInterface **out)
 Only available on [5.0.0+].
 
Result usbDsRegisterInterfaceEx (UsbDsInterface **out, u8 intf_num)
 Only available on [5.0.0+].
 
Result usbDsClearDeviceData (void)
 Only available on [5.0.0+].
 
Result usbDsAddUsbStringDescriptor (u8 *out_index, const char *string)
 Only available on [5.0.0+].
 
Result usbDsAddUsbLanguageStringDescriptor (u8 *out_index, const u16 *lang_ids, u16 num_langs)
 Only available on [5.0.0+].
 
Result usbDsDeleteUsbStringDescriptor (u8 index)
 Only available on [5.0.0+].
 
Result usbDsSetUsbDeviceDescriptor (UsbDeviceSpeed speed, struct usb_device_descriptor *descriptor)
 Only available on [5.0.0+].
 
Result usbDsSetBinaryObjectStore (const void *bos, size_t bos_size)
 Only available on [5.0.0+].
 
Result usbDsEnable (void)
 Only available on [5.0.0+].
 
Result usbDsDisable (void)
 Only available on [5.0.0+].
 
IDsInterface
void usbDsInterface_Close (UsbDsInterface *interface)
 
Result usbDsInterface_GetSetupPacket (UsbDsInterface *interface, void *buffer, size_t size)
 
Result usbDsInterface_EnableInterface (UsbDsInterface *interface)
 
Result usbDsInterface_DisableInterface (UsbDsInterface *interface)
 
Result usbDsInterface_CtrlInPostBufferAsync (UsbDsInterface *interface, void *buffer, size_t size, u32 *urbId)
 
Result usbDsInterface_CtrlOutPostBufferAsync (UsbDsInterface *interface, void *buffer, size_t size, u32 *urbId)
 
Result usbDsInterface_GetCtrlInReportData (UsbDsInterface *interface, UsbDsReportData *out)
 
Result usbDsInterface_GetCtrlOutReportData (UsbDsInterface *interface, UsbDsReportData *out)
 
Result usbDsInterface_StallCtrl (UsbDsInterface *interface)
 
Result usbDsInterface_GetDsEndpoint (UsbDsInterface *interface, UsbDsEndpoint **endpoint, struct usb_endpoint_descriptor *descriptor)
 Removed in [5.0.0+].
 
Result usbDsInterface_RegisterEndpoint (UsbDsInterface *interface, UsbDsEndpoint **endpoint, u8 endpoint_address)
 Only available on [5.0.0+].
 
Result usbDsInterface_AppendConfigurationData (UsbDsInterface *interface, UsbDeviceSpeed speed, const void *buffer, size_t size)
 Only available on [5.0.0+].
 
IDsEndpoint
void usbDsEndpoint_Close (UsbDsEndpoint *endpoint)
 
Result usbDsEndpoint_Cancel (UsbDsEndpoint *endpoint)
 
Result usbDsEndpoint_PostBufferAsync (UsbDsEndpoint *endpoint, void *buffer, size_t size, u32 *urbId)
 
Result usbDsEndpoint_GetReportData (UsbDsEndpoint *endpoint, UsbDsReportData *out)
 
Result usbDsEndpoint_Stall (UsbDsEndpoint *endpoint)
 
Result usbDsEndpoint_SetZlt (UsbDsEndpoint *endpoint, bool zlt)
 

Detailed Description

USB (usb:ds) service IPC wrapper.

Switch-as-device<>host USB comms, see also here: https://switchbrew.org/wiki/USB_services

Author
SciresM, yellows8

Enumeration Type Documentation

◆ UsbDeviceSpeed

Enumerator
UsbDeviceSpeed_Full 

USB 1.1 Full Speed.

UsbDeviceSpeed_High 

USB 2.0 High Speed.

UsbDeviceSpeed_Super 

USB 3.0 Super Speed.