hid.cpp 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <array>
  5. #include "common/common_types.h"
  6. #include "common/logging/log.h"
  7. #include "core/core.h"
  8. #include "core/core_timing.h"
  9. #include "core/core_timing_util.h"
  10. #include "core/frontend/emu_window.h"
  11. #include "core/frontend/input.h"
  12. #include "core/hle/ipc_helpers.h"
  13. #include "core/hle/kernel/client_port.h"
  14. #include "core/hle/kernel/client_session.h"
  15. #include "core/hle/kernel/event.h"
  16. #include "core/hle/kernel/shared_memory.h"
  17. #include "core/hle/service/hid/hid.h"
  18. #include "core/hle/service/hid/irs.h"
  19. #include "core/hle/service/hid/xcd.h"
  20. #include "core/hle/service/service.h"
  21. #include "core/settings.h"
  22. #include "core/hle/service/hid/controllers/controller_base.h"
  23. #include "core/hle/service/hid/controllers/debug_pad.h"
  24. #include "core/hle/service/hid/controllers/gesture.h"
  25. #include "core/hle/service/hid/controllers/keyboard.h"
  26. #include "core/hle/service/hid/controllers/mouse.h"
  27. #include "core/hle/service/hid/controllers/npad.h"
  28. #include "core/hle/service/hid/controllers/stubbed.h"
  29. #include "core/hle/service/hid/controllers/touchscreen.h"
  30. #include "core/hle/service/hid/controllers/xpad.h"
  31. namespace Service::HID {
  32. // Updating period for each HID device.
  33. // TODO(shinyquagsire23): These need better values.
  34. constexpr u64 pad_update_ticks = CoreTiming::BASE_CLOCK_RATE / 100;
  35. constexpr u64 accelerometer_update_ticks = CoreTiming::BASE_CLOCK_RATE / 100;
  36. constexpr u64 gyroscope_update_ticks = CoreTiming::BASE_CLOCK_RATE / 100;
  37. constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000;
  38. enum class HidController : std::size_t {
  39. DebugPad,
  40. Touchscreen,
  41. Mouse,
  42. Keyboard,
  43. XPad,
  44. Unknown1,
  45. Unknown2,
  46. Unknown3,
  47. SixAxisSensor,
  48. NPad,
  49. Gesture,
  50. MaxControllers,
  51. };
  52. class IAppletResource final : public ServiceFramework<IAppletResource> {
  53. public:
  54. IAppletResource() : ServiceFramework("IAppletResource") {
  55. static const FunctionInfo functions[] = {
  56. {0, &IAppletResource::GetSharedMemoryHandle, "GetSharedMemoryHandle"},
  57. };
  58. RegisterHandlers(functions);
  59. auto& kernel = Core::System::GetInstance().Kernel();
  60. shared_mem = Kernel::SharedMemory::Create(
  61. kernel, nullptr, SHARED_MEMORY_SIZE, Kernel::MemoryPermission::ReadWrite,
  62. Kernel::MemoryPermission::Read, 0, Kernel::MemoryRegion::BASE, "HID:SharedMemory");
  63. MakeController<Controller_DebugPad>(HidController::DebugPad);
  64. MakeController<Controller_Touchscreen>(HidController::Touchscreen);
  65. MakeController<Controller_Mouse>(HidController::Mouse);
  66. MakeController<Controller_Keyboard>(HidController::Keyboard);
  67. MakeController<Controller_XPad>(HidController::XPad);
  68. MakeController<Controller_Stubbed>(HidController::Unknown1);
  69. MakeController<Controller_Stubbed>(HidController::Unknown2);
  70. MakeController<Controller_Stubbed>(HidController::Unknown3);
  71. MakeController<Controller_Stubbed>(HidController::SixAxisSensor);
  72. MakeController<Controller_NPad>(HidController::NPad);
  73. MakeController<Controller_Gesture>(HidController::Gesture);
  74. // Homebrew doesn't try to activate some controllers, so we activate them by default
  75. GetController<Controller_NPad>(HidController::NPad).ActivateController();
  76. GetController<Controller_Touchscreen>(HidController::Touchscreen).ActivateController();
  77. GetController<Controller_Stubbed>(HidController::Unknown1).SetCommonHeaderOffset(0x4c00);
  78. GetController<Controller_Stubbed>(HidController::Unknown2).SetCommonHeaderOffset(0x4e00);
  79. GetController<Controller_Stubbed>(HidController::Unknown3).SetCommonHeaderOffset(0x5000);
  80. // Register update callbacks
  81. pad_update_event = CoreTiming::RegisterEvent(
  82. "HID::UpdatePadCallback",
  83. [this](u64 userdata, int cycles_late) { UpdateControllers(userdata, cycles_late); });
  84. // TODO(shinyquagsire23): Other update callbacks? (accel, gyro?)
  85. CoreTiming::ScheduleEvent(pad_update_ticks, pad_update_event);
  86. ReloadInputDevices();
  87. }
  88. void ActivateController(HidController controller) {
  89. controllers[static_cast<size_t>(controller)]->ActivateController();
  90. }
  91. void DeactivateController(HidController controller) {
  92. controllers[static_cast<size_t>(controller)]->DeactivateController();
  93. }
  94. template <typename T>
  95. void MakeController(HidController controller) {
  96. controllers[static_cast<std::size_t>(controller)] = std::make_unique<T>();
  97. }
  98. template <typename T>
  99. T& GetController(HidController controller) {
  100. return static_cast<T&>(*controllers[static_cast<size_t>(controller)]);
  101. }
  102. ~IAppletResource() {
  103. CoreTiming::UnscheduleEvent(pad_update_event, 0);
  104. }
  105. private:
  106. void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
  107. IPC::ResponseBuilder rb{ctx, 2, 1};
  108. rb.Push(RESULT_SUCCESS);
  109. rb.PushCopyObjects(shared_mem);
  110. LOG_DEBUG(Service_HID, "called");
  111. }
  112. void UpdateControllers(u64 userdata, int cycles_late) {
  113. const bool should_reload = Settings::values.is_device_reload_pending.exchange(false);
  114. for (const auto& controller : controllers) {
  115. if (should_reload) {
  116. controller->OnLoadInputDevices();
  117. }
  118. controller->OnUpdate(shared_mem->GetPointer(), SHARED_MEMORY_SIZE);
  119. }
  120. CoreTiming::ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event);
  121. }
  122. // Handle to shared memory region designated to HID service
  123. Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
  124. // CoreTiming update events
  125. CoreTiming::EventType* pad_update_event;
  126. std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)>
  127. controllers{};
  128. };
  129. class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> {
  130. public:
  131. IActiveVibrationDeviceList() : ServiceFramework("IActiveVibrationDeviceList") {
  132. static const FunctionInfo functions[] = {
  133. {0, &IActiveVibrationDeviceList::ActivateVibrationDevice, "ActivateVibrationDevice"},
  134. };
  135. RegisterHandlers(functions);
  136. }
  137. private:
  138. void ActivateVibrationDevice(Kernel::HLERequestContext& ctx) {
  139. IPC::ResponseBuilder rb{ctx, 2};
  140. rb.Push(RESULT_SUCCESS);
  141. LOG_WARNING(Service_HID, "(STUBBED) called");
  142. }
  143. };
  144. class Hid final : public ServiceFramework<Hid> {
  145. public:
  146. Hid() : ServiceFramework("hid") {
  147. // clang-format off
  148. static const FunctionInfo functions[] = {
  149. {0, &Hid::CreateAppletResource, "CreateAppletResource"},
  150. {1, &Hid::ActivateDebugPad, "ActivateDebugPad"},
  151. {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"},
  152. {21, &Hid::ActivateMouse, "ActivateMouse"},
  153. {31, &Hid::ActivateKeyboard, "ActivateKeyboard"},
  154. {32, nullptr, "SendKeyboardLockKeyEvent"},
  155. {40, nullptr, "AcquireXpadIdEventHandle"},
  156. {41, nullptr, "ReleaseXpadIdEventHandle"},
  157. {51, &Hid::ActivateXpad, "ActivateXpad"},
  158. {55, nullptr, "GetXpadIds"},
  159. {56, nullptr, "ActivateJoyXpad"},
  160. {58, nullptr, "GetJoyXpadLifoHandle"},
  161. {59, nullptr, "GetJoyXpadIds"},
  162. {60, nullptr, "ActivateSixAxisSensor"},
  163. {61, nullptr, "DeactivateSixAxisSensor"},
  164. {62, nullptr, "GetSixAxisSensorLifoHandle"},
  165. {63, nullptr, "ActivateJoySixAxisSensor"},
  166. {64, nullptr, "DeactivateJoySixAxisSensor"},
  167. {65, nullptr, "GetJoySixAxisSensorLifoHandle"},
  168. {66, &Hid::StartSixAxisSensor, "StartSixAxisSensor"},
  169. {67, &Hid::StopSixAxisSensor, "StopSixAxisSensor"},
  170. {68, nullptr, "IsSixAxisSensorFusionEnabled"},
  171. {69, nullptr, "EnableSixAxisSensorFusion"},
  172. {70, nullptr, "SetSixAxisSensorFusionParameters"},
  173. {71, nullptr, "GetSixAxisSensorFusionParameters"},
  174. {72, nullptr, "ResetSixAxisSensorFusionParameters"},
  175. {73, nullptr, "SetAccelerometerParameters"},
  176. {74, nullptr, "GetAccelerometerParameters"},
  177. {75, nullptr, "ResetAccelerometerParameters"},
  178. {76, nullptr, "SetAccelerometerPlayMode"},
  179. {77, nullptr, "GetAccelerometerPlayMode"},
  180. {78, nullptr, "ResetAccelerometerPlayMode"},
  181. {79, &Hid::SetGyroscopeZeroDriftMode, "SetGyroscopeZeroDriftMode"},
  182. {80, nullptr, "GetGyroscopeZeroDriftMode"},
  183. {81, nullptr, "ResetGyroscopeZeroDriftMode"},
  184. {82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"},
  185. {83, nullptr, "IsFirmwareUpdateAvailableForSixAxisSensor"},
  186. {91, &Hid::ActivateGesture, "ActivateGesture"},
  187. {100, &Hid::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"},
  188. {101, &Hid::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"},
  189. {102, &Hid::SetSupportedNpadIdType, "SetSupportedNpadIdType"},
  190. {103, &Hid::ActivateNpad, "ActivateNpad"},
  191. {104, nullptr, "DeactivateNpad"},
  192. {106, &Hid::AcquireNpadStyleSetUpdateEventHandle, "AcquireNpadStyleSetUpdateEventHandle"},
  193. {107, &Hid::DisconnectNpad, "DisconnectNpad"},
  194. {108, &Hid::GetPlayerLedPattern, "GetPlayerLedPattern"},
  195. {109, &Hid::ActivateNpadWithRevision, "ActivateNpadWithRevision"},
  196. {120, &Hid::SetNpadJoyHoldType, "SetNpadJoyHoldType"},
  197. {121, &Hid::GetNpadJoyHoldType, "GetNpadJoyHoldType"},
  198. {122, &Hid::SetNpadJoyAssignmentModeSingleByDefault, "SetNpadJoyAssignmentModeSingleByDefault"},
  199. {123, nullptr, "SetNpadJoyAssignmentModeSingleByDefault"},
  200. {124, &Hid::SetNpadJoyAssignmentModeDual, "SetNpadJoyAssignmentModeDual"},
  201. {125, &Hid::MergeSingleJoyAsDualJoy, "MergeSingleJoyAsDualJoy"},
  202. {126, nullptr, "StartLrAssignmentMode"},
  203. {127, nullptr, "StopLrAssignmentMode"},
  204. {128, &Hid::SetNpadHandheldActivationMode, "SetNpadHandheldActivationMode"},
  205. {129, nullptr, "GetNpadHandheldActivationMode"},
  206. {130, nullptr, "SwapNpadAssignment"},
  207. {131, nullptr, "IsUnintendedHomeButtonInputProtectionEnabled"},
  208. {132, nullptr, "EnableUnintendedHomeButtonInputProtection"},
  209. {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"},
  210. {200, &Hid::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"},
  211. {201, &Hid::SendVibrationValue, "SendVibrationValue"},
  212. {202, &Hid::GetActualVibrationValue, "GetActualVibrationValue"},
  213. {203, &Hid::CreateActiveVibrationDeviceList, "CreateActiveVibrationDeviceList"},
  214. {204, nullptr, "PermitVibration"},
  215. {205, nullptr, "IsVibrationPermitted"},
  216. {206, &Hid::SendVibrationValues, "SendVibrationValues"},
  217. {207, nullptr, "SendVibrationGcErmCommand"},
  218. {208, nullptr, "GetActualVibrationGcErmCommand"},
  219. {209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
  220. {210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"},
  221. {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
  222. {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
  223. {302, nullptr, "StopConsoleSixAxisSensor"},
  224. {303, nullptr, "ActivateSevenSixAxisSensor"},
  225. {304, nullptr, "StartSevenSixAxisSensor"},
  226. {305, nullptr, "StopSevenSixAxisSensor"},
  227. {306, nullptr, "InitializeSevenSixAxisSensor"},
  228. {307, nullptr, "FinalizeSevenSixAxisSensor"},
  229. {308, nullptr, "SetSevenSixAxisSensorFusionStrength"},
  230. {309, nullptr, "GetSevenSixAxisSensorFusionStrength"},
  231. {310, nullptr, "ResetSevenSixAxisSensorTimestamp"},
  232. {400, nullptr, "IsUsbFullKeyControllerEnabled"},
  233. {401, nullptr, "EnableUsbFullKeyController"},
  234. {402, nullptr, "IsUsbFullKeyControllerConnected"},
  235. {403, nullptr, "HasBattery"},
  236. {404, nullptr, "HasLeftRightBattery"},
  237. {405, nullptr, "GetNpadInterfaceType"},
  238. {406, nullptr, "GetNpadLeftRightInterfaceType"},
  239. {500, nullptr, "GetPalmaConnectionHandle"},
  240. {501, nullptr, "InitializePalma"},
  241. {502, nullptr, "AcquirePalmaOperationCompleteEvent"},
  242. {503, nullptr, "GetPalmaOperationInfo"},
  243. {504, nullptr, "PlayPalmaActivity"},
  244. {505, nullptr, "SetPalmaFrModeType"},
  245. {506, nullptr, "ReadPalmaStep"},
  246. {507, nullptr, "EnablePalmaStep"},
  247. {508, nullptr, "ResetPalmaStep"},
  248. {509, nullptr, "ReadPalmaApplicationSection"},
  249. {510, nullptr, "WritePalmaApplicationSection"},
  250. {511, nullptr, "ReadPalmaUniqueCode"},
  251. {512, nullptr, "SetPalmaUniqueCodeInvalid"},
  252. {513, nullptr, "WritePalmaActivityEntry"},
  253. {514, nullptr, "WritePalmaRgbLedPatternEntry"},
  254. {515, nullptr, "WritePalmaWaveEntry"},
  255. {516, nullptr, "SetPalmaDataBaseIdentificationVersion"},
  256. {517, nullptr, "GetPalmaDataBaseIdentificationVersion"},
  257. {518, nullptr, "SuspendPalmaFeature"},
  258. {519, nullptr, "GetPalmaOperationResult"},
  259. {520, nullptr, "ReadPalmaPlayLog"},
  260. {521, nullptr, "ResetPalmaPlayLog"},
  261. {522, &Hid::SetIsPalmaAllConnectable, "SetIsPalmaAllConnectable"},
  262. {523, nullptr, "SetIsPalmaPairedConnectable"},
  263. {524, nullptr, "PairPalma"},
  264. {525, &Hid::SetPalmaBoostMode, "SetPalmaBoostMode"},
  265. {1000, nullptr, "SetNpadCommunicationMode"},
  266. {1001, nullptr, "GetNpadCommunicationMode"},
  267. };
  268. // clang-format on
  269. RegisterHandlers(functions);
  270. }
  271. ~Hid() = default;
  272. private:
  273. std::shared_ptr<IAppletResource> applet_resource;
  274. void CreateAppletResource(Kernel::HLERequestContext& ctx) {
  275. if (applet_resource == nullptr) {
  276. applet_resource = std::make_shared<IAppletResource>();
  277. }
  278. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  279. rb.Push(RESULT_SUCCESS);
  280. rb.PushIpcInterface<IAppletResource>(applet_resource);
  281. LOG_DEBUG(Service_HID, "called");
  282. }
  283. void ActivateXpad(Kernel::HLERequestContext& ctx) {
  284. applet_resource->ActivateController(HidController::XPad);
  285. IPC::ResponseBuilder rb{ctx, 2};
  286. rb.Push(RESULT_SUCCESS);
  287. LOG_DEBUG(Service_HID, "called");
  288. }
  289. void ActivateDebugPad(Kernel::HLERequestContext& ctx) {
  290. applet_resource->ActivateController(HidController::DebugPad);
  291. IPC::ResponseBuilder rb{ctx, 2};
  292. rb.Push(RESULT_SUCCESS);
  293. LOG_DEBUG(Service_HID, "called");
  294. }
  295. void ActivateTouchScreen(Kernel::HLERequestContext& ctx) {
  296. applet_resource->ActivateController(HidController::Touchscreen);
  297. IPC::ResponseBuilder rb{ctx, 2};
  298. rb.Push(RESULT_SUCCESS);
  299. LOG_DEBUG(Service_HID, "called");
  300. }
  301. void ActivateMouse(Kernel::HLERequestContext& ctx) {
  302. applet_resource->ActivateController(HidController::Mouse);
  303. IPC::ResponseBuilder rb{ctx, 2};
  304. rb.Push(RESULT_SUCCESS);
  305. LOG_DEBUG(Service_HID, "called");
  306. }
  307. void ActivateKeyboard(Kernel::HLERequestContext& ctx) {
  308. applet_resource->ActivateController(HidController::Keyboard);
  309. IPC::ResponseBuilder rb{ctx, 2};
  310. rb.Push(RESULT_SUCCESS);
  311. LOG_DEBUG(Service_HID, "called");
  312. }
  313. void ActivateGesture(Kernel::HLERequestContext& ctx) {
  314. applet_resource->ActivateController(HidController::Gesture);
  315. IPC::ResponseBuilder rb{ctx, 2};
  316. rb.Push(RESULT_SUCCESS);
  317. LOG_DEBUG(Service_HID, "called");
  318. }
  319. void ActivateNpadWithRevision(Kernel::HLERequestContext& ctx) {
  320. // Should have no effect with how our npad sets up the data
  321. applet_resource->ActivateController(HidController::NPad);
  322. IPC::ResponseBuilder rb{ctx, 2};
  323. rb.Push(RESULT_SUCCESS);
  324. LOG_DEBUG(Service_HID, "called");
  325. }
  326. void StartSixAxisSensor(Kernel::HLERequestContext& ctx) {
  327. IPC::RequestParser rp{ctx};
  328. auto handle = rp.PopRaw<u32>();
  329. IPC::ResponseBuilder rb{ctx, 2};
  330. rb.Push(RESULT_SUCCESS);
  331. LOG_WARNING(Service_HID, "(STUBBED) called");
  332. }
  333. void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {
  334. IPC::ResponseBuilder rb{ctx, 2};
  335. rb.Push(RESULT_SUCCESS);
  336. LOG_WARNING(Service_HID, "(STUBBED) called");
  337. }
  338. void IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx) {
  339. IPC::ResponseBuilder rb{ctx, 3};
  340. rb.Push(RESULT_SUCCESS);
  341. // TODO (Hexagon12): Properly implement reading gyroscope values from controllers.
  342. rb.Push(true);
  343. LOG_WARNING(Service_HID, "(STUBBED) called");
  344. }
  345. void SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
  346. IPC::RequestParser rp{ctx};
  347. auto supported_styleset = rp.PopRaw<u32>();
  348. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  349. .SetSupportedStyleSet({supported_styleset});
  350. IPC::ResponseBuilder rb{ctx, 2};
  351. rb.Push(RESULT_SUCCESS);
  352. LOG_DEBUG(Service_HID, "called");
  353. }
  354. void GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
  355. auto& controller = applet_resource->GetController<Controller_NPad>(HidController::NPad);
  356. IPC::ResponseBuilder rb{ctx, 3};
  357. rb.Push(RESULT_SUCCESS);
  358. rb.Push<u32>(controller.GetSupportedStyleSet().raw);
  359. LOG_DEBUG(Service_HID, "called");
  360. }
  361. void SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) {
  362. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  363. .SetSupportedNPadIdTypes(ctx.ReadBuffer().data(), ctx.GetReadBufferSize());
  364. IPC::ResponseBuilder rb{ctx, 2};
  365. rb.Push(RESULT_SUCCESS);
  366. LOG_DEBUG(Service_HID, "called");
  367. }
  368. void ActivateNpad(Kernel::HLERequestContext& ctx) {
  369. IPC::ResponseBuilder rb{ctx, 2};
  370. rb.Push(RESULT_SUCCESS);
  371. applet_resource->ActivateController(HidController::NPad);
  372. LOG_DEBUG(Service_HID, "called");
  373. }
  374. void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) {
  375. IPC::RequestParser rp{ctx};
  376. auto npad_id = rp.PopRaw<u32>();
  377. IPC::ResponseBuilder rb{ctx, 2, 1};
  378. rb.Push(RESULT_SUCCESS);
  379. rb.PushCopyObjects(applet_resource->GetController<Controller_NPad>(HidController::NPad)
  380. .GetStyleSetChangedEvent());
  381. LOG_DEBUG(Service_HID, "called");
  382. }
  383. void DisconnectNpad(Kernel::HLERequestContext& ctx) {
  384. IPC::RequestParser rp{ctx};
  385. auto npad_id = rp.PopRaw<u32>();
  386. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  387. .DisconnectNPad(npad_id);
  388. IPC::ResponseBuilder rb{ctx, 2};
  389. rb.Push(RESULT_SUCCESS);
  390. LOG_DEBUG(Service_HID, "called");
  391. }
  392. void GetPlayerLedPattern(Kernel::HLERequestContext& ctx) {
  393. IPC::RequestParser rp{ctx};
  394. auto npad_id = rp.PopRaw<u32>();
  395. IPC::ResponseBuilder rb{ctx, 4};
  396. rb.Push(RESULT_SUCCESS);
  397. rb.PushRaw<u64>(applet_resource->GetController<Controller_NPad>(HidController::NPad)
  398. .GetLedPattern(npad_id)
  399. .raw);
  400. LOG_DEBUG(Service_HID, "called");
  401. }
  402. void SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
  403. auto& controller = applet_resource->GetController<Controller_NPad>(HidController::NPad);
  404. IPC::RequestParser rp{ctx};
  405. const auto hold_type = rp.PopRaw<u64>();
  406. controller.SetHoldType(Controller_NPad::NpadHoldType{hold_type});
  407. IPC::ResponseBuilder rb{ctx, 2};
  408. rb.Push(RESULT_SUCCESS);
  409. LOG_DEBUG(Service_HID, "called");
  410. }
  411. void GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
  412. const auto& controller =
  413. applet_resource->GetController<Controller_NPad>(HidController::NPad);
  414. IPC::ResponseBuilder rb{ctx, 4};
  415. rb.Push(RESULT_SUCCESS);
  416. rb.Push<u64>(static_cast<u64>(controller.GetHoldType()));
  417. LOG_DEBUG(Service_HID, "called");
  418. }
  419. void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) {
  420. IPC::RequestParser rp{ctx};
  421. auto npad_id = rp.PopRaw<u32>();
  422. IPC::ResponseBuilder rb{ctx, 2};
  423. rb.Push(RESULT_SUCCESS);
  424. LOG_WARNING(Service_HID, "(STUBBED) called");
  425. }
  426. void BeginPermitVibrationSession(Kernel::HLERequestContext& ctx) {
  427. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  428. .SetVibrationEnabled(true);
  429. IPC::ResponseBuilder rb{ctx, 2};
  430. rb.Push(RESULT_SUCCESS);
  431. LOG_DEBUG(Service_HID, "called");
  432. }
  433. void EndPermitVibrationSession(Kernel::HLERequestContext& ctx) {
  434. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  435. .SetVibrationEnabled(false);
  436. IPC::ResponseBuilder rb{ctx, 2};
  437. rb.Push(RESULT_SUCCESS);
  438. LOG_DEBUG(Service_HID, "called");
  439. }
  440. void SendVibrationValue(Kernel::HLERequestContext& ctx) {
  441. IPC::RequestParser rp{ctx};
  442. const auto controller_id = rp.PopRaw<u32>();
  443. const auto vibration_values = rp.PopRaw<Controller_NPad::Vibration>();
  444. IPC::ResponseBuilder rb{ctx, 2};
  445. rb.Push(RESULT_SUCCESS);
  446. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  447. .VibrateController({controller_id}, {vibration_values});
  448. LOG_DEBUG(Service_HID, "called");
  449. }
  450. void SendVibrationValues(Kernel::HLERequestContext& ctx) {
  451. const auto controllers = ctx.ReadBuffer(0);
  452. const auto vibrations = ctx.ReadBuffer(1);
  453. std::vector<u32> controller_list(controllers.size() / sizeof(u32));
  454. std::vector<Controller_NPad::Vibration> vibration_list(vibrations.size() /
  455. sizeof(Controller_NPad::Vibration));
  456. std::memcpy(controller_list.data(), controllers.data(), controllers.size());
  457. std::memcpy(vibration_list.data(), vibrations.data(), vibrations.size());
  458. std::transform(controller_list.begin(), controller_list.end(), controller_list.begin(),
  459. [](u32 controller_id) { return controller_id - 3; });
  460. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  461. .VibrateController(controller_list, vibration_list);
  462. IPC::ResponseBuilder rb{ctx, 2};
  463. rb.Push(RESULT_SUCCESS);
  464. LOG_DEBUG(Service_HID, "called");
  465. }
  466. void GetActualVibrationValue(Kernel::HLERequestContext& ctx) {
  467. IPC::ResponseBuilder rb{ctx, 6};
  468. rb.Push(RESULT_SUCCESS);
  469. rb.PushRaw<Controller_NPad::Vibration>(
  470. applet_resource->GetController<Controller_NPad>(HidController::NPad)
  471. .GetLastVibration());
  472. LOG_DEBUG(Service_HID, "called");
  473. }
  474. void SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) {
  475. IPC::RequestParser rp{ctx};
  476. const auto npad_id = rp.PopRaw<u32>();
  477. auto& controller = applet_resource->GetController<Controller_NPad>(HidController::NPad);
  478. controller.SetNpadMode(npad_id, Controller_NPad::NPadAssignments::Dual);
  479. IPC::ResponseBuilder rb{ctx, 2};
  480. rb.Push(RESULT_SUCCESS);
  481. LOG_DEBUG(Service_HID, "called");
  482. }
  483. void MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) {
  484. IPC::ResponseBuilder rb{ctx, 2};
  485. rb.Push(RESULT_SUCCESS);
  486. LOG_WARNING(Service_HID, "(STUBBED) called");
  487. }
  488. void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) {
  489. IPC::RequestParser rp{ctx};
  490. auto mode = rp.PopRaw<u32>();
  491. IPC::ResponseBuilder rb{ctx, 2};
  492. rb.Push(RESULT_SUCCESS);
  493. LOG_WARNING(Service_HID, "(STUBBED) called");
  494. }
  495. void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
  496. IPC::ResponseBuilder rb{ctx, 4};
  497. rb.Push(RESULT_SUCCESS);
  498. rb.Push<u32>(1);
  499. rb.Push<u32>(0);
  500. LOG_DEBUG(Service_HID, "called");
  501. }
  502. void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) {
  503. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  504. rb.Push(RESULT_SUCCESS);
  505. rb.PushIpcInterface<IActiveVibrationDeviceList>();
  506. LOG_DEBUG(Service_HID, "called");
  507. }
  508. void ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
  509. IPC::ResponseBuilder rb{ctx, 2};
  510. rb.Push(RESULT_SUCCESS);
  511. LOG_WARNING(Service_HID, "(STUBBED) called");
  512. }
  513. void StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
  514. IPC::ResponseBuilder rb{ctx, 2};
  515. rb.Push(RESULT_SUCCESS);
  516. LOG_WARNING(Service_HID, "(STUBBED) called");
  517. }
  518. void StopSixAxisSensor(Kernel::HLERequestContext& ctx) {
  519. IPC::ResponseBuilder rb{ctx, 2};
  520. rb.Push(RESULT_SUCCESS);
  521. LOG_WARNING(Service_HID, "(STUBBED) called");
  522. }
  523. void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) {
  524. IPC::ResponseBuilder rb{ctx, 2};
  525. rb.Push(RESULT_SUCCESS);
  526. LOG_WARNING(Service_HID, "(STUBBED) called");
  527. }
  528. void SetPalmaBoostMode(Kernel::HLERequestContext& ctx) {
  529. IPC::ResponseBuilder rb{ctx, 2};
  530. rb.Push(RESULT_SUCCESS);
  531. LOG_WARNING(Service_HID, "(STUBBED) called");
  532. }
  533. };
  534. class HidDbg final : public ServiceFramework<HidDbg> {
  535. public:
  536. explicit HidDbg() : ServiceFramework{"hid:dbg"} {
  537. // clang-format off
  538. static const FunctionInfo functions[] = {
  539. {0, nullptr, "DeactivateDebugPad"},
  540. {1, nullptr, "SetDebugPadAutoPilotState"},
  541. {2, nullptr, "UnsetDebugPadAutoPilotState"},
  542. {10, nullptr, "DeactivateTouchScreen"},
  543. {11, nullptr, "SetTouchScreenAutoPilotState"},
  544. {12, nullptr, "UnsetTouchScreenAutoPilotState"},
  545. {20, nullptr, "DeactivateMouse"},
  546. {21, nullptr, "SetMouseAutoPilotState"},
  547. {22, nullptr, "UnsetMouseAutoPilotState"},
  548. {30, nullptr, "DeactivateKeyboard"},
  549. {31, nullptr, "SetKeyboardAutoPilotState"},
  550. {32, nullptr, "UnsetKeyboardAutoPilotState"},
  551. {50, nullptr, "DeactivateXpad"},
  552. {51, nullptr, "SetXpadAutoPilotState"},
  553. {52, nullptr, "UnsetXpadAutoPilotState"},
  554. {60, nullptr, "DeactivateJoyXpad"},
  555. {91, nullptr, "DeactivateGesture"},
  556. {110, nullptr, "DeactivateHomeButton"},
  557. {111, nullptr, "SetHomeButtonAutoPilotState"},
  558. {112, nullptr, "UnsetHomeButtonAutoPilotState"},
  559. {120, nullptr, "DeactivateSleepButton"},
  560. {121, nullptr, "SetSleepButtonAutoPilotState"},
  561. {122, nullptr, "UnsetSleepButtonAutoPilotState"},
  562. {123, nullptr, "DeactivateInputDetector"},
  563. {130, nullptr, "DeactivateCaptureButton"},
  564. {131, nullptr, "SetCaptureButtonAutoPilotState"},
  565. {132, nullptr, "UnsetCaptureButtonAutoPilotState"},
  566. {133, nullptr, "SetShiftAccelerometerCalibrationValue"},
  567. {134, nullptr, "GetShiftAccelerometerCalibrationValue"},
  568. {135, nullptr, "SetShiftGyroscopeCalibrationValue"},
  569. {136, nullptr, "GetShiftGyroscopeCalibrationValue"},
  570. {140, nullptr, "DeactivateConsoleSixAxisSensor"},
  571. {141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"},
  572. {142, nullptr, "DeactivateSevenSixAxisSensor"},
  573. {143, nullptr, "GetConsoleSixAxisSensorCountStates"},
  574. {201, nullptr, "ActivateFirmwareUpdate"},
  575. {202, nullptr, "DeactivateFirmwareUpdate"},
  576. {203, nullptr, "StartFirmwareUpdate"},
  577. {204, nullptr, "GetFirmwareUpdateStage"},
  578. {205, nullptr, "GetFirmwareVersion"},
  579. {206, nullptr, "GetDestinationFirmwareVersion"},
  580. {207, nullptr, "DiscardFirmwareInfoCacheForRevert"},
  581. {208, nullptr, "StartFirmwareUpdateForRevert"},
  582. {209, nullptr, "GetAvailableFirmwareVersionForRevert"},
  583. {210, nullptr, "IsFirmwareUpdatingDevice"},
  584. {211, nullptr, "StartFirmwareUpdateIndividual"},
  585. {215, nullptr, "SetUsbFirmwareForceUpdateEnabled"},
  586. {216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"},
  587. {221, nullptr, "UpdateControllerColor"},
  588. {222, nullptr, "ConnectUsbPadsAsync"},
  589. {223, nullptr, "DisconnectUsbPadsAsync"},
  590. {224, nullptr, "UpdateDesignInfo"},
  591. {225, nullptr, "GetUniquePadDriverState"},
  592. {226, nullptr, "GetSixAxisSensorDriverStates"},
  593. {227, nullptr, "GetRxPacketHistory"},
  594. {228, nullptr, "AcquireOperationEventHandle"},
  595. {229, nullptr, "ReadSerialFlash"},
  596. {230, nullptr, "WriteSerialFlash"},
  597. {231, nullptr, "GetOperationResult"},
  598. {232, nullptr, "EnableShipmentMode"},
  599. {233, nullptr, "ClearPairingInfo"},
  600. {234, nullptr, "GetUniquePadDeviceTypeSetInternal"},
  601. {301, nullptr, "GetAbstractedPadHandles"},
  602. {302, nullptr, "GetAbstractedPadState"},
  603. {303, nullptr, "GetAbstractedPadsState"},
  604. {321, nullptr, "SetAutoPilotVirtualPadState"},
  605. {322, nullptr, "UnsetAutoPilotVirtualPadState"},
  606. {323, nullptr, "UnsetAllAutoPilotVirtualPadState"},
  607. {350, nullptr, "AddRegisteredDevice"},
  608. {400, nullptr, "DisableExternalMcuOnNxDevice"},
  609. {401, nullptr, "DisableRailDeviceFiltering"},
  610. };
  611. // clang-format on
  612. RegisterHandlers(functions);
  613. }
  614. };
  615. class HidSys final : public ServiceFramework<HidSys> {
  616. public:
  617. explicit HidSys() : ServiceFramework{"hid:sys"} {
  618. // clang-format off
  619. static const FunctionInfo functions[] = {
  620. {31, nullptr, "SendKeyboardLockKeyEvent"},
  621. {101, nullptr, "AcquireHomeButtonEventHandle"},
  622. {111, nullptr, "ActivateHomeButton"},
  623. {121, nullptr, "AcquireSleepButtonEventHandle"},
  624. {131, nullptr, "ActivateSleepButton"},
  625. {141, nullptr, "AcquireCaptureButtonEventHandle"},
  626. {151, nullptr, "ActivateCaptureButton"},
  627. {210, nullptr, "AcquireNfcDeviceUpdateEventHandle"},
  628. {211, nullptr, "GetNpadsWithNfc"},
  629. {212, nullptr, "AcquireNfcActivateEventHandle"},
  630. {213, nullptr, "ActivateNfc"},
  631. {214, nullptr, "GetXcdHandleForNpadWithNfc"},
  632. {215, nullptr, "IsNfcActivated"},
  633. {230, nullptr, "AcquireIrSensorEventHandle"},
  634. {231, nullptr, "ActivateIrSensor"},
  635. {301, nullptr, "ActivateNpadSystem"},
  636. {303, nullptr, "ApplyNpadSystemCommonPolicy"},
  637. {304, nullptr, "EnableAssigningSingleOnSlSrPress"},
  638. {305, nullptr, "DisableAssigningSingleOnSlSrPress"},
  639. {306, nullptr, "GetLastActiveNpad"},
  640. {307, nullptr, "GetNpadSystemExtStyle"},
  641. {308, nullptr, "ApplyNpadSystemCommonPolicyFull"},
  642. {309, nullptr, "GetNpadFullKeyGripColor"},
  643. {310, nullptr, "GetMaskedSupportedNpadStyleSet"},
  644. {311, nullptr, "SetNpadPlayerLedBlinkingDevice"},
  645. {312, nullptr, "SetSupportedNpadStyleSetAll"},
  646. {321, nullptr, "GetUniquePadsFromNpad"},
  647. {322, nullptr, "GetIrSensorState"},
  648. {323, nullptr, "GetXcdHandleForNpadWithIrSensor"},
  649. {500, nullptr, "SetAppletResourceUserId"},
  650. {501, nullptr, "RegisterAppletResourceUserId"},
  651. {502, nullptr, "UnregisterAppletResourceUserId"},
  652. {503, nullptr, "EnableAppletToGetInput"},
  653. {504, nullptr, "SetAruidValidForVibration"},
  654. {505, nullptr, "EnableAppletToGetSixAxisSensor"},
  655. {510, nullptr, "SetVibrationMasterVolume"},
  656. {511, nullptr, "GetVibrationMasterVolume"},
  657. {512, nullptr, "BeginPermitVibrationSession"},
  658. {513, nullptr, "EndPermitVibrationSession"},
  659. {520, nullptr, "EnableHandheldHids"},
  660. {521, nullptr, "DisableHandheldHids"},
  661. {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"},
  662. {541, nullptr, "GetPlayReportControllerUsages"},
  663. {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"},
  664. {543, nullptr, "GetRegisteredDevicesOld"},
  665. {544, nullptr, "AcquireConnectionTriggerTimeoutEvent"},
  666. {545, nullptr, "SendConnectionTrigger"},
  667. {546, nullptr, "AcquireDeviceRegisteredEventForControllerSupport"},
  668. {547, nullptr, "GetAllowedBluetoothLinksCount"},
  669. {548, nullptr, "GetRegisteredDevices"},
  670. {549, nullptr, "GetConnectableRegisteredDevices"},
  671. {700, nullptr, "ActivateUniquePad"},
  672. {702, nullptr, "AcquireUniquePadConnectionEventHandle"},
  673. {703, nullptr, "GetUniquePadIds"},
  674. {751, nullptr, "AcquireJoyDetachOnBluetoothOffEventHandle"},
  675. {800, nullptr, "ListSixAxisSensorHandles"},
  676. {801, nullptr, "IsSixAxisSensorUserCalibrationSupported"},
  677. {802, nullptr, "ResetSixAxisSensorCalibrationValues"},
  678. {803, nullptr, "StartSixAxisSensorUserCalibration"},
  679. {804, nullptr, "CancelSixAxisSensorUserCalibration"},
  680. {805, nullptr, "GetUniquePadBluetoothAddress"},
  681. {806, nullptr, "DisconnectUniquePad"},
  682. {807, nullptr, "GetUniquePadType"},
  683. {808, nullptr, "GetUniquePadInterface"},
  684. {809, nullptr, "GetUniquePadSerialNumber"},
  685. {810, nullptr, "GetUniquePadControllerNumber"},
  686. {811, nullptr, "GetSixAxisSensorUserCalibrationStage"},
  687. {821, nullptr, "StartAnalogStickManualCalibration"},
  688. {822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"},
  689. {823, nullptr, "CancelAnalogStickManualCalibration"},
  690. {824, nullptr, "ResetAnalogStickManualCalibration"},
  691. {825, nullptr, "GetAnalogStickState"},
  692. {826, nullptr, "GetAnalogStickManualCalibrationStage"},
  693. {827, nullptr, "IsAnalogStickButtonPressed"},
  694. {828, nullptr, "IsAnalogStickInReleasePosition"},
  695. {829, nullptr, "IsAnalogStickInCircumference"},
  696. {850, nullptr, "IsUsbFullKeyControllerEnabled"},
  697. {851, nullptr, "EnableUsbFullKeyController"},
  698. {852, nullptr, "IsUsbConnected"},
  699. {870, nullptr, "IsHandheldButtonPressedOnConsoleMode"},
  700. {900, nullptr, "ActivateInputDetector"},
  701. {901, nullptr, "NotifyInputDetector"},
  702. {1000, nullptr, "InitializeFirmwareUpdate"},
  703. {1001, nullptr, "GetFirmwareVersion"},
  704. {1002, nullptr, "GetAvailableFirmwareVersion"},
  705. {1003, nullptr, "IsFirmwareUpdateAvailable"},
  706. {1004, nullptr, "CheckFirmwareUpdateRequired"},
  707. {1005, nullptr, "StartFirmwareUpdate"},
  708. {1006, nullptr, "AbortFirmwareUpdate"},
  709. {1007, nullptr, "GetFirmwareUpdateState"},
  710. {1008, nullptr, "ActivateAudioControl"},
  711. {1009, nullptr, "AcquireAudioControlEventHandle"},
  712. {1010, nullptr, "GetAudioControlStates"},
  713. {1011, nullptr, "DeactivateAudioControl"},
  714. {1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"},
  715. {1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"},
  716. {1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"},
  717. {1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"},
  718. {1100, nullptr, "GetHidbusSystemServiceObject"},
  719. {1120, nullptr, "SetFirmwareHotfixUpdateSkipEnabled"},
  720. {1130, nullptr, "InitializeUsbFirmwareUpdate"},
  721. {1131, nullptr, "FinalizeUsbFirmwareUpdate"},
  722. {1132, nullptr, "CheckUsbFirmwareUpdateRequired"},
  723. {1133, nullptr, "StartUsbFirmwareUpdate"},
  724. {1134, nullptr, "GetUsbFirmwareUpdateState"},
  725. };
  726. // clang-format on
  727. RegisterHandlers(functions);
  728. }
  729. };
  730. class HidTmp final : public ServiceFramework<HidTmp> {
  731. public:
  732. explicit HidTmp() : ServiceFramework{"hid:tmp"} {
  733. // clang-format off
  734. static const FunctionInfo functions[] = {
  735. {0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"},
  736. };
  737. // clang-format on
  738. RegisterHandlers(functions);
  739. }
  740. };
  741. class HidBus final : public ServiceFramework<HidBus> {
  742. public:
  743. explicit HidBus() : ServiceFramework{"hidbus"} {
  744. // clang-format off
  745. static const FunctionInfo functions[] = {
  746. {1, nullptr, "GetBusHandle"},
  747. {2, nullptr, "IsExternalDeviceConnected"},
  748. {3, nullptr, "Initialize"},
  749. {4, nullptr, "Finalize"},
  750. {5, nullptr, "EnableExternalDevice"},
  751. {6, nullptr, "GetExternalDeviceId"},
  752. {7, nullptr, "SendCommandAsync"},
  753. {8, nullptr, "GetSendCommandAsynceResult"},
  754. {9, nullptr, "SetEventForSendCommandAsycResult"},
  755. {10, nullptr, "GetSharedMemoryHandle"},
  756. {11, nullptr, "EnableJoyPollingReceiveMode"},
  757. {12, nullptr, "DisableJoyPollingReceiveMode"},
  758. {13, nullptr, "GetPollingData"},
  759. {14, nullptr, "SetStatusManagerType"},
  760. };
  761. // clang-format on
  762. RegisterHandlers(functions);
  763. }
  764. };
  765. void ReloadInputDevices() {
  766. Settings::values.is_device_reload_pending.store(true);
  767. }
  768. void InstallInterfaces(SM::ServiceManager& service_manager) {
  769. std::make_shared<Hid>()->InstallAsService(service_manager);
  770. std::make_shared<HidBus>()->InstallAsService(service_manager);
  771. std::make_shared<HidDbg>()->InstallAsService(service_manager);
  772. std::make_shared<HidSys>()->InstallAsService(service_manager);
  773. std::make_shared<HidTmp>()->InstallAsService(service_manager);
  774. std::make_shared<IRS>()->InstallAsService(service_manager);
  775. std::make_shared<IRS_SYS>()->InstallAsService(service_manager);
  776. std::make_shared<XCD_SYS>()->InstallAsService(service_manager);
  777. }
  778. } // namespace Service::HID