DCB Setup disagreeing with SetCommState

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello,
I am having a problem configuring a certain port on my computer. I
want to loop through a list of active ports and listen to the one that
is giving me the data packets I need.
Right now it loops through the ports just fine but upon trying to
configure the ports with //./COMx configuration, SetCommState believes
that a port is valid even if it's not and then the program freezes at
ReadFile.
My port configuration is as follows:
BOOL updateConnection( HANDLE hndl )
{
time_t TimeSec = 0;

DCB dcb = {0};

dcb.DCBlength = sizeof(dcb);

dcb.BaudRate = 230400; // BAUDRATE(TTYInfo);
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fDsrSensitivity = FALSE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.fErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fAbortOnError = FALSE;
dcb.wReserved = 0;
dcb.XonLim = 1;
dcb.XoffLim = 256;

dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT; // STOPBITS(TTYInfo);
dcb.EvtChar = EV_RXCHAR;
dcb.fParity = FALSE;
dcb.EofChar = '\n';

if (!SetCommState( hndl, &dcb)) //This does not fail where
expected
{
return FALSE;
}

getAllRs232( 0 );
return goodMSG;

}
BOOL listenOnActivePort(int nBus)
{
.... //Declarations
....//Loop to cycle through active ports
{
....//Try port without "\\.\" COM configuration

strcpy(&tempString,"\\\\.\\");
strcat(&tempString,activecomports[port]);
strcpy(activecomports[port],&tempString);
(HANDLE)fd[nBus] = CreateFile(activecomports[port], GENERIC_READ, 0,
0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( updateConnection( (HANDLE)fd[nBus] ) == 1)
{
return TRUE;
}
}

The first step of getAllRs232 is to determine the number of bytes in
the packet being sent, by calling:

ReadFile( (HANDLE)fd, (LPVOID)buf, (DWORD)bufSiz,
(LPDWORD)&nBytesRead, NULL );

This is where my program hangs up. I want it to cycle through the
ports and ultimately (on this specific computer) listen to port
configuration \\.\COM31, however it hangs up on the readfile on the
first instance (\\.\COM12). Is there a reason why SetCommState is not
returning an error for my specific configuration? There should not be
any data coming off any port now except COM31 or COM32.
Thank you very much in advance for any help!

.



Relevant Pages

  • Spurious completions during NCQ
    ... support DPO or FUA ... ACPI: PM-Timer IO Port: 0x408 ... Using ACPI for SMP configuration information ...
    (Linux-Kernel)
  • sata_nv times out for BD-ROM iHOS104-08
    ... ata3: nv: skipping hardreset on occupied port ... configuration follow. ... 00:0e.0 RAID bus controller: nVidia Corporation MCP51 Serial ATA ... USB 1.1 'Open' Host Controller Driver ...
    (Linux-Kernel)
  • Re: serial port question.
    ... Note that you have left the port in non-blocking mode. ... the termios settings are for raw mode and the VTIME and VMIN ... dependent upon that configuration, and when used as an example ... necessarily must be in a loop. ...
    (comp.os.linux.hardware)
  • RE: XP box maintainance and lockdown
    ... download latest virus definitions ... Router Configuration ... to obtain protocol, local port, remote port, and IP address needed to ... disable 3rd-party cookies and/or set cookie policy according to ...
    (Security-Basics)
  • AHCI - remove probing of ata2
    ... On the Intel, I've connected an IDE HDD and a CD-RW, no problem. ... port is slow to respond, ... I'm lost in all the JMICRON configuration possibilities in the ... # ACPI Support ...
    (Linux-Kernel)