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

Fix VoodooI2CHID issue w/ Touchscreen #12

Closed
Qonfused opened this issue Nov 28, 2022 · 21 comments
Closed

Fix VoodooI2CHID issue w/ Touchscreen #12

Qonfused opened this issue Nov 28, 2022 · 21 comments
Assignees
Labels
status:done All issue tasks are completed. type:bug Something isn't working type:feature New feature request

Comments

@Qonfused
Copy link
Owner

Qonfused commented Nov 28, 2022

On startup, touchscreen on both displays works in legacy mouse mode (no multitouch/PTP mode); it also appears to no longer respond about a minute after login. These issues were also described in @shiecldk's tonymacx86 UX582 thread prior to resolution, and describes an issue with VoodooI2CHID where changing driver/device priority can break multitouch.

@gkvt's fork of VoodooI2C at https://github.com/gvkt/VoodooI2CHID resolves an architecture incompatibility w/ multi-I2C HID devices; the workaround allows for greater control of which driver is attached to which device. The pull request for this fork was tracked in VoodooI2C/VoodooI2CHID#58 (closed) and VoodooI2C/VoodooI2CHID#59 (merged).

Refer to VoodooI2C/VoodooI2C#485 (comment) for Info.plist changes (changes are to match drivers to device-specific product ids rather than device names).

For reference, discussion on multi-touch support for touchscreen w/ VoodooI2C details the debugging used to modify the kext's Info.plist to prevent interference from touchscreen/precision trackpad event drivers.

@Qonfused Qonfused added the type:bug Something isn't working label Nov 28, 2022
@Qonfused Qonfused self-assigned this Nov 28, 2022
@Qonfused
Copy link
Owner Author

Qonfused commented Nov 28, 2022

Will need to verify if there different are variations of trackpads/touch controllers/etc. with differing vendor ids/etc.

Support for the UX481{FA|FL}, UX581{GV|LV}, and UX582 ZenBook Duos should be verified w/ this repo and upstream.

@Qonfused
Copy link
Owner Author

Qonfused commented Nov 29, 2022

Found an explanation for the VoodooI2CHID-AsTouchscreen.kext and VoodooI2CHID-AsTrackpad.kext kexts here.

@Qonfused
Copy link
Owner Author

Qonfused commented Nov 29, 2022

