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

hid:dbg service IPC wrapper. More...

#include "../types.h"
#include "../services/hid.h"
#include "../services/hidsys.h"
#include "../sf/service.h"

Go to the source code of this file.

Data Structures

struct  HiddbgDebugPadAutoPilotState
 State for overriding HidDebugPadState. More...
 
struct  HiddbgMouseAutoPilotState
 State for overriding HidMouseState. More...
 
struct  HiddbgKeyboardAutoPilotState
 State for overriding HidKeyboardState. More...
 
struct  HiddbgSleepButtonAutoPilotState
 State for overriding SleepButtonState. More...
 
struct  HiddbgHdlsHandle
 HdlsHandle. More...
 
struct  HiddbgHdlsSessionId
 HdlsSessionId, returned by hiddbgAttachHdlsWorkBuffer. More...
 
struct  HiddbgHdlsDeviceInfoV7
 HdlsDeviceInfo, for [7.0.0-8.1.0]. More...
 
struct  HiddbgHdlsDeviceInfo
 HdlsDeviceInfo, for [9.0.0+]. Converted to/from HiddbgHdlsDeviceInfoV7 on prior sysvers. More...
 
struct  HiddbgHdlsStateV7
 HdlsState, for [7.0.0-8.1.0]. More...
 
struct  HiddbgHdlsStateV9
 HdlsState, for [9.0.0-11.0.1]. More...
 
struct  HiddbgHdlsState
 HdlsState, for [12.0.0+]. More...
 
struct  HiddbgHdlsNpadAssignmentEntry
 HdlsNpadAssignmentEntry. More...
 
struct  HiddbgHdlsNpadAssignment
 HdlsNpadAssignment. Same controllers as HiddbgHdlsStateList, with different entry data. More...
 
struct  HiddbgHdlsStateListEntryV7
 HdlsStateListEntryV7, for [7.0.0-8.1.0]. More...
 
struct  HiddbgHdlsStateListV7
 HdlsStateListV7, for [7.0.0-8.1.0]. This contains a list of all controllers, including non-virtual controllers. More...
 
struct  HiddbgHdlsStateListEntryV9
 HdlsStateListEntry, for [9.0.0-11.0.1]. More...
 
struct  HiddbgHdlsStateListV9
 HdlsStateList, for [9.0.0-11.0.1]. More...
 
struct  HiddbgHdlsStateListEntry
 HdlsStateListEntry, for [12.0.0+]. More...
 
struct  HiddbgHdlsStateList
 HdlsStateList, for [12.0.0+]. More...
 
struct  HiddbgAbstractedPadHandle
 AbstractedPadHandle. More...
 
struct  HiddbgAbstractedPadState
 AbstractedPadState. More...
 

Enumerations

enum  HiddbgNpadButton {
  HiddbgNpadButton_Home = (1U<<( 18 )),
  HiddbgNpadButton_Capture = (1U<<( 19 ))
}
 HiddbgNpadButton. For the remaining buttons, see HidNpadButton. More...
 
enum  HiddbgHdlsAttribute {
  HiddbgHdlsAttribute_HasVirtualSixAxisSensorAcceleration = (1U<<( 0 )),
  HiddbgHdlsAttribute_HasVirtualSixAxisSensorAngle = (1U<<( 1 ))
}
 HdlsAttribute. More...
 

Functions

Result hiddbgInitialize (void)
 Initialize hiddbg.
 
void hiddbgExit (void)
 Exit hiddbg.
 
ServicehiddbgGetServiceSession (void)
 Gets the Service object for the actual hiddbg service session.
 
Result hiddbgSetDebugPadAutoPilotState (const HiddbgDebugPadAutoPilotState *state)
 SetDebugPadAutoPilotState. More...
 
Result hiddbgUnsetDebugPadAutoPilotState (void)
 UnsetDebugPadAutoPilotState.
 
Result hiddbgSetTouchScreenAutoPilotState (const HidTouchState *states, s32 count)
 SetTouchScreenAutoPilotState. More...
 
Result hiddbgUnsetTouchScreenAutoPilotState (void)
 UnsetTouchScreenAutoPilotState.
 
Result hiddbgSetMouseAutoPilotState (const HiddbgMouseAutoPilotState *state)
 SetMouseAutoPilotState. More...
 
Result hiddbgUnsetMouseAutoPilotState (void)
 UnsetMouseAutoPilotState.
 
Result hiddbgSetKeyboardAutoPilotState (const HiddbgKeyboardAutoPilotState *state)
 SetKeyboardAutoPilotState. More...
 
