Using WinUSB as a device driver

Hi,
I’ve been trying to write a .INF file to install WinUSB as a device driver for my USB hardware (Vista). The only complete and ‘working’ example I’ve seen so far, is from Peter Wieland’s “Pointless Blathering” blog, which I’ve based my .INF file off of. When I try to install my INF however, the installation of the device fails with only the message “The required line was not found in the INF”, and the Device Manager shows a device driver error. On the other hand, the hardware class specified in the INF gets properly created and the device seems to get detected properly (i.e. shows up in the device manager in the right hardware class).

The only significant difference I can find between my INF and Peter Wieland’s, is that my INF excludes any reference to OsrUsbFx2.dll in an attempt to install WinUSB.sys directly as the device driver. I’m not entirely sure if this works, but other posts online seem to indicate some level of success with using WinUSB without a second user-mode driver DLL, so I’m not sure where I’m going wrong. The part that I find most suspect about my INF, is the exclusion of the following lines under the [DDInstall.NT.Wdf] section:

UmdfDispatcher=WinUsb
UmdfService=WUDFOsrUsbFx2, WUDFOsrUsbFx2_Install
UmdfServiceOrder=WUDFOsrUsbFx2

I’m assuming this sets up OsrUsbFx2.dll as a user-mode driver layerd on top of WinUSB, but I’d rather be able to just interface my device via the WinUSB API functions. Is this a legitimate exclusion, or do I actually need a user-mode driver to provide an interface to WinUSB? Is there anything else conceptually wrong that I’m doing?

I can’t say that I’ve had the pleasure of working with WinUSB yet, or
that Plug and Play installation is remotely my thing, but I would start
by looking at the setupapi.log file (\Windows). On Vista, this file
only refers to the new location of a couple of such files (one for
applications, and one for drivers), but as I don’t recall their
respective names or the location, I can’t tell you the actual path; just
follow what it says. In any case, this file will provide a bunch of
difficult to understand detail, but it is more helpful than “The
required line was not found in the INF.”

Good luck,

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Friday, August 17, 2007 17:55
To: Windows System Software Devs Interest List
Subject: [ntdev] Using WinUSB as a device driver

Hi,
I’ve been trying to write a .INF file to install WinUSB as a device
driver for my USB hardware (Vista). The only complete and ‘working’
example I’ve seen so far, is from Peter Wieland’s “Pointless Blathering”
blog, which I’ve based my .INF file off of. When I try to install my INF
however, the installation of the device fails with only the message “The
required line was not found in the INF”, and the Device Manager shows a
device driver error. On the other hand, the hardware class specified in
the INF gets properly created and the device seems to get detected
properly (i.e. shows up in the device manager in the right hardware
class).

The only significant difference I can find between my INF and Peter
Wieland’s, is that my INF excludes any reference to OsrUsbFx2.dll in an
attempt to install WinUSB.sys directly as the device driver. I’m not
entirely sure if this works, but other posts online seem to indicate
some level of success with using WinUSB without a second user-mode
driver DLL, so I’m not sure where I’m going wrong. The part that I find
most suspect about my INF, is the exclusion of the following lines under
the [DDInstall.NT.Wdf] section:

UmdfDispatcher=WinUsb
UmdfService=WUDFOsrUsbFx2, WUDFOsrUsbFx2_Install
UmdfServiceOrder=WUDFOsrUsbFx2

I’m assuming this sets up OsrUsbFx2.dll as a user-mode driver layerd on
top of WinUSB, but I’d rather be able to just interface my device via
the WinUSB API functions. Is this a legitimate exclusion, or do I
actually need a user-mode driver to provide an interface to WinUSB? Is
there anything else conceptually wrong that I’m doing?


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 can use WinUSB on its own. As a starting point remove all of the UMDF lines from the DDInstall.NT.Wdf section (and the sections they refer to). Leave the KMDF directives as those describe WinUSB.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, August 17, 2007 2:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Using WinUSB as a device driver

Hi,
I’ve been trying to write a .INF file to install WinUSB as a device driver for my USB hardware (Vista). The only complete and ‘working’ example I’ve seen so far, is from Peter Wieland’s “Pointless Blathering” blog, which I’ve based my .INF file off of. When I try to install my INF however, the installation of the device fails with only the message “The required line was not found in the INF”, and the Device Manager shows a device driver error. On the other hand, the hardware class specified in the INF gets properly created and the device seems to get detected properly (i.e. shows up in the device manager in the right hardware class).

The only significant difference I can find between my INF and Peter Wieland’s, is that my INF excludes any reference to OsrUsbFx2.dll in an attempt to install WinUSB.sys directly as the device driver. I’m not entirely sure if this works, but other posts online seem to indicate some level of success with using WinUSB without a second user-mode driver DLL, so I’m not sure where I’m going wrong. The part that I find most suspect about my INF, is the exclusion of the following lines under the [DDInstall.NT.Wdf] section:

