libnx  v4.6.0
Data Structures | Functions
usb_comms.h File Reference

USB comms. More...

#include "../../types.h"

Go to the source code of this file.

Data Structures

struct  UsbCommsInterfaceInfo
 

Functions

Result usbCommsInitialize (void)
 Initializes usbComms with the default number of interfaces (1)
 
Result usbCommsInitializeEx (u32 num_interfaces, const UsbCommsInterfaceInfo *infos, u16 idVendor, u16 idProduct)
 Initializes usbComms with a specific number of interfaces.
 
void usbCommsExit (void)
 Exits usbComms.
 
void usbCommsSetErrorHandling (bool flag)
 Sets whether to throw a fatal error in usbComms{Read/Write}* on failure, or just return the transferred size. By default (false) the latter is used.
 
Synchronous API
size_t usbCommsRead (void *buffer, size_t size)
 Read data with the default interface.
 
size_t usbCommsWrite (const void *buffer, size_t size)
 Write data with the default interface.
 
size_t usbCommsReadEx (void *buffer, size_t size, u32 interface)
 Same as usbCommsRead except with the specified interface.
 
size_t usbCommsWriteEx (const void *buffer, size_t size, u32 interface)
 Same as usbCommsWrite except with the specified interface.
 
Asynchronous API
EventusbCommsGetReadCompletionEvent (u32 interface)
 Retrieve event used for read completion with the given interface.
 
Result usbCommsReadAsync (void *buffer, size_t size, u32 *urbId, u32 interface)
 Start an asynchronous read. More...
 
Result usbCommsGetReadResult (u32 urbId, u32 *transferredSize, u32 interface)
 Complete an asynchronous read, clearing the completion event, and return the amount of data which was read.
 
EventusbCommsGetWriteCompletionEvent (u32 interface)
 Retrieve event used for write completion with the given interface.
 
Result usbCommsWriteAsync (void *buffer, size_t size, u32 *urbId, u32 interface)
 Start an asynchronous write. More...
 
Result usbCommsGetWriteResult (u32 urbId, u32 *transferredSize, u32 interface)
 Complete an asynchronous write, clearing the completion event, and return the amount of data which was written.
 

Detailed Description

USB comms.

Author
yellows8
plutoo

Function Documentation

◆ usbCommsReadAsync()

Result usbCommsReadAsync ( void *  buffer,
size_t  size,
u32 urbId,
u32  interface 
)

Start an asynchronous read.

The completion event will be signaled when the read completes. The buffer must be page-aligned and no larger than one page.

◆ usbCommsWriteAsync()

Result usbCommsWriteAsync ( void *  buffer,
size_t  size,
u32 urbId,
u32  interface 
)

Start an asynchronous write.

The completion event will be signaled when the write completes. The buffer must be page-aligned and no larger than one page.