“信号量超时期限已过";USB连接错误

quot;The semaphore timeout period has expiredquot; error for USB connection(“信号量超时期限已过;USB连接错误)
本文介绍了“信号量超时期限已过";USB连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误...

信号量超时期限已过.

在这条线上……

ThePorts.ActivePort1.Open();

ThePorts.ActivePort1.Open();

...但我只是偶尔会得到它.当它发生时,它会一遍又一遍地发生.然后问题消失了,几个小时或几天,然后又回来了.

...but I only get it from time to time. When it happens, it happens over and over again. Then the problem goes away, for hours or days, then it comes back.

串行端口是连接蓝牙的 USB.

The serial port is a USB with a BlueTooth connected.

我认为这家伙遇到了一个非常相似的问题,但不是在 C# 中

I think this guy was having a very similar problem, but not in C#

在 SerialPort 上冻结.Open/DeviceIoControl/GetcommState with usbser.sys

尽我所能估计,我已经阅读了他的整个问题,以及由此产生的评论和答案,但我真的无法弄清楚是哪一个解决了他的问题,或者 C# 是否与他所经历的有很大不同.

As best I can estimate, I have read his entire problem, and the resulting comments, and the answer, but I really can't figure out which one fixed his problem, or if C# is significantly different from what he was experiencing.

感谢您对无知者的任何帮助.这是实际发生的代码.

Thanks for any help for the clueless. This is the actual code where it's happening.

public static void Open_ActivePortWeWillUse(String Drone_StringNameFromUser)
{
    SerialPort TempSerialPort = new SerialPort(Drone_StringNameFromUser, (int) SerialPortSpeed);

    ThePorts.ActivePort1 = TempSerialPort;

    ThePorts.ActivePort1.DataBits = 8;
    ThePorts.ActivePort1.Parity = Parity.None;
    ThePorts.ActivePort1.StopBits = StopBits.One;

    ThePorts.ActivePort1.DataReceived += new SerialDataReceivedEventHandler(OurBackGroundSerialPortReceiver);

    ThePorts.ActivePort1.Open();  // "Sometimes" Error hits here
}

推荐答案

如果您遇到网络延迟或互联网或本地网络问题,也可能出现此错误.对应失败的桥接连接也可能是罪魁祸首.

This error could also appear if you are having network latency or internet or local network problems. Bridged connections that have a failing counterpart may be the culprit as well.

这篇关于“信号量超时期限已过";USB连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)