[HID] Stub more gyroscope calls

This commit is contained in:
wheremyfoodat 2022-10-11 23:49:55 +03:00
parent d395fcd3cc
commit 85b7ebae6f
4 changed files with 33 additions and 2 deletions

View file

@ -17,6 +17,8 @@ class HIDService {
// Service commands
void enableAccelerometer(u32 messagePointer);
void enableGyroscopeLow(u32 messagePointer);
void getGyroscopeLowCalibrateParam(u32 messagePointer);
void getGyroscopeCoefficient(u32 messagePointer);
void getIPCHandles(u32 messagePointer);
public:

View file

@ -12,6 +12,7 @@ class NDMService {
// Service commands
void overrideDefaultDaemons(u32 messagePointer);
void suspendDaemons(u32 messagePointer);
void suspendScheduler(u32 messagePointer);
public:
NDMService(Memory& mem) : mem(mem) {}

View file

@ -4,7 +4,9 @@ namespace HIDCommands {
enum : u32 {
GetIPCHandles = 0x000A0000,
EnableAccelerometer = 0x00110000,
EnableGyroscopeLow = 0x00130000
EnableGyroscopeLow = 0x00130000,
GetGyroscopeLowRawToDpsCoefficient = 0x00150000,
GetGyroscopeLowCalibrateParam = 0x00160000
};
}
@ -26,6 +28,8 @@ void HIDService::handleSyncRequest(u32 messagePointer) {
switch (command) {
case HIDCommands::EnableAccelerometer: enableAccelerometer(messagePointer); break;
case HIDCommands::EnableGyroscopeLow: enableGyroscopeLow(messagePointer); break;
case HIDCommands::GetGyroscopeLowCalibrateParam: getGyroscopeLowCalibrateParam(messagePointer); break;
case HIDCommands::GetGyroscopeLowRawToDpsCoefficient: getGyroscopeCoefficient(messagePointer); break;
case HIDCommands::GetIPCHandles: getIPCHandles(messagePointer); break;
default: Helpers::panic("HID service requested. Command: %08X\n", command);
}
@ -43,6 +47,23 @@ void HIDService::enableGyroscopeLow(u32 messagePointer) {
gyroEnabled = true;
}
void HIDService::getGyroscopeLowCalibrateParam(u32 messagePointer) {
log("HID::GetGyroscopeLowCalibrateParam\n");
mem.write32(messagePointer + 4, Result::Success);
// Fill calibration data with 0s since we don't have gyro
for (int i = 0; i < 5; i++) {
mem.write32(messagePointer + 8 + i * 4, 0);
}
}
void HIDService::getGyroscopeCoefficient(u32 messagePointer) {
log("HID::GetGyroscopeLowRawToDpsCoefficient\n");
mem.write32(messagePointer + 4, Result::Success);
// This should write a coeff value here but we don't have gyro so
}
void HIDService::getIPCHandles(u32 messagePointer) {
log("HID::GetIPCHandles\n");
mem.write32(messagePointer + 4, Result::Success); // Result code

View file

@ -3,7 +3,8 @@
namespace NDMCommands {
enum : u32 {
OverrideDefaultDaemons = 0x00140040,
SuspendDaemons = 0x00060040
SuspendDaemons = 0x00060040,
SuspendScheduler = 0x00080040
};
}
@ -20,6 +21,7 @@ void NDMService::handleSyncRequest(u32 messagePointer) {
switch (command) {
case NDMCommands::OverrideDefaultDaemons: overrideDefaultDaemons(messagePointer); break;
case NDMCommands::SuspendDaemons: suspendDaemons(messagePointer); break;
case NDMCommands::SuspendScheduler: suspendScheduler(messagePointer); break;
default: Helpers::panic("NDM service requested. Command: %08X\n", command);
}
}
@ -32,4 +34,9 @@ void NDMService::overrideDefaultDaemons(u32 messagePointer) {
void NDMService::suspendDaemons(u32 messagePointer) {
log("NDM::SuspendDaemons(stubbed)\n");
mem.write32(messagePointer + 4, Result::Success);
}
void NDMService::suspendScheduler(u32 messagePointer) {
log("NDM::SuspendScheduler(stubbed)\n");
mem.write32(messagePointer + 4, Result::Success);
}