开发者

Get signal from PS/2-mouse in C++?

Does anyone know how to get the signal from a PS/2-style mouse by using some c++ code?

What I want to do is the following: I took an old mouse for PS/2 port and want to use the light barrier of the middle wheel for some measurement purposes. It would be nice to get the information about any change of the middle wheel, i.e. the light barrier, by using some C/C++ code.

I tried to find some inf开发者_如何转开发ormation on the Internet, but I'm a real n00b regarding port programming and didn't find something of help for me.


The msdn is decent for this topic, although this may give you higher level information than you're looking for and won't be specific to a particular ps2 port, but will be for any mouse connected to the system. If you want specific information from only the ps/2 port you'll probably have to look at writing your own device driver.

http://msdn.microsoft.com/en-us/library/ms645601%28v=VS.85%29.aspx#_win32_The_Mouse_Wheel


I don't think there are high-level libraries to do this, I think you'll have to look for a system-dependent solution.

What operating system do you wish to target?

On Linux PS/2 mouses (just like any other device) are represented by a virtual file in the /dev directory, usually in /dev/input (but it depends on what software is managing your devices /dev).
You should find out what device corresponds to your PS/2 mouse and just read it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