Newbe, Virtural HID device minidriver installation

Hi,
from reading wdk documentation, and looking at the old vhidmini example, i’ve pieced together a hid minidriver. I am trying to make a virtural hid device HID minidriver to serve as a wrapper to a piece of hardware with a ftdi usb - serial chip in it.

This is my .inf file:

[Version]
Signature= “$CHICAGO$”
Class=HIDClass
ClassGuid={745a17a0-74d3-11d0-b6fe-00a0c90f57da}
Provider=“XXXXXXXXXXXXXX”
DriverVer=12/28/2009, 0.01.1
[Manufacturer]
%Mfg%=DeviceList, Windows7

[DeviceList]
“car Controller”=Install, %GUID%\HID_DEVICE
“car Controller”=Install.Device, HID\carController

[Install]
CopyFiles=FilesToCopy, FilesToCopy.Inf
AddReg=UpdateRegistry

[UpdateRegistry]
HKR,DevLoader,*ntkern
HKR,NTMPDriver,carControllerDriver.sys

[DestinationDirs]
FilesToCopy=12 ;driver directory
FilesToCopy.Inf=17 ;inf file directory

[carControl.Inst.Services]
AddService= carController,0x000000002,carController_service_inst,

[carController_service_inst]
DisplayName = “Car Controller Driver Service”
ServiceType = 1 ;SERVICE_KERNEL_DRIVER
StartType = 3 ;SERVICE_DEMAND_START
ErrorControl = 0 ;SERVICE_ERROR_IGNORE
ServiceBinary = %12%\carControllerDriver.sys

[Install.Services]
AddService = ,0x00000002, ; NULL Service

[SourceDisksName]
1=“carControllerDriver Disk”,

[FilesToCopy]
carControllerDriver.sys

[FilesToCopy.Inf]
carControllerDriver.inf

[Strings]
prov=“XXXXXXXXXXXXXX”
Service_Description=“car Controller Driver”
Mfg=“XXXXXXXXXXXXXX”

; *********Non Localizable Strings*****

