How to use Serial Port in WDM?

Hi all:
I want to write a driver which can write data to serial port and when 8 bytes of data have received via serial port it can be notified. How can I implement this function? Is there a service function/call of system serial port driver?
Who can tell me how to do? Thank you!
Regards,
-Ray Yang

Ray,
I wrote a driver to similar to what you want. Your driver first must
reference the standard serial driver from kernal level. You can then
allocate and build IRPs to configure and read & write the serial driver. I
configured the serial driver to use 10 msec timeouts then continually read
10 bytes chunks. This would cause the serial driver to return to my driver
with 10 bytes or if nothing came in timeout in 10 msecs.

Hope this helps

Larry

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Monday, February 28, 2000 12:39 AM
Subject: [ntdev] How to use Serial Port in WDM?

> Hi all:
> I want to write a driver which can write data to serial port and when 8
bytes of data have received via serial port it can be notified. How can I
implement this function? Is there a service function/call of system serial
port driver?
> Who can tell me how to do? Thank you!
> Regards,
> -Ray Yang
> b­®¶¹®vµj®†¢¢ºn‰zn‘Š•zzì²²

Larry,
Thank you for your answer.
Will you please mail me your source code? I just want to study it and will NOT use it for any illegal purpose.
Regards,
-Ray Yang
----- Original Message -----
From: “Larry Harmon”
To: “NT Developers Interest List”
Sent: Tuesday, February 29, 2000 5:52 AM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Ray,
> I wrote a driver to similar to what you want. Your driver first must
> reference the standard serial driver from kernal level. You can then
> allocate and build IRPs to configure and read & write the serial driver. I
> configured the serial driver to use 10 msec timeouts then continually read
> 10 bytes chunks. This would cause the serial driver to return to my driver
> with 10 bytes or if nothing came in timeout in 10 msecs.
>
> Hope this helps
>
> Larry
>
>
> ----- Original Message -----
> From: Ray Yang
> To: NT Developers Interest List
> Sent: Monday, February 28, 2000 12:39 AM
> Subject: [ntdev] How to use Serial Port in WDM?
>
>
> > Hi all:
> > I want to write a driver which can write data to serial port and when 8
> bytes of data have received via serial port it can be notified. How can I
> implement this function? Is there a service function/call of system serial
> port driver?
> > Who can tell me how to do? Thank you!
> > Regards,
> > -Ray Yang
> > b???v?j???n?zn???zz첲
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

Larry,
What, if with the similar requirement , i don’t use the standard serial
driver , and build my own serial port
driver and implement my requirement.
In my case the requirement is different in the sense that i can receive
asynchronous data chunks from the serial port .
Will the approach suggested by you still work.
Does any IOCTL in the standard serial port driver return me the number of
bytes i can
read from the port after a time out.
Kindly help.
TIA
Shefali


From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
Sent: Tuesday, February 29, 2000 3:22 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?

Ray,
I wrote a driver to similar to what you want. Your driver first must
reference the standard serial driver from kernal level. You can then
allocate and build IRPs to configure and read & write the serial driver.
I
configured the serial driver to use 10 msec timeouts then continually read
10 bytes chunks. This would cause the serial driver to return to my
driver
with 10 bytes or if nothing came in timeout in 10 msecs.

Hope this helps

Larry

----- Original Message -----
From: Ray Yang
> To: NT Developers Interest List
> Sent: Monday, February 28, 2000 12:39 AM
> Subject: [ntdev] How to use Serial Port in WDM?
>
>
> > Hi all:
> > I want to write a driver which can write data to serial port and when 8
> bytes of data have received via serial port it can be notified. How can I
> implement this function? Is there a service function/call of system serial
> port driver?
> > Who can tell me how to do? Thank you!
> > Regards,
> > -Ray Yang
> > b???v?j???n?zn’?*zz첲
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>

If I understand your problem you want a device which will only complete read
operations if 8 bytes of serial data is available.

You could, at user level, write a dll which continually reads and queues
serial data. Read requests to this dll would then check the queue for 8
bytes of data and return appropriatly.

You can, at kernel level, write a driver which will continually read and
queue serial data. Read requests to this driver would then check the queue
for 8 bytes of data and return successfully if they are available or failure
if not.

>What, if with the similar requirement , i don’t use the standard serial
>driver , and build my own serial port
>driver and implement my requirement.

You can write a driver to replace the standard serial.sys, but it is not
recommended. Serial.sys knows how to deal with many types of hardware,
including many chips & multiple port boards. Its functionality is hard to
replace.

> Does any IOCTL in the standard serial port driver return me the number of
>bytes i can
>read from the port after a time out.

The standard serial.sys driver included a rich set of configuration options.
IOCTL_SERIAL_SET_TIMEOUT is the control used to setup timeout options, which
apply to following read operations.
The IRP_MJ_READ operation allows the caller to specify how many characters
are to be read in an operation.

Good Luck

