Skip to content

Commit

Permalink
Merge branch '2.9' of github.com:VoodooI2C/VoodooI2C into 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kprinssu committed Nov 5, 2024
2 parents dfe54bc + 30517ef commit 4505756
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 108 deletions.
78 changes: 0 additions & 78 deletions .circleci/config.yml

This file was deleted.

141 changes: 141 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:
release:
types: [published]

env:
PROJECT_TYPE: KEXT

jobs:
build:
name: Kext Build
runs-on: macos-latest
env:
JOB_TYPE: BUILD
steps:
- name: Checkout VoodooI2C
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 500
- name: Checkout MacKernelSDK
uses: actions/checkout@v4
with:
repository: acidanthera/MacKernelSDK
path: MacKernelSDK
- name: CI Bootstrap
run: |
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1
- name: VoodooInput Bootstrap
run: |
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/VoodooInput/master/VoodooInput/Scripts/bootstrap.sh) && eval "$src" && mv VoodooInput Dependencies
- name: Fetch tags
run: git fetch --tags --recurse-submodules=no

- name: Get Commit SHA
id: vars
run: |
echo "sha_short=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT
- name: Build Debug VoodooI2C
run: xcodebuild -workspace VoodooI2C.xcworkspace -scheme VoodooI2C -derivedDataPath build -jobs 1 -configuration Debug
- name: Build Release VoodooI2C
run: xcodebuild -workspace VoodooI2C.xcworkspace -scheme VoodooI2C -derivedDataPath build -jobs 1 -configuration Release

- name: Generate Release Description
if: github.event_name == 'release'
run: |
LAST_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)
LAST_TEN_COMMITS=$(git log --oneline --pretty=format:"%h - %s (%an)" ${LAST_TAG}..@ -n 10)
NEW_LINES=$'\n\n\n'
NUM_COMMITS="$(git rev-list ${LAST_TAG}..@ --count)"
echo "Since the last release there have been ${NUM_COMMITS} commit(s). The descriptions for the first (at most) 10 of these are as follows${NEW_LINES}${LAST_TEN_COMMITS}" >> ./changelog.md
- uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
files: build/Build/Products/*/*.zip
body_path: ./changelog.md

- uses: actions/upload-artifact@v4
with:
name: VoodooI2C-${{ steps.vars.outputs.sha_short }}
path: build/Build/Products/*/*.zip

docs:
name: Docs
runs-on: macos-latest
steps:
- name: Checkout VoodooI2C
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Checkout MacKernelSDK
uses: actions/checkout@v4
with:
repository: acidanthera/MacKernelSDK
path: MacKernelSDK

- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install python dependencies
run: pip3 install -r requirements.txt

- name: VoodooInput Bootstrap
run: |
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/VoodooInput/master/VoodooInput/Scripts/bootstrap.sh) && eval "$src" && mv VoodooInput Dependencies
- name: Build Documentation
run: ./scripts/build_doc.sh

