PSC services: Difference between revisions

 
(73 intermediate revisions by 4 users not shown)
Line 33: Line 33:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || Initialize
| 0 || [[#Initialize|Initialize]]
|-
|-
| 1 || DispatchRequest
| 1 || [[#DispatchRequest|DispatchRequest]]
|-
|-
| 2 || GetResult
| 2 || [[#GetResult|GetResult]]
|-
|-
| 3 || GetState
| 3 || [[#GetState|GetState]]
|-
|-
| 4 || Cancel
| 4 || [[#Cancel|Cancel]]
|-
|-
| 5 || [1.0.0-6.2.0] PrintModuleInformation
| 5 || [1.0.0-6.2.0] [[#PrintModuleInformation|PrintModuleInformation]]
|-
|-
| 6 || GetModuleInformation
| 6 || [[#GetModuleInformation|GetModuleInformation]]
|-
|-
| 10 || [9.0.0+]
| 7 || [17.0.0+] SetRandomDelay
|-
|-
| 11 || [9.0.0+]
| 10 || [9.0.0+] [[#GetStateLockUpdateEvent|GetStateLockUpdateEvent]]
|-
| 11 || [9.0.0+] [[#IsStateLocked|IsStateLocked]]
|}
|}
== Initialize ==
No input. Returns an output readable Event handle.
== DispatchRequest ==
Takes an input [[#PmState]], an input [[#PmTransitionOrder]] and an input u32 '''Flags'''. No output.
== GetResult ==
No input/output.
== GetState ==
No input. Returns an output [[#PmState]].
== Cancel ==
No input/output.
== PrintModuleInformation ==
No input/output.
== GetModuleInformation ==
Takes two type-0x6 output buffers '''DependencyInformationBefore''' and '''DependencyInformationAfter'''. Returns an output [[#PmModuleTransitionInformation]] and two output u32s '''DependencyInformationBeforeCount''' and '''DependencyInformationAfterCount'''.
== GetStateLockUpdateEvent ==
No input. Returns an output readable Event handle.
== IsStateLocked ==
Takes an input [[#PmState]]. Returns an output bool.


= psc:m =
= psc:m =
Line 57: Line 86:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Cmd || Name || Notes
! Cmd || Name
|-
|-
| 0 || GetPmModule || Returns an [[#IPmModule]].
| 0 || [[#GetPmModule|GetPmModule]]
|}
|}
== GetPmModule ==
No input. Returns an [[#IPmModule]].


== IPmModule ==
== IPmModule ==
Line 69: Line 101:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || Initialize
| 0 || [[#Initialize_2|Initialize]]
|-
|-
| 1 || GetRequest
| 1 || [[#GetRequest|GetRequest]]
|-
|-
| 2 || Acknowledge
| 2 || [[#Acknowledge|Acknowledge]]
|-
|-
| 3 || Finalize
| 3 || [[#Finalize|Finalize]]
|-
|-
| 4 || [5.1.0+] AcknowledgeEx
| 4 || [5.1.0+] [[#AcknowledgeEx|AcknowledgeEx]]
|}
|}
=== Initialize ===
Takes an input [[#PmModuleId]] and a type-0x5 input buffer '''Dependencies'''. Returns an output Event handle.
=== GetRequest ===
No input. Returns an output [[#PmState]] and an output u32 '''Flags'''.
=== Acknowledge ===
No input/output.
On newer versions this cmd just Aborts - this was replaced by [[#AcknowledgeEx|AcknowledgeEx]].
=== Finalize ===
No input/output.
=== AcknowledgeEx ===
Takes an input [[#PmState]]. No output.


= psc:l =
= psc:l =
This is "nn::psc::sf::IPmStateLock".
This was added with [9.0.0+].
This was added with [9.0.0+].


Line 87: Line 138:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||
| 0 || [[#Initialize_3|Initialize]]
|-
|-
| 1 ||
| 1 || [[#Lock|Lock]]
|-
|-
| 2 ||
| 2 || [[#Unlock|Unlock]]
|-
|-
| 3 ||
| 3 || [[#IsLocked|IsLocked]]
|-
|-
| 4 ||
| 4 || [[#GetRelatedState|GetRelatedState]]
|}
|}
== Initialize ==
Takes an input [[#PmState]]. No output.
== Lock ==
No input/output.
== Unlock ==
No input/output.
== IsLocked ==
No input. Returns an output bool.
== GetRelatedState ==
No input. Returns an output [[#PmState]].


= srepo:u, srepo:a =
= srepo:u, srepo:a =
Line 102: Line 168:


These were added with [5.0.0+].
These were added with [5.0.0+].
Some commands are only accessible by srepo:a. srepo:a is only accessible by [[BCAT_services|bcat]] on retail.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 107: Line 175:
! Cmd || Name
! Cmd || Name
|-
|-
| 10100 ||
| 10100 || [[#SaveReport]]
|-
|-
| 10101 || [6.0.0+]
| 10101 || [6.0.0+] [[#SaveReportWithUser]]
|-
|-
| 10200 || [6.0.0+]
| 10200 || [6.0.0+] [[#SaveReportForAntiPiracy]]
|-
|-
| 10201 || [6.0.0+]
| 10201 || [6.0.0+] [[#SaveReportWithUserForAntiPiracy]]
|-
|-
| 11000 || [6.0.0+]
| 10300 || [15.0.0+] [[#SendReportWithUser]]
|-
|-
| 11001 || [6.0.0+]
| 11000 || [6.0.0+] [[#NotifyUserList]]
|-
|-
| 11002 || [6.0.0+]
| 11001 || [6.0.0+] [[#NotifyUserDeleted]]
|-
|-
| 11003 || [6.0.0+]
| 11002 || [6.0.0+] [[#NotifyUserRegistered]]
|-
|-
| 11004 || [6.0.0+]
| 11003 || [6.0.0-10.2.0] [[#NotifyUserClosed]]
|-
|-
| 11100 || [6.0.0+]
| 11004 || [6.0.0-10.2.0] [[#NotifyUserOpened]]
|-
|-
| 11200 || [6.0.0+]
| 11005 || [11.0.0+] [[#NotifyUserClosedWithApplicationId]]
|-
|-
| 11300 || [6.0.0+]
| 11006 || [11.0.0+] [[#NotifyUserOpenedWithApplicationId]]
|-
|-
| 11400 || [6.0.0+]
| 11100 || [6.0.0+] [[#NotifyCompletedNetworkRequestChanged]]
|-
|-
| 11500 || [6.0.0+]
| 11200 || [6.0.0+] [[#NotifyFriendPresenceChanged]]
|-
|-
| 11600 || [6.0.0+]
| 11300 || [6.0.0+] [[#NotifyNotificationConnectivityChanged]]
|-
|-
| 11601 || [6.0.0+]
| 11400 || [6.0.0+] [[#NotifyDeviceOperationModeChanged]]
|-
|-
| 11602 || [6.0.0+]
| 11500 || [6.0.0+] [[#NotifySystemPowerStateChanged]]
|-
|-
| 11700 || [6.0.0+]
| 11600 || [6.0.0+] [[#NotifyAppletLaunched]]
|-
|-
| 11800 || [6.0.0+]
| 11601 || [6.0.0+] [[#NotifyAppletExited]]
|-
|-
| 11801 || [6.0.0+]
| 11602 || [6.0.0+] [[#NotifyForegroundAppletChanged]]
|-
|-
| 11810 || [8.0.0+]
| 11700 || [6.0.0+] [[#NotifyControllerCountChanged]]
|-
|-
| 11811 || [8.0.0+]
| 11800 || [6.0.0+] [[#NotifyAudioInStarted]]
|-
|-
| 12000 || [8.0.0+]
| 11801 || [6.0.0+] [[#NotifyAudioInStopped]]
|-
|-
| 12001 || [8.0.0+]
| 11810 || [8.0.0+] [[#NotifyLaunchApplicationStorage]]
|-
|-
| 13000 || [8.0.0+]
| 11811 || [8.0.0+] [[#NotifyApplicationRightsInfo]]
|-
| 12000 || [8.0.0+] [[#RegisterWatchdog]]
|-
| 12001 || [8.0.0+] [[#UnregisterWatchdog]]
|-
| 12010 || [20.0.0+]
|-
| 13000 || [8.0.0+] [[#GetSyslogLogger]]
|-
| 13001 || [8.0.0-19.0.1] [[#SaveSyslogReport]]
|-
| 13002 || [19.0.0+]
|-
| 13003 || [20.0.0+]
|-
| 13004 || [20.0.0+]
|-
| 20100 || [[#PopReport]]
|-
| 20200 || [[#GetPushEventReadableHandle]]
|-
| 20300 || [6.0.0+] [[#Shutdown]]
|-
| 20400 || [6.0.0+] [[#PopLostByBufferShortageInfo]]
|-
| 20401 || [6.0.0+] [[#GetBufferUsageInfo]]
|-
| 20402 || [7.0.0+] [[#SetDurationReportChatteringDetectionThreshold]]
|-
| 20500 || [8.0.0+] [[#GetWatchdogStatistics]]
|-
| 20600 || [15.0.0+] [[#NotifyForegroundTransmissionResult]]
|}
 
[20.0.0+] Cmd13002 now takes a total of 8-bytes of input.
 
== SaveReport ==
Takes a type-0x9 input buffer containing the [[#EventId]], an input u64 '''ApplicationId''' and a type-0x5 input buffer containing the [[#SystemReport]]. No output.
 
<code>nn::srepo::detail::VerifyEventId</code> is then used with the [[#EventId]], throwing error on failure.
 
The [[#SystemReport]] is used with <code>nn::srepo::detail::VerifyReport</code> and with last param = 0x8000, throwing error on failure.
 
Lastly, the actual processing func is called, returning the Result from here. Besides various cmd input being passed to this etc, this also passes the output from <code>nn::util::GenerateUuid()</code> to this.
 
== SaveReportWithUser ==
Takes a type-0x9 input buffer containing the [[#EventId]], an input u64 '''ApplicationId''', a type-0x5 input buffer containing the [[#SystemReport]] and an input [[Account_services#Uid|Uid]]. No output.
 
Same as [[#SaveReport]] except instead of calling the processing func with Uid=all-zero, the input Uid is passed instead (which must be non-zero).
 
== SaveReportForAntiPiracy ==
Takes a type-0x9 input buffer containing the [[#EventId]], an input u64 '''ApplicationId''' and a type-0x5 input buffer containing the [[#SystemReport]]. No output.
 
Same as [[#SaveReport]] except the [[#SystemReport]] Flags field is 1 instead of 0.
 
== SaveReportWithUserForAntiPiracy ==
Takes a type-0x9 input buffer containing the [[#EventId]], an input u64 '''ApplicationId''', a type-0x5 input buffer containing the [[#SystemReport]] and an input [[Account_services#Uid|Uid]]. No output.
 
Same as [[#SaveReportWithUser]] except the [[#SystemReport]] Flags field is 1 instead of 0.
 
== SendReportWithUser ==
Takes an input [[Account_services#Uid|Uid]], an input u64 '''ApplicationId''', an input bool (padded to u64), two input u32s, a type-0x9 input buffer and a TransferMemory handle. Returns an output [[#IAsyncContext]].
 
The mapped TransferMemory buffer is used with <code>nn::srepo::detail::VerifyReport</code>, returning an error on failure.
 
== NotifyUserList ==
Takes a type-0x9 input buffer containing an array of [[Account_services#Uid|Uid]]. No output.
 
The Sf handler code (func which calls the serv obj vfunc) will throw an error if the buffer size is >0x8F (that is, >8 entries).
 
This gets data from a state list, then clears the is_initialized flag for each entry. Lastly when the input array count is non-zero, this loops through the input array writing each entry into the aforementioned state list. If this would run out of space, it would skip writing that entry and still continue - however this shouldn't be possible with the above Sf check. Then this returns 0.
 
== NotifyUserDeleted ==
Takes an input [[Account_services#Uid|Uid]]. No output.
 
This calls the same state-reset func as [[#NotifyUserList]], except this passes the input Uid instead. Then this returns 0.
 
== NotifyUserRegistered ==
Takes an input [[Account_services#Uid|Uid]]. No output.
 
This calls the same state-writing func as [[#NotifyUserList]], except this passes the input Uid instead. Then this returns 0.
 
== NotifyUserClosed ==
Takes an input [[Account_services#Uid|Uid]]. No output.
 
== NotifyUserOpened ==
Takes an input [[Account_services#Uid|Uid]]. No output.
 
== NotifyUserClosedWithApplicationId ==
Takes an input [[Account_services#Uid|Uid]] and an input u64 '''ApplicationId'''. No output.
 
== NotifyUserOpenedWithApplicationId ==
Takes an input [[Account_services#Uid|Uid]] and an input u64 '''ApplicationId'''. No output.
 
== NotifyCompletedNetworkRequestChanged ==
Takes an input s8 and an input bool. No output.
 
== NotifyFriendPresenceChanged ==
Takes an input [[Account_services#Uid|Uid]] and an input s8 (padded to u64). No output.
 
== NotifyNotificationConnectivityChanged ==
Takes an input s8. No output.
 
== NotifyDeviceOperationModeChanged ==
Takes an input s8. No output.
 
== NotifySystemPowerStateChanged ==
Takes an input s8. No output.
 
== NotifyAppletLaunched ==
Takes an input [[#SfAppletIdentityInfo]]. No output.
 
== NotifyAppletExited ==
Takes an input [[#SfAppletIdentityInfo]]. No output.
 
== NotifyForegroundAppletChanged ==
Takes an input [[#SfAppletIdentityInfo]]. No output.
 
== NotifyControllerCountChanged ==
Takes three input s8s. No output.
 
== NotifyAudioInStarted ==
Takes a type-0x5 input buffer and an input u64. No output.
 
== NotifyAudioInStopped ==
Takes a type-0x5 input buffer and an input u64. No output.
 
== NotifyLaunchApplicationStorage ==
Takes an input u64 '''ApplicationId''' and an input u8 (padded to u64). No output.
 
== NotifyApplicationRightsInfo ==
Takes an input u64 '''ApplicationId''' and an input u32 (padded to u64). No output.
 
If the input u32 is 0 or none of the bits are recognized, this just returns 0. Otherwise the lowest set bit is used to determine a value to write to stack (the ApplicationId is also written afterwards), for passing to a func.
 
{| class="wikitable" border="1"
|-
|-
| 13001 || [8.0.0+]
! Bit || Write value
|-
|-
| 20100 ||
| 0 || 0x2
|-
|-
| 20200 ||
| 3 || 0x3
|-
|-
| 20300 || [6.0.0+]
| 4 || 0x4
|-
|-
| 20400 || [6.0.0+]
| 5 || [20.1.0+] 0x5
|-
|-
| 20401 || [6.0.0+]
| 6 || [20.1.0+] 0x6
|}
 
== RegisterWatchdog ==
Takes a type-0x9 input buffer, an input [[#TimeSpanType]] and an input u64. Returns an output [[#WatchdogHandle]].
 
== UnregisterWatchdog ==
Takes an input [[#WatchdogHandle]]. No output.
 
== GetSyslogLogger ==
Takes a type-0x5 input buffer. No output.
 
[9.0.0+] No input. Returns three output u32s, an [[#ISyslogLogger]] and a SharedMemory handle.
 
The SharedMemory is mapped with the returned size and with permissions=RW.
 
== SaveSyslogReport ==
Takes an input u128 "nn::util::Uuid". No output.
 
== PopReport ==
Takes a type-0xA output buffer and a type-0x6 output buffer. Returns an output [[Account_services#Uid|Uid]].
 
[6.0.0+] This now returns an additional output u64 '''ApplicationId''' and an output u128 "nn::util::Uuid".
 
[10.0.0+] This now returns an additional output u64 and two output u32s.
 
This is only usable with srepo:a.
 
== GetPushEventReadableHandle ==
No input. Returns an output Event handle.
 
This is only usable with srepo:a.
 
== Shutdown ==
No input/output.
 
== PopLostByBufferShortageInfo ==
Takes an input u32. Returns two output u64s.
 
The input u32 must be <=1. This gets data from a state array with the specified index.
 
== GetBufferUsageInfo ==
No input. Returns two output u64s.
 
The first u64 is a constant value, while the second u64 is from state.
 
== SetDurationReportChatteringDetectionThreshold ==
Takes an input [[#TimeSpanType]] and an input u64. No output.
 
The input s64 must be >=1. The two input fields are written into global state, and various state is also cleared.
 
== GetWatchdogStatistics ==
No input. Returns an output [[#WatchdogStatistics]].
 
This gets two u64s from global state.
 
== NotifyForegroundTransmissionResult ==
Takes an input u128 "nn::util::Uuid" and an input [[#ResultHolder]]. No output.
 
This goes through the global list of [[#IAsyncContext]] looking for an entry with data matching the input struct, then writes the input [[#ResultHolder]] into that [[#IAsyncContext]]. This Result would then be returned by [[#GetResult]] - the Event from [[#GetSystemEvent]] is also signaled.
 
This always returns 0.
 
== ISyslogLogger ==
This is "nn::srepo::detail::ipc::ISyslogLogger".
 
This was added with [9.0.0+].
 
{| class="wikitable" border="1"
|-
|-
| 20402 || [7.0.0+]
! Cmd || Name
|-
|-
| 20500 || [8.0.0+]
| 0 || [[#ReallocateBuffer|ReallocateBuffer]]
|}
|}


== Cmd13000 ==
=== ReallocateBuffer ===
Takes a type-0x5 input buffer, no output.
No input. Returns two output u32s.


[9.0.0+] No input, returns a total of 0xC-bytes of output, an [[#IUnknown0]], and a handle.
This does the same entry-allocation in sharedmem as [[#GetSyslogLogger]].


== IUnknown0 ==
== IAsyncContext ==
Added with [9.0.0+].
This is "nn::srepo::detail::ipc::IAsyncContext".
 
This was added with [15.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 186: Line 460:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||  
| 0 || [[#GetSystemEvent]]
|-
| 1 || [[#Cancel]]
|-
| 2 || [[#GetResult]]
|}
|}


Cmd0: no input, returns a total of 8-bytes of output.
=== GetSystemEvent ===
No input, returns an output Event.
 
=== Cancel ===
No input/output.
 
This just returns 0.
 
=== GetResult ===
No input/output.
 
This checks if the Event from GetSystemEvent was signaled throwing an error if not, otherwise this returns the Result stored in the context object.


= ovln:rcv =
= ovln:rcv =
Line 241: Line 530:
|}
|}


= time:su =
= time:m =
This is "nn::timesrv::detail::service::ITimeServiceManager".
This is "nn::timesrv::detail::service::ITimeServiceManager".


This was added with [9.0.0+].
This was added with [9.0.0+].
This service has max_sessions 1.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 250: Line 541:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||
| 0 || [[#GetStaticServiceAsUser]]
|-
|-
| 5 ||
| 5 || [[#GetStaticServiceAsAdmin]]
|-
|-
| 6 ||
| 6 || [[#GetStaticServiceAsRepair]]
|-
|-
| 9 ||
| 9 || [[#GetStaticServiceAsServiceManager]]
|-
|-
| 10 ||
| 10 || [[#SetupStandardSteadyClockCore]]
|-
|-
| 11 ||
| 11 || [[#SetupStandardLocalSystemClockCore]]
|-
|-
| 12 ||
| 12 || [[#SetupStandardNetworkSystemClockCore]]
|-
|-
| 13 ||
| 13 || [[#SetupStandardUserSystemClockCore]]
|-
|-
| 14 ||
| 14 || [[#SetupTimeZoneServiceCore]]
|-
|-
| 15 ||
| 15 || [[#SetupEphemeralNetworkSystemClockCore]]
|-
|-
| 50 ||
| 20 || [19.0.0+] GetStandardSteadyClockCurrentTimePoint
|-
|-
| 51 ||
| 50 || GetStandardLocalClockOperationEvent
|-
|-
| 52 ||
| 51 || GetStandardNetworkClockOperationEventForServiceManager
|-
|-
| 60 ||
| 52 || GetEphemeralNetworkClockOperationEventForServiceManager
|-
|-
| 100 ||
| 60 || GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent
|-
|-
| 200 ||
| 100 || [[#SetStandardSteadyClockBaseTime]]
|-
|-
| 201 ||
| 200 || GetClosestAlarmUpdatedEvent
|-
|-
| 202 ||
| 201 || [[#CheckAndSignalAlarms]]
|-
| 202 || GetClosestAlarmInfo
|}
|}
== GetStaticServiceAsUser ==
Returns an [[#IStaticService]].
This is used for the wrapped instance of "time:u" in [[Glue_services#time:a.2C_time:r.2C_time:u|glue]].
== GetStaticServiceAsAdmin ==
Returns an [[#IStaticService]].
This is used for the wrapped instance of "time:a" in [[Glue_services#time:a.2C_time:r.2C_time:u|glue]].
== GetStaticServiceAsRepair ==
Returns an [[#IStaticService]].
This is used for the wrapped instance of "time:r" in [[Glue_services#time:a.2C_time:r.2C_time:u|glue]].
== GetStaticServiceAsServiceManager ==
Returns an [[#IStaticService]].
This is used as a wrapper for "time:sm".
== SetupStandardSteadyClockCore ==
Takes an input rtc_clock_source UUID, an input rtc_offset s64, an input internal_offset s64, an input test_offset s64 and a is_rtc_reset_detected bool. No output.
== SetupStandardLocalSystemClockCore ==
Takes an input [[#SystemClockContext]] and an input [[#PosixTime]]. No output.
== SetupStandardNetworkSystemClockCore ==
Takes an input [[#SystemClockContext]] and an input sufficient_accuracy_minutes u64. No output.
== SetupStandardUserSystemClockCore ==
Takes an input automatic_correction bool and an input [[#SteadyClockTimePoint]]. No output.
== SetupTimeZoneServiceCore ==
Takes an input [[#LocationName]], an input [[#SteadyClockTimePoint]], an input total_location_name_count u32, an input [[#TimeZoneRuleVersion]] and a type-0x21 input buffer containing a TimeZoneBinary. No output.
== SetupEphemeralNetworkSystemClockCore ==
No input, no output.
== SetStandardSteadyClockBaseTime ==
An input rtc_offset s64, no output.
== CheckAndSignalAlarms ==
No input, no output.


= time:al =
= time:al =
Line 291: Line 628:


This was added with [9.0.0+].
This was added with [9.0.0+].
This has max_sessions 4.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 296: Line 635:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||
| 0 || [[#CreateWakeupAlarm]]
|-
|-
| 1 ||
| 1 || [[#CreateBackgroundTaskAlarm]]
|}
|}


Cmd0/cmd1: no input, returns an [[#ISteadyClockAlarm]].
== CreateWakeupAlarm ==
No input. Returns an [[#ISteadyClockAlarm]].
 
== CreateBackgroundTaskAlarm ==
No input. Returns an [[#ISteadyClockAlarm]].


== ISteadyClockAlarm ==
== ISteadyClockAlarm ==
Line 312: Line 655:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||
| 0 || [[#GetAlarmEvent]]
|-
|-
| 1 ||
| 1 || [[#Enable]]
|-
|-
| 2 ||
| 2 || [[#Disable]]
|-
|-
| 3 ||
| 3 || [[#IsEnabled]]
|-
|-
| 10 ||
| 10 || [[#CreateWakeLock]]
|-
|-
| 11 ||
| 11 || [[#DestroyWakeLock]]
|}
|}


=== Cmd10 ===
=== GetAlarmEvent ===
No input, returns an output Event handle with EventClearMode=0.
 
Official sw uses this during object creation.
 
=== Enable ===
Takes an input u64, no output.
 
The u64 is a nanoseconds value.
 
=== Disable ===
No input/output.
 
Official sw uses [[#IsEnabled]] first, if the output bool is 0 it will skip using the Disable cmd.
 
=== IsEnabled ===
No input, returns an output bool.
 
=== CreateWakeLock ===
Opens a session for [[#psc:l|psc:l]] and returns it's interface.
Opens a session for [[#psc:l|psc:l]] and returns it's interface.


= time:m =
=== DestroyWakeLock ===
No input/output.
 
Close the session opened by [[#CreateWakeLock]] when the alarm is disabled.
 
= time:p =
This is "nn::timesrv::detail::service::IPowerStateRequestHandler".
This is "nn::timesrv::detail::service::IPowerStateRequestHandler".


This was added with [9.0.0+].
This was added with [9.0.0+].
This service has max_sessions 1.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 337: Line 705:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||
| 0 || GetPowerStateRequestEventReadableHandle
|-
|-
| 1 ||
| 1 || GetAndClearPowerStateRequest
|}
|}


= time:s, time:p =
= time:su, time:s =
These are "nn::timesrv::detail::service::IStaticService".
These are "nn::timesrv::detail::service::IStaticService".


These were added with [9.0.0+].
These were added with [9.0.0+].
The time:su service has max_sessions 6, and time:s has max_sessions 4.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 431: Line 801:


=== TimeSpanType ===
=== TimeSpanType ===
This is an u64.
This is an s64.


== ISystemClock ==
== ISystemClock ==
Line 621: Line 991:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||
| 0 || [[#GetInputSourceState]]
|-
|-
| 1 ||
| 1 || [[#GetTriggerTargetEvent]]
|}
|}


== Cmd0 ==
== GetInputSourceState ==
Takes an input u32 '''InsID'''. Returns an u64.
Takes an input u32 '''SourceId'''. Returns an output u64 '''EventTime'''.


== Cmd1 ==
== GetTriggerTargetEvent ==
Takes an input u32 '''InsID''' and an input u64 (unused, official software passes struct pointer). Returns an output Event handle with autoclear disabled.
Takes an input u32 '''SourceId''' and an input u64 (unused, official software passes struct pointer). Returns an output Event handle with autoclear disabled.


= ins:s =
= ins:s =
Line 641: Line 1,011:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#Send]]
| 0 || [[#GetNotifyEvent]]
|}
 
== GetNotifyEvent ==
Takes an input u32 '''SourceId''' and an input u64 (unused, official software passes struct pointer). Returns an output Event handle with autoclear disabled.
 
= hshl:sys =
This is "nn::hshl::IManager".
 
This was added with [11.0.0+].
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetBatteryPercentage
|-
| 1 || GetChargerType
|-
| 2 || [[#OpenChargeSession]]
|-
| 3 || GetRawBatteryPercentage
|-
| 4 || GetBatteryVoltageLevel
|-
| 5 || [[#OpenThermalSession]]
|-
| 6 || GetAbnormalTemperatureSet
|-
| 7 || [[#OpenClockSession]]
|-
| 8 || GetClockRate
|-
| 9 || [17.0.0+] [[#OpenBridgeSession]]
|-
| 10 || [17.0.0+] GetBridgePowerSupply
|-
| 11 || [18.0.0+] [[#OpenVsysVoltageSession]]
|-
| 12 || [18.0.0+] GetIsBatteryEnoughForFullAwake
|-
| 13 || [19.0.0+] GetIsCharging
|-
| 14 || [20.0.0+]
|-
| 15 || [20.0.0+]
|}
 
== OpenChargeSession ==
No input. Returns an [[#IChargeSession]].
 
== OpenThermalSession ==
No input. Returns an [[#IThermalSession]].
 
== OpenClockSession ==
Takes an input u32. Returns an [[#IClockSession]].
 
== OpenBridgeSession ==
No input. Returns an [[#IBridgeSession]].
 
== OpenVsysVoltageSession ==
No input. Returns an [[#IVsysVoltageSession]].
 
== IChargeSession ==
This is "nn::hshl::IChargeSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetStateChangeEvent
|-
| 1 || SetStateChangeSet
|}
 
== IThermalSession ==
This is "nn::hshl::IThermalSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetAbnormalTemperatureEvent
|-
| 1 || SetAbnormalTemperatureEventMask
|}
 
== IClockSession ==
This is "nn::hshl::IClockSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetStateChangeEvent
|}
 
== IBridgeSession ==
This is "nn::hshl::IBridgeSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetStateChangeEvent
|}
 
== IVsysVoltageSession ==
This is "nn::hshl::IVsysVoltageSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || GetStateChangeEvent
|}
 
= hshl:set =
This is "nn::hshl::ISetterManager".
 
This was added with [11.0.0+].
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || [[#OpenChargeSession_2|OpenChargeSession]]
|-
| 1 || [[#OpenThermalSession_2|OpenThermalSession]]
|-
| 2 || SetClockRate
|-
| 3 || [17.0.0+] SetBridgePowerSupply
|-
| 4 || [18.0.0+]
|-
| 5 || [18.0.0+]
|}
 
== OpenChargeSession ==
Takes an input u32. Returns an [[#IChargeSetterSession]].
 
== OpenThermalSession ==
Takes an input u32. Returns an [[#IThermalSetterSession]].
 
== IChargeSetterSession ==
This is "nn::hshl::IChargeSetterSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || SetBatteryPercentage
|-
| 1 || SetRawBatteryPercentage
|-
| 2 || SetChargerType
|-
| 3 || SetBatteryVoltageLevel
|-
| 4 || [18.0.0+]
|-
| 5 || [19.0.0+]
|-
| 6 || [20.0.0+]
|-
| 7 || [20.0.0+]
|}
 
== IThermalSetterSession ==
This is "nn::hshl::IThermalSetterSession".
 
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || SetAbnormalTemperatureSet
|}
|}


== Send ==
= PmModuleId =
Takes an input u32 SenderID and an input u64 (unused, official software passes struct pointer). Returns an output Event handle autoclear disabled.
This is "nn::psc::PmModuleId".


= PSC Module IDs =
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! ID || Module
! Name || Module
|-
|-
| 0x03 ||
| 0x00 || Reserved0
|-
|-
| 0x04 || [[USB services|USB]]
| 0x01 || Reserved1
|-
|-
| 0x05 ||
| 0x02 || Reserved2
|-
|-
| 0x07 || [[PCV services|Pcv]]
| 0x03 || [[Sockets_services|Socket]]
|-
|-
| 0x08 || [[PCV services|Pcv:Imm]]
| 0x04 || [[USB_services|Usb]]
|-
|-
| 0x09 || [[Bus services|Gpio]]
| 0x05 || [[Ethernet_services|Eth]]
|-
|-
| 0x0A || [[Bus services|Pinmux]]
| 0x06 || [[PTM_services|Fgm]]
|-
|-
| 0x0B || [[Bus services|Uart]]
| 0x07 || [[PCV_services|PcvClock]]
|-
|-
| 0x0C || [[Bus services|I2c]]
| 0x08 || [[PCV_services|PcvVoltage]]
|-
|-
| 0x0D || [[Bus services|I2c:Pcv]]
| 0x09 || [[Bus_services|Gpio]]
|-
|-
| 0x0E || [[Bus services|Sasbus]]
| 0x0A || [[Bus_services|Pinmux]]
|-
|-
| 0x0F || [[Bus services|Pwm]]
| 0x0B || [[Bus_services|Uart]]
|-
|-
| 0x10 ||
| 0x0C || [[Bus_services|I2c]]
|-
|-
| 0x13 || [[PCIe services|PCIe]]
| 0x0D || [[Bus_services|I2cPowerBus]]
|-
|-
| 0x14 || [[Backlight services|Backlight]]
| 0x0E || [[Bus_services|Spi]]
|-
|-
| 0x15 || [[Nvnflinger services|Nvnflinger]]
| 0x0F || [[Bus_services|Pwm]]
|-
|-
| 0x18 || [[HID services|nn::psc::PmModuleId_Hid]]
| 0x10 || [[PTM_services|Psm]]
|-
|-
| 0x1B ||
| 0x11 || [[PTM_services|Tc]]
|-
|-
| 0x1C || [[Audio services|Audio]]
| 0x12 || [[OMM_services|Omm]]
|-
|-
| 0x1E ||
| 0x13 || [[PCIe_services|Pcie]]
|-
|-
| 0x1F || [[Bluetooth Driver services|Bluetooth]]
| 0x14 || [[Backlight_services|Lbl]]
|-
|-
| 0x20 || [[PCV services|Bpc]]
| 0x15 || [[Nvnflinger_services|Display]]
|-
|-
| 0x21 || [[PTM services|Ptm]]
| 0x16 || [[Display_services|Multimedia]]
|-
|-
| 0x23 || [[NFC services|nn::psc::PmModuleId_Nfc]]
| 0x17 || Time
|-
| 0x18 || [[HID_services|Hid]]
|-
| 0x19 || [[WLAN_services|SocketWlan]]
|-
| 0x1A || [[WLAN_services|Wlan]]
|-
| 0x1B || [[Filesystem_services|Fs]]
|-
| 0x1C || [[Audio_services|Audio]]
|-
| 0x1D || [[TMA_services|Tm]]
|-
| 0x1E || [[TMA_services|TmHostIo]]
|-
| 0x1F || [[Bluetooth_Driver_services|Bluetooth]]
|-
| 0x20 || [[PCV_services|Bpc]]
|-
| 0x21 || [[PTM_services|Fan]]
|-
| 0x22 || [[PTM_services|Pcm]]
|-
| 0x23 || [[NFC_services|Nfc]]
|-  
|-  
| 0x24 || [[PPC services|Ppc]]
| 0x24 || [[PTM_services|Apm]]
|-
| 0x25 || [[BTM_services|Btm]]
|-
| 0x26 || [[Network_Interface_services|Nifm]]
|-
| 0x27 || [[Bus_services|GpioLow]]
|-
| 0x28 || [[NPNS_services|Npns]]
|-
| 0x29 || [[Log_services|Lm]]
|-
| 0x2A || [[BCAT_services|Bcat]]
|-
|-
| 0x25 ||
| 0x2B || [[Glue_services|Time]]
|-
|-
| 0x26 || [[Network Interface services|Nifm]]
| 0x2C || [[Parental_Control_services|Pctl]]
|-
|-
| 0x28 || [[NPNS services|Npns]]
| 0x2D || [[Error_Report_services|Erpt]]
|-
|-
| 0x29 || [[Log services|nn::psc::PmModuleId_Lm]]
| 0x2E || [[Error_Upload_services|Eupld]]
|-
|-
| 0x2A || [[BCAT services|Bcat]]
| 0x2F || [[Friend_services|Friends]]
|-
|-
| 0x2B || [[PCV services|Time]]
| 0x30 || [[Glue_services|Bgtc]]
|-
|-
| 0x2C || [[Parental Control services|Pctl]]
| 0x31 || [[Account_services|Account]]
|-
|-
| 0x2D || [[Error Report services|Erpt]]
| 0x32 || [[Bus_services|Sasbus]]
|-
|-
| 0x2E || [[Error Upload services|Eupld]]
| 0x33 || [[NIM_services|Ntc]]
|-
|-
| 0x2F || [[Friend services|Friend]]
| 0x34 || [[OMM_services|Idle]]
|-
|-
| 0x30 || [[Glue services|Glue]]
| 0x35 || [[Applet_Manager_services|Tcap]]
|-
|-
| 0x31 || [[Account services|Account]]
| 0x36 || [[PTM_services|PsmLow]]
|-
|-
| 0x32 || [[Bus services|SasBus]]
| 0x37 || [[LDN_services|Ndd]]
|-
|-
| 0x65 || [[NV services|NV]]
| 0x38 || [[OLSC_services|Olsc]]
|-
| 0x39 || [[PCV_services|Rtc]]
|-
| 0x3A || [[PCV_services|Regulator]]
|-
| 0x3B || [[PCV_services|Clkrst]]
|-
| 0x3C || [[Bus_services|Led]]
|-
| 0x3D || [[NS_Services|NuiShell]]
|-
| 0x3E || [[PTM_services|Powctl]]
|-
| 0x3F || [[OMM_services|NotificationPresenter]]
|-
| 0x40 || [[Glue_services|Notification]]
|-
| 0x41 || [[Sockets_services|Dhcpc]]
|-
| 0x42 || [[BCAT_services|Mnpp]]
|-
| 0x43 || [[OLSC_services|Sprofile]]
|-
| 0x65 || [[NV_services|NvHost]]
|-
| 0x69 || NvDbgSvc
|-
| 0x6A || Tspm
|-
| 0x7F || [[OMM_services|Spsm]]
|}
|}


= Power Management States =
= PmState =
This is "nn::psc::PmState".
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! ID || Name || Description
! Value || Name || Description
|-
|-
| Awake || 0 || Everything is awake.
| 0 || FullAwake || Everything is awake.
|-
|-
| ReadyAwaken || 1 || Preparing to transition to awake.
| 1 || MinimumAwake || Preparing to transition to awake.
|-
|-
| ReadySleep || 2 || Preparing to transition to sleep.
| 2 || SleepReady || Preparing to transition to sleep.
|-
|-
| ReadySleepCritical || 3 || Critical services are ready to sleep.
| 3 || EssentialServicesSleepReady || Critical services are ready to sleep.
|-
|-
| ReadyAwakenCritical || 4 || Critical services are ready to wake up.
| 4 || EssentialServicesAwake || Critical services are ready to wake up.
|-
|-
| ReadyShutdown || 5 || Preparing to transition to shutdown.
| 5 || ShutdownReady || Preparing to transition to shutdown.
|-
| 6 || Invalid || Default state.
|}
|}
= PmTransitionOrder =
This is "nn::psc::PmTransitionOrder".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || ToLowerPowerState
|-
| 1 || ToHigherPowerState
|}
= PmModuleTransitionInformation =
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x00
| 0x08
| TimeBefore
|-
| 0x08
| 0x10
| TimeAfter
|-
| 0x10
| 0x04
| Result
|-
| 0x14
| 0x04
| [[#PmState|StateBefore]]
|-
| 0x18
| 0x04
| [[#PmState|StateAfter]]
|-
| 0x1C
| 0x04
| Reserved
|}
= SystemReport =
This is "nn::srepo::SystemReport".
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x00
| 0x20
| [[#EventId|EventId]]
|-
| 0x20
| 0x08
| ApplicationId
|-
| 0x28
| 0x04
| Flags
|-
| 0x2C
| 0x01
|
|-
| 0x2D
| 0x03
| Reserved
|-
| 0x30
| 0x08
| ReportBufferAddress
|-
| 0x38
| 0x08
| ReportBufferTotalSize
|-
| 0x40
| 0x08
| ReportBufferCurrentSize
|}
= EventId =
This is "nn::srepo::EventId". This is a 0x20-byte string.
= WatchdogHandle =
This is "nn::srepo::WatchdogHandle". This is an u64.
= WatchdogStatistics =
This is "nn::srepo::WatchdogStatistics".
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x00
| 0x08
|
|-
| 0x08
| 0x08
|
|}
= ResultHolder =
This is "nn::srepo::detail::ipc::ResultHolder". This is an u32.
= SfAppletIdentityInfo =
This is "nn::srepo::detail::ipc::SfAppletIdentityInfo". This is a 0x10-byte struct.


[[Category:Services]]
[[Category:Services]]