USBCCGP lower filter?

Hi,

I have a true composite device with IAD that is handled by USBCCGP.
However I have to add vendor command support for USBCCGP so that to
be able to send vendor commands to “USBCCGP” (i.e. to be able to send
commands that are captured by the underlying firmware/hardware in any case).

Wished to create a lower filter below USBCCGP like this:

; For XP and later
[i7evobox_ctrl.NT$ARCH$]
%i7evobox.flash.Dev.Desc%=i7evobox.ctrl.Dev, USB\VID_2196&PID_0001

;--------------------------------------------------------------------------
; Device driver
;--------------------------------------------------------------------------

[i7evobox.ctrl.Dev.NT]
CopyFiles = i7evobox.ctrl.Dev.NT.CopyFiles
AddReg = i7evobox.ctrl.Dev.NT.AddReg

[i7evobox.ctrl.Dev.NT.CopyFiles]
usbccgp.sys
i7evobox_ctrl.sys

[i7evobox.ctrl.Dev.NT.Services]
AddService = usbccgp, 0x00000002, DriverServiceInst
AddService = i7evobox_ctrl, 0x00000000, DriverLower.AddService

[i7evobox.ctrl.Dev.NT.AddReg]
HKR,DevLoader,*ntkern
HKR,NTMPDriver,usbccgp.sys

[i7evobox.ctrl.Dev.NT.HW]
AddReg=DriverLower.HW

[DriverLower.HW]
HKR,LowerFilters, 0x00010000, “i7evobox_ctrl”

;--------------------------------------------------------------------------
; Services
;--------------------------------------------------------------------------

[DriverServiceInst]
DisplayName = %USBCCGP_SERVICE%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\usbccgp.sys
LoadOrderGroup = PNP Filter

[DriverLower.AddService]
DisplayName = %I7EVOBOX_CTRL_SERVICE%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\i7evobox_ctrl.sys

But I have an issue. As my device is a IAD one, during enumeration Windows
assigns the “default” USBCCGP.SYS to the device no matter if I wish to overrule
this manually via “updating” my driver and pointing it to my filter driver.

So the question comes:

* can I create a lower filter for USBCCGP?
* how can I handle the situation so that USBCCGP would not be found automatically,
but Windows would request my fitler driver?

Thanks,

Ok, I got to the point that manually (file copy, “addfilter” example in Wdk + registry tweaking (install
service entry)) the stuff works.

Does anybody have the idea how can I install my filter driver in a “more sophisticated way”?
I.e. automatically from an INF when the device is plugged in?
Thanks,

xxxxx@chello.hu wrote:

I have a true composite device with IAD that is handled by USBCCGP.
However I have to add vendor command support for USBCCGP so that to
be able to send vendor commands to “USBCCGP” (i.e. to be able to send
commands that are captured by the underlying firmware/hardware in any case).

What are your interfaces? Do you have a custom driver there? USBCCGP
passes vendor commands through unmodified. It HAS to do so, otherwise
there would be no way to send vendor commands from the individual
interface drivers. You can just send these commands from above.


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

Kinda lost. How can it be done? Is there is internal IOCTL that does
WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR + WdfUsbTargetDeviceSendControlTransferSynchronously ?
Or how else could I send vendor commands to the device?

xxxxx@chello.hu wrote:

Kinda lost. How can it be done? Is there is internal IOCTL that does
WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR + WdfUsbTargetDeviceSendControlTransferSynchronously ?
Or how else could I send vendor commands to the device?

You’re focusing on your proposed solution, not on the problem. Let me
back up. Why do you need to send these vendor commands? What event
causes you to need to send them? Is there some user-mode application
involved?

If you have a composite device, then you also have drivers for the
individual interfaces, sitting on top of usbccgp. Which drivers are
involved there? Are they all standard system drivers, or is one of them
a custom driver? If ANY of those are custom drivers, then that driver
can send the vendor commands. You don’t need an additional filter below
usbccgp.sys to do that.

Do you see what I’m trying to get at? I strongly suspect there are
easier ways to do what you are asking, but we don’t have enough
information to know that.


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

Hi Tim,

let me explain. The device changes interface(s) time to time. I have 4 interfaces totally.
a custom one, a CCID, a mass-storage and a CDC. Because of hw limitation issues, only
2 out of the 4 are present at the same time, thus I need to change “states” time to time.
The custom interface naturally uses a custom USB driver as well that eats vendor commands.
However when I change to CDC+CCID for example, I loose this custom interface, thus I loose
my custom USB driver as well, only the standard ones remain.
As a direct result I am no longer be able to send vendor commands to the standard interfaces.
So what could I do?
Attach a lower filter to the “parent” (that is CCGP) and implement vendor command handling
in this filter.
Any other idea?

On Mon, Oct 11, 2010 at 1:04 PM, wrote:
> let me explain. The device changes interface(s) time to time. I have 4 interfaces totally.
> a custom one, a CCID, a mass-storage and a CDC. Because of hw limitation issues, only
> 2 out of the 4 are present at the same time, thus I need to change “states” time to time.
> The custom interface naturally uses a custom USB driver as well that eats vendor commands.

What do you mean by hardware limitation issues? I guess you do not have
enough USB end points. In that case, can you have an interface with
just the control endpoint for the custom vendor commands?

Another solution is to use libusb-win32 filter driver as the upper
filter driver for the CCGP. I think that would work also. You
can download the latest release and use the GUI Device Filter
Wizard to attach the filter driver as the upper device filter for your
device (the parent). Then you can use vendor commands through
libusb-win32.


Xiaofan

Yes, not enough pipes to have the device running all the interfaces at the same time.

“In that case, can you have an interface with
just the control endpoint for the custom vendor commands”

Sorry lame me, but can’t follow you. This is EXACTLY what I wish to achieve.
I send the vendor commands to the control endpoint (how it should be done).
But as the control EP is handled by CCGP I need to “overrule” CCGP’s behaviour
to accept (in a way or another) vendor commands from the OS.
So I added a lower filter driver to CCGP to accomplish that task.

On Mon, Oct 11, 2010 at 7:14 PM, wrote:
> Yes, not enough pipes to have the device running all the interfaces at the same time.
>
> “In that case, can you have an interface with
> just the control endpoint for the custom vendor commands”
>
> Sorry lame me, but can’t follow you. This is EXACTLY what I wish to achieve.
> I send the vendor commands to the control endpoint (how it should be done).
> But as the control EP is handled by CCGP I need to “overrule” CCGP’s behaviour
> to accept (in a way or another) vendor commands from the OS.
> So I added a lower filter driver to CCGP to accomplish that task.
>

I mean you can create an interface with no IN/OUT endpoints – just
the control endpoints. In that case, this interface can be
handled by your custom driver. I think this should be possible.


Xiaofan

hmmm I have never thought about that honestly. This sounds promising, will take a look at it.
Thanks!

Splendid, the extra interface without EPs works flawlessly, thanks Xiaofan!!!

On Tue, Oct 12, 2010 at 12:44 PM, wrote:
> Splendid, the extra interface without EPs works flawlessly, thanks Xiaofan!!!
>

I am glad to hear that.


Xiaofan