开发者

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

开发者 https://www.devze.com 2023-01-29 22:03 出处:网络
I have connected 2 mice to PC and I wish one mouse to work as regular mouse and capture second mouse exclusively.

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 a开发者_如何转开发m 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


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.

0

精彩评论

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