From: madhukar.gubba on
Hi All,

I have developed a USB-Serial driver. For this i have used KMDF
osrusbfx2 and serial samples.

I m using RS232-analyzer application for testing. This can be
downloaded at http://www.232analyzer.com/CommFront-Downloads.htm. I
have attached a loopback connector to the NULL modem cable and used
this applcation for sending/receiving ascii data. I get the error
Number 8020 and message that followed is "Error reading comm device".
I have debugged the driver and i see that driver is able to write and
then read the data. But the application does not receive the data. I
googled the intertet for the error and found the following url.
http://support.microsoft.com/default.aspx?scid=kb;en-us;318784.

The resolution mentioned is "A serial driver should return SUCCESS
synchronously for all read requests that can be immediately fulfilled
with data that is currently present".

My question is the serial EvtIoRead is a void callback function, so
how can i make it to return SUCCESS?

One other thing i observed is i have replaced the serial inbox drivers
with the serial sample provided in KMDF. I have built the serial
sample and replaced it. The same error occurs with standard COM port
as well. This error does not happen with WDM serial driver.

Is this a bug in KMDF serial sample driver?

All above tests are done in Windows XP 32 bit OS.

All your suggestions are appreciable.

Thanks in Advance.

Regards,
madhukar
From: chris.aseltine on
On Apr 25, 7:56 am, madhukar.gu...(a)gmail.com wrote:

> One other thing i observed is i have replaced the serial inbox drivers
> with the serial sample provided in KMDF. I have built the serial
> sample and replaced it. The same error occurs with standard COM port
> as well. This error does not happen with WDM serial driver.
>
> Is this a bug in KMDF serial sample driver?

Despite what that KB article says (the article sucks, someone should
fix it), the issue you're hitting is actually a bug in MSComm32.ocx,
not in KMDF or the serial sample. If you search around a little more
you will find the complete explanation.

To work around it in KMDF, you'll need to register a WDM preprocess
routine for IRP_MJ_READ so you can truly complete them synchronously
(note: by the time EvtIoRead is called, the IRP is already pended --
and thus MSComm32.ocx gets ERROR_IO_PENDING...)
From: madhukar.gubba on
Thanks for the reply chris.

Where can i get the KB article that you mentioned. Can you provide me
the URL?

As you have suggested me to register the WDM preprocessor rotuine
IRP_MJ_READ. So, do i need to register this routine in place of
EvtIoRead. or do i need to have both of them.

Preprocessor rotuine IRP_MJ_READ for Win XP and EvtIoRead callback
routine for Vista.

Please suggest.

Thank You.

Regards,
Madhukar
From: madhukar.gubba on
One other thing i forgot to mention is that if i register preprocessor
routine IRP_MJ_READ instead of EvtIoRead then i wont be able to use
the queues. This would change the entire design of my driver.

This means a lot of effort. I am not in a position to change this
design. Any other alternatives.

Thank You.

Regards,
MAdhukar
From: chris.aseltine on
On Apr 26, 1:20 pm, madhukar.gu...(a)gmail.com wrote:

> Where can i get the KB article that you mentioned. Can you provide me
> the URL?

I was referring to the one you yourself gave in your post.