mirror of
https://git.code.sf.net/p/fldigi/flrig
synced 2026-08-13 17:28:24 -04:00
hcomm INVALID HANDLE VALUE
* initialize hcomm to invalid handle value when creating
new WIN32 class instance
* test for open port before attempting to reopen
close port if necessary
This commit is contained in:
parent
30868e5f11
commit
c892e43163
1 changed files with 5 additions and 2 deletions
|
|
@ -87,6 +87,7 @@ bool Cserial::CheckPort(string dev) {
|
|||
///////////////////////////////////////////////////////
|
||||
bool Cserial::OpenPort() {
|
||||
|
||||
if (IsOpen()) ClosePort();
|
||||
if ((fd = open( device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY )) < 0)
|
||||
return false;
|
||||
#if SERIAL_DEBUG
|
||||
|
|
@ -279,7 +280,7 @@ void Cserial::ClosePort()
|
|||
if (fd < 0) return;
|
||||
int myfd = fd;
|
||||
fd = -1;
|
||||
|
||||
|
||||
// Some serial drivers force RTS and DTR high immediately upon
|
||||
// opening the port, so our origstatus will indicate those bits
|
||||
// high (though the lines weren't actually high before we opened).
|
||||
|
|
@ -423,6 +424,8 @@ bool Cserial::OpenPort()
|
|||
{
|
||||
if (device.empty()) return false;
|
||||
|
||||
if (IsOpen()) ClosePort();
|
||||
|
||||
string COMportname = "//./";
|
||||
COMportname.append(device);
|
||||
|
||||
|
|
@ -976,7 +979,7 @@ Cserial::Cserial() {
|
|||
serptt = false;
|
||||
baud = CBR_9600;
|
||||
stopbits = 2;
|
||||
hComm = 0;
|
||||
hComm = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
Cserial::Cserial( std::string portname) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue