VoodooSMBus / VoodooRMI

Synaptic Trackpad driver over SMBus/I2C for macOS
GNU General Public License v2.0
232 stars 19 forks source link

Not working on Thinkpad P51 (with logs). Help needed! [SOLVED] #149

Closed AndyTQ closed 2 years ago

AndyTQ commented 2 years ago

Please scroll down to the bottom for the newest update.

Hi there,

unfortunately after trying for 2 days I can't figure out why RMI completely doesn't work on my Thhinkpad P51. Both trackpad and tracepoint are not working via SMBus. They can only work via PS2. Currently, I have PS2 controller, mouse, keyboard, trackpad enabled.

Here is the log:

2022-04-24 10:37:25.567486-0400 0x2cc      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Debug: Too early notification - No VoodooInput on PS2 yet
2022-04-24 10:37:25.941582-0400 0x2cc      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Info: VoodooPS2Trackpad finished init, starting...
2022-04-24 10:37:38.791555-0400 0x2cf      Fault       0x0                  0      0    kernel: (IOHIDFamily) VoodooInputSimulatorDevice:0x10000040a Matching has vendor DeviceUsagePage : ff0c bundleIdentifier com.apple.AppleUserHIDDrivers ioclass AppleUserHIDEventService but transport and vendorID is missing
2022-04-24 10:37:38.916988-0400 0x69d      Fault       0x0                  0      0    kernel: (IOHIDFamily) VoodooInputSimulatorDevice:0x10000040a Matching has vendor DeviceUsagePage : ff0c bundleIdentifier com.apple.AppleUserHIDDrivers ioclass AppleUserHIDEventService but transport and vendorID is missing
2022-04-24 10:37:39.578575-0400 0x6e8      Default     0x0                  121    0    kernelmanagerd: Received kext load notification: as.acidanthera.voodoo.driver.PS2Controller
2022-04-24 10:37:39.580497-0400 0x6e8      Default     0x0                  121    0    kernelmanagerd: Received kext load notification: de.leo-labs.VoodooSMBus
2022-04-24 10:37:39.597080-0400 0x6e8      Default     0x0                  121    0    kernelmanagerd: Received kext load notification: com.1Revenger1.VoodooRMI
2022-04-24 10:37:39.611533-0400 0x6e8      Default     0x0                  121    0    kernelmanagerd: Received kext load notification: as.acidanthera.voodoo.driver.PS2Trackpad
2022-04-24 10:37:39.614351-0400 0x6e8      Default     0x0                  121    0    kernelmanagerd: Received kext load notification: as.acidanthera.voodoo.driver.PS2Keyboard
2022-04-24 10:37:39.616536-0400 0x6e8      Default     0x0                  121    0    kernelmanagerd: Received kext load notification: as.acidanthera.voodoo.driver.PS2Mouse
2022-04-24 10:37:39.621819-0400 0x6e8      Default     0x0                  121    0    kernelmanagerd: Received kext load notification: me.kishorprins.VoodooInput

Feel free to let me know if additional information is needed. Thanks! (apparently from the log above, RMISMBus is not loading?)

AndyTQ commented 2 years ago

If I turn off ps2trackpad and mouse, then VoodooInput will no longer be loading but RMISMBUS will be loading.

andy@andys-MacBook-Pro Desktop % kextstat | grep -i rmi                  
Executing: /usr/bin/kmutil showloaded
No variant specified, falling back to release
   83    1 0                  0x34000    0x34000    com.1Revenger1.VoodooRMI (1.3.4) D8A733E3-975D-3F51-8C70-8949315669A7 <7 6 3>
   84    0 0                  0xf000     0xf000     com.1Revenger1.RMISMBus (1.0) C5BA9E60-6123-3F84-B600-D25870620E65 <83 81 7 6 3>
andy@andys-MacBook-Pro Desktop % kextstat | grep -i voodoo       
Executing: /usr/bin/kmutil showloaded
No variant specified, falling back to release
   74    1 0                  0x19000    0x19000    as.acidanthera.voodoo.driver.PS2Controller (2.2.8) E72A38F2-CDC4-3E4F-85BE-C94041B39DCC <15 9 7 6 3 1>
   81    1 0                  0x1a000    0x1a000    de.leo-labs.VoodooSMBus (3.0) 3104C7EE-A6EC-3C25-AFA5-6656EC441CC4 <16 7 6 3>
   83    1 0                  0x34000    0x34000    com.1Revenger1.VoodooRMI (1.3.4) D8A733E3-975D-3F51-8C70-8949315669A7 <7 6 3>
  112    0 0                  0xd000     0xd000     as.acidanthera.voodoo.driver.PS2Keyboard (2.2.8) 89E380C8-F0BF-3A86-9620-4A6D9481E8DF <74 62 9 7 6 3 1>
