gpt4 book ai didi

windows - 设备被误检测为串行鼠标

转载 作者:可可西里 更新时间:2023-11-01 12:04:35 25 4
gpt4 key购买 nike

我正在开发一种通过(虚拟)串行端口与 PC 通信的设备。问题是我们发送的数据偶尔会被 Windows 错误地识别为总线鼠标,之后加载“Microsoft Serial Ballpoint”驱动程序,鼠标指针开始在屏幕上跳来跳去并随机点击东西。

谷歌搜索显示这是串行设备的一个古老且众所周知的问题,通常的解决方法是对注册表进行一些黑客攻击以禁用有问题的驱动程序。然而,这对我们的用户提出了很多要求,我不想让我们的应用程序弄乱用户的注册表。尤其是当修复依赖于 Windows 版本并且用户很可能使用总线鼠标时。

相反,我想通过更改我们的协议(protocol)以不发送任何可能使我们被误认为是鼠标的数据来避免该问题。唯一的问题是我不太确定要避免什么模式。显然,Microsoft 的鼠标协议(protocol)由四个字节的数据包组成,其中设置了第一个的 MSB,最后三个的 MSB 是明确的。

仅发送 7 位 ASCII 就足够了吗?我是否需要担心被检测为任何其他设备?

最佳答案

我自己刚刚在 Windows 7 Professional x64 上遇到了这个问题,对我有用的解决方案是进入注册表并编辑以下值:

Location: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\sermouse  
Key: Start
Value: 3

Value 更改为 4 它将阻止此问题的发生。

Here is a list of all valid Start values :

0 Boot (loaded by kernel loader). Components of the driver stack for the boot (startup) volume must be loaded by the kernel loader.

1 System (loaded by I/O subsystem). Specifies that the driver is loaded at kernel initialization.

2 Automatic (loaded by Service Control Manager). Specifies that the service is loaded or started automatically.

3 Manual. Specifies that the service does not start until the user starts it manually, such as by using Device Manager.

4 Disabled. Specifies that the service should not be started.

reg 编辑命令如下:

REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\sermouse" /V Start /T REG_DWORD /F /D 4

然后您需要重新启动计算机,现在它应该可以正确启动并且不会尝试发现串行鼠标。

祝你好运。

关于windows - 设备被误检测为串行鼠标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9226082/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com