Larry
----- Original Message -----
From: shefali gulati
To: NT Developers Interest List
Cc: ‘xxxxx@hrdcorp.com’
Sent: Monday, February 28, 2000 11:08 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

Larry,
What, if with the similar requirement , i don’t use the standard serial
driver , and build my own serial port
driver and implement my requirement.
In my case the requirement is different in the sense that i can receive
asynchronous data chunks from the serial port .
Will the approach suggested by you still work.
Does any IOCTL in the standard serial port driver return me the number of
bytes i can
read from the port after a time out.
Kindly help.
TIA
Shefali

> ----------
> From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
> Sent: Tuesday, February 29, 2000 3:22 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
> Ray,
> I wrote a driver to similar to what you want. Your driver first must
> reference the standard serial driver from kernal level. You can then
> allocate and build IRPs to configure and read & write the serial driver.
> I
> configured the serial driver to use 10 msec timeouts then continually read
> 10 bytes chunks. This would cause the serial driver to return to my
> driver
> with 10 bytes or if nothing came in timeout in 10 msecs.
>
> Hope this helps
>
> Larry
>
>
> ----- Original Message -----
> From: Ray Yang
> To: NT Developers Interest List
> Sent: Monday, February 28, 2000 12:39 AM
> Subject: [ntdev] How to use Serial Port in WDM?
>
>
> > Hi all:
> > I want to write a driver which can write data to serial port and when 8
> bytes of data have received via serial port it can be notified. How can I
> implement this function? Is there a service function/call of system serial
> port driver?
> > Who can tell me how to do? Thank you!
> > Regards,
> > -Ray Yang
> > b­®¶¹®vµj®?¢¢ºn?zn’S*zzì²²
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>


You are currently subscribed to ntdev as: xxxxx@hrdcorp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Larry,
Using IoGetDeviceObjectPointer and other function you mentioned is it
possible to gain DMA access to serial port in that case? Is there an “open”
example on the net where we can pick in, to provide us with informations you
are giving us?
Is there (somewhere) a better example for the things you’re explaining than
in MS DDK help -> accessible on the net if possible:)
Could you extract things you were explaining from the driver you wrote?
Please!

Regards,
Nenad Prekupec

-----Original Message-----
From: Larry Harmon
To: NT Developers Interest List
Date: 2000. velja?a 29 15:09
Subject: [ntdev] Re: How to use Serial Port in WDM?

>If I understand your problem you want a device which will only complete
read
>operations if 8 bytes of serial data is available.
>
>You could, at user level, write a dll which continually reads and queues
>serial data. Read requests to this dll would then check the queue for 8
>bytes of data and return appropriatly.
>
>You can, at kernel level, write a driver which will continually read and
>queue serial data. Read requests to this driver would then check the queue
>for 8 bytes of data and return successfully if they are available or
failure
>if not.
>
>>>What, if with the similar requirement , i don’t use the standard serial
>>>driver , and build my own serial port
>>>driver and implement my requirement.
>
>You can write a driver to replace the standard serial.sys, but it is not
>recommended. Serial.sys knows how to deal with many types of hardware,
>including many chips & multiple port boards. Its functionality is hard to
>replace.
>
>>> Does any IOCTL in the standard serial port driver return me the number
of
>>>bytes i can
>>>read from the port after a time out.
>
>The standard serial.sys driver included a rich set of configuration
options.
>IOCTL_SERIAL_SET_TIMEOUT is the control used to setup timeout options,
which
>apply to following read operations.
>The IRP_MJ_READ operation allows the caller to specify how many characters
>are to be read in an operation.
>
>Good Luck
>
>Larry

I’m afraid I no longer have access to the sources for the driver. Look at
driver layering in the DDK Desing guide, chapter 2.

Larry
----- Original Message -----
From: Prekupec Boris <boris.prekupec>
To: NT Developers Interest List
Sent: Tuesday, February 29, 2000 12:02 PM
Subject: [ntdev] How to use Serial Port in WDM?

Larry,
Using IoGetDeviceObjectPointer and other function you mentioned is it
possible to gain DMA access to serial port in that case? Is there an “open”
example on the net where we can pick in, to provide us with informations you
are giving us?
Is there (somewhere) a better example for the things you’re explaining than
in MS DDK help -> accessible on the net if possible:)
Could you extract things you were explaining from the driver you wrote?
Please!

Regards,
Nenad Prekupec

-----Original Message-----
From: Larry Harmon
To: NT Developers Interest List
Date: 2000. veljaèa 29 15:09
Subject: [ntdev] Re: How to use Serial Port in WDM?