Result hiddbgUnsetKeyboardAutoPilotState (void)
 UnsetKeyboardAutoPilotState.
 
Result hiddbgDeactivateHomeButton (void)
 Deactivates the HomeButton.
 
Result hiddbgSetSleepButtonAutoPilotState (const HiddbgSleepButtonAutoPilotState *state)
 SetSleepButtonAutoPilotState. More...
 
Result hiddbgUnsetSleepButtonAutoPilotState (void)
 UnsetSleepButtonAutoPilotState.
 
Result hiddbgUpdateControllerColor (u32 colorBody, u32 colorButtons, HidsysUniquePadId unique_pad_id)
 Writes the input RGB colors to the spi-flash for the specified UniquePad (offset 0x6050 size 0x6). More...
 
Result hiddbgUpdateDesignInfo (u32 colorBody, u32 colorButtons, u32 colorLeftGrip, u32 colorRightGrip, u8 inval, HidsysUniquePadId unique_pad_id)
 Writes the input RGB colors followed by inval to the spi-flash for the specified UniquePad (offset 0x6050 size 0xD). More...
 
Result hiddbgAcquireOperationEventHandle (Event *out_event, bool autoclear, HidsysUniquePadId unique_pad_id)
 Get the OperationEvent for the specified UniquePad. More...
 
Result hiddbgReadSerialFlash (u32 offset, void *buffer, size_t size, HidsysUniquePadId unique_pad_id)
 Reads spi-flash for the specified UniquePad. More...
 
Result hiddbgWriteSerialFlash (u32 offset, void *buffer, size_t tmem_size, size_t size, HidsysUniquePadId unique_pad_id)
 Writes spi-flash for the specified UniquePad. More...
 
Result hiddbgGetOperationResult (HidsysUniquePadId unique_pad_id)
 Get the Result for the Operation and handles cleanup, for the specified UniquePad. More...
 
Result hiddbgGetUniquePadDeviceTypeSetInternal (HidsysUniquePadId unique_pad_id, u32 *out)
 Gets the internal DeviceType for the specified controller. More...
 
AbstractedPad

This is for virtual HID controllers.

Only use this on pre-7.0.0, Hdls should be used otherwise.

Result hiddbgGetAbstractedPadHandles (HiddbgAbstractedPadHandle *handles, s32 count, s32 *total_out)
 Gets a list of HiddbgAbstractedPadHandle. More...
 
Result hiddbgGetAbstractedPadState (HiddbgAbstractedPadHandle handle, HiddbgAbstractedPadState *state)
 Gets the state for the specified HiddbgAbstractedPadHandle. More...
 
Result hiddbgGetAbstractedPadsState (HiddbgAbstractedPadHandle *handles, HiddbgAbstractedPadState *states, s32 count, s32 *total_out)
 Similar to hiddbgGetAbstractedPadHandles except this also returns the state for each pad in output array states. More...
 
Result hiddbgSetAutoPilotVirtualPadState (s8 AbstractedVirtualPadId, const HiddbgAbstractedPadState *state)
 Sets AutoPilot state for the specified pad. More...
 
Result hiddbgUnsetAutoPilotVirtualPadState (s8 AbstractedVirtualPadId)
 Clears AutoPilot state for the specified pad set by hiddbgSetAutoPilotVirtualPadState. More...
 
Result hiddbgUnsetAllAutoPilotVirtualPadState (void)
 Clears AutoPilot state for all pads set by hiddbgSetAutoPilotVirtualPadState.
 
Hdls

This is for virtual HID controllers.

Result hiddbgAttachHdlsWorkBuffer (HiddbgHdlsSessionId *session_id)
 Initialize Hdls. More...
 
Result hiddbgReleaseHdlsWorkBuffer (HiddbgHdlsSessionId session_id)
 Exit Hdls, must be called at some point prior to hiddbgExit. More...
 
Result hiddbgIsHdlsVirtualDeviceAttached (HiddbgHdlsSessionId session_id, HiddbgHdlsHandle handle, bool *out)
 Checks if the given device is still attached. More...
 
Result hiddbgDumpHdlsNpadAssignmentState (HiddbgHdlsSessionId session_id, HiddbgHdlsNpadAssignment *state)
 Gets state for HiddbgHdlsNpadAssignment. More...
 
Result hiddbgDumpHdlsStates (HiddbgHdlsSessionId session_id, HiddbgHdlsStateList *state)
 Gets state for HiddbgHdlsStateList. More...
 
