I can't seem to find specific information on how to control the mouse (PS2, not serial) in an embedded Linux system. I am using a 2.4.20 kernel on a small system and I want to write a program that runs from the console. The program needs to control the frame buffer and the mouse so the user can click on things on the screen. The frame buffer stuff is easy, of course, but I am not sure how I can control the mouse/buttons (and probably the keyboard too, later on).
I think /dev/mouse will return raw data from the mouse? Or is it packetized in some easy to parse format? Anyone have some basic code they can share or weblinks they can post? Thanks!
Michael
How to control the mouse in Linux
Moderator: nferre
Post
Re: How to control the mouse in Linux
Hi Michael,
the /dev/mouse node usually is a link which points to the actual mouse device. The data you get is in raw format. I would suggest you write a simple mini program which hex dumps the input from /dev/mouse to your console. To help interpret the bytes you receive, you might start looking here:
http://www.microsoft.com/whdc/device/in ... wheel.mspx
or download this:
http://innovexpo.itee.uq.edu.au/1999/th ... thesis.PDF
These are just 2 of 298000 hits you will get when you search for "ps2 mouse data format" using http://www.hotbot.com
Best regards,
Markus.
the /dev/mouse node usually is a link which points to the actual mouse device. The data you get is in raw format. I would suggest you write a simple mini program which hex dumps the input from /dev/mouse to your console. To help interpret the bytes you receive, you might start looking here:
http://www.microsoft.com/whdc/device/in ... wheel.mspx
or download this:
http://innovexpo.itee.uq.edu.au/1999/th ... thesis.PDF
These are just 2 of 298000 hits you will get when you search for "ps2 mouse data format" using http://www.hotbot.com
Best regards,
Markus.
Post
Re: How to control the mouse in Linux
i think the best you can do is use gpm. if your kernel has ps/2 driver it's device node is /dev/psaux or /dev/misc/psaux (it's character device with major/minor 10/1)MWeston wrote:I can't seem to find specific information on how to control the mouse (PS2, not serial) in an embedded Linux system.
Post 
I have since found info and source for gpm, but I am still trying to figure out how I can use it. I need the most basic of features (Xdiff,Ydiff and button presses). It looks like you can run it from the console, but I need to access it from my program. I'm sure that is possible, I just don't know what it takes yet. I'm not afraid to admit that I am a Linux novice and that is why I welcome any help anyone can give.
Re: How to control the mouse in Linux
Hi Klama, I have been checking out what comes out of the mouse and I have seen the PS2 format documentation, but the beauty of Linux, and the reason people use it, is for its vast list of drivers that save us from all that hassle! My mouse is /dev/psaux and I can dump its output to the terminal and see the cursor moving back and forth and writing characters so I can see that it does output what looks like nice little packets of information.klama wrote:Hi Michael,
the /dev/mouse node usually is a link which points to the actual mouse device. The data you get is in raw format. I would suggest you write a simple mini program which hex dumps the input from /dev/mouse to your console. To help interpret the bytes you receive, you might start looking here:
http://www.microsoft.com/whdc/device/in ... wheel.mspx
or download this:
http://innovexpo.itee.uq.edu.au/1999/th ... thesis.PDF
These are just 2 of 298000 hits you will get when you search for "ps2 mouse data format" using http://www.hotbot.com
Best regards,
Markus.

I have since found info and source for gpm, but I am still trying to figure out how I can use it. I need the most basic of features (Xdiff,Ydiff and button presses). It looks like you can run it from the console, but I need to access it from my program. I'm sure that is possible, I just don't know what it takes yet. I'm not afraid to admit that I am a Linux novice and that is why I welcome any help anyone can give.
Post
c'mon. don't tell me you were so lazy you didn't follow link from gpm page pointing to http://users.tkk.fi/~then/mytexts/mouse.html
Post
Actually, I downloaded the gpm source from somewhere else and had no idea that link existed until today.
My problem is still concerned with missing information by not polling often enough (and I have never used interrupts) and I don't know if there is a buffering scheme with the /dev/psaux char device. That is why I was hoping Linux had some great way of managing all of this.
Thanks for the link, by the way. I appreciate it greatly.
My problem is still concerned with missing information by not polling often enough (and I have never used interrupts) and I don't know if there is a buffering scheme with the /dev/psaux char device. That is why I was hoping Linux had some great way of managing all of this.
Thanks for the link, by the way. I appreciate it greatly.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest