Soru is playing around with some stuffs and wanted to, programmatically, get the mac address of the console. The IPC nwm::SOC apparently has a method GetMACAddress, however soru can't get it to work without a kernel panic. Furthermore, the file twln:/sys/log/inspect.log also includes the mac address, but soru can't figure out how to read files in twln.
As for the GetMACAddress, soru attempted with this code:
Code: Select all
Result getMac(u8 mac[6]) {
Handle handle;
res = srvGetServiceHandle(&handle, "nwm::SOC");
if (R_FAILED(res)) return res;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(8, 1, 0);
cmdbuf[1] = 6;
for (int i = 2; i < 0x100 / 8; i+=2) {
cmdbuf[i] = IPC_Desc_StaticBuffer(0, 6);
cmdbuf[i+1] = (u32)mac;
}
res = svcSendSyncRequest(handle);
if (R_FAILED(res)) return res;
res = (Result)cmdbuf[1];
memcpy(mac, (u8*)cmdbuf[3], 6);
return res;
}