diff --git a/sunshine/main.cpp b/sunshine/main.cpp index aa30edbe..5f980044 100644 --- a/sunshine/main.cpp +++ b/sunshine/main.cpp @@ -16,6 +16,7 @@ extern "C" { #include } +#include "platform/common.h" using namespace std::literals; util::ThreadPool task_pool; diff --git a/sunshine/platform/linux_evdev.cpp b/sunshine/platform/linux_evdev.cpp index 2b2ba78c..72ab6820 100644 --- a/sunshine/platform/linux_evdev.cpp +++ b/sunshine/platform/linux_evdev.cpp @@ -4,11 +4,11 @@ #include #include #include -#include #include +#include +#include #include -#include #include "common.h" #include "sunshine/utility.h" @@ -433,6 +433,18 @@ input_t input() { return nullptr; } + std::filesystem::path mouse_path { "sunshine_mouse" }; + std::filesystem::path gamepad_path { "sunshine_gamepad" }; + if(std::filesystem::exists(mouse_path)) { + std::filesystem::remove(mouse_path); + } + if(std::filesystem::exists(gamepad_path)) { + std::filesystem::remove(gamepad_path); + } + + std::filesystem::create_symlink(libevdev_uinput_get_devnode(gp.mouse_input.get()), mouse_path); + std::filesystem::create_symlink(libevdev_uinput_get_devnode(gp.gamepad_input.get()), gamepad_path); + gp.display = display(); return result; } diff --git a/sunshine/stream.cpp b/sunshine/stream.cpp index 53edcc50..6d0ad948 100644 --- a/sunshine/stream.cpp +++ b/sunshine/stream.cpp @@ -91,6 +91,7 @@ struct audio_packet_raw_t { #pragma pack(pop) safe::event_t launch_event; +auto input = std::make_shared(); struct config_t { audio::config_t audio; @@ -468,7 +469,6 @@ void control_server_t::send(const std::string_view & payload) { void controlThread(video::idr_event_t idr_events) { control_server_t server { CONTROL_PORT }; - auto input = std::make_shared(); server.map(packetTypes[IDX_START_A], [](const std::string_view &payload) { session.pingTimeout = std::chrono::steady_clock::now() + config::stream.ping_timeout; @@ -514,7 +514,7 @@ void controlThread(video::idr_event_t idr_events) { idr_events->raise(std::make_pair(firstFrame, lastFrame)); }); - server.map(packetTypes[IDX_INPUT_DATA], [&input](const std::string_view &payload) mutable { + server.map(packetTypes[IDX_INPUT_DATA], [](const std::string_view &payload) mutable { session.pingTimeout = std::chrono::steady_clock::now() + config::stream.ping_timeout; std::cout << "type [IDX_INPUT_DATA]"sv << std::endl;