UmdfDispatcher=WinUsb
UmdfService=WUDFOsrUsbFx2, WUDFOsrUsbFx2_Install
UmdfServiceOrder=WUDFOsrUsbFx2

I’m assuming this sets up OsrUsbFx2.dll as a user-mode driver layerd on top of WinUSB, but I’d rather be able to just interface my device via the WinUSB API functions. Is this a legitimate exclusion, or do I actually need a user-mode driver to provide an interface to WinUSB? Is there anything else conceptually wrong that I’m doing?


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

Did you run chkinf against your INF?

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Friday, August 17, 2007 2:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Using WinUSB as a device driver

Hi,
I’ve been trying to write a .INF file to install WinUSB as a device
driver for my USB hardware (Vista). The only complete and ‘working’
example I’ve seen so far, is from Peter Wieland’s “Pointless Blathering”
blog, which I’ve based my .INF file off of. When I try to install my INF
however, the installation of the device fails with only the message “The
required line was not found in the INF”, and the Device Manager shows a
device driver error. On the other hand, the hardware class specified in
the INF gets properly created and the device seems to get detected
properly (i.e. shows up in the device manager in the right hardware
class).

The only significant difference I can find between my INF and Peter
Wieland’s, is that my INF excludes any reference to OsrUsbFx2.dll in an
attempt to install WinUSB.sys directly as the device driver. I’m not
entirely sure if this works, but other posts online seem to indicate
some level of success with using WinUSB without a second user-mode
driver DLL, so I’m not sure where I’m going wrong. The part that I find
most suspect about my INF, is the exclusion of the following lines under
the [DDInstall.NT.Wdf] section:

UmdfDispatcher=WinUsb
UmdfService=WUDFOsrUsbFx2, WUDFOsrUsbFx2_Install
UmdfServiceOrder=WUDFOsrUsbFx2

I’m assuming this sets up OsrUsbFx2.dll as a user-mode driver layerd on
top of WinUSB, but I’d rather be able to just interface my device via
the WinUSB API functions. Is this a legitimate exclusion, or do I
actually need a user-mode driver to provide an interface to WinUSB? Is
there anything else conceptually wrong that I’m doing?


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,

If I run chkinf.bat on WUDFOsrUsbFx2.inf, I get the following. I understand the first error, not the second, nor the warnings. I would have expected only the first error for the sample.

Dean

Summary of ".\WUDFOsrUsbFx2.inf"
Total Errors: 2
Total Warnings: 6


Errors:
Line 9: (E22.1.1004) Provider listed is Microsoft, but should be the organization who wrote this INF.
Line 39: (E22.1.1002) Unable to include WINUSB.INF. Note that only system provided INFs may be specified with the INCLUDE directive.

Warnings:
Line 0: (W22.1.9998) NOTE: The ChkInf tool does not verify the WDF sections and directives of the INF file.
Line 0: (W22.1.2212) No Copyright information found.
Line 7: (W22.1.2215) Class Sample (ClassGUID {78A1C341-4539-11d3-B88D-00C04FAD5171}) is unrecognized.
Line 49: (W22.1.2083) Section [OSRUSB_INSTALL.NT.WDF] not referenced
Line 59: (W22.1.2083) Section [WINUSB_INSTALL] not referenced
Line 62: (W22.1.2083) Section [WUDFOSRUSBFX2_INSTALL] not referenced


Annotated INF:

; (W22.1.9998) NOTE: The ChkInf tool does not verify the WDF sections and directives of the INF file.
; (W22.1.2212) No Copyright information found.
;
; WUDFOsrUsbFx2.inf - Install the OSR USB user-mode driver
;

[Version]
Signature="$Windows NT$"
Class=Sample
; (W22.1.2215) Class Sample (ClassGUID {78A1C341-4539-11d3-B88D-00C04FAD5171}) is unrecognized.
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171}
Provider=%MSFTUMDF%
; (E22.1.1004) Provider listed is Microsoft, but should be the organization who wrote this INF.
DriverVer=08/18/2007,6.0.6000.16386
CatalogFile=wudf.cat

[Manufacturer]
%MSFTUMDF%=Microsoft,NTx86

[Microsoft.NTx86]
%OsrUsbDeviceName%=OsrUsb_Install, USB\Vid_045e&Pid_94aa&mi_00
%OsrUsbDeviceName%=OsrUsb_Install, USB\VID_0547&PID_1002

[ClassInstall32]
AddReg=SampleClass_RegistryAdd

[SampleClass_RegistryAdd]
HKR,,,,%ClassName%
HKR,,Icon,,"-10"

