HID services: Difference between revisions
Line 2,864: | Line 2,864: | ||
== GetBusHandle == | == GetBusHandle == | ||
Takes an input u32 [[#NpadIdType]], an u64 [[#BusType]] | Takes an input u32 [[#NpadIdType]], an u64 [[#BusType]] and an u64 [[AM_services|AppletResourceUserId]]. Returns an output bool '''HasHandle''' and a [[#BusHandle]]. | ||
'''HasHandle''' indicates whether the [[#BusHandle]] is valid. | |||
Official sw will assert when [[#BusHandle]] InternalIndex is >=0x11 (>=0x13 with [6.0.0+]). This same check is also done for all funcs using [[#BusHandle]] as input. | Official sw will assert when [[#BusHandle]] InternalIndex is >=0x11 (>=0x13 with [6.0.0+]). This same check is also done for all funcs using [[#BusHandle]] as input. | ||
Line 2,873: | Line 2,873: | ||
== IsExternalDeviceConnected == | == IsExternalDeviceConnected == | ||
Takes an input [[#BusHandle]] | Takes an input [[#BusHandle]]. Returns an output bool '''IsAttached'''. | ||
This is not used by sdknso. | This is not used by sdknso. | ||
== Initialize == | == Initialize == | ||
Takes an input [[#BusHandle]] | Takes an input [[#BusHandle]] and an u64 [[AM_services|AppletResourceUserId]]. No output. | ||
Prior to using this cmd, sdknso handles [[#GetSharedMemoryHandle|sharedmem]] mapping if not done previously. | Prior to using this cmd, sdknso handles [[#GetSharedMemoryHandle|sharedmem]] mapping if not done previously. | ||
== Finalize == | == Finalize == | ||
Takes an input [[#BusHandle]] | Takes an input [[#BusHandle]] and an u64 [[AM_services|AppletResourceUserId]]. No output. | ||
== EnableExternalDevice == | == EnableExternalDevice == | ||
Takes an input | Takes an input bool '''IsEnabled''', a [[#BusHandle]], an u64 '''Version''' and an u64 [[AM_services|AppletResourceUserId]]. No output. | ||
sdknso passes value 0x38900050018 (0x3A600050018 with 7.x+) for | sdknso passes value 0x38900050018 (0x3A600050018 with 7.x+) for '''Version'''. | ||
'''IsEnabled''' indicates whether to enable the device (true = enable, false = disable). When false, this will use [[#DisableJoyPollingReceiveMode]] if needed. | |||
== GetExternalDeviceId == | == GetExternalDeviceId == | ||
Takes an input [[#BusHandle]] | Takes an input [[#BusHandle]]. Returns an output u32 '''DeviceId'''. | ||
== SendCommandAsync == | == SendCommandAsync == | ||
Takes a type-0x21 input buffer and a [[#BusHandle]] | Takes a type-0x21 input buffer and a [[#BusHandle]]. No output. | ||
== GetSendCommandAsynceResult == | == GetSendCommandAsynceResult == | ||
Takes a type-0x22 output buffer and a [[#BusHandle]] | Takes a type-0x22 output buffer and a [[#BusHandle]]. Returns an output u32 '''OutSize'''. | ||
Official sw copies | Official sw copies '''OutSize''' to an output u64, for the actual output size. | ||
== SetEventForSendCommandAsycResult == | == SetEventForSendCommandAsycResult == | ||
Takes an input [[#BusHandle]] | Takes an input [[#BusHandle]]. Returns an output Event handle '''AttachmentDataReceiveEventHandle''' with EventClearMode=0. | ||
Official sw with SendAndReceive clears this event (6.x+ sdknso), uses [[#SendCommandAsync]], waits on + clears this event, then uses [[#GetSendCommandAsynceResult]]. | Official sw with SendAndReceive clears this event (6.x+ sdknso), uses [[#SendCommandAsync]], waits on + clears this event, then uses [[#GetSendCommandAsynceResult]]. | ||
== GetSharedMemoryHandle == | == GetSharedMemoryHandle == | ||
No input | No input. Returns an output SharedMemory handle. | ||
The SharedMemory is mapped with size 0x1000 and permissions=R--. | The SharedMemory is mapped with size 0x1000 and permissions=R--. | ||
Line 2,941: | Line 2,941: | ||
== EnableJoyPollingReceiveMode == | == EnableJoyPollingReceiveMode == | ||
Takes a type-0x21 input buffer, a TransferMemory handle, an u32 | Takes a type-0x21 input buffer, a TransferMemory handle, an u32 '''TransferMemorySize''', an u32 [[#JoyPollingMode]] and a [[#BusHandle]]. No output. | ||
The TransferMemory is created with an user-specified output buffer, with permissions=R--. | The TransferMemory is created with an user-specified output buffer, with permissions=R--. | ||
Line 3,010: | Line 3,010: | ||
== DisableJoyPollingReceiveMode == | == DisableJoyPollingReceiveMode == | ||
Takes an input [[#BusHandle]] | Takes an input [[#BusHandle]]. No output. | ||
== SetStatusManagerType == | == SetStatusManagerType == | ||
Takes an input u32 | Takes an input u32 [[#StatusManagerType]]. No output. | ||
This is used by sdknso immediately after mapping [[#GetSharedMemoryHandle|sharedmem]] (before [[#Initialize]]) with hard-coded value 0x2. | This is used by sdknso immediately after mapping [[#GetSharedMemoryHandle|sharedmem]] (before [[#Initialize]]) with hard-coded value 0x2. |