Nsysuhs.rpl

From WiiUBrew
Jump to navigation Jump to search

nsysuhs.rpl is the system library that provides low-level USB device access. It is a wrapper over the /dev/uhs IOSU interface, and is meant for USB peripheral drivers. Despite nsysuhs.rpl's presence in OSv11, it is impossible to load with OSDynLoad_Acquire(), at least in the web browser; doing so returns no error but an invalid handle. There is one known library that performs low-level USB operations, usb_mic.rpl, but it includes its own copy of the nsysuhs.rpl functions. This seems to imply that nsysuhs.rpl was not meant to be used directly by anything, and may only be included by accident.

Functions

All of the UHS functions communicate with the IOSU node through a client connection. This connection consists of an IOSU handle, an IPC memory pool, and state information, which is contained in the devbuf argument. devbuf is an opaque 0x18-byte structure, and the first argument to all UHS functions.

Client

Name Prototype Description
UhsClientOpen int UhsClientOpen(void *devbuf, UhsClientOptions *options); Open a handle to the UHS interface with the specified options, placing the handle in devbuf and returning 0 on success
UhsClientClose int UhsClientClose(void *devbuf); Close a handle to the UHS interface, returning 0 on success

Structures

Client

typedef struct
{
    int controller_num;
    void *pool_mem;
    uint32_t pool_size;
} UhsClientOptions;