>If I understand your problem you want a device which will only complete
read
>operations if 8 bytes of serial data is available.
>
>You could, at user level, write a dll which continually reads and queues
>serial data. Read requests to this dll would then check the queue for 8
>bytes of data and return appropriatly.
>
>You can, at kernel level, write a driver which will continually read and
>queue serial data. Read requests to this driver would then check the queue
>for 8 bytes of data and return successfully if they are available or
failure
>if not.
>
>>>What, if with the similar requirement , i don’t use the standard serial
>>>driver , and build my own serial port
>>>driver and implement my requirement.
>
>You can write a driver to replace the standard serial.sys, but it is not
>recommended. Serial.sys knows how to deal with many types of hardware,
>including many chips & multiple port boards. Its functionality is hard to
>replace.
>
>>> Does any IOCTL in the standard serial port driver return me the number
of
>>>bytes i can
>>>read from the port after a time out.
>
>The standard serial.sys driver included a rich set of configuration
options.
>IOCTL_SERIAL_SET_TIMEOUT is the control used to setup timeout options,
which
>apply to following read operations.
>The IRP_MJ_READ operation allows the caller to specify how many characters
>are to be read in an operation.
>
>Good Luck
>
>Larry


You are currently subscribed to ntdev as: xxxxx@hrdcorp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)</boris.prekupec>

Larry,
To implement this function in kernel level, for reading 1 byte from serial port, which IRP should I implement? I think it should be such one - IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver. But there is no such one.
I found that there is a Serial Device Control Request named IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial port when 1 byte data received.
Thanks.
-Ray Yang
----- Original Message -----
From: “Larry Harmon”
To: “NT Developers Interest List”
Sent: Tuesday, February 29, 2000 9:54 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?


> You can, at kernel level, write a driver which will continually read and
> queue serial data. Read requests to this driver would then check the queue
> for 8 bytes of data and return successfully if they are available or failure
> if not.
>

Ray,
As is common in NT, there are usually several ways of doing something.

You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
IRP_MJ_READ operation…

