Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Possible to use WinUSB as parent driver for a composite device?

Alex_EdwardAlex_Edward Member Posts: 1
Hi, this is my first time posting here. After googling a lot to try and get an answer, i found this list.

I am making a custom usb device that is currently using usbccgp.sys parent driver. It has 2 interfaces, one for audio using the generic audio driver and one for serial using usbser. Currently both interfaces work as intended. But I would like to use WinUSB because I am programming a companion chrome app which only works with WinUSB. Currently, with the usbccgp.sys driver, I cannot even see my device listed when i have chrome search for available/usable devices.I would like to use the WinUSB driver for the main device (control endpoint i think would be the right term) but when i assign that driver (using zadig) i lose my interfaces in device manager. So i had a couple of questions:

1. Do i have to make a custom INF file that states WinUSB for the main device, then generic audio for the audio interface and usbser for the serial interface?

2. Can a device even have WinUSB as the parent driver with 2 other drivers for its interfaces?

3. I have never written an INF file for drivers before but i have found a few that i can use as resources. Any suggestions where i can look up keywords used in an INF and find their meanings?

I hope these questions are on topic. Any help would be greatly appreciated!

Regards.

Comments

  • Slava_ImameevSlava_Imameev Member Posts: 480
    Hi,

    It is tricky but I'll try.

    There are three types of device objects
    - PDO(Physical device object)
    - FDO(Functional Device Object)
    - FiDO(Filter Device Object)

    PDOs are created by a bus driver that acts as functional driver for a bus. In your case the device has a "virtual bus" to which two devices are connected - audio and serial.

    USBCCGP creates FDO for a whole device(main device) and creates PDOs for each interface, they are related by BusRelation property. If you query FDO by IRP_MN_QUERY_DEVICE_RELATIONS request an array of PDOs is returned (two PDOs for your device).

    Each interface driver(audio,serial) creates FDO and attaches it to PDO created by USBCCGP ( by DEVICE_OBJECT's AttachedDevice field).

    WinUSB as I know can act only as FDO driver. That means it can't create PDOs and act as a bus driver.

    I can only envision the following configuration - WinUSB is registered as functional driver for audio and serial interfaces and USBCCGP continues to support "virtual bus". If you need to communicate with the "main device" you can create the third communication interface and register WinUSB for it as a functional driver, this requires changing the device hardware(or software if it is reprogrammable), if it is some sort of FPGA this should not be a problem. That means your device will support three interfaces instead of the current two interfaces.

    There is also a possibility of adding some proprietary requests to any interface and using this interface as a proxy for the control interface.
  • Slava_ImameevSlava_Imameev Member Posts: 480
    In addition. If you want to use the existing functional drivers ( i.e. usbser and usbaudio) and communicate with the main device by WinUSB you have to add the third interfaces. In that case there will be three interfaces - serial, audio and proprietary communication interface. USBCCGP will create three PDOs and PnP Manager will attach WinUSB to the communication interface.
  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,796
    Hmmmm... You can with we have USBCCGP's behavior (acting as a bus driver an enumerating a child device for each interface) or you can control the device directly via WinUsb. You can't have both.

    Hope that helps,

    Peter
    OSR
    @OSRDrivers

    Peter Viscarola
    OSR
    @OSRDrivers

  • Yan_Vugenfirer-4Yan_Vugenfirer-4 Member Posts: 8
    Try to use UsbDk. It was developed to overcome the shortcoming of WinUSB.

    https://github.com/daynix/UsbDk
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,397
    [email protected] wrote:
    > I am making a custom usb device that is currently using usbccgp.sys parent driver. It has 2 interfaces, one for audio using the generic audio driver and one for serial using usbser. Currently both interfaces work as intended. But I would like to use WinUSB because I am programming a companion chrome app which only works with WinUSB.

    What does the Chrome app need to do (generally speaking)? It is quite
    unusual to have a device with nothing but standard interfaces that needs
    custom back-door access. Does the Chrome app talk to the serial interface?


    > Currently, with the usbccgp.sys driver, I cannot even see my device listed when i have chrome search for available/usable devices.I would like to use the WinUSB driver for the main device (control endpoint i think would be the right term) but when i assign that driver (using zadig) i lose my interfaces in device manager.

    ALL interfaces have access to the control endpoint.


    > So i had a couple of questions:
    >
    > 1. Do i have to make a custom INF file that states WinUSB for the main device, then generic audio for the audio interface and usbser for the serial interface?

    Why do you need WinUSB? If you want the audio interface and the serial
    interface, then you need to have usbccgp own the composite device. So,
    which interface do you want WinUSB to own?


    > 2. Can a device even have WinUSB as the parent driver with 2 other drivers for its interfaces?

    No.

    > 3. I have never written an INF file for drivers before but i have found a few that i can use as resources. Any suggestions where i can look up keywords used in an INF and find their meanings?

    Before we go there, we need to figure out what you're planning to do.
    If you need to send custom non-standard vendor commands to the control
    endpoint of an otherwise class-standard device, then you need to use a
    filter driver. You can't use WinUSB.

    --
    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA