From: gallon sylvestre on
Hello,

I try to implement a serial driver with kdmf and
I've got a problem with the implementation of
IOCTL_SERIAL_GET_COMMSTATUS.

My device load good. But when I open a hyperterminal the
first input is read, the second do nothing and when the
third appears hyperterminal loop on IOCTL_SERIAL_GET_COMMSTATUS
and freeze.

You can found my code here : http://pastebin.com/m69f4c690

Thanks for your help.

--
Gallon sylvestre
OpenBSD fan | Rathaxes Core Developper
LSE researcher | kernel developer for Adeneo
http://devsyl.blogspot.com/ | www.rathaxes.org
From: chris.aseltine on
On May 12, 4:27 am, gallon sylvestre <ccna....(a)gmail.com> wrote:

> My device load good. But when I open a hyperterminal the
> first input is read, the second do nothing and when the
> third appears hyperterminal loop on IOCTL_SERIAL_GET_COMMSTATUS
> and freeze.

Your code reads:

((SERIAL_STATUS*)buffer)->AmountInInQueue = 0;

Why are you saying there is always zero bytes in your input buffer?

I suspect you are completing a wait-on-mask IOCTL, and then
Hyperterminal comes around and says, "okay, how many bytes do you
have?", and you always say "zero", which is inconsistent.
From: gallon sylvestre on
chris.aseltine(a)gmail.com a �crit :
> On May 12, 4:27 am, gallon sylvestre <ccna....(a)gmail.com> wrote:
>
>> My device load good. But when I open a hyperterminal the
>> first input is read, the second do nothing and when the
>> third appears hyperterminal loop on IOCTL_SERIAL_GET_COMMSTATUS
>> and freeze.
>
> Your code reads:
>
> ((SERIAL_STATUS*)buffer)->AmountInInQueue = 0;
>
> Why are you saying there is always zero bytes in your input buffer?
>
> I suspect you are completing a wait-on-mask IOCTL, and then
> Hyperterminal comes around and says, "okay, how many bytes do you
> have?", and you always say "zero", which is inconsistent.

I change my code to manage the AmountInDirQueue but there I have
the same problem.

Here is my new code :
http://pastebin.com/f38ae7c20

Here is my debug output:
http://pastebin.com/m3de139e3

For the debug output, the first key pressed on hyperterminal produce the
write, the second do nothing and when I pressed a third time a key the
IOCTL_SERIAL_GET_COMMSTATUS loop appears and dont stop.

The only solution to stop that is to kill hypertterminal with the task
manager.

Thans for you help :)

--
Gallon sylvestre
OpenBSD fan | Rathaxes Core Developper
LSE researcher | kernel developer for adeneo
http://devsyl.blogspot.com/ | www.rathaxes.org
From: chris.aseltine on
On May 13, 8:47 am, gallon sylvestre <ccna....(a)gmail.com> wrote:

> For the debug output, the first key pressed on hyperterminal produce the
> write, the second do nothing and when I pressed a third time a key the
> IOCTL_SERIAL_GET_COMMSTATUS loop appears and dont stop.

Are you actually completing the first write IRP? I wonder if you're
getting COMMSTATUS over and over because the app tried to write a
character, but the output never completed, so it's checking your out
queue...
From: gallon sylvestre on
chris.aseltine(a)gmail.com a �crit :
> On May 13, 8:47 am, gallon sylvestre <ccna....(a)gmail.com> wrote:
>
>> For the debug output, the first key pressed on hyperterminal produce the
>> write, the second do nothing and when I pressed a third time a key the
>> IOCTL_SERIAL_GET_COMMSTATUS loop appears and dont stop.
>
> Are you actually completing the first write IRP? I wonder if you're
> getting COMMSTATUS over and over because the app tried to write a
> character, but the output never completed, so it's checking your out
> queue...

The first write irp is completed in the function usb_write_complete,
with this call :

WdfRequestCompleteWithInformation(req, param->IoStatus.Status,
comp_params->Parameters.PipeWrite.Length);

And I receive the first byte on the usb device side.

--
Gallon sylvestre
OpenBSD fan | Rathaxes Core Developper
LSE researcher | kernel developer for adeneo
http://devsyl.blogspot.com/ | www.rathaxes.org