[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

@ -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