SkyrilHD / VoodooPS2-ALPS

Refined macOS driver for ALPS TouchPads
Other
24 stars 5 forks source link

ALPS v3 #11

Closed realizelol closed 2 years ago

realizelol commented 2 years ago

Hi SkyrilHD,

i am using a Dell Latitude E6540 with an integrated ALPS v3. Unfortunately the driver isn't loading:

$ log show --debug --last boot | grep -i "PS2"
2022-01-29 00:46:53.925573+0100 0x107      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller::start entered...
2022-01-29 00:46:53.926220+0100 0x107      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: initial commandByte = 45
2022-01-29 00:46:54.134186+0100 0x107      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: new commandByte = 44
2022-01-29 00:46:54.141076+0100 0x107      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller::start leaving.
2022-01-29 00:46:54.141162+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Keyboard) ApplePS2Keyboard::probe entered...
2022-01-29 00:46:54.141180+0100 0x141      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: Notification consumer published: ApplePS2Controller
2022-01-29 00:46:54.141269+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Keyboard) ApplePS2Keyboard::probe leaving.
2022-01-29 00:46:54.141276+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Keyboard) ApplePS2Keyboard::start entered...
2022-01-29 00:46:54.141301+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Keyboard) ps2bl: KKCL, KKCM, KKQC methods not found in DSDT
2022-01-29 00:46:54.141443+0100 0x142      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: Notification consumer published: ApplePS2Keyboard
2022-01-29 00:46:54.141512+0100 0x140      Default     0x0                  0      0    kernel: (VoodooPS2Trackpad) ALPS: Version 1.0.6 starting on OS X Darwin 19.6.
2022-01-29 00:46:54.141520+0100 0x140      Default     0x0                  0      0    kernel: (VoodooPS2Trackpad) ALPS: probe entered...
2022-01-29 00:46:54.145024+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: oldCommandByte = 44
2022-01-29 00:46:54.145031+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: setCommandByte for keyboard interrupt install
2022-01-29 00:46:54.145163+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: oldCommandByte = 44
2022-01-29 00:46:54.145165+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: newCommandByte = 45
2022-01-29 00:46:54.145301+0100 0x13f      Default     0x0                  0      0    kernel: (VoodooPS2Keyboard) ApplePS2Keyboard::start leaving.
2022-01-29 00:46:54.355490+0100 0x140      Default     0x0                  0      0    kernel: (VoodooPS2Controller) ApplePS2Controller: Timed out on input stream 1.
2022-01-29 00:47:01.888436+0100 0x2dd      Default     0x0                  190    0    hidd: (IOKit) [com.apple.iohid:default] Service added: IOHIDService name:IOHIDSystem id:0x100000297 primaryUsagePage:0xff00 primaryUsage:0x17 transport:PS2 reportInterval:0 batchInterval:0 events:0 mask:0x0
2022-01-29 00:47:06.523021+0100 0x3c3      Default     0x0                  190    0    hidd: (IOKit) [com.apple.iohid:default] Service added: IOHIDService name:IOHIDEventDriver id:0x10000039b primaryUsagePage:0x1 primaryUsage:0x6 transport:PS2 reportInterval:8000 batchInterval:0 events:0 mask:0x0
Transport:           PS2

(no keyboard/no trackpad/no trackstick - not really needed)

How can I help you? What further information do you need?


best regards

realizelol

realizelol commented 2 years ago

Yes scrolling is working but if you give it a fast push it will scroll further even if you have disabled it in "Systemeinstellungen > Bedienungshilfen > Zeigersteuerung > Trackpad Optionen > Scrollen: Ohne Nachlauf" (in German) I hope this will be "Systemsettings > Accessibility > Pointingmanagement > Scroll: Without overrun". Maybe this will be the "scrolldebounce" command? But maybe you could compile both versions (with and w/o "scrolldebounce") for testing?

SkyrilHD commented 2 years ago

The kext is very old (Early 2017), proper scrolling was not ported back then. 1Revenger1's kext has scrolldebounce which you used, I guess.

Can you try this kext, this is with the idea above. Also, I added pressure support back. Hopefully this does not break anything. VoodooPS2Controller-1.0.6-DEBUG.zip

realizelol commented 2 years ago

Same behaviour.

Maybe this will make it clearer (sorry cannot do a "_blank" open in github): scroll.mov

SkyrilHD commented 2 years ago

OK, now I understand it better. I wonder if it is because of bitmap (low resolution of the touchpad). Maybe @1Revenger1 has an idea?

