Page 1 of 1

Touchpad scroll events

Posted: Tue Aug 17, 2021 10:40 am
by 8infy
Hi, I have a question about laptop touchpads.
Do you know how for example linux extracts multitouch events from touchpads?
As far as I can see they're displayed as generic PS/2 mice, but my OS doesn't get scroll events when moving both fingers, while linux does.
What's the secret here? How do I make it generate scroll events? Do i need to read certain proprietary registers?
Thanks.

Re: Touchpad scroll events

Posted: Tue Aug 17, 2021 10:55 am
by Klakap
In default, PS/2 mouse device is sending only three data bytes without scrolling. You have to enable fourth byte by magic sequence https://wiki.osdev.org/Mouse_Input#Init ... _Sequences

Re: Touchpad scroll events

Posted: Tue Aug 17, 2021 12:00 pm
by 8infy
Klakap wrote:In default, PS/2 mouse device is sending only three data bytes without scrolling. You have to enable fourth byte by magic sequence https://wiki.osdev.org/Mouse_Input#Init ... _Sequences
I know, I do in fact enable those. Still no scroll events with 2 fingers.

Re: Touchpad scroll events

Posted: Tue Aug 17, 2021 4:00 pm
by Octocontrabass
Your touchpad is probably emulating a very basic two-button mouse. You'll have to send vendor-specific commands to switch it to its native mode, and then interpret the user's gestures in your driver.

Fortunately, most touchpads are made by one vendor, and they're very nice about documentation. Look for the Synaptics PS/2 TouchPad Interfacing Guide.

Also, since it's a PS/2 device, you have to deal with all the quirks of different PS/2 controllers. You might want to look at the Linux code to see what kind of weird behavior they work around. (And don't forget to disable USB emulation.)

Re: Touchpad scroll events

Posted: Wed Aug 18, 2021 2:49 am
by 8infy
Octocontrabass wrote:Your touchpad is probably emulating a very basic two-button mouse. You'll have to send vendor-specific commands to switch it to its native mode, and then interpret the user's gestures in your driver.

Fortunately, most touchpads are made by one vendor, and they're very nice about documentation. Look for the Synaptics PS/2 TouchPad Interfacing Guide.

Also, since it's a PS/2 device, you have to deal with all the quirks of different PS/2 controllers. You might want to look at the Linux code to see what kind of weird behavior they work around. (And don't forget to disable USB emulation.)
Thank you, i will look into it.

Re: Touchpad scroll events

Posted: Wed Aug 18, 2021 3:27 am
by 8infy
Octocontrabass wrote:Your touchpad is probably emulating a very basic two-button mouse. You'll have to send vendor-specific commands to switch it to its native mode, and then interpret the user's gestures in your driver.

Fortunately, most touchpads are made by one vendor, and they're very nice about documentation. Look for the Synaptics PS/2 TouchPad Interfacing Guide.

Also, since it's a PS/2 device, you have to deal with all the quirks of different PS/2 controllers. You might want to look at the Linux code to see what kind of weird behavior they work around. (And don't forget to disable USB emulation.)
It worked, thank you! 2 laptops report the correct 0x47 constant, but for some reason the other one reports 0x46, do u know what could be the reason for that?

Re: Touchpad scroll events

Posted: Wed Aug 18, 2021 8:49 am
by Octocontrabass
It sounds like the PS/2 controller might be mangling the data. You're sure it's a Synaptics touchpad, right?

Re: Touchpad scroll events

Posted: Wed Aug 18, 2021 10:24 am
by 8infy
Octocontrabass wrote:It sounds like the PS/2 controller might be mangling the data. You're sure it's a Synaptics touchpad, right?
Hmm, I don't have anything that proves that it is, but it does react to 4 set_resolution(0) calls in a different way, it's just that the constant is a bit off... Laptop model is an HP Elitebook 8440p if that helps.

Re: Touchpad scroll events

Posted: Wed Aug 18, 2021 11:41 am
by Octocontrabass
HP offers Synaptics drivers for that model, so I'm going to say it's a Synaptics touchpad and the PS/2 controller is mangling the data.

Check if the PS/2 controller supports Active PS/2 Multiplexing (also published by Synaptics). If it does, you'll need to switch it to multiplexed mode before you can initialize the touchpad.

Re: Touchpad scroll events

Posted: Wed Aug 18, 2021 2:07 pm
by 8infy
Octocontrabass wrote:HP offers Synaptics drivers for that model, so I'm going to say it's a Synaptics touchpad and the PS/2 controller is mangling the data.

Check if the PS/2 controller supports Active PS/2 Multiplexing (also published by Synaptics). If it does, you'll need to switch it to multiplexed mode before you can initialize the touchpad.
Wow! Incredible. You were 100% right. I didn't even know things like that existed. After a few hours of implementing (a hacked together version of) that spec, i get this.

Image

Turns out the 0x46 was the small track ball talking, and the actual touchpad is on AUX 3 and reports 0x47 as expected!