Difference between revisions of "Settings services"

From Nintendo Switch Brew
Jump to: navigation, search
(set:sys)
Line 22: Line 22:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 14 || GetDeviceCert
+
| 0 || GetBdAddress
 
|-
 
|-
| 15 || GetDeviceCert2
+
| 1 || GetConfigurationId1
 
|-
 
|-
| 16 || GetTLSClientPrivk
+
| 2 || GetAccelerometerOffset
 +
|-
 +
| 3 || GetAccelerometerScale
 +
|-
 +
| 4 || GetGyroscopeOffset
 +
|-
 +
| 5 || GetGyroscopeScale
 +
|-
 +
| 6 || GetWlanMacAddress
 +
|-
 +
| 7 || GetWlanCountryCodesNum
 +
|-
 +
| 8 || GetWlanCountryCodes
 +
|-
 +
| 9 || GetSerialNumber
 +
|-
 +
| 10 ||
 +
|-
 +
| 11 ||
 +
|-
 +
| 12 || GetBatteryLot
 +
|-
 +
| 14 || GetDeviceCertECC
 +
|-
 +
| 15 || GetETicketCertRSA
 +
|-
 +
| 16 || GetSslKey
 +
|-
 +
| 17 || GetSslCert
 +
|-
 +
| 18 || GetGamecardKey
 +
|-
 +
| 19 || GetGamecardCert
 +
|-
 +
| 20 || GetDeviceKeyECC
 +
|-
 +
| 21 || GetETicketKeyRSA
 +
|-
 +
| 22 || GetSpeakerCalibrationValues
 
|-
 
|-
| 17 || GetTLSClientCert
 
 
|}
 
|}
  
Used for accessing data calibrated at the factory. Probably only for console-unique data?(Everything read so far has been console-unique)
+
Used for accessing data calibrated at the factory.
  
== GetDeviceCert ==
+
== GetDeviceCertECC ==
 
Takes a type-0x16 output buffer with fixed size 0x180.
 
Takes a type-0x16 output buffer with fixed size 0x180.
  
 
Returns the DeviceCert. This is identical to 3DS DeviceCert/CTCert besides the strings. NIM loads the DeviceId from this.
 
Returns the DeviceCert. This is identical to 3DS DeviceCert/CTCert besides the strings. NIM loads the DeviceId from this.
  
== GetDeviceCert2 ==
+
== GetETicketCertRSA ==
 
Takes a type-0x16 output buffer with fixed size 0x240.
 
Takes a type-0x16 output buffer with fixed size 0x240.
  
Same as GetDeviceCert, except this returns more data and the data starts differing at offset 0x108 compared to GetDeviceCert.
+
Same as GetDeviceCertECC, except this returns more data and the data starts differing at offset 0x108 compared to GetDeviceCert.
  
== GetTLSClientPrivk ==
+
== GetSslKey ==
 
Takes a type-0x16 output buffer with fixed size 0x134.
 
Takes a type-0x16 output buffer with fixed size 0x134.
  
Line 50: Line 87:
 
Used by SSL-sysmodule, see [[SSL_services|here]].
 
Used by SSL-sysmodule, see [[SSL_services|here]].
  
== GetTLSClientCert ==
+
== GetSslCert ==
 
Takes a type-0x16 output buffer with fixed size 0x804.
 
Takes a type-0x16 output buffer with fixed size 0x804.
  

Revision as of 19:55, 7 September 2017

set

Cmd Name
0 GetLanguageCode
1 SetLanguageCode
3
4

set:fd

set:cal

Cmd Name
0 GetBdAddress
1 GetConfigurationId1
2 GetAccelerometerOffset
3 GetAccelerometerScale
4 GetGyroscopeOffset
5 GetGyroscopeScale
6 GetWlanMacAddress
7 GetWlanCountryCodesNum
8 GetWlanCountryCodes
9 GetSerialNumber
10
11
12 GetBatteryLot
14 GetDeviceCertECC
15 GetETicketCertRSA
16 GetSslKey
17 GetSslCert
18 GetGamecardKey
19 GetGamecardCert
20 GetDeviceKeyECC
21 GetETicketKeyRSA
22 GetSpeakerCalibrationValues

Used for accessing data calibrated at the factory.

GetDeviceCertECC

Takes a type-0x16 output buffer with fixed size 0x180.

Returns the DeviceCert. This is identical to 3DS DeviceCert/CTCert besides the strings. NIM loads the DeviceId from this.

GetETicketCertRSA

Takes a type-0x16 output buffer with fixed size 0x240.

Same as GetDeviceCertECC, except this returns more data and the data starts differing at offset 0x108 compared to GetDeviceCert.

GetSslKey

Takes a type-0x16 output buffer with fixed size 0x134.

Returns a container-structure for the encrypted TLS client-privk. Decrypting this fails unless an unknown size >0x134 is passed to this setcal cmd?

Used by SSL-sysmodule, see here.

GetSslCert

Takes a type-0x16 output buffer with fixed size 0x804.

Returns a container-structure for the plaintext TLS client-cert.

Used by SSL-sysmodule, see here.

setcal Container Structure

Offset Size Name
0x0 0x4 Size (same size used for decryption if needed)
0x4 {above size} Actual data starts here.

set:sys

Cmd Name
3 GetSystemVersion
37 QuerySetting
38 ReadSetting
56 GetWirelessCertification
62 GetDebugMode
68 GetSerialNumber

Official user-processes get a new service session handle each time a set:sys cmd is used, with the session being closed aftewards.

ReadSetting

Takes two type-0x19 input buffers and a type-0x6 output buffer. Returns an output u64 for the actual size written to the outbuf.

The outbuf_size is compared with the config_size. When config_size is larger than outbuf_size, outbuf_size is used for the memcpy, otherwise config_size is used. Afterwards the size used for the memcpy is written to output(see above).

If loading from main config fails, it will also attempt to load config from various state if the input strings match hard-coded strings.

GetSystemVersion

Takes a type-0x1A output buffer. User-processes use hard-coded size 0x100.

If needed, reads the content of the System_Version_Title "/file" into state. This is only done once.

Then the above 0x100-byte data is copied to the output buffer.

GetDebugMode

Returns an output u8.

Loads the 1-byte config for <"settings_debug", "is_debug_mode_enabled">. If that fails, value 0x1 is written to output. This uses the same func as ReadSetting internally.

Returned retval is always 0.

GetSerialNumber

Returns the 0x18-byte SerialNumber string.