[SourceDisksFiles]
WUDFOsrUsbFx2.dll=1
WudfUpdate_01005.dll=1
WdfCoInstaller01005.dll=1

[SourceDisksNames]
1 = %MediaDescription%

; =================== UMDF OsrUsb Device ==================================

[OsrUsb_Install.NT]
CopyFiles=UMDriverCopy
Include=WINUSB.INF ; Import sections from WINUSB.INF
; (E22.1.1002) Unable to include WINUSB.INF. Note that only system provided INFs may be specified with the INCLUDE directive.
Needs=WINUSB.NT ; Run the CopyFiles & AddReg directives for WinUsb.INF

[OsrUsb_Install.NT.hw]
AddReg=OsrUsb_Device_AddReg

[OsrUsb_Install.NT.Services]
AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall ; flag 0x2 sets this as the service for the device
AddService=WinUsb,0x000001f8,WinUsb_ServiceInstall ; this service is installed because its a filter.

[OsrUsb_Install.NT.Wdf]
; (W22.1.2083) Section [OSRUSB_INSTALL.NT.WDF] not referenced
KmdfService=WINUSB, WinUsb_Install
UmdfDispatcher=WinUsb
UmdfService=WUDFOsrUsbFx2, WUDFOsrUsbFx2_Install
UmdfServiceOrder=WUDFOsrUsbFx2

[OsrUsb_Install.NT.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles

[WinUsb_Install]
; (W22.1.2083) Section [WINUSB_INSTALL] not referenced
KmdfLibraryVersion = 1.0

[WUDFOsrUsbFx2_Install]
; (W22.1.2083) Section [WUDFOSRUSBFX2_INSTALL] not referenced
UmdfLibraryVersion=1.5.0
DriverCLSID = "{0865b2b0-6b73-428f-a3ea-2172832d6bfc}"
ServiceBinary = "%12%\UMDF\WUDFOsrUsbFx2.dll"

[OsrUsb_Device_AddReg]
HKR,,"LowerFilters",0x00010008,"WinUsb" ; FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND

[WUDFRD_ServiceInstall]
DisplayName = %WudfRdDisplayName%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WUDFRd.sys
LoadOrderGroup = Base

[WinUsb_ServiceInstall]
DisplayName = %WinUsb_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys

[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WudfUpdate_01005.dll", "WdfCoInstaller01005.dll,WdfCoInstaller"

[CoInstallers_CopyFiles]
WudfUpdate_01005.dll
WdfCoInstaller01005.dll

[DestinationDirs]
UMDriverCopy=12,UMDF ; copy to driversMdf
CoInstallers_CopyFiles=11

[UMDriverCopy]
WUDFOsrUsbFx2.dll

; =================== Generic ==================================

[Strings]
MSFTUMDF="Microsoft Internal (WDF:UMDF)"
MediaDescription="Microsoft Sample Driver Installation Media"
ClassName="WDF Samples"
WudfRdDisplayName="Windows Driver Foundation - User-mode Driver Framework Reflector"
OsrUsbDeviceName="UMDF Sample Driver for OSR USB Fx2 Learning Kit"
WinUsb_SvcDesc="WinUSB Driver"

Hi, thanks for the help everyone, I wasn’t aware of these debugging tools. I’ve got it to successfully install in Vista on Friday, and I was trying to get it working in XP (ran into some problems with the class install) when I locked myself out of the lab. I’ll see what happens when I get back on Monday.

>As a starting point remove all of the UMDF lines from the DDInstall.NT.Wdf section (and the sections they refer to). Leave the KMDF directives as those describe WinUSB.
@Peter: When I got it to install on Vista, I commented out both the WDF and UMDF coinstallers, in addition to the other changes mentioned previously. It seems that the UMDF is not needed, but I’m not sure about the WDF coinstaller - is it needed for Windows XP?

You will definitely need the KMDF coinstaller on XP to install the KMDF
bits. You can get away w/out a coinstaller on Vista b/c the KMDF bits
are already present.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Sunday, August 19, 2007 11:01 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Using WinUSB as a device driver

Hi, thanks for the help everyone, I wasn’t aware of these debugging
tools. I’ve got it to successfully install in Vista on Friday, and I was
trying to get it working in XP (ran into some problems with the class
install) when I locked myself out of the lab. I’ll see what happens when
I get back on Monday.

>As a starting point remove all of the UMDF lines from the
DDInstall.NT.Wdf section (and the sections they refer to). Leave the
KMDF directives as those describe WinUSB.
@Peter: When I got it to install on Vista, I commented out both the WDF
and UMDF coinstallers, in addition to the other changes mentioned
previously. It seems that the UMDF is not needed, but I’m not sure about
the WDF coinstaller - is it needed for Windows XP?


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