diff --git a/Changelog.md b/Changelog.md index f0640754..48d9223a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ VoodooPS2 Changelog #### v2.1.8 - Added support for receiving input form other kexts +- Fixed dynamic coordinate refresh for ELAN v3 touchpads #### v2.1.7 - Initial MacKernelSDK and Xcode 12 compatibility diff --git a/VoodooPS2Controller.xcodeproj/project.pbxproj b/VoodooPS2Controller.xcodeproj/project.pbxproj index 789bbf52..2bd39ce1 100644 --- a/VoodooPS2Controller.xcodeproj/project.pbxproj +++ b/VoodooPS2Controller.xcodeproj/project.pbxproj @@ -193,6 +193,7 @@ CE8DA1C3251839B2008C44E8 /* Frameworks */, ); sourceTree = ""; + usesTabs = 0; }; 84167814161B55B2002C60E6 /* Products */ = { isa = PBXGroup; @@ -487,7 +488,7 @@ 84167808161B55B2002C60E6 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1140; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = Acidanthera; }; buildConfigurationList = 8416780B161B55B2002C60E6 /* Build configuration list for PBXProject "VoodooPS2Controller" */; diff --git a/VoodooPS2Controller.xcodeproj/xcshareddata/xcschemes/VoodooPS2Controller.xcscheme b/VoodooPS2Controller.xcodeproj/xcshareddata/xcschemes/VoodooPS2Controller.xcscheme index d9cf0273..07d93519 100644 --- a/VoodooPS2Controller.xcodeproj/xcshareddata/xcschemes/VoodooPS2Controller.xcscheme +++ b/VoodooPS2Controller.xcodeproj/xcshareddata/xcschemes/VoodooPS2Controller.xcscheme @@ -1,6 +1,6 @@ info.x_max) { + info.x_max = x; + needs_update = true; + } + + if (y > info.y_max) { + info.y_max = y; + needs_update = true; + } + + if (needs_update) { + setProperty(VOODOO_INPUT_LOGICAL_MAX_X_KEY, info.x_max - info.x_min, 32); + setProperty(VOODOO_INPUT_LOGICAL_MAX_Y_KEY, info.y_max - info.y_min, 32); + + setProperty(VOODOO_INPUT_PHYSICAL_MAX_X_KEY, (info.x_max - info.x_min + 1) * 100 / info.x_res, 32); + setProperty(VOODOO_INPUT_PHYSICAL_MAX_Y_KEY, (info.y_max - info.y_min + 1) * 100 / info.y_res, 32); + + if (voodooInputInstance) { + VoodooInputDimensions dims = { + static_cast(info.x_min), static_cast(info.x_max), + static_cast(info.y_min), static_cast(info.y_max) + }; + + super::messageClient(kIOMessageVoodooInputUpdateDimensionsMessage, voodooInputInstance, &dims, sizeof(dims)); + } + } +} + void ApplePS2Elan::elantechReportAbsoluteV1() { unsigned char *packet = _ringBuffer.tail(); unsigned int fingers = 0, x = 0, y = 0; @@ -1666,6 +1697,11 @@ void ApplePS2Elan::elantechReportAbsoluteV3(int packetType) { // byte 0: n1 n0 . . . . R L fingers = (packet[0] & 0xc0) >> 6; + INTERRUPT_LOG("report abs v3 type %d finger %u x %d y %d btn %d (%02x %02x %02x %02x %02x %02x)\n", packetType, fingers, + ((packet[1] & 0x0f) << 8) | packet[2], + (((packet[4] & 0x0f) << 8) | packet[5]), + packet[0] & 0x03, packet[0], packet[1], packet[2], packet[3], packet[4], packet[5]); + switch (fingers) { case 3: case 1: @@ -1675,7 +1711,9 @@ void ApplePS2Elan::elantechReportAbsoluteV3(int packetType) { // byte 4: . . . . y11 y10 y9 y8 // byte 5: y7 y6 y5 y4 y3 y2 y1 y0 - y1 = info.y_max - (((packet[4] & 0x0f) << 8) | packet[5]); + y1 = (((packet[4] & 0x0f) << 8) | packet[5]); + elantechRescale(x1, y1); + y1 = info.y_max - y1; break; case 2: @@ -1696,7 +1734,9 @@ void ApplePS2Elan::elantechReportAbsoluteV3(int packetType) { x1 = etd.mt[0].x; y1 = etd.mt[0].y; x2 = ((packet[1] & 0x0f) << 8) | packet[2]; - y2 = info.y_max - (((packet[4] & 0x0f) << 8) | packet[5]); + y2 = (((packet[4] & 0x0f) << 8) | packet[5]); + elantechRescale(x2, y2); + y2 = info.y_max - y2; break; } diff --git a/VoodooPS2Trackpad/VoodooPS2Elan.h b/VoodooPS2Trackpad/VoodooPS2Elan.h index 363ab5e0..332cea0f 100644 --- a/VoodooPS2Trackpad/VoodooPS2Elan.h +++ b/VoodooPS2Trackpad/VoodooPS2Elan.h @@ -306,6 +306,7 @@ class EXPORT ApplePS2Elan : public IOHIPointing { int elantechPacketCheckV2(); int elantechPacketCheckV3(); int elantechPacketCheckV4(); + void elantechRescale(unsigned int x, unsigned int y); void elantechReportAbsoluteV1(); void elantechReportAbsoluteV2(); void elantechReportAbsoluteV3(int packetType);