OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:03 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Touchpad scroll events
PostPosted: Tue Aug 17, 2021 10:40 am 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
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.


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Tue Aug 17, 2021 10:55 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
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.2FDetection_Command_Sequences

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Tue Aug 17, 2021 12:00 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
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.2FDetection_Command_Sequences


I know, I do in fact enable those. Still no scroll events with 2 fingers.


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Tue Aug 17, 2021 4:00 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.)


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Wed Aug 18, 2021 2:49 am 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
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.


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Wed Aug 18, 2021 3:27 am 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
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?


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Wed Aug 18, 2021 8:49 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
It sounds like the PS/2 controller might be mangling the data. You're sure it's a Synaptics touchpad, right?


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Wed Aug 18, 2021 10:24 am 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
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.


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Wed Aug 18, 2021 11:41 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: Touchpad scroll events
PostPosted: Wed Aug 18, 2021 2:07 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 66 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group