Touchpad scroll events

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

Touchpad scroll events

Post 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.
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Touchpad scroll events

Post 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
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

Re: Touchpad scroll events

Post 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.
Octocontrabass
Member
Member
Posts: 5567
Joined: Mon Mar 25, 2013 7:01 pm

Re: Touchpad scroll events

Post 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.)
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

Re: Touchpad scroll events

Post 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.
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

Re: Touchpad scroll events

Post 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?
Octocontrabass
Member
Member
Posts: 5567
Joined: Mon Mar 25, 2013 7:01 pm

Re: Touchpad scroll events

Post by Octocontrabass »

It sounds like the PS/2 controller might be mangling the data. You're sure it's a Synaptics touchpad, right?
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

Re: Touchpad scroll events

Post 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.
Octocontrabass
Member
Member
Posts: 5567
Joined: Mon Mar 25, 2013 7:01 pm

Re: Touchpad scroll events

Post 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.
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

Re: Touchpad scroll events

Post 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!
Post Reply