开发者

Linux Low Level Mouse Reading

I want to read mouse position and button state in Linux with C++, but without X or some (high-level) library etc. The only two possibilities I found are reading from the device /dev/input/m开发者_C百科ice (with fopen,...) or using libgpm. Are there other low level methods?

Thanks ahead.


In Linux all mouse events go through /dev/input/mouseX. /dev/input/mice is an accumulator in the single mouse devices. Both gpm and X fetch mouse events from /dev/input/mouseX or /dev/input/mice and forward it.

So reading from /dev/input/mouseX or /dev/input/mice is as low level as you can get – unless you're using libusb/libhid to directly access a USB mouse device. However accessing a mouse that way will detach it from the kernel, cause just a lot of trouble.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