2 只鼠标,在 Windows 上仅捕获一只鼠标(DirectInput、DDK、Linux 等)

发布于 2024-10-07 01:31:33 字数 626 浏览 8 评论 0原文

我已将 2 个鼠标连接到 PC,我希望其中一个鼠标作为普通鼠标工作并专门捕获第二个鼠标。

首先我尝试了 DirectInput。它显示 InstanceName 中带有“鼠标”一词的 2 个设备。 但只有一台设备具有 DeviceType.Mouse,并且它只是真正工作的设备。 当我获得它时,它阻止了两只老鼠。

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

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

我不太确定这是正确的方向。 我为我的业余机器人项目这样做。我希望电脑从鼠标作为传感器获取一些信息。 我想肯定已经有类似的项目或者解决方案了。

我的桌子上也有 Linux 电脑。 可能更好

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

将鼠标附加到 linux 并解析看起来 sudo cat /dev/input/mouse1 - 提供一些数据,但不会阻止设备点击和移动。

我希望简单的解决方案已经存在

干杯 最大限度

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心的位置 2024-10-14 01:31:33

对于 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文