[idd] ipc: connect LGInput to LGIdd

Move the reusable named-pipe endpoint and shared support code into
the LGCommon static library.

Run a dedicated server in LGIdd and a reconnecting client in
LGInput, with device-lifecycle handling and report framing.

Refactor the helper pipe to use the same endpoint implementation.
This commit is contained in:
Geoffrey McRae
2026-08-08 19:06:50 +10:00
parent 214665bedd
commit 241ab3fad2
24 changed files with 1463 additions and 478 deletions

View File

@@ -23,40 +23,31 @@
#include <windows.h>
#include <wdf.h>
#include <stdint.h>
#include <wrl.h>
#include <vector>
#include "CPipeEndpoint.h"
#include "PipeMsg.h"
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace Microsoft::WRL::Wrappers::HandleTraits;
class CDeviceContext;
class CPipeServer
class CPipeServer : private IPipeEndpointHandler
{
private:
HandleT<HANDLETraits> m_pipe;
HandleT<HANDLENullTraits> m_thread;
HandleT<EventTraits> m_signal;
std::vector<LGPipeMsg> m_queue;
bool m_running = false;
bool m_connected = false;
CPipeEndpoint m_endpoint;
SRWLOCK m_queueLock = SRWLOCK_INIT;
std::vector<LGPipeMsg> m_queue;
SRWLOCK m_deviceContextLock = SRWLOCK_INIT;
CDeviceContext * m_deviceContext = nullptr;
void _DeInit();
static DWORD WINAPI _pipeThread(LPVOID lpParam) { ((CPipeServer*)lpParam)->Thread(); return 0; }
void Thread();
void WriteMsg(const LGPipeMsg & msg);
void QueueMsgLocked(const LGPipeMsg & msg);
void HandleReloadSettings();
void OnPipeConnected() override;
bool OnPipeMessage(const void * message, size_t size) override;
public:
~CPipeServer() { DeInit(); }