andy@andys-MacBook-Pro Desktop % 
AndyTQ commented 2 years ago

Here's IORegistry:

EDIT: This one is old. I've got RMISMBus showing. See the other screenshot in the following posts. Screen Shot 2022-04-24 at 11 04 33 AM

AndyTQ commented 2 years ago

I added vendor and device id to the VoodooSMBus's plist, now the log is showing the following:

2022-04-24 11:10:09.814005-0400 0x336      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Info: SMBus version 2
2022-04-24 11:10:11.030290-0400 0x2b2      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: Failed to reset trackpad!
2022-04-24 11:10:10.211532-0400 0x1c4      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: smb_get_command_code: Failed to write mapping table data
2022-04-24 11:10:10.558586-0400 0x1c4      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: smb_get_command_code: Failed to write mapping table data
2022-04-24 11:10:10.759200-0400 0x213      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: smb_get_command_code: Failed to write mapping table data

It seems that it is related to resetting the trackpad? Not sure what's going on here...

And VoodooInput is still missing:

andy@andys-MacBook-Pro Desktop % kextstat | grep -i voodoo
Executing: /usr/bin/kmutil showloaded
No variant specified, falling back to release
   74    1 0                  0x19000    0x19000    as.acidanthera.voodoo.driver.PS2Controller (2.2.8) E72A38F2-CDC4-3E4F-85BE-C94041B39DCC <15 9 7 6 3 1>
   82    1 0                  0x1a000    0x1a000    de.leo-labs.VoodooSMBus (3.0) 3104C7EE-A6EC-3C25-AFA5-6656EC441CC4 <16 7 6 3>
   85    1 0                  0x34000    0x34000    com.1Revenger1.VoodooRMI (1.3.4) D8A733E3-975D-3F51-8C70-8949315669A7 <7 6 3>
  110    0 0                  0xd000     0xd000     as.acidanthera.voodoo.driver.PS2Keyboard (2.2.8) 89E380C8-F0BF-3A86-9620-4A6D9481E8DF <74 62 9 7 6 3 1>
andy@andys-MacBook-Pro Desktop % kextstat | grep -i rmi   
Executing: /usr/bin/kmutil showloaded
No variant specified, falling back to release
   85    1 0                  0x34000    0x34000    com.1Revenger1.VoodooRMI (1.3.4) D8A733E3-975D-3F51-8C70-8949315669A7 <7 6 3>
   86    0 0                  0xf000     0xf000     com.1Revenger1.RMISMBus (1.0) C5BA9E60-6123-3F84-B600-D25870620E65 <85 82 7 6 3>
AndyTQ commented 2 years ago

Here's the most updated IOReg

Screen Shot 2022-04-24 at 11 17 38 AM

AndyTQ commented 2 years ago

After turning VoodooPS2Trackpad back on, here are the logs I get:

andy@andys-MacBook-Pro Desktop % log show --last 5m | grep -i VRMI
2022-04-24 11:23:20.943255-0400 0x74       Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Info: Found PS2 Trackpad driver! Waiting for registerService()
2022-04-24 11:23:20.943461-0400 0x74       Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Debug: Found GPIO data!
2022-04-24 11:23:20.943464-0400 0x74       Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Info: VoodooPS2Trackpad finished init, starting...
2022-04-24 11:23:23.462440-0400 0x2ea      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Info: SMBus version 2
2022-04-24 11:23:23.663798-0400 0x2ea      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: smb_get_command_code: Failed to write mapping table data
2022-04-24 11:23:23.879289-0400 0x2ea      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: smb_get_command_code: Failed to write mapping table data
2022-04-24 11:23:24.137697-0400 0x2ea      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: smb_get_command_code: Failed to write mapping table data
2022-04-24 11:23:24.697561-0400 0x2ea      Default     0x0                  0      0    kernel: (RMISMBus) VRMI - Error: Failed to reset trackpad!
AndyTQ commented 2 years ago