I also see that 1Revenger1 does not use the code, I mentioned earlier: image

SkyrilHD commented 2 years ago

Can you check if this fixes scrolling? VoodooPS2Controller-1.0.6-DEBUG.zip

realizelol commented 2 years ago

No, sorry it's the same as before. But If I touch the pad at the very top I have around 3mm space to the top (from the top of the circle), on the bottom line the the finger is just a half circle.

Inverted scrolling is done by substrate from the bottom line? Maybe some touches are too high or too low?

    /* Reverse y co-ordinates to have 0 at bottom for gestures to work */
    f.mt[0].y = priv.y_max - f.mt[0].y;
    f.mt[1].y = priv.y_max - f.mt[1].y;
SkyrilHD commented 2 years ago

This happens because the touchpad reports higher coordinates than the hardcoded dimensions in the kext.

The hard-coded dimensions are:

    priv.x_max = 2000;
    priv.y_max = 1400;

So if your y-coordinate gets higher than 1400 then it goes back to the bottom. One can fix it by increasing the priv.y_max a bit to prevent this issue.

Can you try this kext: VoodooPS2Controller-1.0.6-DEBUG.zip

realizelol commented 2 years ago

this drops multifinger support, it only recognize one finger even if I put 5 fingers on pad.

SkyrilHD commented 2 years ago

Ouch, OK reverted. Can you try this: VoodooPS2Controller-1.0.6-DEBUG.zip

Doubt that changes anything, but let's see.

realizelol commented 2 years ago

mutitouchsupport is available again but scrolling is sometimes not recognized.

SkyrilHD commented 2 years ago

Like before, I guess? Try this: VoodooPS2Controller-1.0.6-DEBUG.zip

1Revenger1 commented 2 years ago

I don't remember much about scrolling to be honest. Last I worked on VoodooPS2 Alps was a couple years ago and I don't have my M4700 with me. Sorry I can't help out much.

Also thanks for being insane enough to work on this, this is a big undertaking for these trackpads (especially with 8 different protocols, yuck). I'm sure it's quite the upgrade though, especially with 2/3 finger gestures.

SkyrilHD commented 2 years ago

