Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to get working with latest VoodooI2C #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions VoodooI2CGoodix.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = x86_64;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -201,6 +202,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
KERNEL_EXTENSION_HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../MacKernelSDK/Headers";
KERNEL_FRAMEWORK_HEADERS = "$(PROJECT_DIR)/../../MacKernelSDK/Headers";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand All @@ -212,6 +215,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = x86_64;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -253,6 +257,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
KERNEL_EXTENSION_HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../MacKernelSDK/Headers";
KERNEL_FRAMEWORK_HEADERS = "$(PROJECT_DIR)/../../MacKernelSDK/Headers";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>VoodooI2CGoodix.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>VoodooI2CGoodix.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
<integer>3</integer>
</dict>
</dict>
</dict>
Expand Down
3 changes: 2 additions & 1 deletion VoodooI2CGoodix/VoodooI2CGoodixEventDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#include <IOKit/IOWorkLoop.h>
#include <IOKit/IOTimerEventSource.h>

#include <IOKit/hidevent/IOHIDEventService.h>
#include <IOKit/hid/IOHIDDevice.h>
#include <IOKit/hid/IOHIDEventService.h>
#include <IOKit/hidsystem/IOHIDTypes.h>

#include <IOKit/graphics/IOFramebuffer.h>
Expand Down
42 changes: 41 additions & 1 deletion VoodooI2CGoodix/VoodooI2CGoodixTouchDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ bool VoodooI2CGoodixTouchDriver::init(OSDictionary *properties) {
awake = true;
ready_for_input = false;
read_in_progress = false;

#ifdef GOODIX_TOUCH_DRIVER_DEBUG
IOLog("%s::init: ready_for_input = true\n", getName());
#endif

return true;
}

Expand Down Expand Up @@ -190,6 +195,11 @@ bool VoodooI2CGoodixTouchDriver::start(IOService* provider) {
registerPowerDriver(this, VoodooI2CIOPMPowerStates, kVoodooI2CIOPMNumberPowerStates);
IOSleep(100);
ready_for_input = true;

#ifdef GOODIX_TOUCH_DRIVER_DEBUG
IOLog("%s::start: ready_for_input = true\n", getName());
#endif

setProperty("VoodooI2CServices Supported", OSBoolean::withBoolean(true));
IOLog("%s::VoodooI2CGoodixTouchDriver has started\n", getName());

Expand Down Expand Up @@ -225,8 +235,17 @@ bool VoodooI2CGoodixTouchDriver::start(IOService* provider) {

void VoodooI2CGoodixTouchDriver::interrupt_occurred(OSObject* owner, IOInterruptEventSource* src, int intCount) {
if (read_in_progress || !awake) {
#ifdef GOODIX_TOUCH_DRIVER_DEBUG
IOLog("%s::interrupt_occurred: ignoring interrupt %d\n", getName(), intCount);
#endif

return;
}

#ifdef GOODIX_TOUCH_DRIVER_DEBUG
IOLog("%s::interrupt_occurred: %d\n", getName(), intCount);
#endif

interrupt_source->disable();
read_in_progress = true;
thread_t new_thread;
Expand All @@ -242,6 +261,22 @@ void VoodooI2CGoodixTouchDriver::interrupt_occurred(OSObject* owner, IOInterrupt
}

void VoodooI2CGoodixTouchDriver::handle_input_threaded() {
#ifdef GOODIX_TOUCH_DRIVER_DEBUG
IOLog("%s::handle_input_threaded: called\n", getName());
#endif

#ifdef GOODIX_TOUCH_DRIVER_DEBUG
if (!ready_for_input) {
IOLog("%s::handle_input_threaded: not ready for input\n", getName());
}
#endif

#ifdef GOODIX_TOUCH_DRIVER_DEBUG
if (!command_gate) {
IOLog("%s::handle_input_threaded: no command gate\n", getName());
}
#endif

if (!ready_for_input || !command_gate) {
read_in_progress = false;
return;
Expand All @@ -266,6 +301,11 @@ IOReturn VoodooI2CGoodixTouchDriver::goodix_process_events() {
UInt8 data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS + 1];

numTouches = goodix_ts_read_input_report(data);

#ifdef GOODIX_TOUCH_DRIVER_DEBUG
IOLog("%s::goodix_process_events: Got event report: %d\n", getName(), numTouches);
#endif

if (numTouches <= 0) {
return kIOReturnSuccess;
}
Expand Down Expand Up @@ -370,7 +410,7 @@ void VoodooI2CGoodixTouchDriver::goodix_ts_store_touch(UInt8 *coor_data) {
}

#ifdef GOODIX_TOUCH_DRIVER_DEBUG
IOLog("%s::%s %d with width %d at %d,%d\n", getName(), type ? "Stylus" : "Touch", id, input_w, input_x, input_y);
IOLog("%s::goodix_ts_store_touch: %s %d with width %d at %d,%d\n", getName(), type ? "Stylus" : "Touch", id, input_w, input_x, input_y);
#endif

// Store touch information
Expand Down