Result hiddbgApplyHdlsNpadAssignmentState (HiddbgHdlsSessionId session_id, const HiddbgHdlsNpadAssignment *state, bool flag)
 Sets state for HiddbgHdlsNpadAssignment. More...
 
Result hiddbgApplyHdlsStateList (HiddbgHdlsSessionId session_id, const HiddbgHdlsStateList *state)
 Sets state for HiddbgHdlsStateList. More...
 
Result hiddbgAttachHdlsVirtualDevice (HiddbgHdlsHandle *handle, const HiddbgHdlsDeviceInfo *info)
 Attach a device with the input info. More...
 
Result hiddbgDetachHdlsVirtualDevice (HiddbgHdlsHandle handle)
 Detach the specified device. More...
 
Result hiddbgSetHdlsState (HiddbgHdlsHandle handle, const HiddbgHdlsState *state)
 Sets state for the specified device. More...
 

Detailed Description

hid:dbg service IPC wrapper.

Author
yellows8

Enumeration Type Documentation

◆ HiddbgHdlsAttribute

HdlsAttribute.

Enumerator
HiddbgHdlsAttribute_HasVirtualSixAxisSensorAcceleration 

HasVirtualSixAxisSensorAcceleration.

HiddbgHdlsAttribute_HasVirtualSixAxisSensorAngle 

HasVirtualSixAxisSensorAngle.

◆ HiddbgNpadButton

HiddbgNpadButton. For the remaining buttons, see HidNpadButton.

Enumerator
HiddbgNpadButton_Home 

HOME button.

HiddbgNpadButton_Capture 

Capture button.

Function Documentation

◆ hiddbgAcquireOperationEventHandle()

Result hiddbgAcquireOperationEventHandle ( Event out_event,
bool  autoclear,
HidsysUniquePadId  unique_pad_id 
)

Get the OperationEvent for the specified UniquePad.

Note
The Event must be closed by the user once finished with it.
Only available with [6.0.0+].
Parameters
[out]out_eventOutput Event.
[in]autoclearThe autoclear for the Event.
[in]unique_pad_idHidsysUniquePadId

◆ hiddbgApplyHdlsNpadAssignmentState()

Result hiddbgApplyHdlsNpadAssignmentState ( HiddbgHdlsSessionId  session_id,
const HiddbgHdlsNpadAssignment state,
bool  flag 
)

Sets state for HiddbgHdlsNpadAssignment.

Note
Only available with [7.0.0+].
Parameters
[in]session_id[13.0.0+] HiddbgHdlsSessionId
[in]stateHiddbgHdlsNpadAssignment
[in]flagFlag

◆ hiddbgApplyHdlsStateList()

Result hiddbgApplyHdlsStateList ( HiddbgHdlsSessionId  session_id,
const HiddbgHdlsStateList state 
)

Sets state for HiddbgHdlsStateList.

Note
The HiddbgHdlsState will be applied for each HiddbgHdlsHandle. If a HiddbgHdlsHandle is not found, code similar to hiddbgAttachHdlsVirtualDevice will run with the HiddbgHdlsDeviceInfo, then it will continue with applying state with the new device.
Only available with [7.0.0+].
Parameters
[in]session_id[13.0.0+] HiddbgHdlsSessionId
[in]stateHiddbgHdlsStateList

◆ hiddbgAttachHdlsVirtualDevice()

Result hiddbgAttachHdlsVirtualDevice ( HiddbgHdlsHandle handle,
const HiddbgHdlsDeviceInfo info 
)

Attach a device with the input info.

Note
Only available with [7.0.0+].
Parameters
[out]handleHiddbgHdlsHandle
[in]infoHiddbgHdlsDeviceInfo

◆ hiddbgAttachHdlsWorkBuffer()

Result hiddbgAttachHdlsWorkBuffer ( HiddbgHdlsSessionId session_id)

Initialize Hdls.

Note
Only available with [7.0.0+].
Parameters
[out]session_id[13.0.0+] HiddbgHdlsSessionId

◆ hiddbgDetachHdlsVirtualDevice()

Result hiddbgDetachHdlsVirtualDevice ( HiddbgHdlsHandle  handle)

Detach the specified device.

Note
Only available with [7.0.0+].
Parameters
[in]handleHiddbgHdlsHandle

◆ hiddbgDumpHdlsNpadAssignmentState()

Result hiddbgDumpHdlsNpadAssignmentState ( HiddbgHdlsSessionId  session_id,
HiddbgHdlsNpadAssignment state 
)