For the UX582 (from VoodooI2C/VoodooI2CHID#59 (comment)):

Device Identifier ACPI Path VID:PID
Trackpad ELAN1406 _SB.PCI0.I2C1.ETPD 04F3:3101
Primary Display ELAN9008 _SB.PCI0.I2C1.TPL0 04F3:2C56
Screenpad Plus ELAN9009 _SB.PCI0.I2C1.TPL1 04F3:2C23

For the UX481(FL):

Device Identifier ACPI Path VID:PID
Trackpad ELAN1207 _SB.PCI0.I2C1.ETPD 04F3:310E
Primary Display ELAN9008 _SB.PCI0.I2C0.TPL1 04F3:2B6A
Screenpad Plus ELAN9009 _SB.PCI0.I2C3.TPL0 04F3:29DE

@Maleficent-Magik
Copy link

Indeed, the ACPI Patch are different from one model to another

Qonfused added a commit that referenced this issue Nov 29, 2022
- Added trackpad and touchscreen ACPI path, VID and PID info from #12 (comment).
@Qonfused
Copy link
Owner Author

Qonfused commented Nov 29, 2022

There may be variations even within the same model (e.g. from different manufacturing runs). You'll need to verify that these values are the same; it's possible for the product id to vary even with everything else matching.

You can search for VoodooI2C in IORegistryExplorer to find these devices (look for ETPD and TPL# under PCI@0 > AppleACPIPCI):
image
You can find the vendor and product IDs as properties of VoodooI2CHIDDevice under each device. Note that the top of each substree (in grey) also shows the ACPI path after _SB.PCI0.

@Maleficent-Magik
Copy link

Maleficent-Magik commented Nov 29, 2022

I'm on MacOS and i check on IORegistry :

--> For TLP1 :
Capture d’écran 2022-11-29 à 11 26 28

--> For ETPD :
Capture d’écran 2022-11-29 à 11 36 09

--> And for TLP0 :
Capture d’écran 2022-11-29 à 11 37 03

By the way, i'have see something, if we click on TLP1, ETPD and TLP0, in ACP-Device it's say : "IOACPIPlatformDevice is not serializable" (It's possible that it's linked to a non update of the kext... the last update I did was when I published in #8)

For the UX481(FL):

Device Identifier ACPI Path VID:PID
Trackpad ELAN1207 _SB.PCI0.I2C1.ETPD 04F3:310E
Primary Display ELAN9008 _SB.PCI0.I2C0.TPL1 04F3:2B6A
Screenpad Plus ELAN9009 _SB.PCI0.I2C3.TPL0 04F3:29DE

I confirm that for UX481FA.

@Maleficent-Magik

This comment was marked as resolved.

@Qonfused
Copy link
Owner Author

For the UX481(FL):

Device Identifier ACPI Path VID:PID
Trackpad ELAN1207 _SB.PCI0.I2C1.ETPD 04F3:310E
Primary Display ELAN9008 _SB.PCI0.I2C0.TPL1 04F3:2B6A
Screenpad Plus ELAN9009 _SB.PCI0.I2C3.TPL0 04F3:29DE

I confirm that for UX481FA.

I'd note that your screenpad's product id is 2C58.

To export the DSDT, can we do it from Windows or must we do it from MacOS? I have a memory lapse...

The easiest way would be on Windows/Linux with SSDTTime (you can find instructions here).

@Qonfused
Copy link
Owner Author

Qonfused commented Nov 29, 2022

Refer to VoodooI2C/VoodooI2C#485 (comment) for Info.plist changes (changes are to match drivers to device-specific product ids).

^^ The current workaround for this issue does require the specific product ids, though I suspect that only the product ids will differ from the table.

Probably why Voodoo kexts didn't work OOB was because of the different product ids used in this workaround (relevant commit: shiecldk/ASUS-ZenBook-Pro-Duo-15-OLED-UX582-Hackintosh@7841b5f):

<!-- VoodooI2CHID.kext/Contents/Info.plist
302      | <string>VoodooI2CPrecisionTouchpadHIDEventDriver</string>
303      | <key>IOProbeScore</key>
304      | <integer>300</integer>
305      | <key>IOPropertyMatch</key>
306      | <dict> -->
[-] 307  | <key>Transport</key>
[-] 308  | <string>I2C</string>
[+] 307  | <key>ProductID</key>
[+] 308  | <integer>12545</integer>
<!-- VID=3101       ^^^^^ (base 10 form) -->
<!-- ...
354      | <key>IOClass</key>
355      | <string>VoodooI2CTouchscreenHIDEventDriver</string> -->
[+] 356  | <key>IOPCIMatch</key>
[+] 357  | <string>0x2C5604f3&amp;0x2C2304f3</string>
<!-- PID=2C56,2C23   ^^^^           ^^^^          -->
<!-- VID=04f3            ^^^^           ^^^^      -->

^ These values will need to be changed with the new vendor and product ids.

@Qonfused
Copy link
Owner Author

Also related is VoodooI2C/VoodooI2C#321 for the trackpad freezing issue.

@Qonfused
Copy link
Owner Author

An updated table reflecting VoodooI2C/VoodooI2C#474 (comment).
The 'Voodoo Satellite Drivers/Interfaces' correspond to what should show up in IORegistryExplorer under each device.

Device ACPI Path Vendor Id (VID) Product Id (PID) Voodoo Satellite Drivers/Interfaces
ELAN1207 _SB.PCI0.I2C1.ETPD 04F3 310E VoodooI2CPrecisionTouchpadHIDEventDriver
VoodooI2CMultitouchInterface
ELAN9008 _SB.PCI0.I2C0.TPL1 2B6A VoodooI2CTouchscreenHIDEventDriver
VoodooI2CMultitouchInterface
ELAN9009 _SB.PCI0.I2C3.TPL0 29DE VoodooI2CTouchscreenHIDEventDriver
VoodooI2CMultitouchInterface

@Qonfused
Copy link
Owner Author

Qonfused commented Dec 1, 2022

Here's another way of checking for these values in macOS:

ioreg -rxn IOHIDInterface -k "VoodooI2CServices Supported" -t | grep -E 'IOACPIPlatformDevice|IOPCIDevice|VoodooI2CDeviceNub|VendorID|ProductID|HIDEventDriver  <class VoodooI2C|Interface  <class VoodooI2C' | cut -d "<" -f1

Example output:

$ ioreg -rxn IOHIDInterface -k "VoodooI2CServices Supported" -t | grep -E 'IOACPIPlatformDevice|IOPCIDevice|VoodooI2CDeviceNub|VendorID|ProductID|HIDEventDriver  <class VoodooI2C|Interface  <class VoodooI2C' | cut -d "<" -f1
>>>      +-o PCI0@0  
>>>          +-o I2C0@15  
>>>                  +-o TPL1  
>>>                        |   "VendorID" = 0x4f3
>>>                        |   "ProductID" = 0x2b6a
>>>                        +-o VoodooI2CTouchscreenHIDEventDriver  
>>>                          +-o VoodooI2CMultitouchInterface  
>>>      +-o PCI0@0  
>>>          +-o I2C1@15,1  
>>>                  +-o ETPD  
>>>                        |   "VendorID" = 0x4f3
>>>                        |   "ProductID" = 0x310e
>>>                        +-o VoodooI2CPrecisionTouchpadHIDEventDriver  
>>>                          +-o VoodooI2CMultitouchInterface  
>>>      +-o PCI0@0  
>>>          +-o I2C3@15,3  
>>>                  +-o TPL0  
>>>                        |   "VendorID" = 0x4f3
>>>                        |   "ProductID" = 0x29de
>>>                        +-o VoodooI2CTouchscreenHIDEventDriver  
>>>                          +-o VoodooI2CMultitouchInterface

For checking just product ids:

$ ioreg -rxn IOHIDInterface -k "VoodooI2CServices Supported" | grep ProductID | cut -d "=" -f2
>>> 0x2b6a
>>> 0x310e
>>> 0x29de

For checking for a specific device name:

$ ioreg -rxn ETPD -k i2cAddress -d1 | grep IOName | cut -d "=" -f2 
>>> "ELAN1207"
$ ioreg -rxn TPL1 -k i2cAddress -d1 | grep IOName | cut -d "=" -f2 
>>> "ELAN9008"
$ ioreg -rxn TPL0 -k i2cAddress -d1 | grep IOName | cut -d "=" -f2 
>>> "ELAN9009"

@Qonfused
Copy link
Owner Author

Qonfused commented Dec 15, 2022

Interesting, was just testing using the same VoodooI2CHID kext as from the original repo (applying the new fixes in the info.plist) and found the main touchscreen gestures work.

Edit: This is still the case on the latest Voodoo kext versions (2.7)

@Qonfused
Copy link
Owner Author

Qonfused commented Dec 15, 2022

Still stops working after a while; is fine for a little while after wake again (possible ref: VoodooI2C/VoodooI2C#171).

Will probably require GPIO pinning to fix (as per the official guide), using the below table from shiecldk's tonymax86 thread:

// CoffeeLake-LF Table (works for CometLake H CPUs)
If APICPIN > 47 And APICPIN <= 71 Then
    GPIOPIN = APICPIN - 16
    GPIOPIN2 = APICPIN + 240
    If APICPIN > 47 And APICPIN <= 59 Then GPIOPIN3 = APICPIN + 304
ElseIf APICPIN > 71 And APICPIN <= 95 Then
    GPIOPIN = APICPIN - 8
    GPIOPIN3 = APICPIN + 152
    GPIOPIN2 = APICPIN + 120
ElseIf APICPIN > 95 And APICPIN <= 119 Then
    GPIOPIN = APICPIN 
If APICPIN > 108 And APICPIN <= 115 Then
      GPIOPIN2 = APICPIN + 20
End If

If I understood this correctly then we have the following GPIO options for the three devices:

Device IOInterruptSpecifiers (APICPIN) GPIOPIN options
ETPD 6d 00 00 00 03 00 00 00
(0x6d -> 109)
109 -> 0x6d
TPL0 42 00 00 00 03 00 00 00
(0x42 -> 66)
66 - 8 -> 0x3A
66 + 240 -> 0x132
TPL1 72 00 00 00 03 00 00 00
(0x72 -> 114)
114 -> 0x6d

@Qonfused
Copy link
Owner Author

Qonfused commented Dec 16, 2022

Will need to check 0b67115 for any regressions (and after updating Voodoo kexts back to latest). It's possible that there is a race condition, either between two voodoo kexts/satellite drivers attaching to the same device, or between one of the touchscreen displays and the trackpad.

Update: Found a conflict in kext load order + config in #8 (comment).

@Qonfused
Copy link
Owner Author

Some additional docs for APIC/GPIO for fixing trackpad polling collision:
https://github.com/5T33Z0/OC-Little-Translated/tree/main/05_Laptop-specific_Patches/Trackpad_Patches#instructions

@Qonfused
Copy link
Owner Author

Qonfused commented Jan 2, 2023

Will consider this issue closed with 7ca1167 from #19 PR.

This also partially resolves the intermittency issue between polling I2C devices (as they now use unique GPIO pins), but will leave this issue open in #24.

@Qonfused Qonfused closed this as completed Jan 2, 2023
@Qonfused
Copy link
Owner Author

Qonfused commented Jan 2, 2023

Will re-open for regression testing but close again on PR #19 merge.

@Qonfused Qonfused reopened this Jan 2, 2023
@Qonfused Qonfused added type:documentation Improvements or additions to documentation and removed type:documentation Improvements or additions to documentation labels Jan 2, 2023
@Qonfused
Copy link
Owner Author

Qonfused commented Jan 3, 2023

Added documentation for the fix in this repo's wiki under VoodooI2CHID-Workaround.

@Qonfused Qonfused closed this as completed Jan 3, 2023
@Qonfused Qonfused added type:feature New feature request status:done All issue tasks are completed. labels Jan 5, 2023
@shiecldk
Copy link
Contributor

@Qonfused Do you still have the Trackpad freezing issue with VoodooI2C 2.7.1?

@Qonfused
Copy link
Owner Author

@shiecldk I'm looking into it in #24, though that may be a separate cause for touchscreen intermittency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:done All issue tasks are completed. type:bug Something isn't working type:feature New feature request
Projects
Status: Done
Development

No branches or pull requests

3 participants