Services API

From Nintendo Switch Brew
Jump to: navigation, search

Services are system processes running in the background which wait for incoming requests. When a process wants to communicate with a service, it first needs to get a handle to the named service, and then it can communicate with the service via inter-process communication (each service has a name up to 8 characters).

Handles for services are retrieved from the service manager port, "sm:", and are released via svcCloseHandle or when a process is terminated or crashes. Manager service "sm:m" also exists. Services are an abstraction of ports, they operate the same way except regular ports can have their handles retrieved directly from a SVC. Services are also able to limit the number of handles given to other processes.

sm:

Cmd Name
0 #Initialize
1 #GetService
2 #RegisterService
3 #UnregisterService

Initialize

Takes a pid descriptor and a reserved input u64.

GetService

Takes a zero-padded service name encoded as an u64 integer. Returns a handle.

RegisterService

Takes a zero-padded service name encoded as an u64 integer, an u8 bool, and an u32 at the next word. Returns a handle.

UnregisterService

Takes a zero-padded service name encoded as an u64 integer.

sm:m

Cmd Name
0 #RegisterProcess
1 #UnregisterProcess

RegisterProcess

Takes a pid and two A descriptors with the ACID and ACI0 service lists. That data originates from NPDM.

UnregisterProcess

Takes a pid.

Service List

Service names Description Notes
acc:u0, acc:u1, acc:aa, acc:su Account services u0: System, u1: User, su: Admin, aa: Baas
ahid:cd, ahid:hdr, hid, hid:dbg, hid:sys, irs, irs:sys, xcd:sys HID services
appletAE, appletOE, idle:sys, omm, spsm AM services
[1.0.0+] aoc:u, mii:u, mii:e, ns:am, ns:su, ns:dev, pl:u, ovln:rcv, ovln:snd, pdm:ntfy, pdm:qry

[3.0.0+] aoc:u, ns:am2, ns:dev, ns:ec, ns:rid, ns:rt, ns:su, ns:vm, ns:web, ovln:rcv, ovln:snd

NS Services am: Application Manager, su: System Update
apm, apm:p, apm:sys, fgm, fgm:0, fgm:9, (fgm:dbg?) APM services fgm: Fuel guage?
arp:r, arp:w, bgtc:t, bgtc:sc Glue services r: Reader, w: Writer
audin:a, audin:d, audin:u, audout:a, audout:d, audout:u, audren:a, audren:d, audren:u, audrec:a, audrec:d, audrec:u, audctl, codecctl, hwopus Audio services
banana  ? Some games on [3.0.0+] have access to this service, but it doesn't appear to be present on retail devices.
bcat:a, bcat:u, bcat:m, bcat:s, news:a, news:c, news:m, news:p, news:v, prepo:u, prepo:s, prepo:m, prepo:a BCAT services
bpc, bpc:r, pcv, pcv:arb, pcv:imm, time:u, time:a, time:s PCV services
bsd:u, bsd:s, bsdcfg, ethc:c, ethc:i, nsd:u, nsd:a, sfdnsres Sockets services, NSD services
btdrv Bluetooth Driver services
btm, btm:dbg, btm:sys Battery services
caps:a, caps:c Capture services a: AlbumAccessor, c: AlbumControl
caps:sc, caps:ss, mm:u, vi:m, vi:s, vi:u, cec-mgr Display services
dispdrv Nvnflinger services
erpt:c, erpt:r Error Report services
es ETicket services
fan, psm, tc, ts PTM services
fatal:u, fatal:p Fatal services u: User, p: Privileged
friend:u, friend:v, friend:m, friend:s, friend:a Friend services
fsp-srv, fsp-ldr, fsp-pr Filesystem services srv: Main, ldr: Loader, pr: Program Registry
gpio, i2c, i2c:pcv, pinmux, pwm, uart Bus services
htc, htcs, htc:tenv TMA services
lbl Backlight services
ldn:m, ldn:s, ldn:u LDN services
[1.0.0+] ldr:pm, ldr:ro, ldr:shel, ldr:dmnt

[3.0.0+] ldr:pm, ldr:shel, ldr:dmnt

Loader services
lm Log services
manu Manu Services "Manufacturing", present in factory firmware but not installed on retail systems.
lr, ncm, ncm:v NCM services
nfc:am, nfc:mf:u, nfc:user, nfc:sys NFC services
nifm:u, nifm:a, nifm:s Network Interface services
nim, nim:shp, ntc NIM services shp: eShop
npns:u, npns:s NPNS services
nvdrv:a, nvdrv:s, nvdrv:t, nvdrv, nvdrvdbg, nvgem:c, nvgem:cd, nvmemp NV services
pcie PCIe services
pctl, pctl:a, pctl:s, pctl:r Parental Control services
pm:bm, pm:info, pm:shell Process Manager services
psc:c, psc:m PSC services
[3.0.0+] ldr:ro, ro:dmnt RO services
set, set:fd, set:cal, set:sys Settings services cal: calibration, sys: System Settings
[3.0.0+] mii:u, mii:e, pdm:ntfy, pdm:qry, pl:u Shared Database services
ssl SSL services
csrng, spl: SPL services
usb:ds, usb:hs, usb:pd, usb:pd:c, usb:pm USB services
wlan:inf, wlan:lcl, wlan:lg, wlan:lga, wlan:sg, wlan:soc WLAN services