Gets state for HiddbgHdlsNpadAssignment.

Note
Only available with [7.0.0+].
Parameters
[in]session_id[13.0.0+] HiddbgHdlsSessionId
[out]stateHiddbgHdlsNpadAssignment

◆ hiddbgDumpHdlsStates()

Result hiddbgDumpHdlsStates ( HiddbgHdlsSessionId  session_id,
HiddbgHdlsStateList state 
)

Gets state for HiddbgHdlsStateList.

Note
Only available with [7.0.0+].
Parameters
[in]session_id[13.0.0+] HiddbgHdlsSessionId
[out]stateHiddbgHdlsStateList

◆ hiddbgGetAbstractedPadHandles()

Result hiddbgGetAbstractedPadHandles ( HiddbgAbstractedPadHandle handles,
s32  count,
s32 total_out 
)

Gets a list of HiddbgAbstractedPadHandle.

Note
Only available with [5.0.0-8.1.0].
Parameters
[out]handlesOutput array of HiddbgAbstractedPadHandle.
[in]countMax number of entries for the handles array.
[out]total_outTotal output entries.

◆ hiddbgGetAbstractedPadsState()

Result hiddbgGetAbstractedPadsState ( HiddbgAbstractedPadHandle handles,
HiddbgAbstractedPadState states,
s32  count,
s32 total_out 
)

Similar to hiddbgGetAbstractedPadHandles except this also returns the state for each pad in output array states.

Note
Only available with [5.0.0-8.1.0].
Parameters
[out]handlesOutput array of HiddbgAbstractedPadHandle.
[out]statesOutput array of HiddbgAbstractedPadState.
[in]countMax number of entries for the handles/states arrays.
[out]total_outTotal output entries.

◆ hiddbgGetAbstractedPadState()

Result hiddbgGetAbstractedPadState ( HiddbgAbstractedPadHandle  handle,
HiddbgAbstractedPadState state 
)

Gets the state for the specified HiddbgAbstractedPadHandle.

Note
Only available with [5.0.0-8.1.0].
Parameters
[in]handleHiddbgAbstractedPadHandle
[out]stateHiddbgAbstractedPadState

◆ hiddbgGetOperationResult()

Result hiddbgGetOperationResult ( HidsysUniquePadId  unique_pad_id)

Get the Result for the Operation and handles cleanup, for the specified UniquePad.

Note
Only available with [6.0.0+].
Parameters
[in]unique_pad_idHidsysUniquePadId

◆ hiddbgGetUniquePadDeviceTypeSetInternal()

Result hiddbgGetUniquePadDeviceTypeSetInternal ( HidsysUniquePadId  unique_pad_id,
u32 out 
)

Gets the internal DeviceType for the specified controller.

Note
Only available with [6.0.0+].
Parameters
[in]unique_pad_idHidsysUniquePadId
[out]outPre-9.0.0 this is an u32, with [9.0.0+] it's an u8.

◆ hiddbgIsHdlsVirtualDeviceAttached()

Result hiddbgIsHdlsVirtualDeviceAttached ( HiddbgHdlsSessionId  session_id,
HiddbgHdlsHandle  handle,
bool *  out 
)

Checks if the given device is still attached.

Note
Only available with [7.0.0+].
Parameters
[in]session_id[13.0.0+] HiddbgHdlsSessionId
[in]handleHiddbgHdlsHandle
[out]outWhether the device is attached.

◆ hiddbgReadSerialFlash()

Result hiddbgReadSerialFlash ( u32  offset,
void *  buffer,
size_t  size,
HidsysUniquePadId  unique_pad_id 
)

Reads spi-flash for the specified UniquePad.

Note
This also uses hiddbgAcquireOperationEventHandle to wait for the operation to finish, then hiddbgGetOperationResult is used.
Only available with [6.0.0+].
Parameters
[in]offsetOffset in spi-flash.
[out]bufferOutput buffer.
[in]sizeOutput buffer size.
[in]unique_pad_idHidsysUniquePadId

◆ hiddbgReleaseHdlsWorkBuffer()

Result hiddbgReleaseHdlsWorkBuffer ( HiddbgHdlsSessionId  session_id)

Exit Hdls, must be called at some point prior to hiddbgExit.

Note
Only available with [7.0.0+].
Parameters
[in]session_id[13.0.0+] HiddbgHdlsSessionId

◆ hiddbgSetAutoPilotVirtualPadState()

Result hiddbgSetAutoPilotVirtualPadState ( s8  AbstractedVirtualPadId,
const HiddbgAbstractedPadState state 
)

