Difference between revisions of "Services"
(Battery notifications →Notifications)
|Line 178:||Line 178:|
| Battery (by PTM
| Battery (by PTM
Latest revision as of 02:01, 13 May 2020
Services are an abstraction of ports and are the commonly used way of inter-process communication outside of the kernel. While handles of regular ports are retrieved from svcConnectToPort, service handles are retrieved through the port srv: ("service manager").
When a service is registered, svcCreatePort is used without a port-name. This means that the port is inaccessible via the port SVCs outside of sm-module. See below for getting a session handle for sending commands to services.
Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services. This value is obtained from svcGetSystemInfo. Other processes are limited to access services listed in their service access control list, as passed to SRVPM:RegisterProcess.
Attempting to use GetServiceHandle with a service that the process has access to when that service isn't registered will block until it is registered.
Service Manager Port "srv:"
It appears these "port" commands can be used for transferring arbitrary handles, however GetPort still uses the same service-access-control validation as GetServiceHandle. Despite this fact, it appears that a "port" and a service with the same name can coexist independently.
Service Manager Process-Manager Port/Service "srv:pm"
|Command Header (port), prior to 7.0.0-13||Command Header (service), post 7.0.0-13||Description|
Prior to to 7.0.0-13, the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with 7.0.0-13, the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with 7.0.0-13, see here. Originally any process could use "srv:pm", however starting with 7.0.0-13 only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the Process Manager.
|0x100||This indicates that the recipient must terminate. Does not require subscription.|
|0x101||Signaled to NS on sleep mode entry.|
|0x102||Sleep Mode related? Published by PTM|
|0x103||Fired on sleep mode entry, subscribed to by NS, CSND, NWM, AC and NIM. (Kernel state is modified by PTM after publishing this)|
|0x104||This indicates that the system is entering sleep mode. (Kernel state is modified by PTM before publishing this)|
|0x105||This indicates that the system has exited sleep mode.|
|0x106||Fired after sleep mode exit, subscribed to by NS, MIC, AC, NEWS, CECD and BOSS.|
|0x107||Unknown. Subscribed to by CECD module.|
|0x108||System is going to Power Down. Published by PTM.|
|0x109||? (Subscribed to by GSP)|
|0x10C||Sent by PM after it starts a regular application.|
|0x110-0x11F||Sent to NS on application exit. See PM launch flags.|
|0x179||Sent by PM to the caller (PTM or NS), after all other processes have terminated|
|0x200||Signaled just before sleep mode is exited from, subscribed to by NS.|
|0x202||POWER button pressed|
|0x203||POWER button held long|
|0x204||HOME button pressed|
|0x205||HOME button released|
|0x206||This is signaled by NWMEXT:ControlWirelessEnabled and when the physical Wi-Fi slider is enabled|
|0x207||SD card inserted|
|0x208||Game cartridge inserted|
|0x209||SD card removed|
|0x20A||Game cartridge removed|
|0x20B||Game cartridge inserted or removed|
|0x20C||mcu-module publishes this on a (fatal) hardware condition?, ptm throws fatal error F960D407 in receipt of this|
|0x20D||Charger plugged out|
|0x20E||Charger plugged in|
|0x20F||Published by the mcu module when (bitmask & 0x8000) is true. This bitmask is obtained by reading i2c register 0x10.|
|0x210||Published by the mcu module when (bitmask & 0x4000) is true. This bitmask is obtained by reading i2c register 0x10.|
|0x211||Battery very low (5%), published by PTM|
|0x212||Battery low (10%), published by PTM|
|0x213||Signaled after exiting sleep mode and early during system boot. Subscribed to by CODEC, HID, GSP, CAMERA, MIC, NDM and PTM. GSP powers LCD on in receipt to this, etc.|
|0x214||Signaled before entering sleep mode. Subscribed to by CODEC, HID, GSP, CAMERA, MIC, NDM and PTM. GSP shutdowns LCD in receipt to this, etc.|
|0x300||Signaled after sleep mode exit and during system boot, subscribed to by NDM.|
|0x301||Signaled just before sleep mode is exited from, subscribed to by FRIENDS and NDM.|
|0x302||Unknown. Signaled by nwm/AC module.|
|0x303||Unknown. Subscribed to by CECD module.|
|0x304||Unknown. Subscribed to by CECD module.|