none
A Raspberry Pi Zero USB OTG Driver for Wondows RRS feed

  • Question

  • The new $5 Raspberry Pi Zero has a new capability for Pi boards: it has a USB OTG port.  With Linux kernal drivers now available, the Pi's OTG USB port may be defined as a Ethernet device, a HID device, a Serial Device, a MIDI device, and more.  These individually are recognized by Windows as valid devices via PNP.

    There is also a valid USB OTG mode: Multi or Composite.  This means the port may act like multiple devices on one physical connection.  Similar to the old Windows PCMCIA cards that were both a modem and a flash disk.  Every time someone has tried to have Windows recognize a composite device, it fails.  Why?  Most likely there is no INF file which defines the composite functions being tried.

    Based on some Internet research I have tried to see if a composite driver exists.  The only one people can use appears to be a commercial product by http://www.thesycon.de/.  So trying to read through a great amount of documentation that is tangentially related along with many forums asking for composite driver help, I've tried to put together d definition driver (or framework at least) to define a composite definition that can be used at least for folks working with the Pi Zero (and may be helpful for other devices).

    I am hoping the community will be interested enough to review the the INF below to see if I'm on the right track and to point out issues.  I truly appreciate community advice on this process, re. is this the right direction and if so which definitions need to be set for differing types of devices within the INF need changes.

    I have the composite device defined and a serial device (would be look a terminal or other USB serial communications) - I have not defined the second type (such as storage or ethernet or HID).  I may have info in the NT section that isn't in the NT64 section, it's late and my eyes are blurry but it passes the inf2cat and signtool programs.

    ;************************************************************
    ; Windows USB Composite OTG Communications Driver 
    ; Edits by Mike Barela for Raspberry Pi Zero 
    
    [Version]
    Signature="$Windows NT$"
    ; Information on selecting device class see MSDN page https://goo.gl/S5kozI
    ; maybe Composite class but see http://goo.gl/gQU9L2
    Class=Ports
    ClassGUID={36FC9E60-C465-11CF-8056-444553540000}
    Provider="Raspberry Pi Community"
    LayoutFile=layout.inf
    CatalogFile=%MFGFILENAME%.cat
    DriverVer=02/27/2016,1.0.0000.0
    
    [Manufacturer]
    %MFGNAME%=DeviceList, NTamd64
    
    [DestinationDirs]
    DefaultDestDir=12
    
    [DefaultInstall]
    CopyINF="Composite.inf"
    
    ;------------------------------------------------------------------------------
    ;  Windows 2000/XP/Vista/Win7/Win8/Win8.1/Win10 32 bit Sections
    ;------------------------------------------------------------------------------
    
    [CommonClassParent.AddReg]
    HKR,,DevLoader,,*NTKERN
    HKR,,NTMPDriver,,usbccgp.sys
    
    [CommonClassParent.CopyFiles]
    usbccgp.sys
    
    ; including usb.inf should load the composite driver usbccgr.sys per https://goo.gl/eChJDu
    [CCGPDriverInstall.NT]
    Include=usb.inf
    Needs=Composite.Dev.NT
    AddReg=CCGPDriverInstall.AddReg
    
    [CCGPDriverInstall.NT.Services]
    Include=usb.inf
    Needs=Composite.Dev.NT.Services
    
    [CCGPDriverInstall.AddReg]
    HKR,,EnumeratorClass, 0x00000001,02,00,00
    
    [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,,usbser.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%\usbser.sys
    
    ;------------------------------------------------------------------------------
    ;  Vista/Win7/Win8/Win8.1/Win10 64 bit Sections
    ;------------------------------------------------------------------------------
    
    [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,,usbser.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%\usbser.sys
    
    [Composite.Dev]
    AddReg=CommonClassParent.AddReg
    CopyFiles=CommonClassParent.CopyFiles
    
    ; For Windows NT...
    [Composite.Dev.NT]
    CopyFiles=CommonClassParent.CopyFiles
    DelReg=Composite.DelReg.NT
    
    [Composite.DelReg.NT]
    HKR,,EnumPropPages32
    
    [Composite.Dev.NT.Services]
    AddService = usbccgp, 0x00000002, CommonClassParent.AddService
    
    [CommonClassParent.AddService]
    DisplayName    = "Microsoft USB Generic Parent Driver"
    ServiceType    = 1                  ; SERVICE_KERNEL_DRIVER
    StartType      = 3                  ; SERVICE_DEMAND_START
    ErrorControl   = 1                  ; SERVICE_ERROR_NORMAL
    ServiceBinary  = %12%\usbccgp.sys
    LoadOrderGroup = Base
    ;------------------------------------------------------------------------------
    ;  Vendor and Product ID Definitions
    ;------------------------------------------------------------------------------
    ; When developing your USB device, the VID and PID used in the PC side
    ; application program and the firmware on the microcontroller must match.
    ; Modify the below line to use your VID and PID.  Use the format as shown below.
    ; Note: One INF file can be used for multiple devices with different VID and PIDs.
    ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
    ; A list of USB IDs is at http://www.linux-usb.org/usb.ids
    ;------------------------------------------------------------------------------
    [SourceDisksFiles]
    [SourceDisksNames]
    [DeviceList]
    [DeviceList]
    ; multifunction gadget
    %DESCRIPTION%=CCGPDriverInstall, USB\VID_1D6B&PID_0104
    %DESCRIPTION%=DriverInstall, USB\VID_1D6B&PID_0104&MI_00 
    %DESCRIPTION%=DriverInstall, USB\VID_1D6B&PID_0104&MI_01 
    
    [DeviceList.NTamd64] 
    %DESCRIPTION%=CCGPDriverInstall, USB\VID_1D6B&PID_0104
    %DESCRIPTION%=DriverInstall, USB\VID_1D6B&PID_0104&MI_00 
    %DESCRIPTION%=DriverInstall, USB\VID_1D6B&PID_0104&MI_01 
    
    [DeviceList.NTx86]
    %DESCRIPTION%=CCGPDriverInstall, USB\VID_1D6B&PID_0104
    %DESCRIPTION%=DriverInstall, USB\VID_1D6B&PID_0104&MI_00 
    %DESCRIPTION%=DriverInstall, USB\VID_1D6B&PID_0104&MI_01
    
    ; the Linux Foundation (VID = 0x1D6B) device with a PID = 0x0104 (Multifunction Composite Gadget)
    
    ;------------------------------------------------------------------------------
    ;  String Definitions
    ;------------------------------------------------------------------------------
    ;Modify these strings to customize your device
    ;  NOTE: Do not put spaces in %MFGFILENAME% to maintain Windows 7 compatibility
    ;------------------------------------------------------------------------------
    [Strings]
    MFGFILENAME="ZeroComposite"
    ;DRIVERFILENAME ="usbser"
    MFGNAME="Raspberry Pi Community"
    INSTDISK="Raspberry Pi Composite Driver Installer"
    DESCRIPTION="Raspberry Pi Composite Test Deiver"
    SERVICE="USB Composite Driver"

    Again thanks, Mike


    WHS OEM, Celeron2.0, 1GB, 7 JBOD (3.0TB), Vista/XP mix clients + xbox360

    Sunday, February 28, 2016 12:52 PM

Answers

  • Hi Mike,

    Looks like I've just found a working driver for the CDC Serial port at least..

    The freetronics Arduino 'LeoStick', an AMTEL 32U4 has a built in USB interface, and using the INF from here, i've got a working COM port on Windows 7.

    freetronics.com.au/pages/installing-the-usb-driver-file-for-windows

    Hope this helps, good luck with the CDC ECM Ethernet, hope you manage to work that one out...

    The OTG function I used was from this isticktoit.net/?p=1383

    Adrian.

    Saturday, April 2, 2016 6:23 PM

All replies

  • Mike,

    Windows (7 and later) perfectly support multifunction devices, and usbccgp does this automatically. But the INF file alone cannot do this, the device must have proper descriptors for each function. For the "parent" multifunction device itself, no INF is needed at all, it will be detected based on its class in the device descriptor, no matter what is vendor & device ID.

    Then usbccgp will detect other functions by their descriptors. And here is when you will need custom INF files for functions for which Windows does not have in-box drivers. Win10 has inbox drivers for serial (CDC), storage etc.

    Again, these in-box drivers will be selected by the function class, not by vendor/device/MI.

    Bottom line, make sure that the USB device has proper descriptors.

    -- pa

    Sunday, February 28, 2016 1:31 PM
  • Thanks Pavel, that's what I would have thought.  But in actual use, people have not had success in actually getting a composite device to be recognized for its various components.

    I don't have a Pi Zero myself until later this week so I cannot first hand give the functionality described.  See an example of the Windows confusion at https://developer.ridgerun.com/wiki/index.php/How_to_use_USB_CDC_ACM_and_MS_composite_Linux_gadget_driver#Using_CDC_ACM_+_MS_device_with_Windows_7_host

    and http://blog.gbaman.info/?p=699


    • Edited by TheKitty4 Sunday, February 28, 2016 2:21 PM
    Sunday, February 28, 2016 2:16 PM
  • turn on USB ETW logging and see where things start failing. it should tell you what is being queried for and not being received that stops it from enumerating as a composite device. My guess would be the config descriptor is incorrect.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Sunday, February 28, 2016 10:33 PM
  • Hi Mike,

    Looks like I've just found a working driver for the CDC Serial port at least..

    The freetronics Arduino 'LeoStick', an AMTEL 32U4 has a built in USB interface, and using the INF from here, i've got a working COM port on Windows 7.

    freetronics.com.au/pages/installing-the-usb-driver-file-for-windows

    Hope this helps, good luck with the CDC ECM Ethernet, hope you manage to work that one out...

    The OTG function I used was from this isticktoit.net/?p=1383

    Adrian.

    Saturday, April 2, 2016 6:23 PM
  • Anyone any luck with a CDC ECM ethernet driver ?

    www.thesycon.de supposedly have one

    Using the 'older' g_ether method of setting up the Pi zero works with the built in remote ndis compatible device

    Maybe I can adapt the new setting up of the /sys/kernel/config/usb_gadget/ info to match the equivalent of g_ether ?

    And good research Mike -- I've spent 5+ hours searching the same stuff and sources of info!

    Wednesday, November 23, 2016 12:59 AM
  • Any news about 'older' g_ether method? My PI Zero W  <-> Windows 7 via USB driver doesn't work. Have you installed Bonjour/iTunes? Remote NDIS Driver isn't select able by Windows nor by me. I'm going to install iTunes... 

    Friday, June 8, 2018 1:05 PM