Qonfused / ASUS-ZenBook-Duo-14-UX481-Hackintosh

OpenCore configuration for the ASUS ZenBook Duo 14" (UX481FA/FL)
https://github.com/Qonfused/ASUS-ZenBook-Duo-14-UX481-Hackintosh
BSD 3-Clause "New" or "Revised" License
29 stars 1 forks source link

Fix VoodooI2CHID issue w/ Touchscreen #12

Closed Qonfused closed 1 year ago

Qonfused commented 1 year ago

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 https://github.com/VoodooI2C/VoodooI2CHID/pull/58 (closed) and https://github.com/VoodooI2C/VoodooI2CHID/pull/59 (merged).

Refer to https://github.com/VoodooI2C/VoodooI2C/issues/485#issuecomment-968115898 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 commented 1 year ago

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 commented 1 year ago

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

Qonfused commented 1 year ago
For the UX582 (from https://github.com/VoodooI2C/VoodooI2CHID/pull/59#issuecomment-1033810158): 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 commented 1 year ago

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

Qonfused commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

I suspect that the ACPI path for the UX481FA model may be different from the UX481FL one (left is FL model; right is FA model): Screenshot 2022-11-29 at 2 36 54 AM The firmware on the right is from @wern-apfel, which appears to be missing the ELAN9008 device for the primary display.

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

Qonfused commented 1 year ago
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 commented 1 year ago

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: https://github.com/shiecldk/ASUS-ZenBook-Pro-Duo-15-OLED-UX582-Hackintosh/commit/7841b5ff7bfa3160dc4b1bd130bfaa2ad0ebf44f):

<!-- 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 commented 1 year ago

Also related is https://github.com/VoodooI2C/VoodooI2C/issues/321 for the trackpad freezing issue.

Qonfused commented 1 year ago

An updated table reflecting https://github.com/VoodooI2C/VoodooI2C/issues/474#issuecomment-992006331. 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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Still stops working after a while; is fine for a little while after wake again (possible ref: https://github.com/VoodooI2C/VoodooI2C/issues/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 commented 1 year ago

Will need to check https://github.com/Qonfused/ASUS-ZenBook-Duo-14-UX481-Hackintosh/commit/0b6711556207d49135466101fb8e217ab68704dd 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 https://github.com/Qonfused/ASUS-ZenBook-Duo-14-UX481-Hackintosh/issues/8#issuecomment-1356653397.

Qonfused commented 1 year ago

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 commented 1 year ago

Will consider this issue closed with https://github.com/Qonfused/ASUS-ZenBook-Duo-14-UX481-Hackintosh/pull/19/commits/7ca116734fba10bc2cca61a49204e4f4ae7529fa 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 commented 1 year ago

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

Qonfused commented 1 year ago

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

shiecldk commented 1 year ago

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

Qonfused commented 1 year ago

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