USB-串行端口.
问题描述:
我有通过USB串行COM端口连接到PC的设备.
突然我拔出了电缆.
而且我还处理USBDeviceRemoved事件.我从这里得到的
用于检测USB设备的USB库 [
I have Device which is connect to PC via USB Serial COM Port.
And Suddenly i pulled-out the Cable.
And I also handle the USBDeviceRemoved event. Which i have get from this
A USB Library to Detect USB Devices[^]
But i can''t close the existing connection using .CLOSE() method
(eg. _serialPort.close())
It Gives me Error: Device is not connected and also i can''t connect after joint the cable again. It also gives me Error: COMx does not Exist.
(Through this process i do not want to close my application).
Is there any way to close connection forcefully?
答
这个问题是最近才出现的.
如果您非常仔细地研究了有关SerialPort的msdn页面,那么您会发现一些非常有趣的东西...
http://msdn.microsoft.com/en-us/library/system. io.ports.serialport.aspx [ ^ ]
在社区内容下方,给定的链接为:
http://code.mbx.wh01.ipv.no/examples/SerialPortFixer.html [ ^ ]
祝你好运!
This question came along very recently.
If you would have studied the msdn page about the SerialPort very closely you would find something that is very interesting to you...
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^]
It''s below under community content, the given link is:
http://code.mbx.wh01.ipv.no/examples/SerialPortFixer.html[^]
Good luck!