Sets AutoPilot state for the specified pad.

Note
Only available with [5.0.0-8.1.0].
Parameters
[in]AbstractedVirtualPadIdThis can be any unique value as long as it's within bounds. For example, 0-7 is usable.
[in]stateHiddbgAbstractedPadState

◆ hiddbgSetDebugPadAutoPilotState()

Result hiddbgSetDebugPadAutoPilotState ( const HiddbgDebugPadAutoPilotState state)

SetDebugPadAutoPilotState.

Parameters
[in]stateHiddbgDebugPadAutoPilotState

◆ hiddbgSetHdlsState()

Result hiddbgSetHdlsState ( HiddbgHdlsHandle  handle,
const HiddbgHdlsState state 
)

Sets state for the specified device.

Note
Only available with [7.0.0+].
Parameters
[in]handleHiddbgHdlsHandle
[in]stateHiddbgHdlsState

◆ hiddbgSetKeyboardAutoPilotState()

Result hiddbgSetKeyboardAutoPilotState ( const HiddbgKeyboardAutoPilotState state)

SetKeyboardAutoPilotState.

Parameters
[in]stateHiddbgKeyboardAutoPilotState

◆ hiddbgSetMouseAutoPilotState()

Result hiddbgSetMouseAutoPilotState ( const HiddbgMouseAutoPilotState state)

SetMouseAutoPilotState.

Parameters
[in]stateHiddbgMouseAutoPilotState

◆ hiddbgSetSleepButtonAutoPilotState()

Result hiddbgSetSleepButtonAutoPilotState ( const HiddbgSleepButtonAutoPilotState state)

SetSleepButtonAutoPilotState.

Parameters
[in]stateHiddbgSleepButtonAutoPilotState

◆ hiddbgSetTouchScreenAutoPilotState()

Result hiddbgSetTouchScreenAutoPilotState ( const HidTouchState states,
s32  count 
)

SetTouchScreenAutoPilotState.

Parameters
[in]statesInput array of HiddbgMouseAutoPilotState.
[in]countTotal entries in the states array. Max is 16.

◆ hiddbgUnsetAutoPilotVirtualPadState()

Result hiddbgUnsetAutoPilotVirtualPadState ( s8  AbstractedVirtualPadId)

Clears AutoPilot state for the specified pad set by hiddbgSetAutoPilotVirtualPadState.

Note
Only available with [5.0.0-8.1.0].
Parameters
[in]AbstractedVirtualPadIdId from hiddbgSetAutoPilotVirtualPadState.

◆ hiddbgUpdateControllerColor()

Result hiddbgUpdateControllerColor ( u32  colorBody,
u32  colorButtons,
HidsysUniquePadId  unique_pad_id 
)

Writes the input RGB colors to the spi-flash for the specified UniquePad (offset 0x6050 size 0x6).

Note
Only available with [3.0.0+].
Parameters
[in]colorBodyRGB body color.
[in]colorButtonsRGB buttons color.
[in]unique_pad_idHidsysUniquePadId

◆ hiddbgUpdateDesignInfo()

Result hiddbgUpdateDesignInfo ( u32  colorBody,
u32  colorButtons,
u32  colorLeftGrip,
u32  colorRightGrip,
u8  inval,
HidsysUniquePadId  unique_pad_id 
)

Writes the input RGB colors followed by inval to the spi-flash for the specified UniquePad (offset 0x6050 size 0xD).

Note
Only available with [5.0.0+].
Parameters
[in]colorBodyRGB body color.
[in]colorButtonsRGB buttons color.
[in]colorLeftGripRGB left grip color.
[in]colorRightGripRGB right grip color.
[in]invalInput value.
[in]unique_pad_idHidsysUniquePadId

◆ hiddbgWriteSerialFlash()

Result hiddbgWriteSerialFlash ( u32  offset,
void *  buffer,
size_t  tmem_size,
size_t  size,
HidsysUniquePadId  unique_pad_id 
)

Writes spi-flash for the specified UniquePad.

Note
This also uses hiddbgAcquireOperationEventHandle to wait for the operation to finish, then hiddbgGetOperationResult is used.
Only available with [6.0.0+].
Parameters
[in]offsetOffset in spi-flash.
[in]bufferInput buffer, must be 0x1000-byte aligned.
[in]tmem_sizeSize of the buffer, must be 0x1000-byte aligned.
[in]sizeActual transfer size.
[in]unique_pad_idHidsysUniquePadId