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

Add report ID to set input mode command, revert input_mode->setValue #60

Merged
merged 3 commits into from
Feb 24, 2022

Conversation

1Revenger1
Copy link
Contributor

@1Revenger1 1Revenger1 commented Feb 22, 2022

This should still work with USB devices since the format was fixed.

input_mode->SetValue seems to break completely with I2C on Catalina. I wasn't able to figure out why it was broken, but this was reported to work. User's input mode report had an id of 3 (same value as Touchpad mode). It would be good to see if this works with USB devices.
VoodooI2CHID+reportID.zip
VoodooI2CHID+CondReportID.zip

This should still work with USB devices since the format was fixed
@kprinssu
Copy link
Collaborator

kprinssu commented Feb 22, 2022

This is more or less a revert of c874211

I would much prefer to just revert #48. Honestly, USB trackpads are rare and people who do want support for can build it and support it. I would much provide support for I2C devices.

@kprinssu kprinssu closed this Feb 22, 2022
@kprinssu kprinssu reopened this Feb 22, 2022
@kprinssu
Copy link
Collaborator

kprinssu commented Feb 23, 2022

@1Revenger1 What do you think of doing the following:

  void VoodooI2CPrecisionTouchpadHIDEventDriver::enterPrecisionTouchpadMode() {
       // This appears to not work on Catalina or older though (Works in Big Sur/Monterey)
      if (MACOS_VERSION >= MACOS_BIG_SUR) {
         input_mode_element->setValue(INPUT_MODE_TOUCHPAD);
         ready = true;
         return;
      }
      
      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();
  
      ready = true;
  }
}

@1Revenger1
Copy link
Contributor Author

I think the change looks good, and can make it later tonight. I still want to figure out why setValue doesn't work, but I don't have a device to test with locally (and I don't want to waste other's time).

@kprinssu
Copy link
Collaborator

I think the change looks good, and can make it later tonight. I still want to figure out why setValue doesn't work, but I don't have a device to test with locally (and I don't want to waste other's time).

No worries, I appreciate the effort here. Ideally, we can also use a bit of OOP and IOMatch to selectively load the proper event driver, but we handle that in a follow up PR.

@1Revenger1
Copy link
Contributor Author

@kprinssu this closer to what you were thinking?

@kprinssu
Copy link
Collaborator

Thanks @1Revenger1, this solution will work with Catalina and new macOS versions. However, USB trackpad users will need to be on macOS 11+ for VoodooI2C to work.

I think this is an okay compromise.

Copy link
Member

@ben9923 ben9923 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I wish it could be solved with a simple input_mode->setValue(). No clue on that, huh?

@kprinssu kprinssu merged commit 0206ebc into VoodooI2C:master Feb 24, 2022
@kprinssu
Copy link
Collaborator

Thanks @1Revenger1 :)!

@VoodooI2C VoodooI2C locked as resolved and limited conversation to collaborators Feb 24, 2022
@1Revenger1 1Revenger1 deleted the addReportID branch February 24, 2022 22:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants