在 Linux 中向鼠标驱动程序提供备用数据
我无法理解如何将替代数据输入鼠标驱动程序以在不移动鼠标的情况下控制指针。
我修改了一个驱动程序(未经测试)来提供随机数据,但我需要能够打开/关闭随机鼠标数据,并且我不认为简单的 scanf 会询问“你想这样做吗?”即将开始工作。我认为我需要构建某种与驱动程序交互的界面。
有人可以给我对此的任何看法吗?我不太清楚我需要做什么。
谢谢, 肖恩·刘易斯
I'm in way over my head and looking for a broader understanding of what it would take to feed alternate data into a mouse driver to control the pointer without moving the mouse.
I have modified a driver (untested) to provide random data, but I need to be able to turn on/off the random mouse data and I don't think a simple scanf to ask for a "Do you want to do this?" is going to work. I think that I need to build an interface of some kind that will interact with the driver.
Can anybody give me any perspective on this? I have very little idea of what I need to do.
Thanks,
Shawn Lewis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这取决于您修改的鼠标驱动程序位于用户空间还是内核空间。
如果是用户空间,您可以使用 UNIX 域套接字作为控制通道。如果是内核空间,您可以使用 sysfs 条目。
That depends on if the mouse driver you've modified is in userspace or kernelspace.
If it's userspace, you could use a UNIX-domain socket as your control channel. If it's kernelspace, you could use a
sysfs
entry.也许您可以从设备读取真实数据,但发送随机垃圾。当您读取点击或某些动作时,您可以切换到实模式。如果在一段时间内没有任何动作,您可以再次切换到随机。这完全取决于您想要实现什么目标。
Probably you can read real data from device but send random junk. When you read a click or some movement you can switch to real mode. If no movement in some timeout you can switch to random again. It all depends what are you trying to accomplish.
uinput
可用于注入输入事件。uinput
can be used to inject input events.关于已经提到的
uinput
的优秀教程:http://thiemonge.org/ uinput 入门An excellent tutorial about already mentioned
uinput
: http://thiemonge.org/getting-started-with-uinput