2只老鼠,仅在Windows上捕获一只鼠标(DirectInput,DDK,Linux等) [英] 2 Mice, capturing exclusively one mouse on windows (DirectInput, DDK, Linux, anything)

查看:110
本文介绍了2只老鼠,仅在Windows上捕获一只鼠标(DirectInput,DDK,Linux等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将2只鼠标连接到PC,我希望一只鼠标能够像普通鼠标一样工作,并且只捕获第二只鼠标.

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

首先,我尝试使用DirectInput.它在InstanceName中显示了2个使用鼠标的设备. 但是只有一台设备具有DeviceType.Mouse,并且它只是真正的工作设备. 当我获得它时,它同时阻挡了两只老鼠.

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.

第二,我决定创建驱动程序.我下载了WinDDK.有鼠标过滤器驱动程序示例. 我能够编译它. 但是我不是驱动程序程序员.对于我来说,理解起来很复杂,但是它具有与PS/2鼠标相关的一些代码.我所有的鼠标都是USB.

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.

它应该与.INF文件一起安装.我更喜欢动态加载.

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

我不太确定这是正确的方向. 我是为我的业余机器人项目做的.我希望PC从鼠标中获取一些信息作为传感器. 我认为必须存在类似的项目或解决方案.

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.

我的桌上也有linux pc.将鼠标连接到Linux并解析

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

看起来像 sudo cat/dev/input/mouse1-提供一些数据,但不会阻止设备的点击和移动.

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

欢呼 最高

推荐答案

对于Linux,您需要将第一个鼠标声明为CorePointer或将第二个鼠标配置为SendCoreEvents false.有关更多详细信息,请参见xorg.conf(5)手册页.

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.

这篇关于2只老鼠,仅在Windows上捕获一只鼠标(DirectInput,DDK,Linux等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