USB-Serial Windows device driver

I want to develop a USB-Serial (CDC/ACM) driver but Windows native solution doesn?t include a call to inform to the device that the application requires enabling the hardware flow control in the serial communication.

We need a class/vendor specific request (using EndPoint 0) informing that the device must enable the Hardware flow control.

Now my question is: Should I use a filter driver(kmdf or umdf) above or below usber.sys, develop a function KMDF driver or a function UMDF driver will do? thanks!

wrote in message news:xxxxx@ntdev…
> I want to develop a USB-Serial (CDC/ACM) driver but Windows native
> solution doesn?t include a call to inform to the device that the
> application requires enabling the hardware flow control in the serial
> communication.
>
> We need a class/vendor specific request (using EndPoint 0) informing that
> the device must enable the Hardware flow control.
>
> Now my question is: Should I use a filter driver(kmdf or umdf) above or
> below usber.sys, develop a function KMDF driver or a function UMDF driver
> will do? thanks!
>

Search for thread(s) “Virtual COM-port driver” earlier this month.

–pa

xxxxx@pounceconsulting.com wrote:

I want to develop a USB-Serial (CDC/ACM) driver but Windows native solution doesn?t include a call to inform to the device that the application requires enabling the hardware flow control in the serial communication.

We need a class/vendor specific request (using EndPoint 0) informing that the device must enable the Hardware flow control.

Why? This should be an application choice. If the application or user
wants to use hardware flow control, he’ll turn it on. If he doesn’t,
and things don’t work right, it won’t take very long to figure it why.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

It is to extend the capabilities of the standard usb cd/acm driver. What if we want to send vendor specific requests to our usb/serial device, what would be the best approach?
Thanks

Device lower filter below usbser. Use KMDF. Use the toaster filter example as a start. There is an other thread going on right now that is exactly your problem, read http://www.osronline.com/showthread.cfm?link=185089

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@pounceconsulting.com
Sent: Friday, July 09, 2010 1:41 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB-Serial Windows device driver

It is to extend the capabilities of the standard usb cd/acm driver. What if we want to send vendor specific requests to our usb/serial device, what would be the best approach?
Thanks


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thank you guys, I will look at it and if I have more specific questions, probably I would bother you a little bit more :slight_smile:

Guys:
Assume that I have a lower filter driver named lower_usb.sys and this is the inf file for the usbser.sys:

[Version]
Signature=“$Windows NT$”
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat

DriverVer= 4/24/2009,1.1.2600.1

