Tech Support > Microsoft Windows > Drivers > serial ioctl problem
serial ioctl problem
Posted by gallon sylvestre on May 12th, 2008


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

Posted by chris.aseltine@gmail.com on May 12th, 2008


On May 12, 4:27 am, gallon sylvestre <ccna....@gmail.com> wrote:

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.

Posted by gallon sylvestre on May 13th, 2008


chris.aseltine@gmail.com a écrit :
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

Posted by chris.aseltine@gmail.com on May 13th, 2008


On May 13, 8:47 am, gallon sylvestre <ccna....@gmail.com> wrote:

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...

Posted by gallon sylvestre on May 14th, 2008


chris.aseltine@gmail.com a écrit :
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


Similar Posts