奇怪的串行端口名称不起作用
问题很简单,我正在编写一个工具,它能够通过 .NET 中的 IO.Ports.SerialPort 函数连接 GPS 设备,
一切正常,但要列出所有可用的 COM 接口,它看起来像:
COM1
COM2%
COM3°
COM12$
不可能连接到设备称为COM3°
。如果我只是尝试手动连接到COM3
,它就可以完美工作。
这是我现在正在使用的代码片段:
For i As Integer = 0 To My.Computer.Ports.SerialPortNames.Count - 1
cbbCOMPorts.Items.Add(System.IO.Ports.SerialPort.GetPortNames(i))
Next
感谢您的帮助;)
The Problem is simple, i am coding a tool which is able to connect GPS devices over the IO.Ports.SerialPort function in .NET
Everything works fine, but to list all available COM interfaces it looks like:
COM1
COM2%
COM3°
COM12$
its impossible to connect to a device which is called COM3°
. If i simply try to connect manually to COM3
it works perfect.
this is the code snippet which i am using right now:
For i As Integer = 0 To My.Computer.Ports.SerialPortNames.Count - 1
cbbCOMPorts.Items.Add(System.IO.Ports.SerialPort.GetPortNames(i))
Next
Thanks for your help ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我以前见过这个,已经有一段时间了。这是驱动程序中的一个错误,它正在向注册表写入垃圾。 Bobby 给了你位置,用 Regedit.exe 看看。我想是某种 USB 设备。把它扔掉,然后从不同的制造商那里找到另一个。蹩脚的驱动程序不是您想要处理的。
I've seen this before, it's been a while. This is a bug in the driver, it is writing junk to the registry. Bobby gave you the location, have a look-see with Regedit.exe. Some kind of USB device, I imagine. Throw it away and find another from a different manufacturer. Cr*ppy drivers is not something you want to deal with.
是否有信息此 Connect MSDN 帖子 有帮助吗?
具体来说,我看到的是这样的:
编辑:如上面的评论所述,此链接和问题可以在 现有的 Stackoverflow 问题。
Does the information at this Connect MSDN post help?
Specifically, I see this:
Edit: As noted in the comments above, this link and issue can be found in an existing Stackoverflow question.
这是在使用串行端口时使用 .Net 4.0 的另一个原因。可能最大的问题是修复 USB 串行端口在端口打开时被删除的问题,这会导致许多问题(是的,我知道用户不应该...)。
This is another reason to use .Net 4.0 when using SerialPorts. Probably the biggest issue is to fix USB SerialPorts being removed when the port is open, which leads to many problems (yeah, I know that the user isn't supposed to...).