Skip to content

Commit

Permalink
Use setValueData (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
1Revenger1 authored Oct 18, 2023
1 parent 881078e commit 89fa5b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
5 changes: 0 additions & 5 deletions VoodooI2CHID/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@
<integer>13</integer>
</dict>
</array>
<key>IOPropertyMatch</key>
<dict>
<key>Transport</key>
<string>I2C</string>
</dict>
<key>IOProbeScore</key>
<integer>300</integer>
<key>IOClass</key>
Expand Down
27 changes: 5 additions & 22 deletions VoodooI2CHID/VoodooI2CPrecisionTouchpadHIDEventDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,12 @@
OSDefineMetaClassAndStructors(VoodooI2CPrecisionTouchpadHIDEventDriver, VoodooI2CMultitouchHIDEventDriver);

void VoodooI2CPrecisionTouchpadHIDEventDriver::enterPrecisionTouchpadMode() {
// This needs to be investigated further for USB touchpad support,
// it is currently commented out as it causes issues with input devices
// failing to wake from sleep and does not work on 10.15 and lower

/* if (version_major > CATALINA_MAJOR_VERSION) {
// Update value from hardware so we can rewrite mode when waking from sleep
digitiser.input_mode->getValue(kIOHIDValueOptionsUpdateElementValues);
digitiser.input_mode->setValue(INPUT_MODE_TOUCHPAD);
ready = true;
return;
}*/

// TODO: setValue appears to not work on Catalina or older
VoodooI2CPrecisionTouchpadFeatureReport buffer;
buffer.reportID = digitiser.input_mode->getReportID();
buffer.value = INPUT_MODE_TOUCHPAD;
buffer.reserved = 0x00;
IOBufferMemoryDescriptor* report = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, sizeof(VoodooI2CPrecisionTouchpadFeatureReport));
report->writeBytes(0, &buffer, sizeof(VoodooI2CPrecisionTouchpadFeatureReport));

hid_interface->setReport(report, kIOHIDReportTypeFeature, digitiser.input_mode->getReportID());
report->release();
UInt8 inputMode[] = { INPUT_MODE_TOUCHPAD };

// Use setDataValue as it does not check for duplicate writes
OSData *value = OSData::withBytes(inputMode, sizeof(inputMode));
digitiser.input_mode->setDataValue(value);
OSSafeReleaseNULL(value);
ready = true;
}

Expand Down

0 comments on commit 89fa5b6

Please sign in to comment.