Another approach is to use the serial.sys timeout functionality. First
configure the driver to timeout if no data is coming in then issue an
IRP_MJ_READ IRP. If data is available, it will be returned, if not the
function call will return with no data (allowing you driver to take care of
other housekeeping.

Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
and continually make 1 byte requests, however not using a timeout makes
driver shutdown difficult. (You will always have an outstanding IRP)

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Wednesday, March 01, 2000 7:08 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Larry,
> To implement this function in kernel level, for reading 1 byte from serial
port, which IRP should I implement? I think it should be such one -
IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver.
But there is no such one.
> I found that there is a Serial Device Control Request named
IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
port when 1 byte data received.
> Thanks.
> -Ray Yang
> ----- Original Message -----
> From: “Larry Harmon”
> To: “NT Developers Interest List”
> Sent: Tuesday, February 29, 2000 9:54 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
> …
>
> > You can, at kernel level, write a driver which will continually read and
> > queue serial data. Read requests to this driver would then check the
queue
> > for 8 bytes of data and return successfully if they are available or
failure
> > if not.
> >
> …
> bb²Û(²·(

Larry,
At the kernel Level,the Driver that will perform the following in NT will be
a filter driver to my understanding, because serial port driver
itself is monolithic . So does that mean, this driver also needs to
register all the dispatch routines
that the serial.sys registers.The serial.sys for WIN2k also provides the
dispatch routine for
IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
Please Help
Thanks & Regards
Shefali


From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
Sent: Thursday, March 02, 2000 7:37 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?

Ray,
As is common in NT, there are usually several ways of doing something.

You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
IRP_MJ_READ operation…

Another approach is to use the serial.sys timeout functionality. First
configure the driver to timeout if no data is coming in then issue an
IRP_MJ_READ IRP. If data is available, it will be returned, if not the
function call will return with no data (allowing you driver to take care
of
other housekeeping.

Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
and continually make 1 byte requests, however not using a timeout makes
driver shutdown difficult. (You will always have an outstanding IRP)

----- Original Message -----
From: Ray Yang
> To: NT Developers Interest List
> Sent: Wednesday, March 01, 2000 7:08 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
> > Larry,
> > To implement this function in kernel level, for reading 1 byte from
> serial
> port, which IRP should I implement? I think it should be such one -
> IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port
> driver.
> But there is no such one.
> > I found that there is a Serial Device Control Request named
> IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
> setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
> port when 1 byte data received.
> > Thanks.
> > -Ray Yang
> > ----- Original Message -----
> > From: “Larry Harmon”
> > To: “NT Developers Interest List”
> > Sent: Tuesday, February 29, 2000 9:54 PM
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> > …
> >
> > > You can, at kernel level, write a driver which will continually read
> and
> > > queue serial data. Read requests to this driver would then check the
> queue
> > > for 8 bytes of data and return successfully if they are available or
> failure
> > > if not.
> > >
> > …
> > b> b??(??(
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>

RE: [ntdev] Re: How to use Serial Port in WDM?Sorry, I don’t know anything about filter drivers.

Larry
----- Original Message -----
From: xxxxx@dcmds.co.in
To: NT Developers Interest List
Sent: Friday, March 03, 2000 7:36 AM
Subject: [ntdev] Re: How to use Serial Port in WDM?

Larry,
At the kernel Level,the Driver that will perform the following in NT will be a filter driver to my understanding, because serial port driver

itself is monolithic . So does that mean, this driver also needs to register all the dispatch routines
that the serial.sys registers.The serial.sys for WIN2k also provides the dispatch routine for
IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
Please Help
Thanks & Regards
Shefali


From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
Sent: Thursday, March 02, 2000 7:37 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?

Ray,
As is common in NT, there are usually several ways of doing something.

You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
IRP_MJ_READ operation…

Another approach is to use the serial.sys timeout functionality. First
configure the driver to timeout if no data is coming in then issue an
IRP_MJ_READ IRP. If data is available, it will be returned, if not the
function call will return with no data (allowing you driver to take care of
other housekeeping.

Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
and continually make 1 byte requests, however not using a timeout makes
driver shutdown difficult. (You will always have an outstanding IRP)

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Wednesday, March 01, 2000 7:08 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Larry,
> To implement this function in kernel level, for reading 1 byte from serial
port, which IRP should I implement? I think it should be such one -
IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver.
But there is no such one.
> I found that there is a Serial Device Control Request named
IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
port when 1 byte data received.
> Thanks.
> -Ray Yang
> ----- Original Message -----
> From: “Larry Harmon”
> To: “NT Developers Interest List”
> Sent: Tuesday, February 29, 2000 9:54 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
> …
>
> > You can, at kernel level, write a driver which will continually read and
> > queue serial data. Read requests to this driver would then check the
queue
> > for 8 bytes of data and return successfully if they are available or
failure
> > if not.
> >
> …
> b b??(??(


You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Nope, you’re not a filter driver.

You do an IoGetDeviceObjectPointer on “\device\serial0” for COM1, for
example. That gives you a file handle and a device pointer.

You can then create an irp using IoCreateDeviceIoControlRequest and
IoCallDriver() on the device object pointer to configure the port, and then
send IRP_MJ_WRITE irps to actually write (using IoAllocateIrp() in this
case).

There is sample code in the DDK that does this. I believe the mouse driver?
Grep for IOCTL_SERIAL.

Walter Oney’s book talks about IoGetDeviceObjectPointer() in Chapter 5,
p.219.

Regards – Andy

-----Original Message-----
From: xxxxx@dcmds.co.in [mailto:xxxxx@dcmds.co.in]
Sent: Friday, March 03, 2000 4:36 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?

Larry,
At the kernel Level,the Driver that will perform the following in NT will be
a filter driver to my understanding, because serial port driver
itself is monolithic . So does that mean, this driver also needs to
register all the dispatch routines
that the serial.sys registers.The serial.sys for WIN2k also provides the
dispatch routine for
IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
Please Help
Thanks & Regards
Shefali


From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
Sent: Thursday, March 02, 2000 7:37 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?
Ray,
As is common in NT, there are usually several ways of doing something.
You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
IRP_MJ_READ operation…
Another approach is to use the serial.sys timeout functionality. First
configure the driver to timeout if no data is coming in then issue an
IRP_MJ_READ IRP. If data is available, it will be returned, if not the
function call will return with no data (allowing you driver to take care of
other housekeeping.
Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
and continually make 1 byte requests, however not using a timeout makes
driver shutdown difficult. (You will always have an outstanding IRP)

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Wednesday, March 01, 2000 7:08 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Larry,
> To implement this function in kernel level, for reading 1 byte from serial

port, which IRP should I implement? I think it should be such one -
IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver.
But there is no such one.
> I found that there is a Serial Device Control Request named
IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
port when 1 byte data received.
> Thanks.
> -Ray Yang
> ----- Original Message -----
> From: “Larry Harmon”
> To: “NT Developers Interest List”
> Sent: Tuesday, February 29, 2000 9:54 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
> …
>
> > You can, at kernel level, write a driver which will continually read and

> > queue serial data. Read requests to this driver would then check the
queue
> > for 8 bytes of data and return successfully if they are available or
failure
> > if not.
> >
> …
> bb??(??(


You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Good idea. I’ll try.
Thank you.
-Ray Yang
----- Original Message -----
From: “Larry Harmon”
To: “NT Developers Interest List”
Sent: Thursday, March 02, 2000 10:07 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Ray,
> As is common in NT, there are usually several ways of doing something.
>
> You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
> operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
> IRP_MJ_READ operation…
>
> Another approach is to use the serial.sys timeout functionality. First
> configure the driver to timeout if no data is coming in then issue an
> IRP_MJ_READ IRP. If data is available, it will be returned, if not the
> function call will return with no data (allowing you driver to take care of
> other housekeeping.
>
> Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
> and continually make 1 byte requests, however not using a timeout makes
> driver shutdown difficult. (You will always have an outstanding IRP)
>
>
> ----- Original Message -----
> From: Ray Yang
> To: NT Developers Interest List
> Sent: Wednesday, March 01, 2000 7:08 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
> > Larry,
> > To implement this function in kernel level, for reading 1 byte from serial
> port, which IRP should I implement? I think it should be such one -
> IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver.
> But there is no such one.
> > I found that there is a Serial Device Control Request named
> IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
> setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
> port when 1 byte data received.
> > Thanks.
> > -Ray Yang
> > ----- Original Message -----
> > From: “Larry Harmon”
> > To: “NT Developers Interest List”
> > Sent: Tuesday, February 29, 2000 9:54 PM
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> > …
> >
> > > You can, at kernel level, write a driver which will continually read and
> > > queue serial data. Read requests to this driver would then check the
> queue
> > > for 8 bytes of data and return successfully if they are available or
> failure
> > > if not.
> > >
> > …
> > b> b??(??(
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

Yes. I’ve find 3 samples of mouse driver. Maybe I can use these samples to build up my driver.
Prekupec, I think they are useful to you too.
-Ray Yang
----- Original Message -----
From: “Grover, Andrew”
To: “NT Developers Interest List”
Sent: Saturday, March 04, 2000 8:29 AM
Subject: [ntdev] Re: How to use Serial Port in WDM?

Nope, you’re not a filter driver.

You do an IoGetDeviceObjectPointer on “\device\serial0” for COM1, for
example. That gives you a file handle and a device pointer.

You can then create an irp using IoCreateDeviceIoControlRequest and
IoCallDriver() on the device object pointer to configure the port, and then
send IRP_MJ_WRITE irps to actually write (using IoAllocateIrp() in this
case).

There is sample code in the DDK that does this. I believe the mouse driver?
Grep for IOCTL_SERIAL.

Walter Oney’s book talks about IoGetDeviceObjectPointer() in Chapter 5,
p.219.

Regards – Andy

-----Original Message-----
From: xxxxx@dcmds.co.in [mailto:xxxxx@dcmds.co.in]
Sent: Friday, March 03, 2000 4:36 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?

Larry,
At the kernel Level,the Driver that will perform the following in NT will be
a filter driver to my understanding, because serial port driver
itself is monolithic . So does that mean, this driver also needs to
register all the dispatch routines
that the serial.sys registers.The serial.sys for WIN2k also provides the
dispatch routine for
IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
Please Help
Thanks & Regards
Shefali

----------
From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
Sent: Thursday, March 02, 2000 7:37 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?
Ray,
As is common in NT, there are usually several ways of doing something.
You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
IRP_MJ_READ operation…
Another approach is to use the serial.sys timeout functionality. First
configure the driver to timeout if no data is coming in then issue an
IRP_MJ_READ IRP. If data is available, it will be returned, if not the
function call will return with no data (allowing you driver to take care of
other housekeeping.
Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
and continually make 1 byte requests, however not using a timeout makes
driver shutdown difficult. (You will always have an outstanding IRP)

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Wednesday, March 01, 2000 7:08 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Larry,
> To implement this function in kernel level, for reading 1 byte from serial

port, which IRP should I implement? I think it should be such one -
IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver.
But there is no such one.
> I found that there is a Serial Device Control Request named
IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
port when 1 byte data received.
> Thanks.
> -Ray Yang
> ----- Original Message -----
> From: “Larry Harmon”
> To: “NT Developers Interest List”
> Sent: Tuesday, February 29, 2000 9:54 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
> …
>
> > You can, at kernel level, write a driver which will continually read and

> > queue serial data. Read requests to this driver would then check the
queue
> > for 8 bytes of data and return successfully if they are available or
failure
> > if not.
> >
> …
> bb??(??(


You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@yahoo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

But i can not find IoCreateDeviceIoControlRequest in DDK document. Who can tell me where it is? Thanks!
-Ray Yang
----- Original Message -----
From: “Ray Yang”
To: “NT Developers Interest List”
Sent: Monday, March 06, 2000 12:59 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Yes. I’ve find 3 samples of mouse driver. Maybe I can use these samples to build up my driver.
> Prekupec, I think they are useful to you too.
> -Ray Yang
> ----- Original Message -----
> From: “Grover, Andrew”
> To: “NT Developers Interest List”
> Sent: Saturday, March 04, 2000 8:29 AM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
>
> Nope, you’re not a filter driver.
>
> You do an IoGetDeviceObjectPointer on “\device\serial0” for COM1, for
> example. That gives you a file handle and a device pointer.
>
> You can then create an irp using IoCreateDeviceIoControlRequest and
> IoCallDriver() on the device object pointer to configure the port, and then
> send IRP_MJ_WRITE irps to actually write (using IoAllocateIrp() in this
> case).
>
> There is sample code in the DDK that does this. I believe the mouse driver?
> Grep for IOCTL_SERIAL.
>
> Walter Oney’s book talks about IoGetDeviceObjectPointer() in Chapter 5,
> p.219.
>
> Regards – Andy
>
> -----Original Message-----
> From: xxxxx@dcmds.co.in [mailto:xxxxx@dcmds.co.in]
> Sent: Friday, March 03, 2000 4:36 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
> Larry,
> At the kernel Level,the Driver that will perform the following in NT will be
> a filter driver to my understanding, because serial port driver
> itself is monolithic . So does that mean, this driver also needs to
> register all the dispatch routines
> that the serial.sys registers.The serial.sys for WIN2k also provides the
> dispatch routine for
> IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
> Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
> Please Help
> Thanks & Regards
> Shefali
>
>
>
>
> ----------
> From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
> Sent: Thursday, March 02, 2000 7:37 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: How to use Serial Port in WDM?
> Ray,
> As is common in NT, there are usually several ways of doing something.
> You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
> operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
> IRP_MJ_READ operation…
> Another approach is to use the serial.sys timeout functionality. First
> configure the driver to timeout if no data is coming in then issue an
> IRP_MJ_READ IRP. If data is available, it will be returned, if not the
> function call will return with no data (allowing you driver to take care of
> other housekeeping.
> Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
> and continually make 1 byte requests, however not using a timeout makes
> driver shutdown difficult. (You will always have an outstanding IRP)
>
>
> ----- Original Message -----
> From: Ray Yang
> To: NT Developers Interest List
> Sent: Wednesday, March 01, 2000 7:08 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
> > Larry,
> > To implement this function in kernel level, for reading 1 byte from serial
>
> port, which IRP should I implement? I think it should be such one -
> IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver.
> But there is no such one.
> > I found that there is a Serial Device Control Request named
> IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
> setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
> port when 1 byte data received.
> > Thanks.
> > -Ray Yang
> > ----- Original Message -----
> > From: “Larry Harmon”
> > To: “NT Developers Interest List”
> > Sent: Tuesday, February 29, 2000 9:54 PM
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> > …
> >
> > > You can, at kernel level, write a driver which will continually read and
>
> > > queue serial data. Read requests to this driver would then check the
> queue
> > > for 8 bytes of data and return successfully if they are available or
> failure
> > > if not.
> > >
> > …
> > b> b??(??(
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> b???m???>.??zf?-?%y??z?^?]6?Ib??(??(

Hi,
I’ve never seen IoCreateDeviceIoControlRequest but if u want build a
device IO control request, u can use, IoBuildDeviceIoControlRequest.
U find its prototype in DDK.

chaitanya

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Tuesday, March 07, 2000 1:20 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> But i can not find IoCreateDeviceIoControlRequest in DDK document. Who
can tell me where it is? Thanks!
> -Ray Yang
> ----- Original Message -----
> From: “Ray Yang”
> To: “NT Developers Interest List”
> Sent: Monday, March 06, 2000 12:59 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
> > Yes. I’ve find 3 samples of mouse driver. Maybe I can use these samples
to build up my driver.
> > Prekupec, I think they are useful to you too.
> > -Ray Yang
> > ----- Original Message -----
> > From: “Grover, Andrew”
> > To: “NT Developers Interest List”
> > Sent: Saturday, March 04, 2000 8:29 AM
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> >
> >
> >
> > Nope, you’re not a filter driver.
> >
> > You do an IoGetDeviceObjectPointer on “\device\serial0” for COM1, for
> > example. That gives you a file handle and a device pointer.
> >
> > You can then create an irp using IoCreateDeviceIoControlRequest and
> > IoCallDriver() on the device object pointer to configure the port, and
then
> > send IRP_MJ_WRITE irps to actually write (using IoAllocateIrp() in this
> > case).
> >
> > There is sample code in the DDK that does this. I believe the mouse
driver?
> > Grep for IOCTL_SERIAL.
> >
> > Walter Oney’s book talks about IoGetDeviceObjectPointer() in Chapter 5,
> > p.219.
> >
> > Regards – Andy
> >
> > -----Original Message-----
> > From: xxxxx@dcmds.co.in [mailto:xxxxx@dcmds.co.in]
> > Sent: Friday, March 03, 2000 4:36 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> >
> >
> > Larry,
> > At the kernel Level,the Driver that will perform the following in NT
will be
> > a filter driver to my understanding, because serial port driver
> > itself is monolithic . So does that mean, this driver also needs to
> > register all the dispatch routines
> > that the serial.sys registers.The serial.sys for WIN2k also provides the
> > dispatch routine for
> > IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
> > Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
> > Please Help
> > Thanks & Regards
> > Shefali
> >
> >
> >
> >
> > ----------
> > From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
> > Sent: Thursday, March 02, 2000 7:37 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> > Ray,
> > As is common in NT, there are usually several ways of doing
something.
> > You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
> > operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
> > IRP_MJ_READ operation…
> > Another approach is to use the serial.sys timeout functionality. First
> > configure the driver to timeout if no data is coming in then issue an
> > IRP_MJ_READ IRP. If data is available, it will be returned, if not the
> > function call will return with no data (allowing you driver to take care
of
> > other housekeeping.
> > Another strategy is to use a seperate thread for issuing IRP_MJ_READ
IRPs
> > and continually make 1 byte requests, however not using a timeout makes
> > driver shutdown difficult. (You will always have an outstanding IRP)
> >
> >
> > ----- Original Message -----
> > From: Ray Yang
> > To: NT Developers Interest List
> > Sent: Wednesday, March 01, 2000 7:08 PM
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> >
> >
> > > Larry,
> > > To implement this function in kernel level, for reading 1 byte from
serial
> >
> > port, which IRP should I implement? I think it should be such one -
> > IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port
driver.
> > But there is no such one.
> > > I found that there is a Serial Device Control Request named
> > IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver
after
> > setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
> > port when 1 byte data received.
> > > Thanks.
> > > -Ray Yang
> > > ----- Original Message -----
> > > From: “Larry Harmon”
> > > To: “NT Developers Interest List”
> > > Sent: Tuesday, February 29, 2000 9:54 PM
> > > Subject: [ntdev] Re: How to use Serial Port in WDM?
> > > …
> > >
> > > > You can, at kernel level, write a driver which will continually read
and
> >
> > > > queue serial data. Read requests to this driver would then check the
> > queue
> > > > for 8 bytes of data and return successfully if they are available or
> > failure
> > > > if not.
> > > >
> > > …
> > > b> >
(??(
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yahoo.com
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
> >
> > b???m???>.??zf?-?%y??z?^?]6?Ib??(??(
> ??آ??y˫???-+.n?+???u?ڳ??j+ZY&?)??.??k?&r??&N???r?>zǧu??jyT???^j??z?^??=?O?S?l?<+??&

----- Original Message -----
From: “Ray Yang”
To: “NT Developers Interest List”
Sent: Tuesday, March 07, 2000 2:50 AM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> But i can not find IoCreateDeviceIoControlRequest in DDK document. Who
can tell me where it is? Thanks!
> -Ray Yang

[snip]

There’s no such function. However, there is a function named
IoBuildDeviceIoControlRequest().

Regards,

Matt Arnold
Professional Music Products
Mark of the Unicorn, Inc.
http://www.motu.com

To obtain my real address, please replace “biteme” with “motu”. My use of a
fake address is an anti-spam tactic. Sorry for the inconvenience.

It is called IoBuildDeviceIoControlRequest

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Tuesday, March 07, 2000 10:50 AM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> But i can not find IoCreateDeviceIoControlRequest in DDK document. Who
can tell me where it is? Thanks!

Are u referring to the mouse class driver in DDK samples.


From: Ray Yang[SMTP:xxxxx@yahoo.com]
Sent: Monday, March 06, 2000 10:29 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?

Yes. I’ve find 3 samples of mouse driver. Maybe I can use these samples to
build up my driver.
Prekupec, I think they are useful to you too.
-Ray Yang
----- Original Message -----
From: “Grover, Andrew”
> To: “NT Developers Interest List”
> Sent: Saturday, March 04, 2000 8:29 AM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
>
> Nope, you’re not a filter driver.
>
> You do an IoGetDeviceObjectPointer on “\device\serial0” for COM1, for
> example. That gives you a file handle and a device pointer.
>
> You can then create an irp using IoCreateDeviceIoControlRequest and
> IoCallDriver() on the device object pointer to configure the port, and
> then
> send IRP_MJ_WRITE irps to actually write (using IoAllocateIrp() in this
> case).
>
> There is sample code in the DDK that does this. I believe the mouse
> driver?
> Grep for IOCTL_SERIAL.
>
> Walter Oney’s book talks about IoGetDeviceObjectPointer() in Chapter 5,
> p.219.
>
> Regards – Andy
>
> -----Original Message-----
> From: xxxxx@dcmds.co.in [mailto:xxxxx@dcmds.co.in]
> Sent: Friday, March 03, 2000 4:36 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
> Larry,
> At the kernel Level,the Driver that will perform the following in NT will
> be
> a filter driver to my understanding, because serial port driver
> itself is monolithic . So does that mean, this driver also needs to
> register all the dispatch routines
> that the serial.sys registers.The serial.sys for WIN2k also provides the
> dispatch routine for
> IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
> Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
> Please Help
> Thanks & Regards
> Shefali
>
>
>
>
> ----------
> From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
> Sent: Thursday, March 02, 2000 7:37 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: How to use Serial Port in WDM?
> Ray,
> As is common in NT, there are usually several ways of doing something.
>
> You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
> operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
> IRP_MJ_READ operation…
> Another approach is to use the serial.sys timeout functionality. First
> configure the driver to timeout if no data is coming in then issue an
> IRP_MJ_READ IRP. If data is available, it will be returned, if not the
> function call will return with no data (allowing you driver to take care
> of
> other housekeeping.
> Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
> and continually make 1 byte requests, however not using a timeout makes
> driver shutdown difficult. (You will always have an outstanding IRP)
>
>
> ----- Original Message -----
> From: Ray Yang
> To: NT Developers Interest List
> Sent: Wednesday, March 01, 2000 7:08 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
>
>
> > Larry,
> > To implement this function in kernel level, for reading 1 byte from
> serial
>
> port, which IRP should I implement? I think it should be such one -
> IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port
> driver.
> But there is no such one.
> > I found that there is a Serial Device Control Request named
> IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
>
> setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
> port when 1 byte data received.
> > Thanks.
> > -Ray Yang
> > ----- Original Message -----
> > From: “Larry Harmon”
> > To: “NT Developers Interest List”
> > Sent: Tuesday, February 29, 2000 9:54 PM
> > Subject: [ntdev] Re: How to use Serial Port in WDM?
> > …
> >
> > > You can, at kernel level, write a driver which will continually read
> and
>
> > > queue serial data. Read requests to this driver would then check the
> queue
> > > for 8 bytes of data and return successfully if they are available or
> failure
> > > if not.
> > >
> > …
> > b> b²Û(²·(
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dcmds.co.in
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>
> b‹š­ç.®·§¶\¬¹»®&ÞvÚ’µ×¯jË!yö¥‰×&vÇ(Štèº{.nÇ+‰·¬zwZnV§'隊[h*æ¯z{]zþ÷Ü©b²Û
> (²·(
>

yes
-Ray Yang
----- Original Message -----
From: xxxxx@dcmds.co.in
To: NT Developers Interest List
Sent: Wednesday, March 08, 2000 6:06 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

Are u referring to the mouse class driver in DDK samples.

From: Ray Yang[SMTP:xxxxx@yahoo.com]
Sent: Monday, March 06, 2000 10:29 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?
Yes. I’ve find 3 samples of mouse driver. Maybe I can use these samples to build up my driver.
Prekupec, I think they are useful to you too.
-Ray Yang
----- Original Message -----
From: “Grover, Andrew”
To: “NT Developers Interest List”
Sent: Saturday, March 04, 2000 8:29 AM
Subject: [ntdev] Re: How to use Serial Port in WDM?

Nope, you’re not a filter driver.

You do an IoGetDeviceObjectPointer on “\device\serial0” for COM1, for
example. That gives you a file handle and a device pointer.

You can then create an irp using IoCreateDeviceIoControlRequest and
IoCallDriver() on the device object pointer to configure the port, and then
send IRP_MJ_WRITE irps to actually write (using IoAllocateIrp() in this
case).

There is sample code in the DDK that does this. I believe the mouse driver?
Grep for IOCTL_SERIAL.

Walter Oney’s book talks about IoGetDeviceObjectPointer() in Chapter 5,
p.219.

Regards – Andy
-----Original Message-----
From: xxxxx@dcmds.co.in [mailto:xxxxx@dcmds.co.in]
Sent: Friday, March 03, 2000 4:36 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?

Larry,
At the kernel Level,the Driver that will perform the following in NT will be
a filter driver to my understanding, because serial port driver
itself is monolithic . So does that mean, this driver also needs to
register all the dispatch routines
that the serial.sys registers.The serial.sys for WIN2k also provides the
dispatch routine for
IRP_MJ_INTERNAL_DEVICE_CONTROL. while that in NT4 is not present.
Can our driver create IRP’s with IRP_MJ_DEVICE_CONTROL.
Please Help
Thanks & Regards
Shefali

----------
From: Larry Harmon[SMTP:xxxxx@hrdcorp.com]
Sent: Thursday, March 02, 2000 7:37 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to use Serial Port in WDM?
Ray,
As is common in NT, there are usually several ways of doing something.
You can use IOCTL_SERIAL_WAIT_ON_MASK, however this will require two I/O
operations. One for the IOCTL_SERIAL_WAIT_ON_MASK and another for the
IRP_MJ_READ operation…
Another approach is to use the serial.sys timeout functionality. First
configure the driver to timeout if no data is coming in then issue an
IRP_MJ_READ IRP. If data is available, it will be returned, if not the
function call will return with no data (allowing you driver to take care of
other housekeeping.
Another strategy is to use a seperate thread for issuing IRP_MJ_READ IRPs
and continually make 1 byte requests, however not using a timeout makes
driver shutdown difficult. (You will always have an outstanding IRP)

----- Original Message -----
From: Ray Yang
To: NT Developers Interest List
Sent: Wednesday, March 01, 2000 7:08 PM
Subject: [ntdev] Re: How to use Serial Port in WDM?

> Larry,
> To implement this function in kernel level, for reading 1 byte from serial
port, which IRP should I implement? I think it should be such one -
IOCTL_SERIAL_INTERNAL_READ between my driver and system serial port driver.
But there is no such one.
> I found that there is a Serial Device Control Request named
IOCTL_SERIAL_WAIT_ON_MASK. Can I implement this request in my driver after
setting the events as SERIAL_EV_RXCHAR? So I can read 1 byte from serial
port when 1 byte data received.
> Thanks.
> -Ray Yang
> ----- Original Message -----
> From: “Larry Harmon”
> To: “NT Developers Interest List”
> Sent: Tuesday, February 29, 2000 9:54 PM
> Subject: [ntdev] Re: How to use Serial Port in WDM?
> …
>
> > You can, at kernel level, write a driver which will continually read and
> > queue serial data. Read requests to this driver would then check the
queue
> > for 8 bytes of data and return successfully if they are available or
failure
> > if not.
> >