GUID={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

Under windows 7 both the .inf file and the .sys file for the driver get copied into the windows inf directory and System32\Driver directory and “car Controller” shows up under device manager.
But, when I click on car Controller, “No drivers are installed for this device.” shows up under device status.

Have I messed up the .inf file, or does this mean that the problem is with the driver itself?

xxxxx@gmail.com wrote:

Hi,
from reading wdk documentation, and looking at the old vhidmini example, i’ve pieced together a hid minidriver. I am trying to make a virtural hid device HID minidriver to serve as a wrapper to a piece of hardware with a ftdi usb - serial chip in it.

Who is driving the FTDI device? Is there another driver for that?

This is my .inf file:

[Manufacturer]
%Mfg%=DeviceList, Windows7

That’s not a valid OS model. If you want Windows 7 only, use this:
%Mfg%=DeviceList, NT.7
although I don’t know why you would want it to be Win 7 only.

[DeviceList]
“car Controller”=Install, %GUID%\HID_DEVICE
“car Controller”=Install.Device, HID\carController

You do not have a section called “Install.Device”. That’s probably the
root cause of the error.

[UpdateRegistry]
HKR,DevLoader,*ntkern
HKR,NTMPDriver,carControllerDriver.sys

That section serves absolutely no purpose, unless you expect to support
Windows 98, and based on the “Windows7” above, I’m guessing you do not.

[FilesToCopy.Inf]
carControllerDriver.inf

Do not copy your INF into place. The system will do that at install time.

Under windows 7 both the .inf file and the .sys file for the driver get copied into the windows inf directory and System32\Driver directory and “car Controller” shows up under device manager.

How did that happen? How did you install this, exactly?


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

There is another driver for the FTDI device, FTDI supplys a virtural com port driver that makes the device appear as a windows com port.
FTDI supplies two different drivers, a VCP driver (virtural serial port) and a D2XX driver (provides a .dll that can be used to access the device).
The board has a dsPIC33f on it and a FTDI chip for USB.
It was used previously with some custom software, but now we want it to be compatable with as many programs as possible. I’ve asked about changing the board design to just get it to report itself as a HID device but for now its not going to happen.

The driver is going to be for WindowsXP and up, my computer has Windows7. I’m hoping to avoid having different sections for the different OS’s if I can for the moment.

I installed this by running:
devcon install carController.inf “{XXXXXXXXXXXXXXXXXX}\HID_DEVICE”

From your comments, I’ve modified the inf file.

[Version]
Signature= “$CHICAGO$”
Class=HIDClass
ClassGuid={745a17a0-74d3-11d0-b6fe-00a0c90f57da}
Provider=%Mfg%
DriverVer=12/28/2009, 0.01.1
[Manufacturer]
%Mfg%=DeviceList

[DeviceList]
“car Controller”=Install, %GUID%\HID_DEVICE

[Install]
CopyFiles=FilesToCopy

[DestinationDirs]
FilesToCopy=12 ;driver directory

[Install.Services]
AddService = ,0x00000002, ; NULL Service

;[Install.Services]
;AddService= carController,0x000000002,carController_service_inst,

[carController_service_inst]
DisplayName = “Car Controller Driver Service”
ServiceType = 1 ;SERVICE_KERNEL_DRIVER
StartType = 3 ;SERVICE_DEMAND_START
ErrorControl = 0 ;SERVICE_ERROR_IGNORE
ServiceBinary = %12%\carControllerDriver.sys

[SourceDisksName]
1=“carControllerDriver Disk”,

[FilesToCopy]
carControllerDriver.sys

[Strings]
Service_Description=“car Controller Driver”
Mfg=“XXXXXXXXX”

; *********Non Localizable Strings*****

GUID={XXXXXXXXXXXXXXXXXX}

With this .inf file I get the same result as with the previous .inf file.
But If I use the commented out Install.Services section instead of seeing
“car Controller” in Device Manager, I get “Unknown Device” also with
“No drivers are installed for this device.”

xxxxx@gmail.com wrote:

There is another driver for the FTDI device, FTDI supplys a virtural com port driver that makes the device appear as a windows com port.
FTDI supplies two different drivers, a VCP driver (virtural serial port) and a D2XX driver (provides a .dll that can be used to access the device).

A user-mode DLL, right?

The board has a dsPIC33f on it and a FTDI chip for USB.
It was used previously with some custom software, but now we want it to be compatable with as many programs as possible. I’ve asked about changing the board design to just get it to report itself as a HID device but for now its not going to happen…

I installed this by running:
devcon install carController.inf “{XXXXXXXXXXXXXXXXXX}\HID_DEVICE”

How do you think that your carControllerDriver.sys is going to
communicate with the existing driver? By installing it the way you
have, there is no connection to the original device. You are a
brand-new device stack, with no one underneath you.

[DeviceList]
“car Controller”=Install, %GUID%\HID_DEVICE

OK, this loads your driver, based on vhidmini. Vhidmini is a bus driver
– it then advertises a child device (HID\MyVirtualHidDevice in the
sample). The operating system will then try to load a driver for THAT
device. In the sample, that’s a null driver. I’m guessing that’s where
your “unknown device” comes in. Your vhidmini-derivation is getting
loaded just fine, and you just aren’t looking in the right place in
Device Manager for it.

So, add another item back to your [DeviceList] with whatever device ID
you are exposing in your driver, and match it to a null driver.


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

> There is another driver for the FTDI device, FTDI supplys a virtural com port driver that makes the device appear as a windows com port.

FTDI supplies two different drivers, a VCP driver (virtural serial port) and a D2XX driver (provides a .dll that can be used to access the device).

A user-mode DLL, right?

Yes I think so, the FTDI driver stack is set up with ftdibus.sys on the bottom and then either ftd2xx.dll (D2XX driver) or ftser2k.sys (virtual com port) on top.

Also in ftd2xx.h it says:
"
Environment:

kernel & user mode
"

How do you think that your carControllerDriver.sys is going to
communicate with the existing driver? By installing it the way you
have, there is no connection to the original device. You are a
brand-new device stack, with no one underneath you.

So, Two programs will open the virtural HID device at once. The program that the HID device is providing input to, and a user mode program that has a connection open to the virtural com port. This program will put data into a buffer inside the virtural HID device driver and also poll it for outgoing data. This will be done via the HID get feature and set feature reports.

> [DeviceList]
> “car Controller”=Install, %GUID%\HID_DEVICE

OK, this loads your driver, based on vhidmini. Vhidmini is a bus driver
– it then advertises a child device (HID\MyVirtualHidDevice in the
sample). The operating system will then try to load a driver for THAT
device. In the sample, that’s a null driver. I’m guessing that’s where
your “unknown device” comes in. Your vhidmini-derivation is getting
loaded just fine, and you just aren’t looking in the right place in
Device Manager for it.

So, add another item back to your [DeviceList] with whatever device ID
you are exposing in your driver, and match it to a null driver.

Ah, thats what the null service is for.

Heres the new inf, still same problem,
also here is a link to a screenshot of the problem
http://img20.imageshack.us/img20/5585/devicez.jpg

[Version]
Signature= “$CHICAGO$”
Class=HIDClass
ClassGuid={745a17a0-74d3-11d0-b6fe-00a0c90f57da}
Provider=%Mfg%
DriverVer=12/28/2009, 0.01.1
[Manufacturer]
%Mfg%=DeviceList

[DeviceList]
%VirtualBus% =VirtualBus.Inst, %GUID%\HID_DEVICE
%VHidDevice% =VHidDevice.Inst, HID\carController

[VirtualBus.Inst]
CopyFiles=FilesToCopy

[VirtualBus.services]
AddService= carController, 2,virtual_bus_service_inst,

[virtural_bus_service_inst]
DisplayName = %VirtualBus%
ServiceType = 1 ;SERVICE_KERNEL_DRIVER
StartType = 3 ;SERVICE_DEMAND_START
ErrorControl = 0 ;SERVICE_ERROR_IGNORE
ServiceBinary = %12%\carControllerDriver.sys

;==================================================
; VHidDevice install section
; -null device
;==================================================
[VHidDevice.Inst]

[VHidDevice.Services]
AddService = , 2, ; NULL Service

;--------------------------------------------------

[DestinationDirs]
FilesToCopy=12 ;Driver Directory

[SourceDisksNames]
1=“carControllerDriver Disk”,

[FilesToCopy]
carControllerDriver.sys

[Strings]
VhidDevice =“Car Controller”
VirtualBus =“Root Enumerated Virtual HID Device”
Mfg =“string”

; *********Non Localizable Strings*****

GUID={4A3EF6D9-BC2B-49C2-A640-DA3F44064E70}

xxxxx@gmail.com wrote:

Heres the new inf, still same problem,
also here is a link to a screenshot of the problem
http://img20.imageshack.us/img20/5585/devicez.jpg

I’m not sure this is a problem. It knows it’s a HID, and it knows it
belongs to you (Manufacturer: string). If you look on the Details tab
in the Hardware ID, is the “unknown device” your HID\carController or is
it your %GUID%\HID_DEVICE? If it is HID\carController, then isn’t
everything OK?

Your INF does have a confusion between VHidDevice and VhidDevice, but
I’m not sure capitalization matters there.


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

In the details tab, the “unknown device” is %GUID\HID_DEVICE:
http://img215.imageshack.us/img215/2343/devicehardwareid.jp

After the spelling fix:
http://img27.imageshack.us/img27/1827/devicespcorrected.jpg
http://img513.imageshack.us/img513/2285/devicespcorrectedhardwa.jpg

So, when I click on a mouse and take a look at it, it says, “This device is working properly.”

xxxxx@gmail.com wrote:

In the details tab, the “unknown device” is %GUID\HID_DEVICE:
http://img215.imageshack.us/img215/2343/devicehardwareid.jp

After the spelling fix:
http://img27.imageshack.us/img27/1827/devicespcorrected.jpg
http://img513.imageshack.us/img513/2285/devicespcorrectedhardwa.jpg

So, when I click on a mouse and take a look at it, it says, “This device is working properly.”

Pssht, I see it now. Duh. You have this:

[DeviceList]
%VirtualBus% =VirtualBus.Inst, %GUID%\HID_DEVICE
%VHidDevice% =VHidDevice.Inst, HID\carController

[VirtualBus.Inst]
CopyFiles=FilesToCopy

[VirtualBus.services]
AddService= carController, 2,virtual_bus_service_inst,

That last section needs to be [VirtualBus.Inst.services].


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

No dice.
Here I changed [VirtualBus.services] to [VirtualBus.Inst.services]:
http://img690.imageshack.us/img690/2238/devicetypocorrectedhard.jpg
and here I tried [VirturalBus.Inst.Services]:
http://img29.imageshack.us/img29/3613/devicetestcaptializehar.jpg

I’m starting to suspect that my previous instalation attempts are still lingering, because, I wasn’t getting devcon failed before.
Btw, thank you.

They do linger, and those old install attempts can cause problems installing
drivers, and since there is no means of completely auto-magically cleaning
everything up you have to use System Restore, and or go tip toeing through
\Windows\INF and the registry to remove all the INF files and clobbered
registry keys that can cause problems. The best is to always have an image
of the boot disk using Vista/Win7 backup tools, or a 3rd party prgram and
simply re-image the disk. Bingo … clean environment.

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, January 05, 2010 6:29 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Newbe, Virtural HID device minidriver installation

No dice.
Here I changed [VirtualBus.services] to [VirtualBus.Inst.services]:
http://img690.imageshack.us/img690/2238/devicetypocorrectedhard.jpg
and here I tried [VirturalBus.Inst.Services]:
http://img29.imageshack.us/img29/3613/devicetestcaptializehar.jpg

I’m starting to suspect that my previous instalation attempts are still
lingering, because, I wasn’t getting devcon failed before.
Btw, thank you.


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

__________ Information from ESET Smart Security, version of virus signature
database 4746 (20100105) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature
database 4746 (20100105) __________

The message was checked by ESET Smart Security.

http://www.eset.com