From aadc62a96c18d9911428da041e611f8c3b01a444 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 6 Feb 2019 21:51:06 +0100 Subject: [PATCH] device: fix inability to detect devices with pipelining enabled This is because the message window is being created in the main thread, but there is nothing processing messages in the main thread. --- panda/src/device/winInputDeviceManager.cxx | 13 +++++++++++++ panda/src/device/winInputDeviceManager.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/panda/src/device/winInputDeviceManager.cxx b/panda/src/device/winInputDeviceManager.cxx index 40820f40cc..515dc376d8 100644 --- a/panda/src/device/winInputDeviceManager.cxx +++ b/panda/src/device/winInputDeviceManager.cxx @@ -391,6 +391,19 @@ on_input_device_removal(HANDLE handle) { } } +/** + * Polls the system to see if there are any new devices. In some + * implementations this is a no-op. + */ +void WinInputDeviceManager:: +update() { + MSG msg; + while (PeekMessage(&msg, _message_hwnd, WM_INPUT_DEVICE_CHANGE, WM_INPUT, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } +} + /** * Implementation of the message loop. */ diff --git a/panda/src/device/winInputDeviceManager.h b/panda/src/device/winInputDeviceManager.h index 4bf178b376..e99a01f761 100644 --- a/panda/src/device/winInputDeviceManager.h +++ b/panda/src/device/winInputDeviceManager.h @@ -52,6 +52,8 @@ private: pmap _raw_devices; pmap _raw_devices_by_path; + virtual void update() override; + static LRESULT WINAPI window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); typedef CONFIGRET (WINAPI *pCM_Get_DevNode_Property)(DEVINST, const DEVPROPKEY *, DEVPROPTYPE *, PBYTE, PULONG, ULONG);