From bbb98bd490db9e5d5eb016562f1290f9e34f05e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fatay=20G=C3=BC=C3=A7l=C3=BC?= <33038942+defektu@users.noreply.github.com> Date: Mon, 5 Oct 2026 02:04:41 +0300 Subject: [PATCH] hle: add BluetoothHid, DeviceService and Usbd stubs (#1031) --- src/libs/libBluetoothHid.cpp | 42 +++++++++++++++++++++++++++++++++ src/libs/libDeviceService.cpp | 36 ++++++++++++++++++++++++++++ src/libs/libUsbd.cpp | 44 +++++++++++++++++++++++++++++++++++ src/libs/libs.cpp | 6 +++++ 4 files changed, 128 insertions(+) create mode 100644 src/libs/libBluetoothHid.cpp create mode 100644 src/libs/libDeviceService.cpp create mode 100644 src/libs/libUsbd.cpp diff --git a/src/libs/libBluetoothHid.cpp b/src/libs/libBluetoothHid.cpp new file mode 100644 index 00000000..0c352f10 --- /dev/null +++ b/src/libs/libBluetoothHid.cpp @@ -0,0 +1,42 @@ +#include "common/abi.h" +#include "common/logging/log.h" +#include "libs/errno.h" +#include "libs/libs.h" +#include "loader/symbolDatabase.h" + +namespace Libs { + +LIB_VERSION("BluetoothHid", 1, "BluetoothHid", 1, 1); + +namespace BluetoothHid { + +static int KYTY_SYSV_ABI BluetoothHidInit() { + PRINT_NAME(); + + return OK; +} + +static int KYTY_SYSV_ABI BluetoothHidRegisterDevice() { + PRINT_NAME(); + + return OK; +} + +// Callback signature is unverified; the stub never invokes it. +static int KYTY_SYSV_ABI BluetoothHidRegisterCallback(uint64_t callback_func) { + PRINT_NAME(); + + LOGF("\t callback_func = 0x%016" PRIx64 "\n", callback_func); + + return OK; +} + +} // namespace BluetoothHid + +LIB_DEFINE(InitBluetoothHid_1) { + LIB_FUNC("tul3-GzejQc", BluetoothHid::BluetoothHidInit); + LIB_FUNC("4FUZ+c52d2k", BluetoothHid::BluetoothHidRegisterDevice); + LIB_FUNC("4Ypfo9RIwfM", BluetoothHid::BluetoothHidRegisterCallback); +} + +} // namespace Libs diff --git a/src/libs/libDeviceService.cpp b/src/libs/libDeviceService.cpp new file mode 100644 index 00000000..8d5165f3 --- /dev/null +++ b/src/libs/libDeviceService.cpp @@ -0,0 +1,36 @@ +#include "common/abi.h" +#include "common/logging/log.h" +#include "libs/errno.h" +#include "libs/libs.h" +#include "loader/symbolDatabase.h" + +namespace Libs { + +LIB_VERSION("DeviceService", 1, "Mbus", 1, 1); + +namespace DeviceService { + +static int KYTY_SYSV_ABI DeviceServiceInitialize() { + PRINT_NAME(); + + return OK; +} + +static int KYTY_SYSV_ABI DeviceServiceQueryDeviceInfo(uint32_t device_handle, void* out_info) { + PRINT_NAME(); + + LOGF("\t device_handle = 0x%08" PRIx32 "\n" + "\t out_info = 0x%016" PRIx64 "\n", + device_handle, reinterpret_cast(out_info)); + + return OK; +} + +} // namespace DeviceService + +LIB_DEFINE(InitDeviceService_1) { + LIB_FUNC("84fDxStrG44", DeviceService::DeviceServiceInitialize); + LIB_FUNC("UNMEa+5lrUA", DeviceService::DeviceServiceQueryDeviceInfo); +} + +} // namespace Libs diff --git a/src/libs/libUsbd.cpp b/src/libs/libUsbd.cpp new file mode 100644 index 00000000..171145cf --- /dev/null +++ b/src/libs/libUsbd.cpp @@ -0,0 +1,44 @@ +#include "common/abi.h" +#include "common/threads.h" +#include "libs/errno.h" +#include "libs/libs.h" +#include "loader/symbolDatabase.h" + +namespace Libs { + +LIB_VERSION("Usbd", 1, "Usbd", 1, 1); + +namespace Usbd { + +constexpr uint32_t POLL_INTERVAL_MS = 16; + +static int KYTY_SYSV_ABI UsbdInit() { + PRINT_NAME(); + + return OK; +} + +static int KYTY_SYSV_ABI UsbdExit() { + PRINT_NAME(); + + return OK; +} + +static int KYTY_SYSV_ABI UsbdHandleEventsTimeout() { + PRINT_NAME(); + + // Avoid a busy loop while USB events are unimplemented. + Common::Thread::SleepMicro(POLL_INTERVAL_MS * 1000); + + return OK; +} + +} // namespace Usbd + +LIB_DEFINE(InitUsbd_1) { + LIB_FUNC("TOhg7P6kTH4", Usbd::UsbdInit); + LIB_FUNC("Fq6+0Fm55xU", Usbd::UsbdExit); + LIB_FUNC("+wU6CGuZcWk", Usbd::UsbdHandleEventsTimeout); +} + +} // namespace Libs diff --git a/src/libs/libs.cpp b/src/libs/libs.cpp index 02804db3..c366dadb 100644 --- a/src/libs/libs.cpp +++ b/src/libs/libs.cpp @@ -79,8 +79,10 @@ LIB_DEFINE(InitVideoOutVrrStatus_1); LIB_DEFINE(InitAppContent_1); LIB_DEFINE(InitAudio_1); +LIB_DEFINE(InitBluetoothHid_1); LIB_DEFINE(InitConvertKeycode_1); LIB_DEFINE(InitDbgAddressSanitizer_1); +LIB_DEFINE(InitDeviceService_1); LIB_DEFINE(InitDialog_1); LIB_DEFINE(InitFont_1); LIB_DEFINE(InitFontFt_1); @@ -99,6 +101,7 @@ LIB_DEFINE(InitShare_1); LIB_DEFINE(InitSysmodule_1); LIB_DEFINE(InitSystemService_1); LIB_DEFINE(InitTextToSpeech2_1); +LIB_DEFINE(InitUsbd_1); LIB_DEFINE(InitUserService_1); LIB_DEFINE(InitWebBrowserDialog_1); @@ -120,6 +123,9 @@ void InitAll(Loader::SymbolDatabase* s) { InitFont_1(s); InitFontFt_1(s); InitAgcDriver_1(s); + InitBluetoothHid_1(s); + InitDeviceService_1(s); + InitUsbd_1(s); InitHmd2_1(s); InitLibKernel_1(s); LibMouse::InitMouse_1(s);