Display device ID using spl

This commit is contained in:
Joel16 2018-05-20 01:13:26 -05:00
parent f2ba108e1c
commit 72be1ff56e
3 changed files with 14 additions and 1 deletions

View File

@ -5,6 +5,7 @@ const char *SwitchIdent_GetVersion(void);
const char *SwitchIdent_GetHardwareType(void);
const char *SwitchIdent_GetUnit(void);
bool SwitchIdent_IsSafeMode(void);
u64 SwitchIdent_GetDeviceID(void);
const char *SwitchIdent_GetSerialNumber(void);
#endif

View File

@ -118,6 +118,17 @@ bool SwitchIdent_IsSafeMode(void)
return out;
}
u64 SwitchIdent_GetDeviceID(void)
{
Result ret = 0;
u64 deviceID = 0;
if (R_FAILED(ret = splGetConfig(SplConfigItem_DeviceId, &deviceID)))
printf("splGetConfig(SplConfigItem_DeviceId) failed: 0x%x.\n\n", ret);
return deviceID;
}
const char *SwitchIdent_GetSerialNumber(void)
{
Result ret = 0;

View File

@ -58,7 +58,8 @@ int main(int argc, char **argv)
*/
printf("\x1b[31;1m*\x1b[0m System version: \x1b[31;1m%s\n", SwitchIdent_GetVersion());
printf("\x1b[31;1m*\x1b[0m Hardware: \x1b[31;1m%s\x1b[0m (\x1b[31;1m%s\x1b[0m) \x1b[0m\n", SwitchIdent_GetHardwareType(), SwitchIdent_GetUnit());
printf("\x1b[31;1m*\x1b[0m Serial number: \x1b[31;1m%s\n\n", SwitchIdent_GetSerialNumber());
printf("\x1b[31;1m*\x1b[0m Serial number: \x1b[31;1m%s\n", SwitchIdent_GetSerialNumber());
printf("\x1b[31;1m*\x1b[0m Device ID: \x1b[31;1m%llu\n\n", SwitchIdent_GetDeviceID());
/*
System info: