CI: temporary VoodooI2CHID AlpsHID wake-fix build #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build VoodooI2CHID AlpsHID wake fix | |
| on: | |
| push: | |
| branches: | |
| - ci-vihid-wakefix-7720 | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: macos-14 | |
| steps: | |
| - name: Clone AlpsHID VoodooI2CHID fork | |
| run: | | |
| git clone --depth 1 --branch juico-report https://github.com/juico/VoodooI2CHID.git "$GITHUB_WORKSPACE/VoodooI2CHID" | |
| - name: Clone MacKernelSDK | |
| run: | | |
| git clone --depth 1 https://github.com/acidanthera/MacKernelSDK.git "$GITHUB_WORKSPACE/../MacKernelSDK" | |
| - name: Apply Tahoe wake retry fix to AlpsHID fork | |
| shell: bash | |
| run: | | |
| cat > "$GITHUB_WORKSPACE/VoodooI2CHID/VoodooI2CHID/VoodooI2CPrecisionTouchpadHIDEventDriver.cpp" <<'EOF' | |
| // | |
| // VoodooI2CPrecisionTouchpadHIDEventDriver.cpp | |
| // VoodooI2CHID | |
| // | |
| // AlpsHID/juico-report base + wake retry port from VoodooI2C issue #582 | |
| // | |
| #include "VoodooI2CPrecisionTouchpadHIDEventDriver.hpp" | |
| #define super VoodooI2CMultitouchHIDEventDriver | |
| OSDefineMetaClassAndStructors(VoodooI2CPrecisionTouchpadHIDEventDriver, VoodooI2CMultitouchHIDEventDriver); | |
| void VoodooI2CPrecisionTouchpadHIDEventDriver::enterPrecisionTouchpadMode() { | |
| const int maxRetries = 10; | |
| int retry = 0; | |
| while (!digitiser.input_mode && retry < maxRetries) { | |
| IOSleep(50); | |
| retry++; | |
| } | |
| if (!digitiser.input_mode) { | |
| IOLog("VoodooI2CHID: input_mode not ready after wake retry limit\n"); | |
| ready = false; | |
| return; | |
| } | |
| UInt8 inputMode[] = { INPUT_MODE_TOUCHPAD }; | |
| OSData *value = OSData::withBytes(inputMode, sizeof(inputMode)); | |
| if (!value) { | |
| IOLog("VoodooI2CHID: failed to allocate input-mode OSData\n"); | |
| ready = false; | |
| return; | |
| } | |
| digitiser.input_mode->setDataValue(value); | |
| OSSafeReleaseNULL(value); | |
| ready = true; | |
| } | |
| void VoodooI2CPrecisionTouchpadHIDEventDriver::handleInterruptReport(AbsoluteTime timestamp, IOMemoryDescriptor *report, IOHIDReportType report_type, UInt32 report_id) { | |
| if (!ready) | |
| return; | |
| super::handleInterruptReport(timestamp, report, report_type, report_id); | |
| } | |
| bool VoodooI2CPrecisionTouchpadHIDEventDriver::handleStart(IOService* provider) { | |
| if (!super::handleStart(provider)) | |
| return false; | |
| if (!digitiser.input_mode) | |
| return false; | |
| IOLog("%s::%s Putting device into Precision Touchpad Mode\n", getName(), name); | |
| ready = false; | |
| enterPrecisionTouchpadMode(); | |
| return true; | |
| } | |
| IOReturn VoodooI2CPrecisionTouchpadHIDEventDriver::setPowerState(unsigned long whichState, IOService* whatDevice) { | |
| if (whatDevice != this) | |
| return kIOReturnInvalid; | |
| if (!whichState) { | |
| if (awake) | |
| awake = false; | |
| ready = false; | |
| } else { | |
| if (!awake) { | |
| ready = false; | |
| IOSleep(10); | |
| enterPrecisionTouchpadMode(); | |
| awake = true; | |
| } | |
| } | |
| return kIOPMAckImplied; | |
| } | |
| EOF | |
| - name: Build Release kext | |
| working-directory: VoodooI2CHID | |
| run: | | |
| xcodebuild \ | |
| -project VoodooI2CHID.xcodeproj \ | |
| -target VoodooI2CHID \ | |
| -configuration Release \ | |
| SYMROOT="$PWD/build" \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| ONLY_ACTIVE_ARCH=NO \ | |
| ARCHS=x86_64 \ | |
| build | |
| - name: Package kext | |
| working-directory: VoodooI2CHID | |
| run: | | |
| set -e | |
| KEXT="$(find build -type d -name VoodooI2CHID.kext -print -quit)" | |
| test -n "$KEXT" | |
| echo "Built: $KEXT" | |
| /usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$KEXT/Contents/Info.plist" | |
| file "$KEXT/Contents/MacOS/VoodooI2CHID" | |
| codesign --force --sign - "$KEXT" | |
| ditto -c -k --sequesterRsrc --keepParent "$KEXT" "$GITHUB_WORKSPACE/VoodooI2CHID-AlpsHID12-WakeFix582.zip" | |
| shasum -a 256 "$GITHUB_WORKSPACE/VoodooI2CHID-AlpsHID12-WakeFix582.zip" | |
| - name: Upload patched kext | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: VoodooI2CHID-AlpsHID12-WakeFix582 | |
| path: VoodooI2CHID-AlpsHID12-WakeFix582.zip | |
| if-no-files-found: error |