2 Mice, capturing exclusively one mouse on windows (DirectInput, DDK, Linux, anything)

醉酒当歌 提交于 2019-12-11 09:08:43

问题


I have connected 2 mice to PC and I wish one mouse to work as regular mouse and capture second mouse exclusively.

First I was trying DirectInput. It showed 2 devices with word mouse in InstanceName. But only one device had DeviceType.Mouse and it was only really working device. When I was acquiring it was blocking both mice.

Second I decided to create driver. I downloaded WinDDK. There is Mouse Filter driver sample. I was able to compile it. But I am not driver programmer. It is complex for me to understand but it has some code related to PS/2 mouse. All my mice are USB.

It should be installed with .INF file. I prefer it be dynamically loaded.

I am not quite sure that it is right direction. I do it for my hobbyist robotic project. I wish PC take some information from mouse as sensor. I think there must be existing similar projects or solutions.

I have linux pc on my table as well. May be better to attach mouse to linux and parse

/dev/input/mouse0
/dev/input/mouse1
/dev/input/mouse2

looks like sudo cat /dev/input/mouse1 - gives some data but does not block device from clicks and movements.

I hope simple solution already exists

Cheers Max


回答1:


For Linux, you need to either declare the first mouse as the CorePointer or configure the second mouse to have SendCoreEvents false. See the xorg.conf(5) man page for more details.



来源:https://stackoverflow.com/questions/4419906/2-mice-capturing-exclusively-one-mouse-on-windows-directinput-ddk-linux-any

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!