- name: Package Documentation
run: zip -r Docs.zip ./docs/*
- uses: actions/upload-artifact@v4
with:
name: VoodooI2C-Docs
path: Docs.zip

- name: Upload Docs to Github Pages
if: ${{ (github.event_name == 'release') && (github.event.repository.full_name == 'VoodooI2C/VoodooI2C') }}
working-directory: ./docs
env:
DOCUMENTATION_TOKEN: ${{ secrets.DOCUMENTATION_TOKEN }}
USERNAME: github-actions[bot]
run: |
git init .
git config user.name "$USERNAME"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "${{ github.ref_name}} Documentation"
git push -f https://$USERNAME:$DOCUMENTATION_TOKEN@github.com/VoodooI2C/VoodooI2C.github.io.git master
lint:
name: Lint
runs-on: macos-latest
steps:
- name: Checkout VoodooI2C
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Checkout MacKernelSDK
uses: actions/checkout@v4
with:
repository: acidanthera/MacKernelSDK
path: MacKernelSDK

- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install python dependencies
run: pip3 install -r requirements.txt
- name: Run Lint
run: ./scripts/run_lint.sh
34 changes: 34 additions & 0 deletions .github/workflows/objective-c-xcode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Xcode - Build and Analyze

on:
push:
branches: [ "*" ]
pull_request:
types:
- opened

jobs:
build:
name: Build and analyse default scheme using xcodebuild command
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: download mackernelsdk
run: git clone https://github.com/acidanthera/MacKernelSDK

- run: src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/VoodooInput/master/VoodooInput/Scripts/bootstrap.sh) && eval "$src" && mv VoodooInput Dependencies
- run: pip3 install --break-system-packages cpplint
- run: pip3 install --break-system-packages git+https://github.com/voodooi2c/cldoc.git
- run: git submodule init && git submodule update

- name: xcodebuild
run: xcodebuild -workspace "VoodooI2C.xcworkspace" -scheme "VoodooI2C" -derivedDataPath build clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/Build/Products/Release
5 changes: 5 additions & 0 deletions Multitouch Support/Native/VoodooI2CNativeEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ MultitouchReturn VoodooI2CNativeEngine::handleInterruptReport(VoodooI2CMultitouc
if (inputTransducer->isValid) {
valid_touch_count++;
}

if (!transducer->confidence.value()) {
inputTransducer->fingerType = kMT2FingerTypePalm;
}

inputTransducer->isTransducerActive = transducer->tip_switch.value();
inputTransducer->isPhysicalButtonDown = !transducer->has_secondary_button && transducer->physical_button.value(); // if it has secondary button, then it will be passed as buttons on the "trackpoint" device

Expand Down
3 changes: 3 additions & 0 deletions Multitouch Support/VoodooI2CDigitiserTransducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ VoodooI2CDigitiserTransducer* VoodooI2CDigitiserTransducer::transducer(Digitiser
transducer->collection = digitizer_collection;
transducer->in_range = false;

// Set Confidence bit for satellites which do not implement contact rejection yet
transducer->confidence.update(1, 0);

exit:
return transducer;
}
1 change: 1 addition & 0 deletions Multitouch Support/VoodooI2CDigitiserTransducer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class EXPORT VoodooI2CDigitiserTransducer : public OSObject {
DigitiserTransducerAziAltiOrentation azi_alti_orientation;
DigitiserTransducerTiltOrientation tilt_orientation;

DigitiserTransducerButtonState confidence;
DigitiserTransducerButtonState tip_switch;
TimeTrackedValue tip_pressure;

Expand Down
35 changes: 8 additions & 27 deletions VoodooI2C/VoodooI2C.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,7 @@
AC2603AD1F2F294000CF238F /* Headers */,
AC2603AE1F2F294000CF238F /* Resources */,
AC0955921F4EE9B00052E343 /* Add GPIO and Services Plugin */,
ACA4A00D21E25F0E00A91B61 /* Linting */,
ACA4A00F21E25F3500A91B61 /* Generate Documentation */,
EE5AF8832CD44DB1001EE729 /* Archive */,
);
buildRules = (
);
Expand Down Expand Up @@ -641,7 +640,7 @@
shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/VoodooI2C.kext/Contents/PlugIns\"\nrm -rf \"${BUILT_PRODUCTS_DIR}/VoodooI2C.kext/Contents/PlugIns/VoodooGPIO.kext\"\nmv \"${BUILT_PRODUCTS_DIR}/VoodooGPIO.kext\" \"${BUILT_PRODUCTS_DIR}/VoodooI2C.kext/Contents/PlugIns\"\n\nrm -rf \"${BUILT_PRODUCTS_DIR}/VoodooI2C.kext/Contents/PlugIns/VoodooI2CServices.kext\"\nmv \"${BUILT_PRODUCTS_DIR}/VoodooI2CServices.kext\" \"${BUILT_PRODUCTS_DIR}/VoodooI2C.kext/Contents/PlugIns\"\n\nrm -rf \"${BUILT_PRODUCTS_DIR}/VoodooI2C.kext/Contents/PlugIns/VoodooInput.kext\"\ncp -r \"${SRCROOT}/../Dependencies/VoodooInput/${CONFIGURATION}\"/VoodooInput.kext \"${BUILT_PRODUCTS_DIR}/VoodooI2C.kext/Contents/PlugIns\"\n\nrm -rf \"${BUILT_PRODUCTS_DIR}/VoodooInput.kext.dSYM\"\ncp -r \"${SRCROOT}/../Dependencies/VoodooInput/${CONFIGURATION}\"/*.dSYM ${BUILT_PRODUCTS_DIR} 2>/dev/null || true\n";
showEnvVarsInLog = 0;
};
ACA4A00D21E25F0E00A91B61 /* Linting */ = {
EE5AF8832CD44DB1001EE729 /* Archive */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -650,32 +649,14 @@
);
inputPaths = (
);
name = Linting;
name = Archive;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cpplint --recursive --filter=-build/include_subdir,-build/header_guard,-whitespace/line_length,-runtime/int ./\n";
};
ACA4A00F21E25F3500A91B61 /* Generate Documentation */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Generate Documentation";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "pwd; find ./VoodooI2C ../Dependencies ../Multitouch\\ Support ../VoodooI2C\\ Satellites -name \"*.hpp\" -print0 | xargs -0 cldoc generate -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -nostdinc -std=gnu++11 -stdlib=libc++ -fmodules -gmodules -fmodules-cache-path=${MODULE_CACHE_DIR} -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=${MODULE_CACHE_DIR}/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -fno-builtin -Wno-trigraphs -fno-exceptions -fno-rtti -msoft-float -O0 -fno-common -mkernel -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wno-inconsistent-missing-override -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DDEBUG=1 -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -DAPPLE -DNeXT -fapple-kext -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.10 -g -Wno-sign-conversion -Winfinite-recursion -Wno-move -I${PROJECT_DIR}/../MacKernelSDK/Headers -I${SDKROOT}/System/Library/Frameworks/Kernel.framework/PrivateHeaders -I${SDKROOT}/System/Library/Frameworks/Kernel.framework/Headers -I${DERIVED_SOURCES_DIR}/x86_64 -I${DERIVED_SOURCES_DIR} -I../Dependencies/VoodooInput/Debug/VoodooInput.kext/Contents/Resources -Wno-inconsistent-missing-override -Wno-unused-variable -- --output ../docs --report --merge \"../Documentation\" --basedir .\n";
shellScript = "cd \"${TARGET_BUILD_DIR}\"\n\n# Find kexts\ndist=()\nfor i in *.kext; do\n dist+=($i)\ndone\n\n# Move debug symbols to dSYM folder\nif [ -d \"$DWARF_DSYM_FILE_NAME\" ]; then\n rm -rf dSYM\n mkdir dSYM\n find . -name \"*.dSYM\" -exec mv \"{}\" dSYM/ \\;\n dist+=(dSYM);\nfi\n\n#zip\narchive=\"VoodooI2C-${CURRENT_PROJECT_VERSION}-$(echo $CONFIGURATION | tr /a-z/ /A-Z/).zip\"\nrm -rf *.zip\nzip -qry -FS \"${archive}\" \"${dist[@]}\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -773,7 +754,7 @@
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -832,7 +813,7 @@
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
Expand All @@ -859,7 +840,7 @@
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.8;
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../Dependencies/VoodooInput/Debug/VoodooInput.kext/Contents/Resources";
Expand All @@ -884,7 +865,7 @@
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.8;
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../Dependencies/VoodooInput/Debug/VoodooInput.kext/Contents/Resources";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include "VoodooI2CControllerNub.hpp"

// Log only if current thread is interruptible, otherwise we will get a panic.
#define TryLog(args...) do { if (ml_get_interrupts_enabled()) IOLog(args); } while (0)
#define TryLog(args...) \
do { \
if (ml_get_interrupts_enabled()) \
IOLog(args); \
} while (0)

#define super IOService
OSDefineMetaClassAndStructors(VoodooI2CController, IOService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ constexpr uint64_t MICRO = 1000000;
({ \
uint32_t __base = (base); \
uint32_t __rem; \
__rem = ((uint64_t)(n)) % __base; \
(n) = ((uint64_t)(n)) / __base; \
__rem = (static_cast<uint64_t>(n)) % __base; \
(n) = (static_cast<uint64_t>(n)) / __base; \
__rem; \
})

Expand Down
Loading

0 comments on commit 4505756

Please sign in to comment.