From 2254589865e05ecedf1f81688e903afe5500427c Mon Sep 17 00:00:00 2001 From: ndeadly <24677491+ndeadly@users.noreply.github.com> Date: Tue, 9 Feb 2021 21:53:32 +0100 Subject: [PATCH] bluetooth-mitm: add function to signal a fake hid event --- mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.cpp | 7 +++++++ mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.cpp b/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.cpp index aa52a11..f9b7ad4 100644 --- a/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.cpp +++ b/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.cpp @@ -84,6 +84,13 @@ namespace ams::bluetooth::hid { return ams::ResultSuccess(); } + void SignalFakeEvent(HidEventType type, const void *data, size_t size) { + g_current_event_type = type; + std::memcpy(g_event_info_buffer, data, size); + + os::SignalSystemEvent(&g_system_event_fwd); + } + void handleConnectionStateEvent(bluetooth::HidEventInfo *event_info) { switch (event_info->connection_state.state) { case BtdrvHidConnectionState_Connected: diff --git a/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.hpp b/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.hpp index 0231e5d..d458a3e 100644 --- a/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.hpp +++ b/mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_hid.hpp @@ -32,4 +32,6 @@ namespace ams::bluetooth::hid { Result GetEventInfo(ncm::ProgramId program_id, HidEventType *type, uint8_t* buffer, size_t size); void HandleEvent(void); + void SignalFakeEvent(HidEventType type, const void *data, size_t size); + }