Difference between revisions of "PSC services"

From Nintendo Switch Brew
Jump to navigation Jump to search
 
(37 intermediate revisions by 3 users not shown)
Line 47: Line 47:
 
| 6 || [[#GetModuleInformation|GetModuleInformation]]
 
| 6 || [[#GetModuleInformation|GetModuleInformation]]
 
|-
 
|-
| 10 || [9.0.0+] [[#AcquireLock|AcquireLock]]
+
| 7 || [17.0.0+] SetRandomDelay
 
|-
 
|-
| 11 || [9.0.0+] [[#HasLock|HasLock]]
+
| 10 || [9.0.0+] [[#GetStateLockUpdateEvent|GetStateLockUpdateEvent]]
 +
|-
 +
| 11 || [9.0.0+] [[#IsStateLocked|IsStateLocked]]
 
|}
 
|}
  
Line 73: Line 75:
 
Takes two type-0x6 output buffers '''DependencyInformationBefore''' and '''DependencyInformationAfter'''. Returns an output [[#PmModuleTransitionInformation]] and two output u32s '''DependencyInformationBeforeCount''' and '''DependencyInformationAfterCount'''.
 
Takes two type-0x6 output buffers '''DependencyInformationBefore''' and '''DependencyInformationAfter'''. Returns an output [[#PmModuleTransitionInformation]] and two output u32s '''DependencyInformationBeforeCount''' and '''DependencyInformationAfterCount'''.
  
== AcquireLock ==
+
== GetStateLockUpdateEvent ==
Unofficial name.
 
 
 
 
No input. Returns an output readable Event handle.
 
No input. Returns an output readable Event handle.
  
== HasLock ==
+
== IsStateLocked ==
Unofficial name.
+
Takes an input [[#PmState]]. Returns an output bool.
 
 
Takes an input u32. Returns an output bool.
 
  
 
= psc:m =
 
= psc:m =
Line 122: Line 120:
 
=== Acknowledge ===
 
=== Acknowledge ===
 
No input/output.
 
No input/output.
 +
 +
On newer versions this cmd just Aborts - this was replaced by [[#AcknowledgeEx|AcknowledgeEx]].
  
 
=== Finalize ===
 
=== Finalize ===
Line 146: Line 146:
 
| 3 || [[#IsLocked|IsLocked]]
 
| 3 || [[#IsLocked|IsLocked]]
 
|-
 
|-
| 4 || [[#GetLockId|GetLockId]]
+
| 4 || [[#GetRelatedState|GetRelatedState]]
 
|}
 
|}
  
 
== Initialize ==
 
== Initialize ==
Unofficial name.
+
Takes an input [[#PmState]]. No output.
 
 
Takes an input u32. No output.
 
  
 
== Lock ==
 
== Lock ==
Unofficial name.
 
 
 
No input/output.
 
No input/output.
  
 
== Unlock ==
 
== Unlock ==
Unofficial name.
 
 
 
No input/output.
 
No input/output.
  
 
== IsLocked ==
 
== IsLocked ==
Unofficial name.
 
 
 
No input. Returns an output bool.
 
No input. Returns an output bool.
  
== GetLockId ==
+
== GetRelatedState ==
Unofficial name.
+
No input. Returns an output [[#PmState]].
 
 
No input. Returns an output u32.
 
  
 
= srepo:u, srepo:a =
 
= srepo:u, srepo:a =
Line 178: 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 183: Line 175:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 10100 ||
+
| 10100 || [[#SaveReport]]
 +
|-
 +
| 10101 || [6.0.0+] [[#SaveReportWithUser]]
 +
|-
 +
| 10200 || [6.0.0+] [[#SaveReportForAntiPiracy]]
 +
|-
 +
| 10201 || [6.0.0+] [[#SaveReportWithUserForAntiPiracy]]
 +
|-
 +
| 10300 || [15.0.0+] [[#SendReportWithUser]]
 +
|-
 +
| 11000 || [6.0.0+] [[#NotifyUserList]]
 
|-
 
|-
| 10101 || [6.0.0+]
+
| 11001 || [6.0.0+] [[#NotifyUserDeleted]]
 
|-
 
|-
| 10200 || [6.0.0+]
+
| 11002 || [6.0.0+] [[#NotifyUserRegistered]]
 
|-
 
|-
| 10201 || [6.0.0+]
+
| 11003 || [6.0.0-10.2.0] [[#NotifyUserClosed]]
 
|-
 
|-
| 11000 || [6.0.0+]
+
| 11004 || [6.0.0-10.2.0] [[#NotifyUserOpened]]
 
|-
 
|-
| 11001 || [6.0.0+]
+
| 11005 || [11.0.0+] [[#NotifyUserClosedWithApplicationId]]
 
|-
 
|-
| 11002 || [6.0.0+]
+
| 11006 || [11.0.0+] [[#NotifyUserOpenedWithApplicationId]]
 
|-
 
|-
| 11003 || [6.0.0+]
+
| 11100 || [6.0.0+] [[#NotifyCompletedNetworkRequestChanged]]
 
|-
 
|-
| 11004 || [6.0.0+]
+
| 11200 || [6.0.0+] [[#NotifyFriendPresenceChanged]]
 
|-
 
|-
| 11100 || [6.0.0+]
+
| 11300 || [6.0.0+] [[#NotifyNotificationConnectivityChanged]]
 
|-
 
|-
| 11200 || [6.0.0+]
+
| 11400 || [6.0.0+] [[#NotifyDeviceOperationModeChanged]]
 
|-
 
|-
| 11300 || [6.0.0+]
+
| 11500 || [6.0.0+] [[#NotifySystemPowerStateChanged]]
 
|-
 
|-
| 11400 || [6.0.0+]
+
| 11600 || [6.0.0+] [[#NotifyAppletLaunched]]
 
|-
 
|-
| 11500 || [6.0.0+]
+
| 11601 || [6.0.0+] [[#NotifyAppletExited]]
 
|-
 
|-
| 11600 || [6.0.0+]
+
| 11602 || [6.0.0+] [[#NotifyForegroundAppletChanged]]
 
|-
 
|-
| 11601 || [6.0.0+]
+
| 11700 || [6.0.0+] [[#NotifyControllerCountChanged]]
 
|-
 
|-
| 11602 || [6.0.0+]
+
| 11800 || [6.0.0+] [[#NotifyAudioInStarted]]
 
|-
 
|-
| 11700 || [6.0.0+]
+
| 11801 || [6.0.0+] [[#NotifyAudioInStopped]]
 
|-
 
|-
| 11800 || [6.0.0+]
+
| 11810 || [8.0.0+] [[#NotifyLaunchApplicationStorage]]
 
|-
 
|-
| 11801 || [6.0.0+]
+
| 11811 || [8.0.0+] [[#NotifyApplicationRightsInfo]]
 
|-
 
|-
| 11810 || [8.0.0+]
+
| 12000 || [8.0.0+] [[#RegisterWatchdog]]
 
|-
 
|-
| 11811 || [8.0.0+]
+
| 12001 || [8.0.0+] [[#UnregisterWatchdog]]
 
|-
 
|-
| 12000 || [8.0.0+]
+
| 13000 || [8.0.0+] [[#GetSyslogLogger]]
 
|-
 
|-
| 12001 || [8.0.0+]
+
| 13001 || [8.0.0+] [[#SaveSyslogReport]]
 
|-
 
|-
| 13000 || [8.0.0+] [[#OpenSyslogLogger]]
+
| 13002 || [19.0.0+]  
 
|-
 
|-
| 13001 || [8.0.0+]
+
| 20100 || [[#PopReport]]
 
|-
 
|-
| 20100 ||
+
| 20200 || [[#GetPushEventReadableHandle]]
 
|-
 
|-
| 20200 ||
+
| 20300 || [6.0.0+] [[#Shutdown]]
 
|-
 
|-
| 20300 || [6.0.0+]
+
| 20400 || [6.0.0+] [[#PopLostByBufferShortageInfo]]
 
|-
 
|-
| 20400 || [6.0.0+]
+
| 20401 || [6.0.0+] [[#GetBufferUsageInfo]]
 
|-
 
|-
| 20401 || [6.0.0+]
+
| 20402 || [7.0.0+] [[#SetDurationReportChatteringDetectionThreshold]]
 
|-
 
|-
| 20402 || [7.0.0+]
+
| 20500 || [8.0.0+] [[#GetWatchdogStatistics]]
 
|-
 
|-
| 20500 || [8.0.0+]
+
| 20600 || [15.0.0+] [[#NotifyForegroundTransmissionResult]]
 
|}
 
|}
  
[10.0.0+] Cmd20100 now takes an additional 0x10-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.
 +
 
 +
== 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.
  
== OpenSyslogLogger ==
+
The input u32 must be <=1. This gets data from a state array with the specified index.
Takes a type-0x5 input buffer, no output.
 
  
[9.0.0+] No input, returns a total of 0xC-bytes of output, an [[#ISyslogLogger]], and a handle.
+
== 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 ==
 
== ISyslogLogger ==
Line 266: Line 418:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||  
+
| 0 || [[#ReallocateBuffer|ReallocateBuffer]]
 +
|}
 +
 
 +
=== ReallocateBuffer ===
 +
No input. Returns two output u32s.
 +
 
 +
This does the same entry-allocation in sharedmem as [[#GetSyslogLogger]].
 +
 
 +
== IAsyncContext ==
 +
This is "nn::srepo::detail::ipc::IAsyncContext".
 +
 
 +
This was added with [15.0.0+].
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 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 351: Line 535:
 
|-
 
|-
 
| 15 || [[#SetupEphemeralNetworkSystemClockCore]]
 
| 15 || [[#SetupEphemeralNetworkSystemClockCore]]
 +
|-
 +
| 20 || [19.0.0+] GetStandardSteadyClockCurrentTimePoint
 
|-
 
|-
 
| 50 || GetStandardLocalClockOperationEvent
 
| 50 || GetStandardLocalClockOperationEvent
Line 590: Line 776:
  
 
=== TimeSpanType ===
 
=== TimeSpanType ===
This is an u64.
+
This is an s64.
  
 
== ISystemClock ==
 
== ISystemClock ==
Line 780: Line 966:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#AddSource]]
+
| 0 || [[#GetInputSourceState]]
 
|-
 
|-
| 1 || [[#Receive]]
+
| 1 || [[#GetTriggerTargetEvent]]
 
|}
 
|}
  
== AddSource ==
+
== GetInputSourceState ==
Unofficial name.
 
 
 
 
Takes an input u32 '''SourceId'''. Returns an output u64 '''EventTime'''.
 
Takes an input u32 '''SourceId'''. Returns an output u64 '''EventTime'''.
  
== Receive ==
+
== GetTriggerTargetEvent ==
Unofficial name.
 
 
 
 
Takes an input u32 '''SourceId''' 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.
  
Line 804: Line 986:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#Send]]
+
| 0 || [[#GetNotifyEvent]]
 
|}
 
|}
  
== Send ==
+
== GetNotifyEvent ==
Unofficial name.
 
 
 
 
Takes an input u32 '''SourceId''' 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.
  
Line 821: Line 1,001:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || GetBatteryPercentage
 
|-
 
|-
| 1 ||
+
| 1 || GetChargerType
 
|-
 
|-
 
| 2 || [[#OpenChargeSession]]
 
| 2 || [[#OpenChargeSession]]
 
|-
 
|-
| 3 ||
+
| 3 || GetRawBatteryPercentage
 
|-
 
|-
| 4 ||
+
| 4 || GetBatteryVoltageLevel
 
|-
 
|-
 
| 5 || [[#OpenThermalSession]]
 
| 5 || [[#OpenThermalSession]]
 
|-
 
|-
| 6 ||
+
| 6 || GetAbnormalTemperatureSet
 
|-
 
|-
 
| 7 || [[#OpenClockSession]]
 
| 7 || [[#OpenClockSession]]
 
|-
 
|-
| 8 ||
+
| 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
 
|}
 
|}
  
Line 848: Line 1,038:
 
== OpenClockSession ==
 
== OpenClockSession ==
 
Takes an input u32. Returns an [[#IClockSession]].
 
Takes an input u32. Returns an [[#IClockSession]].
 +
 +
== OpenBridgeSession ==
 +
No input. Returns an [[#IBridgeSession]].
 +
 +
== OpenVsysVoltageSession ==
 +
No input. Returns an [[#IVsysVoltageSession]].
  
 
== IChargeSession ==
 
== IChargeSession ==
Line 856: Line 1,052:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || GetStateChangeEvent
 
|-
 
|-
| 1 ||
+
| 1 || SetStateChangeSet
 
|}
 
|}
  
Line 868: Line 1,064:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || GetAbnormalTemperatureEvent
 
|-
 
|-
| 1 ||
+
| 1 || SetAbnormalTemperatureEventMask
 
|}
 
|}
  
Line 880: Line 1,076:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 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
 
|}
 
|}
  
Line 892: Line 1,108:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#OpenChargeSetterSession]]
+
| 0 || [[#OpenChargeSession_2|OpenChargeSession]]
 +
|-
 +
| 1 || [[#OpenThermalSession_2|OpenThermalSession]]
 +
|-
 +
| 2 || SetClockRate
 +
|-
 +
| 3 || [17.0.0+] SetBridgePowerSupply
 
|-
 
|-
| 1 || [[#OpenThermalSetterSession]]
+
| 4 || [18.0.0+]  
 
|-
 
|-
| 2 ||
+
| 5 || [18.0.0+]
 
|}
 
|}
  
== OpenChargeSetterSession ==
+
== OpenChargeSession ==
 
Takes an input u32. Returns an [[#IChargeSetterSession]].
 
Takes an input u32. Returns an [[#IChargeSetterSession]].
  
== OpenThermalSetterSession ==
+
== OpenThermalSession ==
 
Takes an input u32. Returns an [[#IThermalSetterSession]].
 
Takes an input u32. Returns an [[#IThermalSetterSession]].
  
Line 912: Line 1,134:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || SetBatteryPercentage
 
|-
 
|-
| 1 ||
+
| 1 || SetRawBatteryPercentage
 
|-
 
|-
| 2 ||
+
| 2 || SetChargerType
 
|-
 
|-
| 3 ||
+
| 3 || SetBatteryVoltageLevel
 +
|-
 +
| 4 || [18.0.0+]
 +
|-
 +
| 5 || [19.0.0+]
 
|}
 
|}
  
Line 928: Line 1,154:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || SetAbnormalTemperatureSet
 
|}
 
|}
  
Line 948: Line 1,174:
 
| 0x04 || [[USB_services|Usb]]
 
| 0x04 || [[USB_services|Usb]]
 
|-
 
|-
| 0x05 || [[Sockets_services|Eth]]
+
| 0x05 || [[Ethernet_services|Eth]]
 
|-
 
|-
 
| 0x06 || [[PTM_services|Fgm]]
 
| 0x06 || [[PTM_services|Fgm]]
Line 974: Line 1,200:
 
| 0x11 || [[PTM_services|Tc]]
 
| 0x11 || [[PTM_services|Tc]]
 
|-
 
|-
| 0x12 || [[Applet_Manager_services|Omm]]
+
| 0x12 || [[OMM_services|Omm]]
 
|-
 
|-
 
| 0x13 || [[PCIe_services|Pcie]]
 
| 0x13 || [[PCIe_services|Pcie]]
Line 1,042: Line 1,268:
 
| 0x33 || [[NIM_services|Ntc]]
 
| 0x33 || [[NIM_services|Ntc]]
 
|-
 
|-
| 0x34 || [[Applet_Manager_services|Idle]]
+
| 0x34 || [[OMM_services|Idle]]
 
|-
 
|-
 
| 0x35 || [[Applet_Manager_services|Tcap]]
 
| 0x35 || [[Applet_Manager_services|Tcap]]
Line 1,062: Line 1,288:
 
| 0x3D || [[NS_Services|Ns]]
 
| 0x3D || [[NS_Services|Ns]]
 
|-
 
|-
| 0x3E ||  
+
| 0x3E || [[PTM_services|Powctl]]
 +
|-
 +
| 0x3F || [[OMM_services|NotificationPresenter]]
 +
|-
 +
| 0x40 || [[Glue_services|Notification]]
 
|-
 
|-
| 0x3F || [[Applet_Manager_services|NotificationPresenter]]
+
| 0x41 || [[Sockets_services|Dhcps]]
 
|-
 
|-
| 0x40 ||  
+
| 0x42 || [[BCAT_services|Mnpp]]
 
|-
 
|-
| 0x41 || [[Sockets_services|DhcpClient]]
+
| 0x43 || [[OLSC_services|Sprofile]]
 
|-
 
|-
 
| 0x65 || [[NV_services|NvHost]]
 
| 0x65 || [[NV_services|NvHost]]
 
|-
 
|-
| 0x69 || [[NV_services|NvDbgSvc]]
+
| 0x69 || NvDbgSvc
 
|-
 
|-
 
| 0x6A || Tspm
 
| 0x6A || Tspm
 
|-
 
|-
| 0x7F || [[Applet_Manager_services|Spsm]]
+
| 0x7F || [[OMM_services|Spsm]]
 
|}
 
|}
  
Line 1,145: Line 1,375:
 
| Reserved
 
| 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]]

Latest revision as of 20:03, 8 October 2024

PSC (Power State Control) provides services related to power state changes in the system.

Concept

psc:m allows a process to register a module that depends on power management in some way. A client calls GetPmModule to receive an IPmModule (Power Managed Module), and then calls IPmModule->Initialize(module_id, module_dependency_list) where module_id is the ModuleId enum member for the client, and the dependency list is an array of module IDs for the modules that this depends on. Initialize() returns an event handle that the client can wait on to be notified of a power state change.

psc:c allows a module to the power state controller for the system (in practice, AM is the only client to the controller). IPmControl->DispatchRequest() is used notify all IPmModules of a state change.

For example, FS registers itself as an IPmModule with dependencies on pinmux, gpio, pcv, tma, and initializes the SD card once those dependencies have registered..

It then does (basically) the following pseudocode (actual code located at .text + 0xB2DB0 in 6.0.0 FS):

   while (true) {
       Fs_IPmModule->WaitSignaled();
       
       Fs_IPmModule->GetRequest(&state);
       switch (state) {
           case WakingUp:
               /* hardware devices are woken up here */
           case GoingToSleep:
               /* hardware devices are put to sleep here */
           case ShuttingDown:
               /* hardware devices are turned off here */
       }
       
       Fs_IPmModule->Acknowledge(state);
   }

psc:c

This is "nn::psc::sf::IPmControl".

Cmd Name
0 Initialize
1 DispatchRequest
2 GetResult
3 GetState
4 Cancel
5 [1.0.0-6.2.0] PrintModuleInformation
6 GetModuleInformation
7 [17.0.0+] SetRandomDelay
10 [9.0.0+] GetStateLockUpdateEvent
11 [9.0.0+] 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

This is "nn::psc::sf::IPmService".

Cmd Name
0 GetPmModule

GetPmModule

No input. Returns an #IPmModule.

IPmModule

This is "nn::psc::sf::IPmModule".

Cmd Name
0 Initialize
1 GetRequest
2 Acknowledge
3 Finalize
4 [5.1.0+] 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.

Finalize

No input/output.

AcknowledgeEx

Takes an input #PmState. No output.

psc:l

This is "nn::psc::sf::IPmStateLock".

This was added with [9.0.0+].

Cmd Name
0 Initialize
1 Lock
2 Unlock
3 IsLocked
4 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

These are "nn::srepo::detail::ipc::ISrepoService".

These were added with [5.0.0+].

Some commands are only accessible by srepo:a. srepo:a is only accessible by bcat on retail.

Cmd Name
10100 #SaveReport
10101 [6.0.0+] #SaveReportWithUser
10200 [6.0.0+] #SaveReportForAntiPiracy
10201 [6.0.0+] #SaveReportWithUserForAntiPiracy
10300 [15.0.0+] #SendReportWithUser
11000 [6.0.0+] #NotifyUserList
11001 [6.0.0+] #NotifyUserDeleted
11002 [6.0.0+] #NotifyUserRegistered
11003 [6.0.0-10.2.0] #NotifyUserClosed
11004 [6.0.0-10.2.0] #NotifyUserOpened
11005 [11.0.0+] #NotifyUserClosedWithApplicationId
11006 [11.0.0+] #NotifyUserOpenedWithApplicationId
11100 [6.0.0+] #NotifyCompletedNetworkRequestChanged
11200 [6.0.0+] #NotifyFriendPresenceChanged
11300 [6.0.0+] #NotifyNotificationConnectivityChanged
11400 [6.0.0+] #NotifyDeviceOperationModeChanged
11500 [6.0.0+] #NotifySystemPowerStateChanged
11600 [6.0.0+] #NotifyAppletLaunched
11601 [6.0.0+] #NotifyAppletExited
11602 [6.0.0+] #NotifyForegroundAppletChanged
11700 [6.0.0+] #NotifyControllerCountChanged
11800 [6.0.0+] #NotifyAudioInStarted
11801 [6.0.0+] #NotifyAudioInStopped
11810 [8.0.0+] #NotifyLaunchApplicationStorage
11811 [8.0.0+] #NotifyApplicationRightsInfo
12000 [8.0.0+] #RegisterWatchdog
12001 [8.0.0+] #UnregisterWatchdog
13000 [8.0.0+] #GetSyslogLogger
13001 [8.0.0+] #SaveSyslogReport
13002 [19.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

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.

nn::srepo::detail::VerifyEventId is then used with the #EventId, throwing error on failure.

The #SystemReport is used with nn::srepo::detail::VerifyReport 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 nn::util::GenerateUuid() 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 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 Uid. No output.

Same as #SaveReportWithUser except the #SystemReport Flags field is 1 instead of 0.

SendReportWithUser

Takes an input 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 nn::srepo::detail::VerifyReport, returning an error on failure.

NotifyUserList

Takes a type-0x9 input buffer containing an array of 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 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 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 Uid. No output.

NotifyUserOpened

Takes an input Uid. No output.

NotifyUserClosedWithApplicationId

Takes an input Uid and an input u64 ApplicationId. No output.

NotifyUserOpenedWithApplicationId

Takes an input Uid and an input u64 ApplicationId. No output.

NotifyCompletedNetworkRequestChanged

Takes an input s8 and an input bool. No output.

NotifyFriendPresenceChanged

Takes an input 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.

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 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+].

Cmd Name
0 ReallocateBuffer

ReallocateBuffer

No input. Returns two output u32s.

This does the same entry-allocation in sharedmem as #GetSyslogLogger.

IAsyncContext

This is "nn::srepo::detail::ipc::IAsyncContext".

This was added with [15.0.0+].

Cmd Name
0 #GetSystemEvent
1 #Cancel
2 #GetResult

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

This is "nn::ovln::IReceiverService".

Cmd Name
0 OpenReceiver

IReceiver

This is "nn::ovln::IReceiver".

Cmd Name
0 AddSource
1 RemoveSource
2 GetReceiveEventHandle
3 Receive
4 ReceiveWithTick

ovln:snd

This is "nn::ovln::ISenderService".

Cmd Name
0 OpenSender

ISender

This is "nn::ovln::ISender".

Cmd Name
0 Send
1 GetUnreceivedMessageCount

time:m

This is "nn::timesrv::detail::service::ITimeServiceManager".

This was added with [9.0.0+].

This service has max_sessions 1.

Cmd Name
0 #GetStaticServiceAsUser
5 #GetStaticServiceAsAdmin
6 #GetStaticServiceAsRepair
9 #GetStaticServiceAsServiceManager
10 #SetupStandardSteadyClockCore
11 #SetupStandardLocalSystemClockCore
12 #SetupStandardNetworkSystemClockCore
13 #SetupStandardUserSystemClockCore
14 #SetupTimeZoneServiceCore
15 #SetupEphemeralNetworkSystemClockCore
20 [19.0.0+] GetStandardSteadyClockCurrentTimePoint
50 GetStandardLocalClockOperationEvent
51 GetStandardNetworkClockOperationEventForServiceManager
52 GetEphemeralNetworkClockOperationEventForServiceManager
60 GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent
100 #SetStandardSteadyClockBaseTime
200 GetClosestAlarmUpdatedEvent
201 #CheckAndSignalAlarms
202 GetClosestAlarmInfo

GetStaticServiceAsUser

Returns an #IStaticService.

This is used for the wrapped instance of "time:u" in glue.

GetStaticServiceAsAdmin

Returns an #IStaticService.

This is used for the wrapped instance of "time:a" in glue.

GetStaticServiceAsRepair

Returns an #IStaticService.

This is used for the wrapped instance of "time:r" in 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

This is "nn::timesrv::detail::service::IAlarmService".

This was added with [9.0.0+].

This has max_sessions 4.

Cmd Name
0 #CreateWakeupAlarm
1 #CreateBackgroundTaskAlarm

CreateWakeupAlarm

No input. Returns an #ISteadyClockAlarm.

CreateBackgroundTaskAlarm

No input. Returns an #ISteadyClockAlarm.

ISteadyClockAlarm

This is "nn::timesrv::detail::service::ISteadyClockAlarm".

This was added with [9.0.0+].

Cmd Name
0 #GetAlarmEvent
1 #Enable
2 #Disable
3 #IsEnabled
10 #CreateWakeLock
11 #DestroyWakeLock

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 and returns it's interface.

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 was added with [9.0.0+].

This service has max_sessions 1.

Cmd Name
0 GetPowerStateRequestEventReadableHandle
1 GetAndClearPowerStateRequest

time:su, time:s

These are "nn::timesrv::detail::service::IStaticService".

These were added with [9.0.0+].

The time:su service has max_sessions 6, and time:s has max_sessions 4.

Cmd Name Notes
0 GetStandardUserSystemClock Returns an #ISystemClock.
1 GetStandardNetworkSystemClock Returns an #ISystemClock.
2 GetStandardSteadyClock Returns an #ISteadyClock.
3 GetTimeZoneService Returns an #ITimeZoneService.
4 GetStandardLocalSystemClock Returns an #ISystemClock.
5 [4.0.0+] GetEphemeralNetworkSystemClock Returns an #ISystemClock.
20 [6.0.0+] GetSharedMemoryNativeHandle
30 [6.0.0-8.1.0] GetStandardNetworkClockOperationEventReadableHandle
31 [6.0.0-8.1.0] GetEphemeralNetworkClockOperationEventReadableHandle
50 [4.0.0+] SetStandardSteadyClockInternalOffset
51 [9.0.0+] GetStandardSteadyClockRtcValue
100 IsStandardUserSystemClockAutomaticCorrectionEnabled
101 SetStandardUserSystemClockAutomaticCorrectionEnabled
102 [5.0.0+] GetStandardUserSystemClockInitialYear
200 [3.0.0+] IsStandardNetworkSystemClockAccuracySufficient
201 [6.0.0+] GetStandardUserSystemClockAutomaticCorrectionUpdatedTime
300 [4.0.0+] CalculateMonotonicSystemClockBaseTimePoint
400 [4.0.0+] GetClockSnapshot
401 [4.0.0+] GetClockSnapshotFromSystemClockContext
500 [4.0.0+] CalculateStandardUserSystemClockDifferenceByUser
501 [4.0.0+] CalculateSpanBetween

ISteadyClock

This is "nn::timesrv::detail::service::ISteadyClock".

Cmd Name Notes
0 GetCurrentTimePoint No input, returns an output #SteadyClockTimePoint.
2 GetTestOffset No input, returns an output #TimeSpanType.
3 SetTestOffset Takes an input #TimeSpanType, no output.
100 [2.0.0+] GetRtcValue No input, returns an output s64.
101 [2.0.0+] IsRtcResetDetected No input, returns an output u8 bool.
102 [2.0.0+] GetSetupResultValue No input, returns an output u32.
200 [3.0.0+] GetInternalOffset No input, returns an output #TimeSpanType.
201 [3.0.0-3.0.2] SetInternalOffset Takes an input #TimeSpanType, no output.

SteadyClockTimePoint

Offset Size Description
0x0 0x8 A u64 representing a point in time.
0x8 0x10 An ID representing the clock source.

This is a 0x18-byte struct.

TimeSpanType

This is an s64.

ISystemClock

This is "nn::timesrv::detail::service::ISystemClock".

Cmd Name Notes
0 GetCurrentTime Returns an output #PosixTime.
1 SetCurrentTime Takes an input #PosixTime.
2 GetSystemClockContext Returns an output #SystemClockContext.
3 SetSystemClockContext Takes an input #SystemClockContext.
4 [9.0.0+] GetOperationEventReadableHandle

PosixTime

This is an s64 for UTC POSIX time.

SystemClockContext

This is an 0x20-byte struct.

Offset Size Description
0x0 0x8 a #PosixTime representing the system clock epoch.
0x8 0x18 a #SteadyClockTimePoint

ITimeZoneService

This is "nn::timesrv::detail::service::ITimeZoneService".

Cmd Name Notes
0 GetDeviceLocationName No input, returns an output #LocationName.
1 SetDeviceLocationName Takes an input #LocationName, no output.
2 GetTotalLocationNameCount No input, returns an output s32.
3 LoadLocationNameList
4 LoadTimeZoneRule Takes an input #LocationName and a type-0x16 output buffer for #TimeZoneRule, no output.
5 [2.0.0+] GetTimeZoneRuleVersion No input, returns an output #TimeZoneRuleVersion.
6 [5.0.0+] GetDeviceLocationNameAndUpdatedTime
7 [9.0.0+] SetDeviceLocationNameWithTimeZoneRule
8 [9.0.0+] ParseTimeZoneBinary
20 [9.0.0+] GetDeviceLocationNameOperationEventReadableHandle
100 ToCalendarTime Takes an input #PosixTime and a type-0x15 input buffer for #TimeZoneRule, returns an output #CalendarTime and #CalendarAdditionalInfo.
101 ToCalendarTimeWithMyRule Takes an input #PosixTime, returns an output #CalendarTime and #CalendarAdditionalInfo.
201 ToPosixTime Takes an input #CalendarTime, a type-0x15 input buffer for #TimeZoneRule, an type-0xA output buffer for #PosixTime array, and returns an output s32.
202 ToPosixTimeWithMyRule Takes an input #CalendarTime, an type-0xA output buffer for #PosixTime array, and returns an output s32.

LoadLocationNameList

Takes an input s32 LocationName_index and a type-0x6 output buffer for #LocationName, returns an output s32 for total output entries.

LocationName

This contains a TimeZone location string with a max size of 0x24 bytes.

TimeZoneRule

This is an 0x4000-byte struct. Official sw uses fixed-size 0x4000 for the buffer size with the above commands.

This is loaded from the TimeZoneBinary title with the specified LocationName under the zoneinfo/ directory, the content is then converted into this TimeZoneRule structure.

The files contained under zoneinfo/ directory are Tzif2 files without Tzif1 header and data at the begining of them (see RFC8536 for more information).

The conversion of a Tzif2 file to a TimeZoneRule structure is based on tz database code with some custom modifications (Leap seconds aren't handled, no usage of "posixrules" and Tzif1 support stripped out).

Offset Size Description
0x0 0x4 timecnt
0x4 0x4 typecnt
0x8 0x4 charcnt
0xC 0x1 goback
0xD 0x1 goahead
0xE 0x2 Padding
0x10 0x8 * 1000 ats
0x1f50 0x1 * 1000 types
0x2338 0x10 * 128 ttis (time type information), struct ttinfo[1000]
0x2b38 0x1 * 512 chars
0x2d38 0x4 defaulttype
0x2d3c 0x12c4 Reserved / Unused

ttinfo

This is an 0x10-byte struct. Represent a Time Type Information used in #TimeZoneRule.

Offset Size Description
0x0 0x4 tt_gmtoff
0x4 0x1 tt_isdst
0x5 0x3 Padding
0x8 0x4 tt_abbrind
0xC 0x1 tt_ttisstd
0xD 0x1 tt_ttisgmt
0xE 0x2 Padding

TimeZoneRuleVersion

This is an u128.

CalendarTime

Offset Size Description
0x0 0x2 Year
0x2 0x1 Month
0x3 0x1 Day
0x4 0x1 Hour
0x5 0x1 Minute
0x6 0x1 Second
0x7 0x1 Padding / unknown?

This is an 0x8-byte struct.

CalendarAdditionalInfo

Offset Size Description
0x0 0x4 0-based day-of-week.
0x4 0x4 0-based day-of-year.
0x8 0x8 Timezone name string.
0x10 0x4 0 = no DST, 1 = DST.
0x14 0x4 s32 seconds relative to UTC for this timezone.

This is an 0x18-byte struct. This stores timezone info.

ins:r

This is "nn::ins::IReceiverManager".

This was added with [9.0.0+].

Cmd Name
0 #GetInputSourceState
1 #GetTriggerTargetEvent

GetInputSourceState

Takes an input u32 SourceId. Returns an output u64 EventTime.

GetTriggerTargetEvent

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

This is "nn::ins::ISenderManager".

This was added with [9.0.0+].

Cmd Name
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+].

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

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".

Cmd Name
0 GetStateChangeEvent
1 SetStateChangeSet

IThermalSession

This is "nn::hshl::IThermalSession".

Cmd Name
0 GetAbnormalTemperatureEvent
1 SetAbnormalTemperatureEventMask

IClockSession

This is "nn::hshl::IClockSession".

Cmd Name
0 GetStateChangeEvent

IBridgeSession

This is "nn::hshl::IBridgeSession".

Cmd Name
0 GetStateChangeEvent

IVsysVoltageSession

This is "nn::hshl::IVsysVoltageSession".

Cmd Name
0 GetStateChangeEvent

hshl:set

This is "nn::hshl::ISetterManager".

This was added with [11.0.0+].

Cmd Name
0 OpenChargeSession
1 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".

Cmd Name
0 SetBatteryPercentage
1 SetRawBatteryPercentage
2 SetChargerType
3 SetBatteryVoltageLevel
4 [18.0.0+]
5 [19.0.0+]

IThermalSetterSession

This is "nn::hshl::IThermalSetterSession".

Cmd Name
0 SetAbnormalTemperatureSet

PmModuleId

This is "nn::psc::PmModuleId".

Name Module
0x00 Reserved0
0x01 Reserved1
0x02 Reserved2
0x03 Socket
0x04 Usb
0x05 Eth
0x06 Fgm
0x07 PcvClock
0x08 PcvVoltage
0x09 Gpio
0x0A Pinmux
0x0B Uart
0x0C I2c
0x0D I2cPowerBus
0x0E Spi
0x0F Pwm
0x10 Psm
0x11 Tc
0x12 Omm
0x13 Pcie
0x14 Lbl
0x15 Display
0x16 Multimedia
0x17 Time
0x18 Hid
0x19 SocketWlan
0x1A Wlan
0x1B Fs
0x1C Audio
0x1D Tm
0x1E TmHostIo
0x1F Bluetooth
0x20 Bpc
0x21 Fan
0x22 Pcm
0x23 Nfc
0x24 Apm
0x25 Btm
0x26 Nifm
0x27 GpioLow
0x28 Npns
0x29 Lm
0x2A Bcat
0x2B Time
0x2C Pctl
0x2D Erpt
0x2E Eupld
0x2F Friends
0x30 Bgtc
0x31 Account
0x32 Sasbus
0x33 Ntc
0x34 Idle
0x35 Tcap
0x36 PsmLow
0x37 Ndd
0x38 Olsc
0x39 Rtc
0x3A
0x3B
0x3C Led
0x3D Ns
0x3E Powctl
0x3F NotificationPresenter
0x40 Notification
0x41 Dhcps
0x42 Mnpp
0x43 Sprofile
0x65 NvHost
0x69 NvDbgSvc
0x6A Tspm
0x7F Spsm

PmState

This is "nn::psc::PmState".

Value Name Description
0 FullAwake Everything is awake.
1 MinimumAwake Preparing to transition to awake.
2 SleepReady Preparing to transition to sleep.
3 EssentialServicesSleepReady Critical services are ready to sleep.
4 EssentialServicesAwake Critical services are ready to wake up.
5 ShutdownReady Preparing to transition to shutdown.
6 Invalid Default state.

PmTransitionOrder

This is "nn::psc::PmTransitionOrder".

Value Description
0 ToLowerPowerState
1 ToHigherPowerState

PmModuleTransitionInformation

Offset Size Description
0x00 0x08 TimeBefore
0x08 0x10 TimeAfter
0x10 0x04 Result
0x14 0x04 StateBefore
0x18 0x04 StateAfter
0x1C 0x04 Reserved

SystemReport

This is "nn::srepo::SystemReport".

Offset Size Description
0x00 0x20 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".

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.