bSizer30->Add(staticBoxSizer28a,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
-#ifdef __WXMSW__
- //------------------------------
- // debug console, for WIndows build make console pop up for debug messages
- //------------------------------
-
- wxStaticBoxSizer* sbSizer_console;
- wxStaticBox *sb_console = new wxStaticBox(this, wxID_ANY, _("Debug"));
- sbSizer_console = new wxStaticBoxSizer(sb_console, wxHORIZONTAL);
-
- m_ckboxDebugConsole = new wxCheckBox(this, wxID_ANY, _("Show Console"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
- sbSizer_console->Add(m_ckboxDebugConsole, 0, wxALIGN_LEFT, 0);
-
- bSizer30->Add(sbSizer_console,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
-#endif
-
//------------------------------
// FreeDV 700 Options
//------------------------------
bSizer30->Add(sbSizer_udp,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
#endif
+#ifdef __WXMSW__
+ //------------------------------
+ // debug console, for WIndows build make console pop up for debug messages
+ //------------------------------
+
+ wxStaticBoxSizer* sbSizer_console;
+ wxStaticBox *sb_console = new wxStaticBox(this, wxID_ANY, _("Debug: Windows"));
+ sbSizer_console = new wxStaticBoxSizer(sb_console, wxHORIZONTAL);
+
+ m_ckboxDebugConsole = new wxCheckBox(this, wxID_ANY, _("Show Console"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+ sbSizer_console->Add(m_ckboxDebugConsole, 0, wxALIGN_LEFT, 0);
+
+ bSizer30->Add(sbSizer_console,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+#endif
+
//----------------------------------------------------------
// FIFO and PortAudio under/overflow counters used for debug
//----------------------------------------------------------
wxStaticBoxSizer* sbSizer_fifo;
- wxStaticBox* sb_fifo = new wxStaticBox(this, wxID_ANY, _("FIFO and PortAudio Debug Counters"));
+ wxStaticBox* sb_fifo = new wxStaticBox(this, wxID_ANY, _("Debug: FIFO and PortAudio Under/Over Flow Counters"));
sbSizer_fifo = new wxStaticBoxSizer(sb_fifo, wxVERTICAL);
m_BtnFifoReset = new wxButton(this, wxID_ANY, _("Reset"), wxDefaultPosition, wxDefaultSize, 0);
bool Serialport::openport(const char name[], bool useRTS, bool RTSPos, bool useDTR, bool DTRPos)
{
- fprintf(stderr, "starting openport(), name: %s useRTS: %d RTSPos: %d useDTR: %d DTRPos: %d\n",
- name, useRTS, RTSPos, useDTR, DTRPos);
+ fprintf(stderr, "starting openport(), name: %s strlen(name): %d useRTS: %d RTSPos: %d useDTR: %d DTRPos: %d\n",
+ name, (int)strlen(name), useRTS, RTSPos, useDTR, DTRPos);
if (com_handle != COM_HANDLE_INVALID) {
closeport();
#ifdef _WIN32
{
- COMMCONFIG CC;
- DWORD CCsize=sizeof(CC);
COMMTIMEOUTS timeouts;
DCB dcb;
TCHAR lpszFunction[100];
- if(GetDefaultCommConfigA(name, &CC, &CCsize)) {
-
+ // As per:
+ // [1] https://support.microsoft.com/en-us/help/115831/howto-specify-serial-ports-larger-than-com9
+ // [2] Hamlib lib/termios.c, win32_serial_open()
+
+ /*
+ To test change of COM port for USB serial device on Windows
+
+ 1/ Run->devmgmnt.msc
+ 2/ Change COM port Ports (COM & LPT) -> Serial Device -> Properties Tab -> Advanced
+ 3/ Unplug USB serial devce and plug in again. This is really important. FreeDV won't recognise
+ new COM port number until this is done.
+ 4/ Test PTT on FreeDV Tools->PTT
+ */
+
+ TCHAR nameWithStrangePrefix[100];
+ StringCchPrintf(nameWithStrangePrefix, 100, "\\\\.\\%s", name);
+ fputs("nameWithStrangePrefix: ", stderr);
+ fputs(nameWithStrangePrefix, stderr);
+ fprintf(stderr,"\n");
+
+#ifdef NOT_USED
+
+ COMMCONFIG CC;
+ DWORD CCsize=sizeof(CC);
+ memset(&CC, 0, CCsize);
+ CC.dwSize = CCsize;
+
+ /* Commented out by David May 13 2018, as it was failing after
+ "name" changed to "nameWithStrangePrefix" that is reqd for
+ support of COM ports above 9. I am not sure if this is
+ needed as I can't see anything similar in Hamlib */
+
+ if(GetDefaultCommConfigA(nameWithStrangePrefix, &CC, &CCsize)) {
+ fprintf(stderr, "GetDefaultCommConfigA OK\n");
CC.dcb.fOutxCtsFlow = FALSE;
CC.dcb.fOutxDsrFlow = FALSE;
CC.dcb.fDtrControl = DTR_CONTROL_DISABLE;
CC.dcb.fDsrSensitivity = FALSE;
CC.dcb.fRtsControl = RTS_CONTROL_DISABLE;
- if (!SetDefaultCommConfigA(name, &CC, CCsize)) {
+ if (!SetDefaultCommConfigA(nameWithStrangePrefix, &CC, CCsize)) {
StringCchPrintf(lpszFunction, 100, "%s", "SetDefaultCommConfigA");
goto error;
}
-
+ fprintf(stderr, "SetDefaultCommConfigA OK\n");
} else {
StringCchPrintf(lpszFunction, 100, "%s", "GetDefaultCommConfigA");
goto error;
}
-
- // As per:
- // https://support.microsoft.com/en-us/help/115831/howto-specify-serial-ports-larger-than-com9
-
- TCHAR nameWithStrangePrefix[100];
- StringCchPrintf(nameWithStrangePrefix, 100, "\\\\\\\\.\\\\%s", name);
- fprintf(stderr, "nameWithStrangePrefix: %s\n");
- if((com_handle=CreateFileA(name
- ,fdwAccess /* Access */
+#endif
+
+ if((com_handle=CreateFileA(nameWithStrangePrefix
+ ,GENERIC_READ | GENERIC_WRITE/* Access */
,0 /* Share mode */
,NULL /* Security attributes */
,OPEN_EXISTING /* Create access */
))==INVALID_HANDLE_VALUE) {
StringCchPrintf(lpszFunction, 100, "%s", "CreateFileA");
goto error;
- }
-
+ }
+ fprintf(stderr, "CreateFileA OK\n");
+
if(GetCommTimeouts(com_handle, &timeouts)) {
+ fprintf(stderr, "GetCommTimeouts OK\n");
timeouts.ReadIntervalTimeout=MAXDWORD;
timeouts.ReadTotalTimeoutMultiplier=0;
timeouts.ReadTotalTimeoutConstant=0; // No-wait read timeout
timeouts.WriteTotalTimeoutMultiplier=0;
timeouts.WriteTotalTimeoutConstant=5000; // 5 seconds
- SetCommTimeouts(com_handle,&timeouts);
+ if (!SetCommTimeouts(com_handle,&timeouts)) {
+ StringCchPrintf(lpszFunction, 100, "%s", "SetCommTimeouts");
+ goto error;
+ }
+ fprintf(stderr, "SetCommTimeouts OK\n");
} else {
StringCchPrintf(lpszFunction, 100, "%s", "GetCommTimeouts");
goto error;
/* Force N-8-1 mode: */
if(GetCommState(com_handle, &dcb)==TRUE) {
+ fprintf(stderr, "GetCommState OK\n");
+
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
StringCchPrintf(lpszFunction, 100, "%s", "SetCommState");
goto error;
}
+ fprintf(stderr, "SetCommState OK\n");
} else {
StringCchPrintf(lpszFunction, 100, "%s", "GetCommState");
goto error;
}
-
+
return true;
error: