libnx
v4.7.0
|
hidbus service IPC wrapper, for using external devices attached to HID controllers. More...
#include "../types.h"
#include "../kernel/event.h"
#include "../services/hid.h"
#include "../sf/service.h"
Go to the source code of this file.
Enumerations | |
enum | HidbusBusType { HidbusBusType_LeftJoyRail = 0 , HidbusBusType_RightJoyRail = 1 , HidbusBusType_RightLarkRail = 2 } |
BusType. More... | |
enum | HidbusJoyPollingMode { HidbusJoyPollingMode_SixAxisSensorDisable = 0 , HidbusJoyPollingMode_SixAxisSensorEnable = 1 , HidbusJoyPollingMode_ButtonOnly = 2 } |
JoyPollingMode. More... | |
Functions | |
Result | hidbusGetServiceSession (Service *srv_out) |
Gets the Service object for the actual hidbus service session. This object must be closed by the user once finished using cmds with this. | |
void * | hidbusGetSharedmemAddr (void) |
Gets the SharedMemory addr (HidbusStatusManagerV5 on 5.x, otherwise HidbusStatusManager). Only valid when at least one BusHandle is currently initialized (hidbusInitialize). | |
Result | hidbusGetBusHandle (HidbusBusHandle *handle, bool *flag, HidNpadIdType id, HidbusBusType bus_type) |
GetBusHandle. More... | |
Result | hidbusInitialize (HidbusBusHandle handle) |
Initialize. More... | |
Result | hidbusFinalize (HidbusBusHandle handle) |
Finalize. More... | |
Result | hidbusEnableExternalDevice (HidbusBusHandle handle, bool flag, u32 device_id) |
EnableExternalDevice. More... | |
Result | hidbusSendAndReceive (HidbusBusHandle handle, const void *inbuf, size_t inbuf_size, void *outbuf, size_t outbuf_size, u64 *out_size) |
SendAndReceive. More... | |
Result | hidbusEnableJoyPollingReceiveMode (HidbusBusHandle handle, const void *inbuf, size_t inbuf_size, void *workbuf, size_t workbuf_size, HidbusJoyPollingMode polling_mode) |
EnableJoyPollingReceiveMode. More... | |
Result | hidbusDisableJoyPollingReceiveMode (HidbusBusHandle handle) |
DisableJoyPollingReceiveMode. More... | |
Result | hidbusGetJoyPollingReceivedData (HidbusBusHandle handle, HidbusJoyPollingReceivedData *recv_data, s32 count) |
GetJoyPollingReceivedData. More... | |
hidbus service IPC wrapper, for using external devices attached to HID controllers.
See also: https://switchbrew.org/wiki/HID_services#hidbus
enum HidbusBusType |
enum HidbusJoyPollingMode |
Result hidbusDisableJoyPollingReceiveMode | ( | HidbusBusHandle | handle | ) |
DisableJoyPollingReceiveMode.
[in] | handle | HidbusBusHandle |
Result hidbusEnableExternalDevice | ( | HidbusBusHandle | handle, |
bool | flag, | ||
u32 | device_id | ||
) |
EnableExternalDevice.
[in] | handle | HidbusBusHandle |
[in] | flag | Whether to enable the device (true = enable, false = disable). When false, this will internally use hidbusDisableJoyPollingReceiveMode if needed. |
[in] | device_id | ExternalDeviceId which must match the connected device. Only used when flag is set. |
Result hidbusEnableJoyPollingReceiveMode | ( | HidbusBusHandle | handle, |
const void * | inbuf, | ||
size_t | inbuf_size, | ||
void * | workbuf, | ||
size_t | workbuf_size, | ||
HidbusJoyPollingMode | polling_mode | ||
) |
EnableJoyPollingReceiveMode.
[in] | handle | HidbusBusHandle |
[in] | inbuf | Input buffer, containing the command data. |
[in] | inbuf_size | Input buffer size, must be <0x26. |
[out] | workbuf | TransferMemory buffer, must be 0x1000-byte aligned. This buffer must not be written to until after hidbusDisableJoyPollingReceiveMode is used. |
[in] | workbuf_size | TransferMemory buffer size, must be 0x1000-byte aligned. |
[in] | polling_mode | HidbusJoyPollingMode |
Result hidbusFinalize | ( | HidbusBusHandle | handle | ) |
Finalize.
[in] | handle | HidbusBusHandle |
Result hidbusGetBusHandle | ( | HidbusBusHandle * | handle, |
bool * | flag, | ||
HidNpadIdType | id, | ||
HidbusBusType | bus_type | ||
) |
GetBusHandle.
[out] | handle | HidbusBusHandle |
[out] | flag | Output flag indicating whether the handle is valid. |
[in] | id | HidNpadIdType |
[in] | bus_type | HidbusBusType |
Result hidbusGetJoyPollingReceivedData | ( | HidbusBusHandle | handle, |
HidbusJoyPollingReceivedData * | recv_data, | ||
s32 | count | ||
) |
GetJoyPollingReceivedData.
[in] | handle | HidbusBusHandle |
[out] | recv_data | Output array of HidbusJoyPollingReceivedData. |
[in] | count | Total entries for the recv_data array. The maximum is 0xa. Official apps use range 0x1-0x9. |
Result hidbusInitialize | ( | HidbusBusHandle | handle | ) |
Initialize.
[in] | handle | HidbusBusHandle |
Result hidbusSendAndReceive | ( | HidbusBusHandle | handle, |
const void * | inbuf, | ||
size_t | inbuf_size, | ||
void * | outbuf, | ||
size_t | outbuf_size, | ||
u64 * | out_size | ||
) |
SendAndReceive.
[in] | handle | HidbusBusHandle |
[in] | inbuf | Input buffer, containing the command data. |
[in] | inbuf_size | Input buffer size, must be <0x26. |
[out] | outbuf | Output buffer, containing the command reply data. |
[in] | outbuf_size | Output buffer max size. |
[out] | out_size | Actual output size. |