设备被误检测为串行鼠标 [英] Device misdetected as serial mouse

查看:21
本文介绍了设备被误检测为串行鼠标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm working on a device which communicates with a PC through a (virtual) serial port. The problem is that the data we are sending occasionally gets incorrectly identified by Windows as a bus mouse, after which the "Microsoft Serial Ballpoint" driver is loaded and the mouse pointer starts jumping around on the screen and randomly clicking on things.

通过谷歌搜索发现这是串行设备的一个古老而众所周知的问题,通常的解决方法是通过一些注册表黑客来禁用有问题的驱动程序.然而,我们的用户有很多要求,我宁愿不要让我们的应用程序弄乱用户的注册表.尤其是当修复依赖于 Windows 版本并且用户很可能正在使用总线鼠标时.

A bit of Googling reveals that is an old and well-known problem with serial devices where the usual work-around is a bit of registry hacking to disable the offending driver. That it is a lot to demand from our users however and I'd rather not have our application messing around with the user's registry. Especially not when the fix is dependent on the Windows version and the user may well be using a bus mouse.

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

Instead I'd like to avoid the problem by changing our protocol to not send any data which may get us misidentified as a mouse. The only problem is that I'm not quite certain what patterns to avoid. Apparently Microsoft's Mouse protocol consists of packets of four bytes where the MSB of the first is set and that of the last three is clear.

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

Would sending only 7-bit ASCII suffice? Are there any other devices I need to worry about being detected as?

推荐答案

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

I just encountered this problem myself on Windows 7 Professional x64, and a solution that worked for me was to go into the registry and edit the following value:

Location: HKEY_LOCAL_MACHINESystemCurrentControlSetServicessermouse  
Key: Start  
Value: 3

Value改成4,就不会出现这个问题了.

Change Value to 4 and it will stop this problem occurring.

这里是所有有效的列表起始值:

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 编辑命令如下:


A reg edit command would be as follows:

REG ADD "HKLMSYSTEMCurrentControlSetServicessermouse" /V Start /T REG_DWORD /F /D 4

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

You then need to restart the computer, which should now start correctly and not attempt to discover a serial mouse.

祝你好运.

这篇关于设备被误检测为串行鼠标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