[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64

[DestinationDirs]
DefaultDestDir=12

;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg

[DriverCopyFiles.nt]
usbser.sys,0x20

[DriverInstall.nt.AddReg]
HKR,DevLoader,*ntkern
HKR,NTMPDriver,%DRIVERFILENAME%.sys
HKR,EnumPropPages32,“MsPorts.dll,SerialPortPropPageProvider”

[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt

[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%%DRIVERFILENAME%.sys

;------------------------------------------------------------------------------
; Windows Vista64 Support
;------------------------------------------------------------------------------

[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg

[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,0x20

[DriverInstall.NTamd64.AddReg]
HKR,DevLoader,*ntkern
HKR,NTMPDriver,%DRIVERFILENAME%.sys
HKR,EnumPropPages32,“MsPorts.dll,SerialPortPropPageProvider”

[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64

[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%%DRIVERFILENAME%.sys

;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall, USB\VID_15A2&PID_A50E
%DESCRIPTION%=DriverInstall, USB\VID_15A2&PID_A50F

[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall, USB\VID_15A2&PID_A50E
%DESCRIPTION%=DriverInstall, USB\VID_15A2&PID_A50F

[Strings]

FILENAME=“cust_cdc”
DRIVERFILENAME =“usbser”
MANUFACTURER=“Custom”
INSTDISK=“USB2UART”
DESCRIPTION=“Custom CDC Device”
SERVICE=“Virtual Com Driver”

What things I must change for this inf file to install lower_usb.sys as a lower filter driver for usbser.sys? Or do I have to use clasfilt.inf as a template and add usbser.sys somewhere there?

xxxxx@pounceconsulting.com wrote:

Guys:
Assume that I have a lower filter driver named lower_usb.sys and this is the inf file for the usbser.sys:

[DriverInstall.nt.AddReg]
HKR,DevLoader,*ntkern
HKR,NTMPDriver,%DRIVERFILENAME%.sys

Both of those lines are absolutely useless, unless you plan to support
Windows 98.

What things I must change for this inf file to install lower_usb.sys as a lower filter driver for usbser.sys? Or do I have to use clasfilt.inf as a template and add usbser.sys somewhere there?

Grep for LowerFilter in \windows\inf*.inf. There are lots of
examples. Basically, you add another service section for your filter
driver, add another AddService line pointing to that section with 0 for
the second parameter (so it isn’t seen as the function driver), and add
a registry entry to set the LowerFilters value:

[DriverInstall.nt.AddReg]
HKR,EnumPropPages32,“MsPorts.dll,SerialPortPropPageProvider”
HKR,LowerFilters,0x00010000,“myfilterservice”

[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
AddService=myfilterservice, 0, MyFilter.nt

[MyFilter.nt]
DisplayName=%MYFILTERNAME%
ServiceBinary=%FILTERFILENAME%.sys
ServiceType=1
StartType=3
ErrorControl=1


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Guys:
Sorry for the lame question but If I wanna send a supported-device-vendor request from an application to my device then the app will send the command to the COM side of usbser.sys and this FDO will pass this vendor request (from its USB side) to my lower filter driver where I send it to the device (usb bus)? Hence what is the purpose of the lower filter driver? Sorry again if it is too obvious

Usbser does not pass through vendor commands down the stack.

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@pounceconsulting.com
Sent: July 14, 2010 8:04 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB-Serial Windows device driver

Guys:
Sorry for the lame question but If I wanna send a supported-device-vendor request from an application to my device then the app will send the command to the COM side of usbser.sys and this FDO will pass this vendor request (from its USB side) to my lower filter driver where I send it to the device (usb bus)? Hence what is the purpose of the lower filter driver? Sorry again if it is too obvious


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

OK Doron, so this means that for this scenario I have to create a sandwich filter that complements usbser.sys? So the upper filter (COM) receives the custom-IOCTL ad send them directly to the lower filter (USB)?
Thanks!

Yup, just like i described to robot yesterday in his thread

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@pounceconsulting.com
Sent: July 14, 2010 8:34 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB-Serial Windows device driver

OK Doron, so this means that for this scenario I have to create a sandwich filter that complements usbser.sys? So the upper filter (COM) receives the custom-IOCTL ad send them directly to the lower filter (USB)?
Thanks!


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

You refer to this thread Doron?
http://www.osronline.com/showThread.CFM?link=185841 (Tibor)

Yes (tibor auto corrected to robot on my phone :slight_smile: )

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@pounceconsulting.com
Sent: July 14, 2010 9:00 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB-Serial Windows device driver

You refer to this thread Doron?
http://www.osronline.com/showThread.CFM?link=185841 (Tibor)


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Guys:
I created the filter sandwich. The upper filter receives the COM Ioctl and if it is standard, it is forward with no changes to usbser.sys. Now, if it is a vendor class ioctl is forwarded to a control device object created at my lower filter (using symbolic names). Now the control device object is unique for all device instances (keeping a collection of them, from toaster filter) so when it receives the ioctl in the control device object how I could know to where instance is directed? Getting the device from the queue (at lower filter) give me the control device object but how I can know to which device object targets the forward from the upper filter? is any information I can extract from the original request?

This is overly complicated. Don’t use a control device object. Instead, from the upper filter, send a IRP_MJ_PNP/IRP_MN_QUERY_INTERFACE with a custom interface/guid which has one output field, a PDEVICE_OBJECT. KMDF has a function to help you send it if you are using KMDF. In the lower filter, you handle this custom interface/GUID and fill in the output field in the INTERFACE with the lower filter’s PDEVICE_OBJECT and complete the request. Now when you get a custom ioctl, you have the pdevice_object you can send it to directly (which you can wrap in a remote io target if you want with WDF_IO_TARGET_OPEN_PARAMS_INIT_EXISTING_DEVICE).

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@pounceconsulting.com
Sent: Thursday, July 22, 2010 12:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB-Serial Windows device driver

Guys:
I created the filter sandwich. The upper filter receives the COM Ioctl and if it is standard, it is forward with no changes to usbser.sys. Now, if it is a vendor class ioctl is forwarded to a control device object created at my lower filter (using symbolic names). Now the control device object is unique for all device instances (keeping a collection of them, from toaster filter) so when it receives the ioctl in the control device object how I could know to where instance is directed? Getting the device from the queue (at lower filter) give me the control device object but how I can know to which device object targets the forward from the upper filter? is any information I can extract from the original request?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron:
I am using kmdf, indeed. Any close example of this at WinDDK samples?
Cheers

Pass the device interface name string (IoGetDeviceInterfaces for serial class GUID) as one of the IOCTL’s parameters.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Guys:
> I created the filter sandwich. The upper filter receives the COM Ioctl and if it is standard, it is forward with no changes to usbser.sys. Now, if it is a vendor class ioctl is forwarded to a control device object created at my lower filter (using symbolic names). Now the control device object is unique for all device instances (keeping a collection of them, from toaster filter) so when it receives the ioctl in the control device object how I could know to where instance is directed? Getting the device from the queue (at lower filter) give me the control device object but how I can know to which device object targets the forward from the upper filter? is any information I can extract from the original request?
>

No samples show this, sorry

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@pounceconsulting.com
Sent: Thursday, July 22, 2010 12:30 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB-Serial Windows device driver

Doron:
I am using kmdf, indeed. Any close example of this at WinDDK samples?
Cheers


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron:
But if use this approach you mention what about the usb select/config and pipes (captured from usbser.sys) that are in the lower filter? Are already configured with the PDEVICE_OBJECT sent and then I can send the usb custom ioctls directly to the pdo from the upper filter???