Pre-VoodooInput was a big mess (I've only had issues before) and old, hence the motivation. The project started as a proof of concept, so I could use VoodooInput on my V7, but here we are xD.

About V3, I think it's returning somewhere it shouldn't be. I had this issue too on my V7 where two+ fingers caused jumping and removing a return statement was enough.

realizelol commented 2 years ago

No, sorry it's the same. You'll see the two fingers moving correctly in fingerMgmt but sometimes the scrolling hasn't been done. Sometimes you could scroll about 15-20 times but then there are one two or maybe 3 scrolls that won't work.

SkyrilHD commented 2 years ago

Do the one two or three scrolls which do not work show in FingerMgmt?

realizelol commented 2 years ago

yes they're shown in FingerMgmt.

SkyrilHD commented 2 years ago

So macOS gets the input, but doesn't do anything with it. For some reason, I doubt the driver has a problem, but I'm not sure. Do you use any third-party app that changes anything with the mouse/trackpad?

Can you try this, I removed pressure check VoodooPS2Controller-1.0.6-DEBUG.zip

BTW, if you find anything useful in the code, can you post here?

realizelol commented 2 years ago

No, I am not using any 3rd party apps for mouse input. The only thing that is relevant is FingerMgmt. What's not relevant is Paragon NTFS + extFS, Virtualbox + Parallels Desktop + Intel Power Gadget

kextstat | grep -v "com\.apple"
Index Refs Address            Size       Wired      Name (Version) UUID <Linked Against>
   44    7 0xffffff7f83ee4000 0x89000    0x89000    as.vit9696.Lilu (1.6.0) E5BEEE8E-E840-3224-BF88-B0A191D0F0A6 <8 6 5 3 2 1>
   45    3 0xffffff7f83fc4000 0x1a000    0x1a000    as.vit9696.VirtualSMC (1.2.8) 9ACEAA34-44F9-376E-AA09-657C0D4EB1F9 <44 12 8 6 5 3 1>
   47    0 0xffffff7f83ff2000 0x18000    0x18000    ru.usrsse2.SMCBatteryManager (1.2.8) 2A3593DB-B0F7-3385-8D3B-57DAFBAD9829 <46 45 44 12 8 6 5 3 1>
   48    0 0xffffff7f84019000 0x19d000   0x19d000   as.vit9696.AppleALC (1.6.9) 8464F1A4-0F72-3259-BB9A-86F41879DEC5 <44 13 8 6 5 3 1>
   49    0 0xffffff7f841ed000 0x9000     0x9000     ru.usrsse2.SMCLightSensor (1.2.8) 9CEECDFE-BC91-3E1F-8823-A6B720FE1F8B <45 44 12 8 6 5 3 2 1>
   50    0 0xffffff7f841f6000 0xae000    0xae000    as.vit9696.WhateverGreen (1.5.7) C2AB3099-E6D2-3F93-A043-215328DA16CA <44 13 8 6 5 3 2 1>
   51    0 0xffffff7f842ab000 0x15000    0x15000    as.lvs1974.AirportBrcmFixup (2.1.4) 289D6130-793A-3041-BC31-6F700514F8AB <44 13 8 6 5 3 2 1>
   52    1 0xffffff7f842c0000 0x2a4000   0x2a4000   as.acidanthera.BrcmFirmwareStore (2.6.1) 570D21DB-DAB4-3331-B606-55691287CDF9 <6 5 3>
   53    0 0xffffff7f84572000 0x2000     0x2000     pk.qwerty12.DisableTurboBoostBattery (2) ED1979F3-79A0-3BBE-AB14-67B59DD5E4EB <8 6 5 3>
   54    0 0xffffff7f8400a000 0xf000     0xf000     as.vit9696.SMCProcessor (1.2.8) A301BF68-3EB4-37B5-A0CF-3CB6F7689D8A <45 44 12 8 6 5 3 2 1>
   66    2 0xffffff7f83f84000 0x15000    0x15000    as.acidanthera.voodoo.driver.PS2Controller (1.0.6) FD17EFB6-FB26-3741-BE7E-2F0520F592DF <12 8 6 5 3 1>
   74    0 0xffffff7f841c3000 0x14000    0x14000    as.acidanthera.mieze.IntelMausi (1.0.7) 82B83B99-6FE0-3D1F-91BF-E22233968775 <32 13 6 5 3 1>
   75    0 0xffffff7f83fde000 0x14000    0x14000    org.rehabman.driver.FakePCIID (1.3.16) 4D03E713-BB38-38CE-87C4-70E297238A7C <13 8 6 5 3 1>
   92    0 0xffffff7f83fac000 0xc000     0xc000     com.skyrilhd.PS2Trackpad (1.0.6) F738B7C2-33A6-350E-9A70-0E970F169B44 <67 66 6 5 3>
   93    0 0xffffff7f83f9d000 0x6000     0x6000     as.acidanthera.voodoo.driver.PS2Keyboard (1.0.6) E94AA684-EE78-36B8-97CC-23D506895241 <67 66 8 6 5 3 1>
  107    0 0xffffff7f83f6d000 0x8000     0x8000     me.kishorprins.VoodooInput (1.1.2) 97E45DFD-F9C6-35E0-AE94-545071CC44C1 <67 6 5 3>
  114    0 0xffffff7f84564000 0x5000     0x5000     as.acidanthera.BrcmPatchRAM3 (2.6.1) 93365FCA-9960-3569-B79E-E9EC60462460 <52 21 6 5 3 1>
  121    0 0xffffff7f8457b000 0x42000    0x42000    com.paragon-software.filesystems.ntfs (106.5.15) 4575C073-7080-3B2F-AF62-A365668ACD34 <8 6 5 1>
  123    0 0xffffff7f845bd000 0x37000    0x37000    com.paragon-software.filesystems.extfs (30.3.11) FB7BD498-B52E-3B42-AFD6-E17D4F15266E <8 6 5 1>
  151    0 0xffffff7f84a01000 0x4000     0x4000     com.intel.driver.EnergyDriver (3.5.5) 80256914-DED1-317B-9311-300A286F8072 <8 6 5 3>
  169    3 0xffffff7f84d13000 0xf4000    0xf4000    org.virtualbox.kext.VBoxDrv (6.1.32) 2966CECD-ED9D-33B1-9B19-35D5B2F3C2A3 <8 6 5 3 1>
  172    0 0xffffff7f84e11000 0x8000     0x8000     org.virtualbox.kext.VBoxUSB (6.1.32) 2A227B02-53F7-3AC9-8633-3DA6BC2C99F6 <171 169 90 8 6 5 3 1>
  179    0 0xffffff7f84e5a000 0x5000     0x5000     org.virtualbox.kext.VBoxNetFlt (6.1.32) FCFA4205-F86E-3847-87F9-FD20D97978B2 <169 8 6 5 3 1>
  180    0 0xffffff7f84e5f000 0x6000     0x6000     org.virtualbox.kext.VBoxNetAdp (6.1.32) 596D7961-E512-363D-B8C0-12F4B22D8678 <169 6 5 1>

I think the code is losing a finger. You'll the two fingers in fingerMgmt but then you'll the cursor is moving instead of a scroll.

Maybe the momentumscroll do the trick? https://github.com/1Revenger1/VoodooPS2-Alps/blob/master/VoodooPS2Trackpad/alps.cpp#L240 https://github.com/1Revenger1/VoodooPS2-Alps/blob/master/VoodooPS2Trackpad/alps.cpp#L2850-L2860 https://github.com/1Revenger1/VoodooPS2-Alps/blob/master/VoodooPS2Trackpad/alps.cpp#L3147-L3190

I would say it works a bit better, I could do more scrolls before the cursor moves instead of scrolling.

But what is maybe also relevant is that zooming - left finger goes down to the bottom left and the right finger goes upper right - will sometimes take the left finger upwards instead downwards. So it looks like a open "V" (like rabbit ears as it's not closed).

SkyrilHD commented 2 years ago

momentumscroll doesn't matter since the driver doesn't do anything with gestures. Only finger coordinates are passed to macOS, and macOS does the rest.

About zooming, I would like to see a screen recording of this (you can upload videos here as well), and logs would probably be useful too. Is it only happening with two fingers, or does it happen on three finger gestures as well? Can you move around with two fingers and check if you have any jumping like the video 'buggy' here: https://github.com/SkyrilHD/VoodooPS2-ALPS/pull/2

realizelol commented 2 years ago

There you go, Zooming from middle to down-left and up-right is looking like a "V" doing this from the middle to the up-left and down-right seems to be working. It doesn't matter if it's pinching or spreading.

realizelol commented 2 years ago

A little success:

changing some default values in case ALPS_PROTO_V3_RUSHMORE:: Do not change priv.x_bits& priv.y_bits resize priv.y_max = 1542; -> this should fix the trackpad size. Disable trackstick priv.flags = 0; -> this should fix the scroll issue -> maybe there's some strange input from trackstick?!

Accidentally I now have to work on my car, broken rear-breaks. But I will check later.

This is my actual change: Bildschirmfoto 2022-02-19 um 09 43 37

If trackstick is broken somehow, we should consider disabling it in the first step. Also we should comment priv.nibble_commands and alps_probe_trackstick_v3_v7(ALPS_REG_BASE_RUSHMORE)

I will check it later and give you a reply.

What's still not working:

I was using the actual & cleaned VoodooPS2 PR of acidanthera repo. (https://github.com/acidanthera/VoodooPS2/pull/44)

SkyrilHD commented 2 years ago

Can you try these three kexts and report if scrolling is fixed? IMO, the trackstick is not causing this issue, as it does not involve with the bitmap. However, the bits sound related to the issue and after some research I found out that these bits should be set for Pinnacle, not Rushmore. Talking about Pinnacle, one of the attached kext uses the dimensions of Pinnacle touchpads, which has increased x_max and y_max (close to what you set). This should fix the jumping to the bottom when you place the finger at the top.

VoodooPS2Controller-2.2.8-DEBUG (normal).zip VoodooPS2Controller-2.2.8-DEBUG (disabled bits).zip VoodooPS2Controller-2.2.8-DEBUG (disabled bits + pinnacle dim).zip

About the zooming issue, if it does not cause any issue in normal use, I would probably leave it as is. About the jumping with scrolling, I think this is a limitation with the bitmap as it is a low-res report which is not ideal for finger tracking which VoodooInput does. Perhaps, one could fix that by updating the dimensions during runtime (which I removed since it caused issues on V8).

realizelol commented 2 years ago

normal = anything changed? Or is it the actual one (master)? disabled bits = a bit more scrolls are recognized disabled bits + pinnacle dim = almost all scrolls were recognized . I also tested zooming which now shows the correct finger movement in fingerMgmt and which now works much better. (Didn't test this with "disabled bits")

SkyrilHD commented 2 years ago

normal was straight from the PR as I did changes to bitmap. I guess, I can push disabled bits and pinnacle dim? The only issue remains the two scroll directions. Is anything else broken?

realizelol commented 2 years ago

Two finger gestures zooming and rotating:

But pointing, scrolling (which is a very important thing), touching, 3 and 4 finger gestures are working. Thank you for being that crazy and overambitious.