Skip to main content
Ken, N9VV reported an error in PowerSDR 1.3.13 where opening a serial port after it had already been opened and then closed would cause an exception. The serial port will remain unavailable until PowerSDR is exited and then restarted.

Using PortMon, I immediately saw the error: I was trying to close the handle to the com port without first cancelling a WaitCommEvent(). The file handle to the com port would only be closed when PowerSDR exited.

The correction to the source code was pretty easy:

In SerialStream.cs line 1383, function FreeHandle needs to be changed to:




protected internal override void FreeHandle(IntPtr handle)
{
if (_ownsHandle)
{
//Important! Must cancel all events before closing file!!!
Win32API_Serial.SetCommMask(handle, 0);
//Now we can close the file handle
Win32API_Serial.CloseHandle(handle);
}
}


Calling SetCommMask() with a mask of 0 cancells the current WaitCommEvent() allowing the com port to be closed and correcting the problem.

Comments

Anonymous said…
Nice blog. :) Thanks for the link. I'll add it to my favorites so I can check up on it every once in a while.

Popular posts from this blog

History of HPSDR Mercury and Quick Silver

History of HPSDR Mercury and Quick Silver Philip Covington, N8VB Early HPSDR and XYLO In 2005 I started a High Performance SDR (HPSDR) project which was to consist of a motherboard carrying a FPGA/USB 2.0 interface and power supply with the provision for plug in modules through 40 pin headers. I had planned a narrow band high dynamic range module based on a QSD/DDS/PCM4202 audio ADC and a wide bandwidth module based on a high speed 16 bit ADC: http://www.philcovington.com/SDR/PICS/HPSDR_FPGA_USB_Board_top1_800600.jpg http://www.philcovington.com/SDR/PICS/HPSDR_FPGA_USB_Board_top4.jpg I soon selected the LTC2208 ADC from Linear Technology. A representative from Linear Technology came across my blog ( http://pcovington.blogspot.com/ ) and offered evaluation boards and samples to support the project. At about the same time my HPSDR project came about, Phil Harman, VK6APH and Bill Tracey, KD5TFD were interested developing a sound card replacement to be used with the SD...

Rumors and other nonsense...

[07.25.2012] Recently I have seen this subject brought up again when it should have been put to rest a long time ago.  There was a talented volunteer software developer (Cathy Moss of the UK) who developed a GUI software application for the QS1R (called Panoptos or SDRMAX III) who eventually stopped developing the software.  There has been much speculation on why she left the project. These recent references to Cathy Moss, who volunteered to write a GUI that worked with my QS1R server, demonstrates how ridiculous fabrications, gossip, and rumors can become.

2323 Wilt