Skip to content

Commit

Permalink
Fix not responding for every fifth-time touch.
Browse files Browse the repository at this point in the history
Issue: VoodooI2C/VoodooI2C#185

The correcting of the wrapper index in ``handleDigitizerReport()''
is not a good fit for some specific touchpad model, in which
the first identifier is changed for every five times of touch,
resulting in the wrong actual index for the wrapper.

This fix is simple and may not perfect for every model. We still need to dig into it.
  • Loading branch information
Goshin committed Dec 21, 2019
1 parent ee26207 commit d729e26
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions VoodooI2CHID/VoodooI2CMultitouchHIDEventDriver.cpp
Expand Up @@ -140,26 +140,6 @@ void VoodooI2CMultitouchHIDEventDriver::handleDigitizerReport(AbsoluteTime times
if (!wrapper)
return;

UInt8 finger_count = digitiser.fingers->getCount();

if (finger_count) {
// Check if we are sending the report to the right wrapper, 99% of the time, `digitiser.current_report - 1` will
// be the correct index but in rare circumstances, it won't be so we should ensure we have the right index

if (!wrapper->first_identifier)
return;

UInt8 first_identifier = wrapper->first_identifier->getValue() ? wrapper->first_identifier->getValue() : 0;

UInt8 actual_index = static_cast<int>(roundUp(first_identifier + 1, finger_count)/finger_count) - 1;

if (actual_index != digitiser.current_report - 1) {
wrapper = OSDynamicCast(VoodooI2CHIDTransducerWrapper, digitiser.wrappers->getObject(actual_index));
if (!wrapper)
return;
}
}

for (int i = 0; i < wrapper->transducers->getCount(); i++) {
VoodooI2CDigitiserTransducer* transducer = OSDynamicCast(VoodooI2CDigitiserTransducer, wrapper->transducers->getObject(i));
handleDigitizerTransducerReport(transducer, timestamp, report_id);
Expand Down

0 comments on commit d729e26

Please sign in to comment.