我有两个相同型号的触摸屏显示器连接到一台Windows 10机器上。显示器通过HDMI连接图像,通过USB连接触摸输入。
当我插入所有设备并使用内置校准“multidigimon.exe”进行设置时,我可以设置所有设备,使触摸屏按预期工作。
然而,重新启动后,有时触摸输入注册在错误的屏幕上,所以触摸右屏幕使事情发生在左边,触摸左屏幕使事情发生在右屏幕上。
我已经试过了,看看是否能找到一种方法让脚本来纠正这个问题,下面是我到目前为止找到的方法:
- multidigimon.exe将注册表项写入HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wisp\Pen\Digimon中。作为项,它使用与USB触控设备对应的Windows对象管理器路径。作为值,它使用与显示设备对应的Windows对象管理器路径。(我可以使用WinObj在“GLOBAL??”下看到这两个项)。将这两个项导出到.reg文件中,如下所示:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wisp\Pen\Digimon]
"20-\\\\?\\HID#VID_1FF7&PID_0F27&Col04#a&25dfa661&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}"="\\\\?\\DISPLAY#IVM1A3E#5&1778d8b3&1&UID260#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}"
"20-\\\\?\\HID#VID_1FF7&PID_0F27&Col04#a&29d74c67&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}"="\\\\?\\DISPLAY#IVM1A3E#5&1778d8b3&1&UID256#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}"
它主要由设备示例路径组成,可以在设备管理器中的设备详细信息下看到。在本例中,HID\VID_1FF7&PID_0F27&Col04\A&25DFA661&0&0003
和HID\VID_1FF7&PID_0F27&COL04\A&29D74C67&0&0003
将\
替换为#
,类GUID也附加在另一个#
之后。Info部分来自this stackoverflow answer。
1.在this stackoverflow answer中解释了部分设备示例路径,但这只解释了USB设备,我处理的是HID设备。因此VID_XXXX
和PID_XXXX
似乎意味着相同的事情,但ColXX
没有解释,最后一个\
之后的部分是示例特定的id。
1.重新启动后,实际触摸HID设备随机获得特定于示例的ID。因此,有时右侧触摸屏具有设备示例路径HID\VID_1FF7&PID_0F27&Col04\A&25DFA661&0&0003
,有时具有HID\VID_1FF7&PID_0F27&COL04\A&29D74C67&0&0003
,这看起来相当随机 *。左侧触摸屏获得右侧触摸屏没有的设备示例路径。
- 这可能取决于什么屏幕启动更快(他们自动打开时,PC启动)。当我拔下触摸屏设备USB后,启动和插入一个一次,第一个总是得到相同的示例特定的id。
有没有办法分辨这两个设备的区别?也许可以以某种方式获得它插入的USB端口的信息?
1条答案
按热度按时间w80xi6nr1#
找到了一种使用PowerShell和使用Win32 API的嵌入式C#的方法。
Windows上的设备位于device tree上。Windows提供了navigate that tree in Cfgmgr32.h的方法。因为在我的例子中,设备是USB设备,所以我可以在编写代码之前使用USB Device Tree Viewer进行可视化和实验。
奇怪的是,我连接的触摸屏并不识别为单个USB设备,而是一个接一个的多个USB集线器,其中一些设备已连接(一些端口未连接),而显示器不提供任何USB端口来插入东西。USB设备树Viwer还显示USB设备的子设备,甚至是我正在寻找的HID设备。
在测试了一段时间后,拔出和重新插入不同的USB端口的触摸屏,并查看什么USB设备树Viwer显示我,我可以看到设备ID(在现实中,它是设备示例ID)并不总是保持完全相同。The Device instance ID is is made up of the device ID and instance id,有时示例ID完全改变后,重新插入USB设备。
我还可以注意到位置ID的一部分,即使在重新插入和重新启动Windows后,USB端口也保持不变。
因此,为了使触摸屏在重新启动时正常工作,我需要采取的步骤是:
1.查找以指定供应商和产品ID开头的HID设备,然后查找连接到正确USB端口的COL 04(选中位置ID /位置路径)。
1.删除旧的
HKLM:\SOFTWARE\Microsoft\Wisp\Pen\Digimon
下可能错误的值1.将新找到的设备路径以正确的格式作为值添加到其中。(幸运的是,显示设备在重新启动后保持完全相同的路径)。我在通常使用内置工具将触摸屏应用到显示Map后查看了格式,并使用字符串插值将正确的格式拼凑在一起。
1.让Windows读取新的配置。为此我发现
wisptis.exe
根本不存在于我的机器上。经过一些测试后,我发现只要终止dwm.exe就能让Windows读取新的配置。它还会使屏幕变黑一会儿,因为dwm.exe是桌面窗口管理器。但在启动后立即执行此操作不会导致任何问题。甚至打开的窗口也会停留在相同的位置。我将所有这些都放在下面的脚本中,我使用Windows任务调度程序在系统启动后运行此脚本(我不能在更早的时间运行此脚本,因为屏幕启动速度比PC慢,因此USB设备仅在PC启动后“插入”):