diff --git a/guest/kext/src/RgfxPointerDevice.cpp b/guest/kext/src/RgfxPointerDevice.cpp index b461fe0eb..975d52927 100644 --- a/guest/kext/src/RgfxPointerDevice.cpp +++ b/guest/kext/src/RgfxPointerDevice.cpp @@ -148,7 +148,7 @@ OSNumber *RgfxPointerDevice::newPrimaryUsagePageNumber() const #if defined(__arm64e__) OSString *RgfxPointerDevice::newTransportString() const { - return OSString::withCString(kIOHIDTransportVirtualValue); + return OSString::withCString(kRgfxMouseTransport); } #endif diff --git a/guest/kext/src/RgfxPointerDevice.hpp b/guest/kext/src/RgfxPointerDevice.hpp index 0069b7d52..befef6fb8 100644 --- a/guest/kext/src/RgfxPointerDevice.hpp +++ b/guest/kext/src/RgfxPointerDevice.hpp @@ -65,13 +65,13 @@ public: OSNumber *newPrimaryUsageNumber() const override; OSNumber *newPrimaryUsagePageNumber() const override; #if defined(__arm64e__) - // Its HID transport, "Virtual" (kIOHIDTransportVirtualValue), on arm64 alone. There display - // 0's framebuffer, its provider, carries IOMobileFramebuffer's own "Transport", a dictionary - // (ReimsGraphicsMobile.cpp), which a lookup of the mouse's transport through its parents finds - // where the mouse names none: macOS 26.6.2's ReportIntervalServiceFilter took it for a string, - // and WindowServer died of the exception at each start, so no desktop came (lane a64ptr, - // potluck job m3-max-35949). The x86-64 kext's framebuffer has no "Transport", so its mouse - // names none, as before. + // Its HID transport, kRgfxMouseTransport (RgfxPointerMotion.hpp), "Virtual", on arm64 alone. + // There display 0's framebuffer, its provider, carries IOMobileFramebuffer's own "Transport", a + // dictionary (ReimsGraphicsMobile.cpp), which a lookup of the mouse's transport through its + // parents finds where the mouse names none: macOS 26.6.2's ReportIntervalServiceFilter took it + // for a string, and WindowServer died of the exception at each start, so no desktop came (lane + // a64ptr, potluck job m3-max-35949). The x86-64 kext's framebuffer has no "Transport", so its + // mouse names none, as before. OSString *newTransportString() const override; #endif diff --git a/guest/kext/src/RgfxPointerMotion.hpp b/guest/kext/src/RgfxPointerMotion.hpp index 56f845ad6..edbbbd2cc 100644 --- a/guest/kext/src/RgfxPointerMotion.hpp +++ b/guest/kext/src/RgfxPointerMotion.hpp @@ -86,6 +86,13 @@ constexpr uint8_t kRgfxMouseReportDescriptor[] = { // The size of one report. constexpr size_t kRgfxMouseReportBytes = RGFX_GUEST_ARM64 ? 6 : 7; +// The HID transport the mouse names (RgfxPointerDevice's newTransportString): "Virtual", +// IOHIDKeys.h's kIOHIDTransportVirtualValue, on arm64, where display 0's framebuffer, the mouse's +// provider, carries IOMobileFramebuffer's own "Transport", a dictionary, which a lookup of the +// mouse's transport through its parents finds where the mouse names none (RgfxPointerDevice.hpp); +// none on x86-64, whose framebuffer has no "Transport". +constexpr const char *kRgfxMouseTransport = RGFX_GUEST_ARM64 ? "Virtual" : nullptr; + // The most one report moves on an axis, and turns the wheel (or pans). constexpr int32_t kRgfxMouseReportMotionMax = 32767; constexpr int32_t kRgfxMouseReportWheelMax = 127; diff --git a/guest/kext/tests/pointer_motion_test.cpp b/guest/kext/tests/pointer_motion_test.cpp index 1a4e519a9..da3e170bd 100644 --- a/guest/kext/tests/pointer_motion_test.cpp +++ b/guest/kext/tests/pointer_motion_test.cpp @@ -4,9 +4,11 @@ // X and Y and an 8-bit wheel, six bytes a report, and as the x86-64 kext builds it an 8-bit AC // Pan after the wheel, seven bytes, which a SCROLL's notches turn, and the precise scroller's // descriptor and counts, which a SCROLL's distance turns (pointer_motion_arm64_test builds it as -// the arm64e kext does, which has neither). +// the arm64e kext does, which has neither), and the HID transport the mouse names. #include "RgfxPointerMotion.hpp" +#include + #include #include #include @@ -225,6 +227,16 @@ int main() "which every report carries"); } #endif + // The transport the mouse names: on arm64 IOHIDKeys.h's Virtual, a string, so a lookup of it + // through the mouse's parents stops before display 0's framebuffer and its dictionary of the + // same key (a desktop-killing exception in macOS 26.6.2's WindowServer, m3-max-35949); none on + // x86-64, whose framebuffer has none. + if (RGFX_GUEST_ARM64) + check(kRgfxMouseTransport != nullptr && + std::strcmp(kRgfxMouseTransport, kIOHIDTransportVirtualValue) == 0, + "the arm64 mouse names the Virtual transport"); + else + check(kRgfxMouseTransport == nullptr, "the x86-64 mouse names no transport"); std::printf("pointer_motion_test: %d checks passed\n", checks); return 0; }