From 72cf86ece0f43a5f699fb6c1b9faac2081615806 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Fri, 25 Sep 2026 20:27:37 +1200 Subject: [PATCH] Open the 3D mouse non-exclusively on macOS hidapi's macOS backend opens every device with kIOHIDOptionsTypeSeizeDevice unless told otherwise (hid_init() calls hid_darwin_set_open_exclusive(1) for backward compatibility). When 3DxWare is running it already holds the SpacePilot/SpaceMouse, so the seize fails, hid_open_path() returns NULL and HidBackend::scan() keeps retrying every 3 s without ever finding the device. Reported in discussion #599: a SpacePilot Pro (046d:c629) is listed by hid_enumerate() and works in 3DxWare, but has no effect in QET's macOS build. Enumeration never opens a device, so it did not exercise this. Guarded on HID_API_VERSION >= 0.12, where the setter first appeared. Co-Authored-By: Claude Opus 5.5 --- sources/spacemouse/hidbackend.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sources/spacemouse/hidbackend.cpp b/sources/spacemouse/hidbackend.cpp index 9ab2d5d51..63d9dbb05 100644 --- a/sources/spacemouse/hidbackend.cpp +++ b/sources/spacemouse/hidbackend.cpp @@ -20,6 +20,9 @@ #include #include +#if defined(Q_OS_MACOS) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) +# include +#endif namespace { constexpr int SCAN_INTERVAL_MS = 3000; @@ -42,6 +45,11 @@ HidBackend::HidBackend(QObject *parent) : return; } m_hid_initialised = true; +#if defined(Q_OS_MACOS) && HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0) + //hidapi opens devices exclusively on macOS by default, which fails + //while 3DxWare has the device open (discussion #599). + hid_darwin_set_open_exclusive(0); +#endif m_read_timer = new QTimer(this); connect(m_read_timer, &QTimer::timeout, this, &HidBackend::readReports);