IOReg that corresponds to the above log: Screen Shot 2022-04-24 at 11 32 24 AM

AndyTQ commented 2 years ago

It seems that demsg can give me more information:

andy@andys-MacBook-Pro Desktop % sudo dmesg | grep VRMI           
Password:
[    2.470213]: VRMI - Info: Found PS2 Trackpad driver! Waiting for registerService()
[    2.470395]: VRMI - Debug: Too early notification - No VoodooInput on PS2 yet
[    2.847338]: VRMI - Debug: Found GPIO data!
[    2.847343]: VRMI - Info: VoodooPS2Trackpad finished init, starting...
[    9.266989]: VRMI - Error: Error: Failed to read SMBus version. Code: 0xFFFFFF92

The code is 0xFFFFFF92 and it seems thet VRMI fails to read the SMBus version. Here's the Synaptics version:

andy@andys-MacBook-Pro Desktop % sudo dmesg | grep VoodooPS2Trackpad
[    2.469916]: VoodooPS2Trackpad starting: Synaptics TouchPad reports type 0x47, version 8.2
[    2.703280]: VoodooPS2Trackpad: Trackpad supports Intertouch/SMBus operation
[    2.847343]: VRMI - Info: VoodooPS2Trackpad finished init, starting...
AndyTQ commented 2 years ago

I am trying to figure out the error code 0xFFFFFF92 by looking into https://github.com/torvalds/linux/blob/master/drivers/input/rmi4/rmi_smbus.c

https://github.com/mozilla-b2g/i2c-tools/blob/master/lib/smbus.c#L81 https://github.com/mozilla-b2g/i2c-tools/blob/master/lib/smbus.c#L51

https://man7.org/linux/man-pages/man3/errno.3.html Will update more info if I figured out something.

Update: I am trying to recall some OS stuff. Tracing the error down to the bottom I noticed that the smbus's error is eventually triggered by the ioctl function of linux. Looking at the man page of ioctl it shows the following error messages:

       **EBADF**  fd is not a valid file descriptor.

       **EFAULT** argp references an inaccessible memory area.

       **EINVAL** request or argp is not valid.

       **ENOTTY** fd is not associated with a character special device.

       **ENOTTY** The specified request does not apply to the kind of object
              that the file descriptor fd references.

But I am not sure how the constant error names are related to the hex values (in our case, 0xFFFFFF92). I am considering set up some breakpoints to trace it line by line. Not sure how to do that though for rmi_smbus.c.

in the mean time feel free to provide any possible assistance. deeply appreicated!

AndyTQ commented 2 years ago

After looking into the discussion at https://www.linuxquestions.org/questions/linux-hardware-18/how-to-extend-usb-response-time-on-linux-4175572837/

It seems that there could be connection time out from system, not ioctl, and maybe the system had override the errno from ioctl.

After discussion in r/hackintosh discord, I will try it setting intertouch mode to 1 on linux next week, thanks to the help by 1Revenger1!

AndyTQ commented 2 years ago

Update: After discussion with @1Revenger1 in r/hackintosh discord, I can get intertouch working in Linux. using I2ctools also shows that Synaptic device is at 0x2c (showing as UU) in Linux environment. I have no clue why it works in Linux but doesn't work on Macos now. I will share my full IOReg this weekend. This is really weird.

AndyTQ commented 2 years ago

WORKING NOW AFTER ADDING THE FOLLOWING BLOCK KEYS TO KERNEL UNDER PLIST, after looking into README of VoodooSMBUS as well as some additional research throughout github Thanks @1Revenger1 for the help again!

<key>Block</key>
        <array>
            <dict>
                <key>Comment</key>
                <string></string>
                <key>Enabled</key>
                <true/>
                <key>Identifier</key>
                <string>com.apple.driver.AppleIntelLpssI2CController</string>
                <key>MaxKernel</key>
                <string></string>
                <key>MinKernel</key>
                <string></string>
            </dict>
            <dict>
                <key>Comment</key>
                <string></string>
                <key>Enabled</key>
                <true/>
                <key>Identifier</key>
                <string>com.apple.driver.AppleIntelLpssI2C</string>
                <key>MaxKernel</key>
                <string></string>
                <key>MinKernel</key>
                <string></string>
            </dict>
        </array>