重新配置鼠标设备

2024-05-14 08:43:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个罗技无线触摸板,我希望在一个项目中使用。我对用这台设备来驱动显微镜工作台很感兴趣。理想情况下,我会把触摸板和电脑连接起来,它的唯一目的是驱动舞台,而不是充当鼠标。一个普通的鼠标将被用来在windows和我的程序的用户界面中导航。在

问题是:我不知道如何重新配置这个设备的功能。似乎我需要为touchpad编写一个新的驱动程序。然而,这听起来像是为一个设备编写一个新的驱动程序是一个巨大的任务,如果做得不正确会带来严重的后果。以前从没写过司机,我肯定会把事情搞砸的。在

以下是我的具体问题:

  1. 是否需要编写一个新的驱动程序来重新配置鼠标以进行其他操作?

  2. 如果没有,如何重新配置?(任何方法都可以接受)。

  3. 我是否可以简单地将设备输出的数据读入计算机,以便捕捉事件进行处理?

这里还有一些其他信息可以证明是有用的:我在Windows7上用Python编程。我只需要知道触摸板上的(x,y)坐标。任何帮助或建议总比没有好。如果这个问题需要改进才能正确回答,请告诉我!提前谢谢!在


Tags: 项目程序目的windows驱动程序情况鼠标用户界面
1条回答
网友
1楼 · 发布于 2024-05-14 08:43:17

​1. Is writing a new driver necessary to reconfigure a mouse for other operations?

不需要。你仍然需要相同的驱动程序来从鼠标读取数据,而不管其他问题。在

​2. If not, how could such reconfigurations be done? (Any method would be acceptable).

你只需要使指针不是一个“核心”设备。在Linux下,您只需告诉xinput将其与X下的虚拟核心指针分离

$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
$ xinput float 12
$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
∼ Logitech USB-PS/2 Optical Mouse           id=12   [floating slave]

我确信其他操作系统上也存在类似的过程。在

​3. Could I somehow simply read the data being output from the device to the computer in order to grab events to process?

当然。这就是event subsystem(及其在其他操作系统上的类似)的用途。在

相关问题 更多 >

    热门问题