kernel: Display touchscreen firmware version

This commit is contained in:
joel16 2023-10-14 17:13:17 -04:00
parent dc79f6fdb2
commit 7413411329
5 changed files with 29 additions and 1 deletions

View File

@ -93,9 +93,10 @@ namespace SwitchIdent {
s32 GetWlanQuality(s32 dBm);
u32 GetWlanRSSI(void);
// Joycon
// HID
Result GetJoyconFirmwareVersion(HidDeviceTypeBits deviceType, HIDFirmwareVersion *version);
HidPowerInfo GetJoyconPowerInfo(HidNpadIdType id);
HidPowerInfo GetJoyconPowerInfoL(HidNpadIdType id);
HidPowerInfo GetJoyconPowerInfoR(HidNpadIdType id);
Result GetTouchScreenFirmwareVersion(HIDFirmwareVersion *version);
}

View File

@ -41,4 +41,18 @@ namespace SwitchIdent {
hidGetNpadPowerInfoSplit(id, &info_left, &info_right);
return info_right;
}
static Result hidsysGetTouchScreenFirmwareVersion(HIDFirmwareVersion *version) {
return serviceDispatchOut(hidsysGetServiceSession(), 1151, *version);
}
Result GetTouchScreenFirmwareVersion(HIDFirmwareVersion *version) {
Result ret = 0;
if (R_FAILED(ret = hidsysGetTouchScreenFirmwareVersion(version))) {
std::printf("hidsysGetTouchScreenFirmwareVersion() failed: 0x%x.\n\n", ret);
}
return ret;
}
}

View File

@ -161,4 +161,6 @@ namespace SwitchIdent {
return version;
}
}

View File

@ -8,6 +8,7 @@ namespace Services {
void Exit(void) {
gpioPadClose(&hp_inserted);
gpioExit();
hidsysExit();
hiddbgExit();
tsExit();
wlaninfExit();
@ -106,6 +107,10 @@ namespace Services {
std::printf("hiddbgInitialize() failed: 0x%x.\n\n", ret);
}
if (R_FAILED(ret = hidsysInitialize())) {
std::printf("hidsysInitialize() failed: 0x%x.\n\n", ret);
}
if (R_FAILED(ret = gpioInitialize())) {
std::printf("gpioInitialize() failed: 0x%x.\n\n", ret);
}

View File

@ -40,6 +40,7 @@ namespace Menus {
SetSysSerialNumber serial_number;
const char *dram_desc;
u64 device_id;
HIDFirmwareVersion touchscreen_version;
} KernelInfo;
typedef struct {
@ -117,6 +118,10 @@ namespace Menus {
Menus::DrawItem(5, "DRAM ID:", kernel_info.dram_desc);
Menus::DrawItemf(6, "Device ID:", "%llu", kernel_info.device_id);
if (hosversionAtLeast(9, 0, 0)) {
Menus::DrawItemf(7, "Touchscreen firmware:", "%d.%d.%d.%d", kernel_info.touchscreen_version.major, kernel_info.touchscreen_version.minor, kernel_info.touchscreen_version.micro, kernel_info.touchscreen_version.rev);
}
// if (hosversionAtLeast(2, 0, 0) && g_applet_operation_mode == AppletOperationMode_Console) {
// Menus::DrawItemf(7, "Dock firmware:", "%d.%d.%d.%d", kernel_info.dock_version.major, kernel_info.dock_version.minor, kernel_info.dock_version.micro, kernel_info.dock_version.rev);
// }
@ -269,6 +274,7 @@ namespace Menus {
kernel_info.serial_number = SwitchIdent::GetSerialNumber();
kernel_info.dram_desc = SwitchIdent::GetDramDesc();
kernel_info.device_id = SwitchIdent::GetDeviceID();
SwitchIdent::GetTouchScreenFirmwareVersion(&kernel_info.touchscreen_version);
SystemInfo system_info = { 0 };
system_info.region = SwitchIdent::GetRegion();